This commit is contained in:
2025-10-31 15:20:38 +08:00
parent 254e1926cf
commit 5ad8b2b7e1
6502 changed files with 581819 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// FPS <20><>ʾ<EFBFBD><CABE>OnGUI
/// </summary>
public class FPSOnGUIText : MonoBehaviour
{
float updateInterval = 1.0f; //<2F><>ǰʱ<C7B0><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
private float accumulated = 0.0f; //<2F>ڴ<EFBFBD><DAB4>ڼ<EFBFBD><DABC>ۻ<EFBFBD>
private float frames = 0; //<2F>ڼ<EFBFBD><DABC><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB>Ƶ<EFBFBD>֡
private float timeRemaining; //<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD><CAA3>ʱ<EFBFBD><CAB1>
private float fps = 15.0f; //<2F><>ǰ֡ Current FPS
private float lastSample;
void Start()
{
//if (!H5Controller.IsShowFPS())
// Destroy(this);
DontDestroyOnLoad(this.gameObject); //<2F><><EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD><D9B4><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>ע<EFBFBD><D7A2>
timeRemaining = updateInterval;
lastSample = Time.realtimeSinceStartup; //ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
void Update()
{
++frames;
float newSample = Time.realtimeSinceStartup;
float deltaTime = newSample - lastSample;
lastSample = newSample;
timeRemaining -= deltaTime;
accumulated += 1.0f / deltaTime;
if (timeRemaining <= 0.0f)
{
fps = accumulated / frames;
timeRemaining = updateInterval;
accumulated = 0.0f;
frames = 0;
}
}
void OnGUI()
{
GUIStyle style = new GUIStyle
{
border = new RectOffset(10, 10, 10, 10),
fontSize = 50,
fontStyle = FontStyle.BoldAndItalic,
};
//<2F>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>߶ȴ<DFB6>С <20><>ɫ<EFBFBD><C9AB>style
GUI.Label(new Rect(Screen.width / 2 - 50, Screen.height - 100, 200, 200), "<color=#00ff00><size=30>" + "FPS:" + fps.ToString("f2") + "</size></color>", style);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4e77d0574790e5f4eb9e2e2b767fe0e1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,57 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class HelpTip : MonoBehaviour
{
public GameObject objImgHelp;
public Text txtHelp;
public Image imgHelp;
private void Start()
{
// Invoke("SetControl", 0.2f);
SetControl();
// StartCoroutine(ImageLoader<Image>.LoadImage(CommonData.UIImageFullPath + "Help.png", imgHelp));
}
void SetControl()
{
BaseController.CanControl = false;
}
public void Close()
{
}
// Update is called once per frame
//void Update()
//{
// if (Input.GetKeyDown(KeyCode.F2))
// {
// objImgHelp.SetActive(!objImgHelp.activeSelf);
// // txtHelp.text = objImgHelp.activeSelf ? "<22>밴 F2 <20><> ESC <20>رմ<D8B1>ҳ | Press F2 or ESC to hide help" : "<22>밴F2<46>򿪰<EFBFBD><F2BFAAB0><EFBFBD> | Press F2 for help";
// BaseController.CanControl = !objImgHelp.activeSelf;
// }
// if (Input.GetKeyDown(KeyCode.Escape))
// {
// if (objImgHelp.activeSelf)
// {
// objImgHelp.SetActive(false);
// // txtHelp.text = "<22>밴F2<46>򿪰<EFBFBD><F2BFAAB0><EFBFBD> | Press F2 for help";
// BaseController.CanControl = !objImgHelp.activeSelf;
// }
// }
//}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 84797a0c821e2934e9d12d8186bbb72f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,35 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RotateObject : MonoBehaviour
{
public float rotateSpeed = 5f;
public bool rotateAlways = true;
public Vector3 rotateDir = Vector3.up;
bool enableRotate;
// Start is called before the first frame update
void OnTriggerEnter(Collider other)
{
enableRotate = true;
}
// Start is called before the first frame update
void OnTriggerExit(Collider other)
{
enableRotate = false;
}
// Update is called once per frame
void Update()
{
if ( rotateAlways || enableRotate)
{
transform.Rotate(rotateDir * Time.deltaTime * rotateSpeed);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4216442000bb30e4196757f917836c08
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,46 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TexturePool
{
public static Dictionary<string, Texture2D> dicTextures;
static List<string> removeKeys;
static TexturePool()
{
}
void ClearTexture()
{
}
static int MaxTextureCount;
public static Texture2D GetTexture(string key)
{
Texture2D tex = null;
if (dicTextures.ContainsKey(key))
{
tex = dicTextures[key];
removeKeys.Remove(key);
}
return tex;
}
public static void SaveTexture(string key, Texture2D txt)
{
if (!dicTextures.ContainsKey(key))
{
dicTextures.Add(key, txt);
}
}
public static void RemoveTexture(string key)
{
removeKeys.Add(key);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 69c971373d9543c4289aeb13cdf3b29f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,38 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TextureScroll : MonoBehaviour
{
Material mat;
public float smoothSpeed = 0.1f;
public int scrollSpeed = 5;
int offset;
// Start is called before the first frame update
void Start()
{
mat = this.GetComponent<MeshRenderer>().material;
StartCoroutine(Scroll());
}
IEnumerator Scroll()
{
while (true)
{
offset = (offset + scrollSpeed) % 100000;
mat.mainTextureOffset = new Vector2(offset / 100000f, 0f);
yield return new WaitForSeconds(smoothSpeed);
}
}
void OnMouseDown()
{
// Debug.Log("A");
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: eb6cf74d69ecb9848a955a1a9b2f2c0b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: