GQ_Communicate/GQ_URP/GQ/Assets/tooltest.cs

223 lines
9.6 KiB
C#
Raw Blame History

using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Unity.VisualScripting;
using UnityEditor;
using UnityEngine;
using static BaseConf;
public class tooltest : MonoBehaviour
{
public Transform a;
public Transform b;
public List<Transform> A;
public List<Transform> B;
public int CardCount = 0;
//public class Asd
//{
// public string username;
// public string password;
//}
void Start()
{
//Asd asd = new Asd();
//asd.username = "p6k5b9h9Yfp8Hxf75vO0sA==";
//asd.password = "It8gXWKtH3hA0hLc+q79Lg==";
//var newData = JsonConvert.SerializeObject(asd);
//Debug.LogError(CombineJSON.Encrypt(newData));
//Debug.LogError(CombineJSON.Decrypt("9N5AHveJlY8V2XM/4ARv0l/FdyxcgdiaOYJvxcfvxjYt9y2bNfYYoZMzQMmsOObDlavdtLNpurQsOLbE8KlKa2Y4RpBi57Jf7NokVMftviz6kp6ko6OSr6zy82a/6q3ELJPanS7Dv2H9qIQaNespreQ/5E3zsmfTtyokVQncAZLzxpqwkQVGMUutJ21abOqtA46NYZuLgeAtgMDtYiSrbThxf4RrGPcpX2qRo4Bjm32Ys5C5SeZ0Xc1DsuCXqr1ridlQQmYvYnM+ID4c+6Yc/7whrB8R/u/tvrd2AklAnUPtBKVBhtDzqNzo/SemWK9fYPG1jnzt49Urfm97zeb+O5aK8mTP4oycx3JXbWV2lu2qRZ0IhLf5otR6xfaj/aVBc6fFR+/4KwsxQOix0hKcDq5Ew2/Ric1Xhn3BrNRbgKtwr8UHDQy5+40TvYR/4YasFCU7V/EulA5yBPyc4ELK8TQh7hyLWr69bdaean+5HEuF9//BZpwJZ3fhCjbQI0GKo9erXx5ETjcl+bpqqBDYzyCfFklz5PIvIdTOXJC/SIKJaWAMMTLN9Zsfvo9M2Mw0t7qKC7JR0/HvpBRV2fwOxsYBN7j1VvRYsxTNUEKayEmWvluyqO7katNZM06nEkS5F+6N/M1LLtJooVHS+4rWzwdAIC2Q4nxFmKTgSzC8R7OqLoSphTfmttwMx7NVbYhsY5ttyEPUOKJnTxRKrstXJPg4bo5lemyWwX8KTcIkBo+6bX6r/ZgVx7Z07mW3DNHN+3W5uDN1atT8+LUWwk5jRm0gll2USHarUmoHXTyv+jw="));
//Debug.LogError(CombineJSON.Decrypt("9N5AHveJlY8V2XM/4ARv0l/FdyxcgdiaOYJvxcfvxjYt9y2bNfYYoZMzQMmsOObDlavdtLNpurQsOLbE8KlKa2Y4RpBi57Jf7NokVMftviz6kp6ko6OSr6zy82a/6q3ELJPanS7Dv2H9qIQaNespreQ/5E3zsmfTtyokVQncAZLzxpqwkQVGMUutJ21abOqtA46NYZuLgeAtgMDtYiSrbThxf4RrGPcpX2qRo4Bjm32Ys5C5SeZ0Xc1DsuCXqr1ridlQQmYvYnM+ID4c+6Yc/7whrB8R/u/tvrd2AklAnUPtBKVBhtDzqNzo/SemWK9fYPG1jnzt49Urfm97zeb+O5aK8mTP4oycx3JXbWV2lu2qRZ0IhLf5otR6xfaj/aVBc6fFR+/4KwsxQOix0hKcDq5Ew2/Ric1Xhn3BrNRbgKtwr8UHDQy5+40TvYR/4YasFCU7V/EulA5yBPyc4ELK8TQh7hyLWr69bdaean+5HEuF9//BZpwJZ3fhCjbQI0GKo9erXx5ETjcl+bpqqBDYzyCfFklz5PIvIdTOXJC/SIKJaWAMMTLN9Zsfvo9M2Mw0t7qKC7JR0/HvpBRV2fwOxpkJc0u5agKMLha6GPhz3UO1EN+l1TtVryhWvygRrc2LLw4Nr2GAt9yQrtuok9QicjbKwUxi3VGAk9tDrAXPfYFbPYb3BIu7wYtAwzqNRK2DFwKZhJd7X+Tq4jKETZfnFEB4z0iGocoFU2w0+3k+8/9E1sp+IEwUUVrtBGj9zz6G87+HmaLUAUzs/AGHKS3Ssjo9W7xzW1RnmJ2DIaJCsV0="));
}
// Update is called once per frame
void Update()
{
}
[ContextMenu("ճ<><D5B3>5<EFBFBD><35><EFBFBD>ű<EFBFBD><C5B1><EFBFBD><EFBFBD><EFBFBD><E8B1B8>")]
public void Replace5()
{
var b1 = b.AddComponent<DeviceQuery>();
var b2 = b.AddComponent<DragTest>();
var b3 = b.AddComponent<TmsAlarmQuery>();
var b4 = b.AddComponent<TransparentGlow>();
var b5 = b.AddComponent<DragTest1>();
UnityEditorInternal.ComponentUtility.CopyComponent(a.GetComponent<DeviceQuery>());
UnityEditorInternal.ComponentUtility.PasteComponentValues(b1);
UnityEditorInternal.ComponentUtility.CopyComponent(a.GetComponent<DragTest>());
UnityEditorInternal.ComponentUtility.PasteComponentValues(b2);
UnityEditorInternal.ComponentUtility.CopyComponent(a.GetComponent<TmsAlarmQuery>());
UnityEditorInternal.ComponentUtility.PasteComponentValues(b3);
UnityEditorInternal.ComponentUtility.CopyComponent(a.GetComponent<TransparentGlow>());
UnityEditorInternal.ComponentUtility.PasteComponentValues(b4);
UnityEditorInternal.ComponentUtility.CopyComponent(a.GetComponent<DragTest1>());
UnityEditorInternal.ComponentUtility.PasteComponentValues(b5);
if (!b.GetComponent<MeshCollider>()) b.AddComponent<MeshCollider>();
b.gameObject.layer = 8;
}
[ContextMenu("-----------------------------------------------------------------")]
[ContextMenu("ճ<><D5B3>4<EFBFBD><34><EFBFBD>ű<EFBFBD><C5B1><EFBFBD><EFBFBD><EFBFBD><E5BFA8>")]
public void Replace4()
{
for (int i = 0; i < A.Count; i++)
{
var b1 = B[i].AddComponent<DeviceQuery>();
//var b2 = B.AddComponent<DragTest>();
var b3 = B[i].AddComponent<TmsAlarmQuery>();
var b4 = B[i].AddComponent<TransparentGlow>();
//var b5 = B.AddComponent<DragTest1>();
var b6 = B[i].AddComponent<ClickEvent>();
UnityEditorInternal.ComponentUtility.CopyComponent(A[i].GetComponent<DeviceQuery>());
UnityEditorInternal.ComponentUtility.PasteComponentValues(b1);
//UnityEditorInternal.ComponentUtility.CopyComponent(A.GetComponent<DragTest>());
//UnityEditorInternal.ComponentUtility.PasteComponentValues(b2);
UnityEditorInternal.ComponentUtility.CopyComponent(A[i].GetComponent<TmsAlarmQuery>());
UnityEditorInternal.ComponentUtility.PasteComponentValues(b3);
UnityEditorInternal.ComponentUtility.CopyComponent(A[i].GetComponent<TransparentGlow>());
UnityEditorInternal.ComponentUtility.PasteComponentValues(b4);
//UnityEditorInternal.ComponentUtility.CopyComponent(A.GetComponent<DragTest1>());
//UnityEditorInternal.ComponentUtility.PasteComponentValues(b5);
UnityEditorInternal.ComponentUtility.CopyComponent(A[i].GetComponent<ClickEvent>());
UnityEditorInternal.ComponentUtility.PasteComponentValues(b6);
if (!B[i].GetComponent<MeshCollider>()) B[i].AddComponent<MeshCollider>();
B[i].gameObject.layer = 13;
}
}
[ContextMenu("-----------------------------------------------------------------")]
[ContextMenu("ճ<><D5B3>2<EFBFBD><32><EFBFBD>ű<EFBFBD><C5B1><EFBFBD><EFBFBD>˿ڣ<CBBF>")]
public void Replace2()
{
for (int i = 0; i < A.Count; i++)
{
PortQuery b1 = B[i].AddComponent<PortQuery>();
//var b2= B[i].AddComponent<>
UnityEditorInternal.ComponentUtility.CopyComponent(A[i].GetComponent<PortQuery>());
UnityEditorInternal.ComponentUtility.PasteComponentValues(b1);
B[i].position = A[i].position;
B[i].gameObject.layer = 11;
B[i].GetComponent<PortQuery>().portList.portPosition = (i + 1).ToString();
}
}
[ContextMenu("<22>˿<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")]
public void Replace2_()
{
for (int i = 0; i < B.Count; i++)
{
var b1 = B[i].GetComponent<PortQuery>();
b1.portList.portPosition = (i + 1).ToString();
}
}
[ContextMenu("-----------------------------------------------------------------")]
[ContextMenu("UPosItem<65><6D><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")]
public void setUPosItem_c()
{
var uposi = a.GetComponentsInChildren<UPosItem>().ToList();
for (int i = 0; i < uposi.Count; i++)
{
uposi[i].conf2.isUse = true;
uposi[i].conf2.module_type = BaseConf.ModuleType.<EFBFBD>;
}
}
[ContextMenu("-----------------------------------------------------------------")]
[ContextMenu("<22><><EFBFBD><EFBFBD><EFBFBD>°濨")]
public void CreateCards()
{
for (int i = 0; i < A.Count; i++)
{
A[i].gameObject.layer = 13;
var d = A[i].AddComponent<DeviceQuery>();
var t = A[i].AddComponent<TmsAlarmQuery>();
var c = A[i].AddComponent<ClickEvent>();
var m = A[i].AddComponent<MeshCollider>();
d.conf2.isUse = true;
d.deviceList.type = "2";
d.deviceList.deviceType = "3";
d.deviceList.devicePosition = (i + 1).ToString();
}
}
[ContextMenu("-----------------------------------------------------------------")]
[ContextMenu("<22><><EFBFBD><EFBFBD>Uλ")]
public void Replace1()
{
GameObject emptyObject = new GameObject("Uλ");
emptyObject.layer = 10;
emptyObject.transform.parent = b;
emptyObject.transform.localPosition = Vector3.zero;
emptyObject.transform.localEulerAngles = Vector3.zero;
emptyObject.AddComponent<UPosManger>();
for (int i = 0; i < CardCount; i++)
{
GameObject g = new GameObject();
g.layer = 10;
g.transform.SetParent(emptyObject.transform);
g.transform.localPosition = A[i].localPosition;
g.transform.localEulerAngles = A[i].localEulerAngles;
g.name = (i + 1).ToString();
var uPosItem = g.AddComponent<UPosItem>();
uPosItem.uPosManager = emptyObject.GetComponent<UPosManger>();
uPosItem.ID = i + 1;
}
for (int i = 0; i < A.Count; i++)
{
var b1 = emptyObject.transform.GetChild(i).AddComponent<MeshFilter>();
UnityEditorInternal.ComponentUtility.CopyComponent(A[i].GetComponent<MeshFilter>());
UnityEditorInternal.ComponentUtility.PasteComponentValues(b1);
var b2 = emptyObject.transform.GetChild(i).AddComponent<MeshCollider>();
UnityEditorInternal.ComponentUtility.CopyComponent(A[i].GetComponent<MeshFilter>());
UnityEditorInternal.ComponentUtility.PasteComponentValues(b2);
//A[i].gameObject.SetActive(false);
var uposi = emptyObject.transform.GetChild(i).GetComponent<UPosItem>();
uposi.conf2 = new BaseConf.Conf2
{
isUse = true,
module_type = BaseConf.ModuleType.<EFBFBD>,
type_card = Type_Card.<EFBFBD>1
};
}
AssetDatabase.Refresh();//ˢ<>±༭<C2B1><E0BCAD>
UPosManger uPosManger = emptyObject.GetComponent<UPosManger>();
uPosManger.uPosItems = new UPosItem[CardCount];
uPosManger.uPosItems = emptyObject.GetComponentsInChildren<UPosItem>();
for (int i = 0; i < A.Count; i++)
{
A[i].gameObject.SetActive(false);
}
}
}