using UnityEngine.UI; using UnityEngine; using System.Linq; using System.Collections; using Unity.VisualScripting; public class PanelCreator : MonoBehaviour { //MODELS public static void AddModels(){ GameObject List = Get.o2(_G.PON+"/MODELS/Viewport","Content"); DOIT.DELETEAllObjectChild(List); Object[] Image = Resources.LoadAll("ICONS/PANELS/", typeof(Sprite)); GameObject PnlModel=Get.o2(_G.PON + "/MODELS/Viewport","Content"); GameObject BtnModel=Get.o2(_G.PON + "/BASEBTN/","UIT_BTNMODEL"); foreach (Sprite I in Image.Cast()) { AddBTNSELECTION(I,BtnModel,PnlModel); } Set.ToggleGroupToAllChild(_G.PON + "/MODELS/Viewport/Content"); } public static void AddBTNSELECTION(Sprite I, GameObject SEL,GameObject PNL) { GameObject Sel=Instantiate(SEL); Sel.transform.SetParent(PNL.transform, false); Sel.name = I.name; //string nameShow="K_"+;//NONE"; print("I.name==="+I.name); //if(I.name!="fbtnx")nameShow=GetNameShow(I.name); Sel.transform.Find("Image/Text").gameObject.GetComponent().text = I.name; Sel.transform.Find("Background").GetComponent().sprite = I; Sel.SetActive(true); //Sel.GetComponent().onValueChanged.AddListener(delegate { AddSizeSelections(Sel.name); }); } //TEXTURES public static void AddTextures(){ GameObject List = Get.o2(_G.PON+"/TEXTCOL/Viewport","Content"); DOIT.DELETEAllObjectChild(List); GameObject BTN=Get.o2(_G.PON + "/BASEBTN/","UIT_BTNTEXCOL"); for(int i=0; i<100; i++){AddbtntoList(List,BTN,i);} //Reset colors // Get.o2(_G.PON+"/COLORS/ColorPickerTexture_1/Button","Image").GetComponent().color=DOIT.CSc("ffffff",255); // Get.o2(_G.PON+"/COLORS/ColorPickerTexture_2/Button","Image").GetComponent().color=DOIT.CSc("393A39",255); // Get.o2(_G.PON+"/COLORS/ColorPickerTexture_3/Button","Image").GetComponent().color=DOIT.CSc("ffffff",255); // StaticCoroutine.Start(WaitHideScroller("TEXTCOL")); // if(_G.PON=="CABDOORpnl")UIT_DOORCAB.ShowSelecded("TEXT.1.1"); // if(_G.PON=="UNIVERSALpnl")UIT_UNIVERSALPnl.Showselecded(); // if(_G.PON=="MOLDINGpnl")UIT_MOLDING.ShowSelecded("TEXT.1.1"); // if(_G.PON=="PANELpnl")UIT_PANELPnl.ShowSelecded("TEXT.1.1"); Set.ToggleGroupToAllChild(_G.PON + "/TEXTCOL/Viewport/Content"); StaticCoroutine.Start(WaitHideScroller("TEXTCOL")); } public static void AddbtntoList(GameObject List,GameObject btn,int i){ GameObject C = Instantiate(btn); //string filter= "CreateIt"//UIT.TogOn("FILTERS"); string finish=""; string Texture=""; C.name="TEXT.1."+(i+1).ToString(); C.transform.SetParent(List.transform, false); if (List.transform.childCount < 20) {C.SetActive(true);} print("C.name===="+C.name); //if(filter=="CreateIt"){ //C.transform.Find("Background").GetComponent().material = UIT_MATERIAL.GetCabTextureCreateIt(C.name,"PNL"); //Texture=TRANS.This("T_Grain"); //} //else C.transform.Find("Background").GetComponent().material = UIT_MATERIAL.GetCabTexture(C.name,"PNL"); C.transform.Find("Image").transform.Find("Text").gameObject.GetComponent().text =Texture+" "+(i+0).ToString()+" "+finish; //Texture=TRANS.This("T_Grain"); } //SCROLLER public static IEnumerator WaitHideScroller(string PnlName) { int qty = Get.o2(_G.PON+"/"+PnlName+"/Viewport","Content").transform.childCount; yield return new WaitForSeconds(qty * 0.00005f); int ind = 1;//Number of row 6 number on one row if(PnlName=="TEXTCOL")ind=3; Hide.SETSCROLLER(PnlName, 6, ind, qty); GameObject listpnl=Get.o2(_G.PON+"/"+PnlName+"/Viewport","Content"); if(listpnl.transform.childCount > 0){ listpnl.transform.GetChild(0).GetComponent().isOn=true; Set.ToggleGroupToAllChild(_G.PON+"/"+PnlName+"/Viewport/Content"); } } public static void CreateIT(){ print("Model====="+UIT.TogOn("MODELS")); print("Texture====="+UIT.TogOn("TEXTCOL")); print("Color1====="+UIT.TogOn("TEXTCOL")); print("Color2====="+UIT.TogOn("TEXTCOL")); print("Conrast====="+UIT.TogOn("TEXTCOL")); } }