123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- using System;
- using UnityEngine;
- using UnityEngine.UI;
- using System.Collections;
- using System.Collections.Generic;
- public class Auxiliary : MonoBehaviour
- {
- #region 变量
- public string TempString;
- public Font TempFont;
- public GameObject TempGo;
- public List<GameObject> TempGoList;
- #endregion
- private void Start()
- {
-
- }
- private void Update()
- {
- if (Input.GetKeyDown(KeyCode.P))
- {
- ManaData.Level += 10;
- }
- }
- private void FixedUpdate()
- {
-
- }
- public static ObjType ToObjType(string str)
- {
- return (ObjType) Enum.Parse(typeof(ObjType), str);
- }
- public static void AddSuffix(GameObject go, string value)
- {
- Transform[] transforms = go.GetComponentsInChildren<Transform>(true);
-
- for (int i = 0; i < transforms.Length; i++)
- {
- transforms[i].name = transforms[i].name + value;
- }
- }
- public static void AddPrefix(GameObject go, string value)
- {
- Transform[] transforms = go.GetComponentsInChildren<Transform>(true);
- for (int i = 0; i < transforms.Length; i++)
- {
- transforms[i].name = value + transforms[i].name;
- }
- }
- public static void ChangePrefix(GameObject go, string value)
- {
- Transform[] transforms = go.GetComponentsInChildren<Transform>(true);
- for (int i = 0; i < transforms.Length; i++)
- {
- int index = transforms[i].name.IndexOf('_');
- transforms[i].name = value + transforms[i].name.Remove(0, index);
- }
- }
- public static void ChangeFont(List<GameObject> goList, Font font)
- {
- for (int j = 0; j < goList.Count; j++)
- {
- Transform[] transforms = goList[j].GetComponentsInChildren<Transform>(true);
- for (int i = 0; i < transforms.Length; i++)
- {
- Text text = transforms[i].GetComponent<Text>();
- TextMesh textMesh = transforms[i].GetComponent<TextMesh>();
- if (text != null)
- {
- text.font = font;
- text.fontStyle = FontStyle.Normal;
- }
- if (textMesh != null)
- {
- textMesh.font = font;
- textMesh.fontStyle = FontStyle.Normal;
- }
- }
- }
- }
- public static void PrintBounds(GameObject go)
- {
- Bounds bounds = go.GetComponent<Renderer>().bounds;
- Debug.Log(string.Format("x : {0:0.00} y : {1:0.00} z : {2:0.00}", bounds.extents.x, bounds.extents.y, bounds.extents.z));
- }
- }
|