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 list = new List(); 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 testGs=new Dictionary(); Queue jsondata = new Queue(); 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); } }