Test.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //using HybridCLR;
  2. using DTYJ;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.IO;
  6. using TMPro;
  7. using UnityCommon;
  8. using UnityEngine;
  9. using UnityEngine.UI;
  10. //using UnityEngine.AddressableAssets;
  11. public class Test : MonoBehaviour
  12. {
  13. public GameObject[] gos;
  14. public void Start()
  15. {
  16. Utility.DelayExe(5, () =>
  17. {
  18. for (int i = 0; i < gos.Length; i++)
  19. {
  20. gos[i].SetActive(true);
  21. }
  22. });
  23. }
  24. //private void OnTriggerEnter(Collider other)
  25. //{
  26. // Debug.LogWarning(other.name);
  27. //}
  28. //public float stepL;
  29. //public int count = 30;
  30. //[ContextMenu("处理")]
  31. //public void Handle1()
  32. //{
  33. // GameObject goOrig = transform.GetChild(0).gameObject;
  34. // for (int i = 0; i < count; i++)
  35. // {
  36. // var goNew = Instantiate(goOrig, goOrig.transform.parent);
  37. // goNew.name = "进出列车-下行_" + (i + 1);
  38. // goNew.transform.localPosition = new Vector3(0, 0, stepL * i);
  39. // }
  40. //}
  41. public string mac;
  42. [ContextMenu("处理")]
  43. public void Handle()
  44. {
  45. SetANim();
  46. return;
  47. //var regMd5 = Utility.GetMD5WithString(mac + "swsj202312");
  48. //Debug.Log(regMd5);
  49. int ncount = transform.childCount;
  50. for (int i = 0; i < ncount; i++)
  51. {
  52. Transform t = transform.GetChild(i);
  53. t.GetChild(0).gameObject.SetActive(false);
  54. t.GetChild(1).gameObject.SetActive(false);
  55. t.GetChild(2).gameObject.SetActive(false);
  56. }
  57. }
  58. public float sthVal = 4.42f;
  59. public GameObject goOrg;
  60. public void SetSth()
  61. {
  62. var tfOrg = goOrg.transform;
  63. for (int i = 138092; i <= 138120; ++i)
  64. {
  65. var tfNew = Instantiate(tfOrg, tfOrg.parent);
  66. tfNew.name = i.ToString();
  67. tfNew.transform.position = new Vector3(tfOrg.position.x, tfOrg.position.y, tfOrg.position.z + (sthVal * (i - 138092)));
  68. }
  69. }
  70. public void SetANim()
  71. {
  72. int count = transform.childCount;
  73. for (int i = 0; i < count; i++)
  74. {
  75. var t = transform.GetChild(i);
  76. var lcw = t.GetComponent<OptEquipItem_LCW>();
  77. string strAnim = "EquipController/LCW/" + t.name;
  78. lcw.dic = new Dictionary<string, string>() {
  79. { "自动", strAnim },
  80. { "手动开", strAnim },
  81. { "手动关", strAnim },
  82. { "隔离", strAnim }
  83. };
  84. }
  85. }
  86. }