void RemoveJS(int index, string name) { GameObject removingObj = teamList.transform.GetChild(index).FindChild(name).gameObject; GoodColor.EnQueueColor(removingObj.GetComponent <JavascriptPannel>().jsInfo.color); Destroy(removingObj); }
void Start() { GoodColor.Init(); GoodColor.SetColorsList(defaultColorCount); AddTeam(false); AddTeam(false); }
public void AddTeam(bool sendMessage = true) { GameObject pannel = (GameObject)Instantiate(Resources.Load("TeamPannel")); pannel.transform.SetParent(transform); pannel.transform.localScale = Vector3.one; pannel.GetComponent <Image>().color = GoodColor.DequeueColor(); teamPannels.Add(pannel); if (NetworkValues.isServer && NetworkValues.isNetwork && sendMessage) { Client.instance.Send(NetworkDecorator.AttachHeader(NetworkHeader.ADDTEAM)); } }
void AddJS(int index, string name, string code) { GameObject scriptPannelObj = (GameObject)Instantiate(Resources.Load("ScriptPannel")); scriptPannelObj.GetComponent <DragHandler>().enabled = false; scriptPannelObj.transform.SetParent(teamList.transform.GetChild(index)); scriptPannelObj.transform.localScale = Vector3.one; var scriptPannel = scriptPannelObj.GetComponent <JavascriptPannel>(); scriptPannel.jsInfo.name = name; scriptPannel.jsInfo.code = code.Replace(Convert.ToChar(0x0).ToString(), "");; scriptPannel.jsInfo.color = GoodColor.DequeueColor(); scriptPannel.jsInfo.isMine = false; scriptPannel.UpdateInfo(); }
void AttachPannels() { string[] javascriptPaths = LoadJavascripts(); foreach (string path in javascriptPaths) { GameObject scriptPannelObj = (GameObject)Instantiate(Resources.Load("ScriptPannel")); scriptPannelObj.transform.SetParent(transform); scriptPannelObj.transform.localScale = Vector3.one; var scriptPannel = scriptPannelObj.GetComponent <JavascriptPannel>(); scriptPannel.jsInfo.name = Path.GetFileNameWithoutExtension(path); scriptPannel.jsInfo.code = File.ReadAllText(path); scriptPannel.jsInfo.color = GoodColor.DequeueColor(); scriptPannel.jsInfo.isMine = true; scriptPannel.UpdateInfo(); } }
public void RemoveTeam() { if (teamPannels.Count <= 2) { return; } foreach (GameObject pannel in teamPannels) { if (pannel.transform.childCount <= 0) { GoodColor.EnQueueColor(pannel.GetComponent <Image>().color); teamPannels.Remove(pannel); Destroy(pannel); break; } } if (NetworkValues.isServer) { Client.instance.Send(NetworkDecorator.AttachHeader(NetworkHeader.REMOVETEAM)); } }
public void AddInitData() { var green = new GoodColor() { Descr = "Green" }; db_context.Colors.Add(green); var red = new GoodColor() { Descr = "Red" }; db_context.Colors.Add(red); var blue = new GoodColor() { Descr = "Bloe" }; db_context.Colors.Add(blue); for (int i = 0; i < 100; i++) { var targetColor = i < 30 ? green : i < 60 ? red : blue; db_context.Goods.Add(new Good() { Name = $"Good{i}", Color = targetColor, Price = Math.Round(DateTime.Now.Millisecond / (DateTime.Now.Minute + 1m), 2) } ); } db_context.SaveChanges(); }