123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- using LitJson;
- using SC.XR.Unity;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class testManager : MonoBehaviour
- {
- public SlideList blist;
- public RollList alist;
- public NormalList clist;
- // Start is called before the first frame update
- void Start()
- {
- Invoke("initList",1f);
-
- }
- List<BaseConfig> list = new List<BaseConfig>();
- void initList()
- {
- BaseConfig bc = new BaseConfig();
- list.Add(bc);
- list.Add(bc);
- list.Add(bc);
- list.Add(bc);
- list.Add(bc);
- blist.initList(list);
- alist.initList(list);
- alist.initList(list);
- // blist.showItems(0, 9);
- //WSHandler.init();
- //WSHandler.User.OnLogin += testFun;
- id = Time.deltaTime.ToString() + "_" + UnityEngine.Random.Range(1, 1000);
- }
- // public
- public void initRoom()
- {
- // NetworkConfiguration.socket_Url_test2
- //WSHandler.init();
- //WSHandler.User.OnLogin += testFun;
- id = Time.deltaTime.ToString() + "_" + UnityEngine.Random.Range(1, 1000);
- }
- private string id;
- public TextMesh test;
- private Dictionary<string ,GameObject> testGs=new Dictionary<string, GameObject>();
- Queue<JsonData> jsondata = new Queue<JsonData>();
- private void testFun(JsonData data)
- {
- jsondata.Enqueue(data);
- }
- private void testCt(JsonData data)
- {
- test.text = data.ToJson();
- if (data.Keys.Contains("data"))
- {
- JsonData jd = JsonMapper.ToObject(data["data"].ToString());
- data["data"] = jd;
- if (data.Keys.Contains("method"))
- {
- if (data["method"].ToString() == "login")
- {
- GameObject obj = (GameObject)Resources.Load("testLogin");
- obj = Instantiate(obj);
- testGs.Add(data["data"]["id"].ToString(), obj);
- }
- else if (data["method"].ToString() == "test")
- {
- if (data.Keys.Contains("data"))
- {
- if (data["data"].Keys.Contains("pos"))
- {
- if (!testGs.ContainsKey(data["data"]["id"].ToString()))
- {
- GameObject obj = (GameObject)Resources.Load("testLogin");
- obj = Instantiate(obj);
- testGs.Add(data["data"]["id"].ToString(), obj);
- }
- string[] poss = data["data"]["pos"].ToString().Split('_');
- string[] euls = data["data"]["eul"].ToString().Split('_');
- string[] scals = data["data"]["scal"].ToString().Split('_');
- testGs[data["data"]["id"].ToString()].transform.position = new Vector3(float.Parse(poss[0]), float.Parse(poss[1]), float.Parse(poss[2]));
- testGs[data["data"]["id"].ToString()].transform.eulerAngles = new Vector3(float.Parse(euls[0]), float.Parse(euls[1]), float.Parse(euls[2]));
- testGs[data["data"]["id"].ToString()].transform.localScale = new Vector3(0.05f, 0.05f, 0.05f);
- }
- }
- }
- }
- }
- }
- public void isSend()
- {
- issendd = !issendd;
- if(issendd)
- {
- //WSHandler.User.testLogin(id);
- }
- }
- public void Time30()
- {
- stime = 0.03f;
- }
- public void Time60()
- {
- stime = 0.015f;
- }
- private bool issendd=false;
- private float stime=0.03f;
- private float times;
- // Update is called once per frame
- void Update()
- {
-
-
- // sc3D.value = blist.getProgress();
- }
- public void login()
- {
- //WSHandler.User.testLogin(id);
- }
- public void add()
- {
- BaseConfig bc = new BaseConfig();
- list.Add(bc);
- blist.updateConfig(list);
- }
- public void red()
- {
- BaseConfig bc = new BaseConfig();
- list.RemoveAt(0);
- blist.updateConfig(list);
- }
- }
|