using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class TopcounterPNL : MonoBehaviour { GameObject TOPCOUNTERpnl; GameObject SuplierPnl; GameObject CategoryPnl; static GameObject TexturesPnl; static private List _ObjectOnProcess; public void StartPNL() { _G.PON = "TOPCOUNTERpnl"; _G.PNL = "TexturesCounterPNL"; DOIT.CloseALLPNL(); SceneModeManager.SelectedName = ""; if(_P.ListSwitch.ContainsKey("COUNTERTOP_SUPPLIER") && !_P.ListSwitch["COUNTERTOP_SUPPLIER"]){ TEXTURESPNL.Startpnl("Counter"); } else{ _G.PNLSelect = "TOP COUNTER"; TOPCOUNTERpnl=Get.o2("Panel_SCENE/PNL","TOPCOUNTERpnl"); TOPCOUNTERpnl.SetActive(true); SetFilter(); } _ObjectOnProcess=new(); GetStartCode(); } public void SetFilter(){ SuplierPnl=Get.o2("Panel_SCENE/PNL/TOPCOUNTERpnl/FILTERS/Viewport","Content"); DOIT.DELETEAllChild(SuplierPnl.transform); GameObject btn=Get.o2("Panel_SCENE/PNL/TOPCOUNTERpnl/BASEBTN","BTNFILTERS"); GameObject Newbtn=Instantiate(btn); Newbtn.SetActive(true); Newbtn.name=TRANS.This("U_Supplier"); Newbtn.transform.Find("Background/text").GetComponent().text=Newbtn.name; Newbtn.transform.SetParent(SuplierPnl.transform); Get.o2("Panel_SCENE/PNL/TOPCOUNTERpnl/FILTERS/Viewport","Content").transform.GetChild(0).gameObject.GetComponent().isOn=true; SetSubFilters( ); } public void SetSubFilters(){ CategoryPnl=Get.o2("Panel_SCENE/PNL/TOPCOUNTERpnl/SUB_FILTERS/Viewport","Content"); DOIT.DELETEAllChild(CategoryPnl.transform); GameObject btn=Get.o2("Panel_SCENE/PNL/TOPCOUNTERpnl/BASEBTN","BTNSUBFILTERS"); List SuplierList=new(); print("_G.UIT_LibraryTopCounters.Count===="+_G.UIT_LibraryTopCounters.Count); foreach(string Line in _G.UIT_LibraryTopCounters){ if(Line!=_G.UIT_LibraryTopCounters[0] && !string.IsNullOrEmpty(Line)){ string[] L=Line.Split(","); if(!SuplierList.Contains(L[1])){ SuplierList.Add(L[1]); AddSuplier(L[1],CategoryPnl,btn); }; } } GameObject FirstOnList= Get.o2("Panel_SCENE/PNL/TOPCOUNTERpnl/SUB_FILTERS/Viewport","Content").transform.GetChild(0).gameObject; FirstOnList.GetComponent().isOn=true; //Add Toggle AddTextures(FirstOnList.name); } //----------------------------------------------------------------------------------------------- //-------------------Add to list----------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- public static void AddSuplier(string SuplierName,GameObject pnl,GameObject btn) { GameObject SuplierbBtn= Instantiate(btn); SuplierbBtn.transform.SetParent(pnl.transform, false); SuplierbBtn.transform.Find("Background").transform.Find("text").gameObject.GetComponent().text = TRANS.Retext(SuplierName); SuplierbBtn.name = SuplierName; SuplierbBtn.SetActive(true); } public static void AddTextures(string Suplier){ TexturesPnl=Get.o2("Panel_SCENE/PNL/TOPCOUNTERpnl/TEXTCOL/Viewport","Content"); DOIT.DELETEAllChild(TexturesPnl.transform); GameObject TextureBtn=Get.o2("Panel_SCENE/PNL/TOPCOUNTERpnl/BASEBTN","BTNTEXCOL"); List TexturesList=new(); foreach(string Line in _G.UIT_LibraryTopCounters) { if(Line!=_G.UIT_LibraryTopCounters[0] && !string.IsNullOrEmpty(Line)){ string[] L=Line.Split(","); if(!TexturesList.Contains(L[0]) && L[1]==Suplier){ TexturesList.Add(L[0]); AddTextureIcon(L[0],L[1],L[2],TexturesPnl,TextureBtn); }; } } Set.ToggleGroupToAllChild("Panel_SCENE/PNL/TOPCOUNTERpnl/TEXTCOL/Viewport/Content"); } public static void AddTextureIcon(string ID,string Supplier,string Collection, GameObject Pnl, GameObject Btn){ GameObject NewBtn= Instantiate(Btn); NewBtn.SetActive(true); NewBtn.transform.SetParent(Pnl.transform, false); NewBtn.name=ID; NewBtn.transform.Find("Image/Text").GetComponent().text=Collection+"\n"+ID; NewBtn.transform.Find("Background").GetComponent().sprite=Resources.Load("ICONS/TOPCOUNTER/"+Supplier+"_"+ID); } public static string GetStartCode() { if (_G.PNL == "TexturesCounterPNL") { _G.TCsStart = UIT.Global(Header.Counter,_G.G); GameObject[] objectsWithTag = GameObject.FindGameObjectsWithTag("counter"); _ObjectOnProcess = new List(objectsWithTag); } return _G.TCsStart; } //----------------------------------------------------------------------------------------------- //-------------------Add to Scene----------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- public void AddtoScene() { UIT.GlobalSet(Header.Counter,GetCodeRecipe(),_G.G); DOIT.AddtoCodeCabGlobal(41, GetCodeRecipe(), _G.G); AddNewTexture(GetCodeRecipe()); DOIT.CloseALLPNL(); } public string GetCodeRecipe(){ string TextureName=UIT.TogOn("TEXTCOL"); print("TextureName===="+TextureName); List ListCode=new(){"TOPCOUNTER/"+TextureName,"ffffff","ffffff", "ffffff","1","0","0.9","0.5", "0"}; string NewCode=""; for(int i=0; i().material=UIT_MATERIAL.GetMaterial(NewCode); } } public static void DOUNIQUE(string cc) { int nO = Get.GetObjectIndex(SceneModeManager.SelectedName); _G.OBJs[nO][41] = cc; DOIT.REDOOBJECT(nO); DOIT.CloseALLPNL(); DOIT.AllSelOff(); } public void SetGlobal() { DOUNIQUE(UIT.Global(Header.Counter,_G.G));//GlobalSelectionManager.GetValue(GlobalOption.COUN_8)); } }