using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.UI.Extensions; using TMPro; using System.Globalization; using System.Collections.Specialized; using System.Security; using System; using UnityEngine.Rendering; using Unity.VisualScripting; public class UIT_SetCab : MonoBehaviour { public GameObject SHOWSELECTION; public GameObject GlobalSelections; public Image model; public InputField A; public InputField B; public InputField C; public InputField D; public InputField E; public InputField F; public InputField K; public TMP_Dropdown AD; public TMP_Dropdown BD; public TMP_Dropdown CD; public TMP_Dropdown DD; public Text FixB; public Text FixA; public Text FixC; public Text FixD; public Text FixE; public Text FixF; public Text FixK; public Text Des; public Text FlipText; static float sch = 1; static float scw = 1; public void Showselect() { string Name=UIT.TogOn("CABMODEL"); Showselected(Name); } public void Showselected(string modelname) { _G.VTcat="ST"; Allfalse.SetCabPnlOpen(); string CabLib="Cabinet"; //if(UIT.TogOn("FILTERS")=="Ukitchenit")CabLib="CabinetUkitchenit"; SHOWSELECTION.SetActive(true); SHOWSELECTION.transform.Find("DIMS").gameObject.SetActive(true); _G.SC[0] = modelname; string[] c = UIT.GetLibraryLine(CabLib,modelname); Set.alpha(SHOWSELECTION, true); DOIT.AllChildOff(Get.o1("DIMS")); //Set Global door Selection Set.AvailableDoors(GlobalSelections,"Cabinet", modelname); //Index int Unique_Name=UIT.Ind(CabLib,"Unique_Name"); int Cab_Image=UIT.Ind(CabLib,"Cab_Image"); int Des_L1=UIT.Ind(CabLib,"Des_L1"); int Des_L2=UIT.Ind(CabLib,"Des_L2"); int Des_L3=UIT.Ind(CabLib,"Des_L3"); int Flip=UIT.Ind(CabLib,"Flip"); int Pattern_Door_1=UIT.Ind(CabLib,"Pattern_Door_1"); int Pattern_Door_2=UIT.Ind(CabLib,"Pattern_Door_2"); int indModel=UIT.Ind(CabLib,Header.Model); string Model=UIT.Value(Library.Cabinet,modelname,Header.Model); //Model _G.RCAT = c[Cab_Image];//Cab_Image; string mod = _G.RCAT.Split('.')[0] + "." + _G.RCAT.Split('.')[1] + "." + _G.RCAT.Split('.')[2]; model.GetComponent().sprite = Resources.Load("CABIMAGE/" + mod); //Add dimensions AddDim("A"); AddDim("B"); AddDim("C"); AddDim("D"); AddDim("E"); AddDim("F"); AddDim("K"); //Description if (_G.L == 1) { Des.text = c[Unique_Name] + " : " + c[Des_L1]; } else if (_G.L == 2) { Des.text = c[Unique_Name] + " : " + c[Des_L2]; } else if (_G.L == 3) { Des.text = c[Unique_Name] + " : " + c[Des_L3]; } //Flip string flip = ""; if (c[Flip] == "L") flip = TRANS.This("T_Left"); else if (c[Flip] == "R") flip = TRANS.This("T_Right"); else if (c[Flip] == "F") flip = TRANS.This("T_Fix"); FlipText.text = flip; //set skew for (int i = 0; i < Get.o2("CABINETpnl/SHOWSELECTION", "MODEL").transform.childCount; i++) { Get.o2("CABINETpnl/SHOWSELECTION", "MODEL").transform.GetChild(i).transform.GetComponent().alpha = 0; } _G.CODEPATERN = c[Pattern_Door_1]; _G.CODEPATERN2 = c[Pattern_Door_2]; //Paternskew(c[Cab_Image]); Get.o2("Canvas/Panel_SCENE/PNL/CABINETpnl/SHOWSELECTION", "DELETEFROMLIST").SetActive(false); Get.o2("Canvas/Panel_SCENE/PNL/CABINETpnl/SHOWSELECTION", "RE_CREATOR").SetActive(false); //Get.o2("Canvas/Panel_SCENE/PNL/CABINETpnl/SHOWSELECTION", "RowHeightBtn").SetActive(true); if (_G.User == "Admin") { Get.o2("Canvas/Panel_SCENE/PNL/CABINETpnl/SHOWSELECTION", "DELETEFROMLIST").SetActive(true); Get.o2("CABINETpnl","SHOWSELECTION").transform.Find("RE_CREATOR").gameObject.SetActive(true); } string cat = Get.o1("Title").GetComponent().text; SetOPTIONS_ONOFF(cat, modelname,Model); //Preferences Resize if(_P.ListSwitch["ALLOW_RESIZE_CABINET"]){ RedimensionFromPreferences(Model); } } public void RedimensionFromPreferences(string Model){ print("Model===="+Model); if(new List(){"B1","B2","B3","B4","B5","B9","B10"}.Contains(Model)){ GameObject.Find("InputFieldK").GetComponent().text=DOIT.CSs(_P.List["KICK_HEIGHT"]); Resize.ResetCabinetDIM("InputK"); GameObject.Find("InputFieldD").GetComponent().text=DOIT.CSs(_P.List["BASE_HEIGHT"]); Resize.ResetCabinetDIM("InputD"); } else if(new List(){"B1","B9","B10"}.Contains(Model)){ GameObject.Find("InputFieldC").GetComponent().text=DOIT.CSs(_P.List["BASE_DEPTH"]); } else if(new List(){"B2","B3","B4","B5"}.Contains(Model)){ GameObject.Find("InputFieldE").GetComponent().text=DOIT.CSs(_P.List["WALL_DEPTH"]); GameObject.Find("InputFieldF").GetComponent().text=DOIT.CSs(_P.List["WALL_DEPTH"]); } else if(new List(){"B9"}.Contains(Model)){ GameObject.Find("InputFieldE").GetComponent().text=DOIT.CSs(_P.List["WALL_DEPTH"]); } //TALL else if(new List(){"T1"}.Contains(Model)){ GameObject.Find("InputFieldK").GetComponent().text=DOIT.CSs(_P.List["KICK_HEIGHT"]); Resize.ResetCabinetDIM("InputK"); GameObject.Find("InputFieldD").GetComponent().text=DOIT.CSs(_P.List["TALL_HEIGHT"]); Resize.ResetCabinetDIM("InputD"); GameObject.Find("InputFieldC").GetComponent().text=DOIT.CSs(_P.List["TALL_DEPTH"]); } //WALL else if(new List(){"WB10"}.Contains(Model)){ GameObject.Find("InputFieldF").GetComponent().text=DOIT.CSs(_P.List["WALL_DEPTH"]); } else if(new List(){"W1","W2","W3","W4","W5","W9","W10"}.Contains(Model)){ GameObject.Find("InputFieldB").GetComponent().text=DOIT.CSs(_P.List["WALL_HEIGHT"]); } else if(new List(){"W1","W9","W10"}.Contains(Model)){ GameObject.Find("InputFieldC").GetComponent().text=DOIT.CSs(_P.List["WALL_DEPTH"]); } else if(new List(){"W2","W3","W4","W5"}.Contains(Model)){ GameObject.Find("InputFieldE").GetComponent().text=DOIT.CSs(_P.List["WALL_DEPTH"]); GameObject.Find("InputFieldF").GetComponent().text=DOIT.CSs(_P.List["WALL_DEPTH"]); } else if(new List(){"W9"}.Contains(Model)){ GameObject.Find("InputFieldE").GetComponent().text=DOIT.CSs(_P.List["WALL_DEPTH"]); } else if(new List(){"W10"}.Contains(Model)){ GameObject.Find("InputFieldF").GetComponent().text=DOIT.CSs(_P.List["WALL_DEPTH"]); } } public void SetOPTIONS_ONOFF(string name, string modelname,string Model) { GameObject COUNTER = Get.o1("Canvas/Panel_SCENE/PNL/CABINETpnl/SHOWSELECTION/OPTIONS_ONOFF/COUNTER"); GameObject NOLEGS = Get.o1("Canvas/Panel_SCENE/PNL/CABINETpnl/SHOWSELECTION/OPTIONS_ONOFF/NOLEGS"); GameObject NOKICK = Get.o1("Canvas/Panel_SCENE/PNL/CABINETpnl/SHOWSELECTION/OPTIONS_ONOFF/NOKICK"); GameObject UNDERFINISH = Get.o1("Canvas/Panel_SCENE/PNL/CABINETpnl/SHOWSELECTION/OPTIONS_ONOFF/UNDERFINISH"); GameObject INTERIORFINISH = Get.o1("Canvas/Panel_SCENE/PNL/CABINETpnl/SHOWSELECTION/OPTIONS_ONOFF/INTERIORFINISH"); GameObject NO_DOOR = Get.o1("Canvas/Panel_SCENE/PNL/CABINETpnl/SHOWSELECTION/OPTIONS_ONOFF/NO_DOOR"); GameObject Sideselection = Get.o1("Canvas/Panel_SCENE/PNL/CABINETpnl/SHOWSELECTION/SIDES"); COUNTER.SetActive(false); NOLEGS.SetActive(false); NOKICK.SetActive(false); UNDERFINISH.SetActive(false); INTERIORFINISH.SetActive(true); if (name == "BASE" || name == "CBASE") { COUNTER.SetActive(true); COUNTER.transform.GetComponent().isOn = false; } if (name == "WALL" || name == "CWALL") { if(_P.ListSwitch.ContainsKey("ALLOW_UNDER_FINISH") && _P.ListSwitch["ALLOW_UNDER_FINISH"])UNDERFINISH.SetActive(true); } string CabLib="Cabinet"; if(UIT.TogOn("FILTERS")=="Ukitchenit")CabLib="CabinetUkitchenit"; string SideFinish = UIT.Value(CabLib,_G.SC[0],"Finish"); if(_P.ListSwitch["ALLOW_KICK&LEG"] ){ if(name == "BASE" || name == "CBASE" || name == "TALL"){ NOLEGS.SetActive(true); NOKICK.SetActive(true); NOLEGS.GetComponent().isOn = false; NOKICK.GetComponent().isOn = false; } } if(_P.InterorFinishOnCabPnl) if (SideFinish == "1_1_1_1_1_1_1") { INTERIORFINISH.transform.GetComponent().isOn = false; } else { INTERIORFINISH.transform.GetComponent().isOn = true; } else INTERIORFINISH.SetActive(false); if(_P.ListSwitch["NO_DOOR"]){ NO_DOOR.SetActive(true); NO_DOOR.GetComponent().isOn=false; } else NO_DOOR.SetActive(false); print("Model====="+Model); //Set Side Selection bool isSidesSelection=false; Get.o2("Canvas/Panel_SCENE/PNL/CABINETpnl/SHOWSELECTION", "SIDES").SetActive(false); if( _P.ListSwitch["ALLOW_SIDES_SELECTION"] ){ if(new List(){"B1"}.Contains(Model))isSidesSelection=true; } Sideselection.SetActive(isSidesSelection); // if (SideFinish.Split("_")[6] == "1") { UNDERFINISH.transform.GetComponent().isOn = true; } // else { UNDERFINISH.transform.GetComponent().isOn = false; } } public static void Paternskew(string name) { //All skew off string[] NAME = name.Split('.'); string ns = NAME[0] + "." + NAME[1] + "." + NAME[2]; if (ns == "M.5.L") ns = "M.5.L.A"; if (ns == "M.5.R") ns = "M.5.R.A"; if (ns == "M.8.L") ns = "M.8.L.A"; if (ns == "M.8.R") ns = "M.8.R.A"; string path = "CABINETpnl/SHOWSELECTION/MODEL/SkewPatern"; if (_G.PNL == "NewCAB") { path = "CABINETpnl/ADDINPUTS/SIZES/MODEL/SkewPatern"; } GameObject SK = Get.o1(path + ns); SK.transform.GetComponent().alpha = 1; AddPATERN1(SK); if (NAME[1] == "5" || NAME[1] == "8") { string ns2 = ns.Replace("A", "B"); GameObject SK2 = Get.o1(path + ns2); SK2.transform.GetComponent().alpha = 1; AddPATERN2(SK2); } } public static Vector2 WorldToScreenPoint(Camera cam, Vector3 worldPoint) { if (cam == null) return new(worldPoint.x, worldPoint.y); return (Vector2)cam.WorldToScreenPoint(worldPoint); } public void SetDIM(GameObject O, string header, string[] c, GameObject O2) { string letter = header.Split('_')[0]; //int ind=UIT.Ind("Cabinet",letter); string CabLib="Cabinet"; if(UIT.TogOn("FILTERS")=="Ukitchenit")CabLib="CabinetUkitchenit"; string Code=UIT.Value(CabLib,_G.SC[0],letter); string minValue = ""; string maxValue = ""; string currentValue = Code; if(Code.IndexOf("_")!=-1){ minValue=Code.Split('_')[0]; currentValue=Code.Split('_')[1]; maxValue=Code.Split('_')[2]; } if (minValue != maxValue && !string.IsNullOrEmpty(currentValue)) { O.gameObject.SetActive(true); O.transform.Find("min").GetComponent().text = minValue; O.gameObject.GetComponent().text = DOIT.CSss(currentValue); O.transform.Find("max").GetComponent().text = maxValue; } else if (minValue == maxValue && !string.IsNullOrEmpty(currentValue)) { O2.SetActive(true); O2.GetComponent().text = DOIT.CSss(currentValue); } } public void SetDIMFIX(TMP_Dropdown O, string header, string[] c ) { O.gameObject.SetActive(true); string[] list = c[UIT.Ind("Cabinet","A_Value")].Split("_"); TMP_Dropdown dropdown = O.GetComponent(); dropdown.options.Clear(); foreach (string option in list) { dropdown.options.Add(new TMP_Dropdown.OptionData(option)); } dropdown.value = 0; dropdown.RefreshShownValue(); if (O.name == "DropdownD") { FixB.gameObject.SetActive(true); float valueD = DOIT.ConvertStringToNumber(DOIT.CSs(GameObject.Find("DropdownD").transform.Find("Label").GetComponent().text)); float valueK = DOIT.ConvertStringToNumber(c[UIT.Ind("Cabinet","K_Value")]); float value = valueD + valueK; FixB.gameObject.GetComponent().text = value.ToString(); } } public void ResetInput() { if (_G.VTcat != "TMP") ResetInput(name); else { ResetInputTMP(name); } } public static void ResetInput(string name) { print("------------------------RRESSIZZZZE----------------------1-------" + name); string model = Get.o2("CABINETpnl/SHOWSELECTION", "MODEL").GetComponent().sprite.name; string[] m = model.Split('.'); bool AV = CheckBool("InputFieldA"); bool BV = CheckBool("InputFieldB"); bool CV = CheckBool("InputFieldC"); bool DV = CheckBool("InputFieldD"); bool EV = CheckBool("InputFieldE"); bool FV = CheckBool("InputFieldF"); bool KV = CheckBool("InputFieldK"); bool AF = CheckBool("FixA"); bool BF = CheckBool("FixB"); bool CF = CheckBool("FixC"); bool DF = CheckBool("FixD"); bool EF = CheckBool("FixE"); bool FF = CheckBool("FixF"); bool KF = CheckBool("FixK"); //Min Max stop if (AV) { Minmax("A"); } if (BV) { Minmax("B"); } if (CV) { Minmax("C"); } if (DV) { Minmax("D"); } if (EV) { Minmax("E"); } if (FV) { Minmax("F"); } //if(KV){Minmax("K");} //Base hight if (BV && DV && !KV) { if (name == "InputFieldB") { float K = Getfloat("FixK"); float B = Getfloat("InputFieldB"); AddString("InputFieldD", B - K); } } if (BV && !DV && KV) { if (name == "InputFieldB") { float D = Getfloat("InputFieldD"); float B = Getfloat("InputFieldB"); if(B().text); // float Dh=DOIT.ConvertStringToNumber(Get.o2("ADDINPUTS/SIZES/DIMS/"+leter,leter+"_Value").GetComponent().text); // print("Dw====="+Dw); // print("Dh====="+Dh); // DC.RedoNew(_G.CODEPATERN,Dw,Dh,_G.VF); // if(_G.CODEPATERN2!="")DC.RedoNew(_G.CODEPATERN2,Dw,Dh,_G.VF2); } public static void ResetInputTMP(string name) { print("------------------------RRESSIZZZZE TMP----------------------1-------" + name); string model = Get.o2("ADDINPUTS", "MODEL").GetComponent().sprite.name; string[] m = model.Split('.'); bool AV = CheckBool("A"); bool BV = CheckBool("B"); bool CV = CheckBool("C"); bool DV = CheckBool("D"); bool EV = CheckBool("E"); bool FV = CheckBool("F"); bool KV = CheckBool("K"); //Base hight if (BV && DV && !KV) { if (name == "Bvalue") { float K = Getfloat("FixK"); float B = Getfloat("InputFieldB"); AddString("InputFieldD", B - K); } } if (BV && DV && KV) { if (name == "InputFieldK") { float K = Getfloat("InputFieldK"); float D = Getfloat("InputFieldD"); AddString("InputFieldB", D + K); } if (name == "InputFieldB") { float K = Getfloat("InputFieldK"); float B = Getfloat("InputFieldB"); AddString("InputFieldD", B - K); } if (name == "InputFieldD") { float K = Getfloat("InputFieldK"); float D = Getfloat("InputFieldD"); AddString("InputFieldB", D + K); } } } public static void Minmax(string L) { L = "InputField" + L; float min = GetfloatMinMax(L, "min"); float max = GetfloatMinMax(L, "max"); float AI = Getfloat(L); if (AI < min) AI = min; if (AI > max) AI = max; AddString(L, AI); } public static bool CheckBool(string Mesure) { bool check = false; if (Get.o2("DIMS", Mesure).activeInHierarchy == true) check = true; return check; } public static bool CheckBoolNEWCab(string Mesure) { bool check = false; if (Get.o2("ADDINPUTS/DIMS", Mesure).activeInHierarchy == true) check = true; return check; } public static float Getfloat(string Mesure) { float v = 0; if (_G.VTcat != "TMP") { if (Mesure.IndexOf("Fix") != -1) v = DOIT.ConvertStringToNumber(Get.o2("DIMS", Mesure).GetComponent().text); if (Mesure.IndexOf("Input") != -1) v = DOIT.ConvertStringToNumber(Get.o2("DIMS", Mesure).GetComponent().text); } else { if (Mesure.IndexOf("Fix") != -1) v = DOIT.ConvertStringToNumber(Get.o2("DIMS", Mesure).GetComponent().text); if (Mesure.IndexOf("Input") != -1) v = DOIT.ConvertStringToNumber(Get.o2("DIMS", Mesure).GetComponent().text); } return v; } public static float GetfloatMinMax(string Mesure, string mm) { float v = 0; v = DOIT.ConvertStringToNumber(Get.o3("DIMS", Mesure, mm).GetComponent().text); return v; } public static void AddString(string Mesure, float value) { string VS = DOIT.CNs(value); if (_G.VTcat != "TMP") { if (Mesure.IndexOf("Fix") != -1) Get.o2("CABINETpnl/SHOWSELECTION/DIMS", Mesure).GetComponent().text = VS; if (Mesure.IndexOf("Input") != -1) Get.o2("CABINETpnl/SHOWSELECTION/DIMS", Mesure).GetComponent().text = VS; } else { if (Mesure.IndexOf("Fix") != -1) Get.o2("CABINETpnl/SHOWSELECTION/DIMS", Mesure).GetComponent().text = VS; if (Mesure.IndexOf("Input") != -1) Get.o2("CABINETpnl/SHOWSELECTION/DIMS", Mesure).GetComponent().text = VS; } } public void SetBvalue() { print(this.transform.Find("Label").GetComponent().text); float valueD = DOIT.ConvertStringToNumber(DOIT.CSs(GameObject.Find("DropdownD").transform.Find("Label").GetComponent().text)); float valueK = DOIT.ConvertStringToNumber(FixK.text); float value = valueD + valueK; FixB.gameObject.GetComponent().text = value.ToString(); } //Test public static void AddPATERN1(GameObject PATERN) { string path = "CABINETpnl/SHOWSELECTION/MODEL/"; if (_G.PNL == "NewCAB") { path = "CABINETpnl/ADDINPUTS/SIZES/MODEL/"; } DOIT.DELETEAllChild(path + PATERN.name); _G.CODEPATERN = _G.CODEPATERN.Replace(",", "_"); GameObject DS = new("doorPatern"); string[] code = _G.CODEPATERN.Split('_'); float sx = DOIT.ConvertStringToNumber(code[3]); float sy = DOIT.ConvertStringToNumber(code[4]); float sz = 0.625f; float PW = DOIT.ConvertStringToNumber(code[0]); float YH = DOIT.ConvertStringToNumber(code[1]); float px = -PW / 2f + sx / 2f; float py = YH / 2f - sy / 2f; float b = 0;//Glass.getBorder(C[61].Substring(4, 3)); int nd = (code.Length - 2) / 4;//number of door GameObject knob = new(); _G.RTOT = 1; RectTransform rt = PATERN.transform.GetComponent(); float swide = rt.sizeDelta.x; float swheigt = rt.sizeDelta.y; sch = swheigt / YH; scw = swide / PW; for (int i = 0; i < nd ; i++) { int a = 2 + 4 * i; if (i>0 ) { px += DOIT.ConvertStringToNumber(code[a-3])*0.5f+DOIT.ConvertStringToNumber(code[a+1])*0.5f ; if (px >= PW *0.5f) { _G.RTOT += 1; px = - PW / 2f + DOIT.ConvertStringToNumber(code[a+1])*0.5f ; py -= DOIT.ConvertStringToNumber(code[a-2])*0.5f + DOIT.ConvertStringToNumber(code[a+2])*0.5f; } } //door CreateDoor(DS, (i + 1).ToString(), code[a], code[0], DOIT.ConvertStringToNumber(code[a+1]) - 0.0f, DOIT.ConvertStringToNumber(code[a+2]) - 0.0f, sz, px, py, b, PATERN.name); //knob if (code[a+3] != "0") { if(code[a] != "dd"){ knob = Addknob((i + 2).ToString(), DOIT.ConvertStringToNumber(code[a+1]), DOIT.ConvertStringToNumber(code[a+2]), code[a+3], px, py); knob.transform.SetParent(DS.transform); } if(code[a] == "dd"){ knob = Addknob((i + 2).ToString(), DOIT.ConvertStringToNumber(code[a+1]), DOIT.ConvertStringToNumber(code[a+2])*0.5f, code[a+3], px, py+DOIT.ConvertStringToNumber(code[a+2])*0.5f*0.25f); knob.transform.SetParent(DS.transform); GameObject knob2 = Addknob((i + 2).ToString(), DOIT.ConvertStringToNumber(code[a+1]), DOIT.ConvertStringToNumber(code[a+2])*0.5f, code[a+3], px, py-DOIT.ConvertStringToNumber(code[a+2])*0.25f); knob2.transform.SetParent(DS.transform); } } }//fin for DS.transform.SetParent(PATERN.transform, true); DS.transform.localScale = new Vector3(scw, sch, 1); DS.transform.localPosition = new Vector3(0, 0, 0); } public static void AddPATERN2(GameObject PATERN) { string path = "CABINETpnl/SHOWSELECTION/MODEL/"; if (_G.PNL == "NewCAB") { path = "CABINETpnl/ADDINPUTS/MODEL/"; } DOIT.DELETEAllChild(path + PATERN.name); _G.CODEPATERN2 = _G.CODEPATERN2.Replace(",", "_"); GameObject DS = new(); DS.name = "doorPatern"; string[] CodeS2 = _G.CODEPATERN2.Split('_'); float sx = DOIT.ConvertStringToNumber(CodeS2[3]); float sy = DOIT.ConvertStringToNumber(CodeS2[4]); float sz = 0.625f; float PW = DOIT.ConvertStringToNumber(CodeS2[0]); float YH = DOIT.ConvertStringToNumber(CodeS2[1]); float px = -PW / 2f + sx / 2f; float py = YH / 2f - sy / 2f; float b = 0;//Glass.getBorder(C[61].Substring(4, 3)); GameObject knob = new(); _G.RTOT = 1; RectTransform rt = PATERN.transform.GetComponent(); float swide = rt.sizeDelta.x; float swheigt = rt.sizeDelta.y; sch = swheigt / YH; scw = swide / PW; CreateDoor(DS, "1", CodeS2[2], CodeS2[0], sx - 0.0f, sy - 0.0f, sz, px, py, b, PATERN.name); if (CodeS2[5] != "0") { knob = Addknob("1", sx, sy, CodeS2[5], px, py); knob.transform.SetParent(DS.transform); } if (_G.RCAT == "6" || _G.RCAT == "7" || _G.RCAT == "12" || _G.RCAT == "13") { CreateDoor(DS, "1B", CodeS2[2], CodeS2[0], sx - 0.0f, sy - 0.0f, sz, px + _G.D2W, py, b, PATERN.name); if (CodeS2[5] != "0") { knob = Addknob("1", sx, sy, CodeS2[5], px + _G.D2W, py); knob.transform.SetParent(DS.transform); } } for (int i = 0; i < 25; i++) { int a = i * 4; if (CodeS2.Length > 6 + a) { px += DOIT.ConvertStringToNumber(CodeS2[3 + a]); if (px >= PW / 2) { _G.RTOT += 1; px = -PW / 2f + DOIT.ConvertStringToNumber(CodeS2[7 + a]) / 2f; py -= DOIT.ConvertStringToNumber(CodeS2[4 + a]) / 2 + DOIT.ConvertStringToNumber(CodeS2[8 + a]) / 2; } //door CreateDoor(DS, (i + 2).ToString(), CodeS2[6 + a], CodeS2[0], DOIT.ConvertStringToNumber(CodeS2[7 + a]) - 0.0f, DOIT.ConvertStringToNumber(CodeS2[8 + a]) - 0.0f, sz, px, py, b, PATERN.name); //knob if (CodeS2[9 + a] != "0") { knob = Addknob((i + 2).ToString(), DOIT.ConvertStringToNumber(CodeS2[7 + a]), DOIT.ConvertStringToNumber(CodeS2[8 + a]), CodeS2[9 + a], px, py); knob.transform.SetParent(DS.transform); } if (_G.RCAT == "6" || _G.RCAT == "7" || _G.RCAT == "12" || _G.RCAT == "13") { CreateDoor(DS, (i + 2).ToString() + 'B', CodeS2[6 + a], CodeS2[0], DOIT.ConvertStringToNumber(CodeS2[7 + a]) - 0.0f, DOIT.ConvertStringToNumber(CodeS2[8 + a]) - 0.0f, sz, px + _G.D2W, py, b, PATERN.name); if (CodeS2[9 + a] != "0") { knob = Addknob((i + 2).ToString(), DOIT.ConvertStringToNumber(CodeS2[7 + a]), DOIT.ConvertStringToNumber(CodeS2[8 + a]), CodeS2[9 + a], px + _G.D2W, py); knob.transform.SetParent(DS.transform); } } DS.transform.SetParent(PATERN.transform, true); DS.transform.localScale = new Vector3(scw, sch, 1); } }//fin for DS.transform.SetParent(PATERN.transform, true); DS.transform.localScale = new Vector3(scw, sch, 1); //DS.transform.localPosition = new Vector3(-DOIT.ConvertStringToNumber(CodeS2[3])*scw/2, 0, 0); DS.transform.localPosition = new Vector3(0, 0, 0); //Allbtncode(); } public static void CreateDoor(GameObject ds, string N, string p, string wp, float Sx, float Sy, float Sz, float Px, float Py, float b, string PATERN) { string btnName = ""; GameObject Doorbtn = Get.o2("CABINETpnl", "PATERNBTN"); if (p == "p") { btnName = "DOOR"; } if (p == "d") { btnName = "DRAW"; } if (p == "t") { btnName = "TAMB"; } if (p == "o") { btnName = "OPEN"; } if (p == "w") { btnName = "WINE"; } if (p == "g") { btnName = "GLAS"; } if (p == "c") { btnName = "CUTO"; } if (p == "dd"){ btnName = "DDOO"; } GameObject R = Instantiate(Doorbtn, new Vector3(0, 0, 0), Quaternion.identity); R.SetActive(true); R.name = btnName + N.ToString(); R.transform.Find("Line1").transform.GetComponent().sizeDelta = new(Sx, Sy); R.transform.position = new Vector3(Px, Py, 0); if (_G.RTOT == 1) { _G.ROWH1[0] = Sy; } if (_G.RTOT == 2) { _G.ROWH1[1] = Sy; } if (_G.RTOT == 3) { _G.ROWH1[2] = Sy; } if (_G.RTOT == 4) { _G.ROWH1[3] = Sy; } if (_G.RTOT == 5) { _G.ROWH1[4] = Sy; } if (_G.RTOT == 6) { _G.ROWH1[5] = Sy; } R.transform.SetParent(ds.transform, true); UILineRenderer ui = R.transform.Find("Line1").GetComponent(); float ofx = Sx / 2; float ofy = Sy / 2; //print("PATERNPATERNPATERNPATERNPATERN=="+PATERN); float skew=0;//wide door patern float skewcoffset=0;//wide door patern if(PATERN=="SkewPaternM.5.L.B"){skew=0.35f; skewcoffset=-2.2f;} if(PATERN=="SkewPaternM.5.R.B"){skew=-0.35f; skewcoffset=2.2f;} if(PATERN=="SkewPaternM.8.L.B"){skew=0.35f; skewcoffset=-2.2f;} if(PATERN=="SkewPaternM.8.R.B"){skew=-0.35f; skewcoffset=2.2f;} Vector3 Rpos=R.transform.localPosition; R.transform.localPosition=new( Rpos.x, Rpos.y+skewcoffset, Rpos.z); float wd=DOIT.ConvertStringToNumber(wp);//wide door patern float yskew1=(wd/2+Px-Sx/2)*skew; float yskew2=(wd/2+Px+Sx/2)*skew; Vector2 p1 = new(-Sx / 2 + ofx, Sy / 2 + ofy); p1 = new(p1.x, p1.y + yskew1); Vector2 p2 = new(Sx / 2 + ofx, Sy / 2 + ofy); p2 = new(p2.x, p2.y + yskew2); Vector2 p3 = new(Sx / 2 + ofx, -Sy / 2 + ofy); p3 = new(p3.x, p3.y + yskew2); Vector2 p4 = new(-Sx / 2 + ofx, -Sy / 2 + ofy); p4 = new(p4.x, p4.y + yskew1); Vector2 p5 = new(-Sx / 2 + ofx, Sy / 2 + ofy ); p5 = new(p5.x, p5.y + yskew1); List pointlist = new(){p1,p2,p3,p4,p5}; ui.Points = pointlist.ToArray(); ui.LineThickness = 200 / (sch * 100); float posx = -Sx / 2 + ofx + Px; float posy = -Sy / 2 + ofy + Py; if (p == "w") { UILineRenderer ui2 = R.transform.Find("Line2").GetComponent(); R.transform.Find("Line2").transform.GetComponent().sizeDelta = new(Sx, Sy); Vector2 p6 = new(p1.x + 1, p1.y - 1); Vector2 p7 = new(p2.x - 1, p2.y - 1); Vector2 p8 = new(p3.x - 1, p3.y + 1); Vector2 p9 = new(p4.x + 1, p4.y + 1); Vector2 p10 = new(p5.x + 1, p5.y - 1); List pointlist2 = new(){p6,p7,p8,p9,p10}; ui2.Points = pointlist2.ToArray(); ui2.LineThickness = 150 / (sch * 100); if (p == "w") PaternDraw.AddSprite(R, p, Sx, Sy, 0, 0, 0); } if (p == "o") { PaternDraw.DrawlineOpen(R, Sx, Sy, posx, posy, _G.SC[0], 50, 1); } if (p == "t") { PaternDraw.DrawlineTambour(R, Sx, Sy, posx,posy, _G.SC[0], 50, 1, 0.5f); } if (p == "g") { PaternDraw.DrawlineGlass(R, Sx, Sy, -Sx / 2 + ofx + Px, -Sy / 2 + ofy + Py, _G.SC[0], 50, 1, 0.5f); } if (p == "c") { PaternDraw.DrawlineCutout(R, Sx, Sy, posx,posy, _G.SC[0], 50, 1, 0.5f); } if (p == "dd") { UILineRenderer ui2 = R.transform.Find("Line2").GetComponent(); R.transform.Find("Line2").transform.GetComponent().sizeDelta = new(Sx, Sy); Vector2 left=(p4+p1)*0.5f; Vector2 right=(p3+p2)*0.5f; List pointlist2 = new(){left,right}; ui2.Points = pointlist2.ToArray(); ui2.LineThickness = 150 / (sch * 100); } } public static string Del0(float FV) { string SV = FV.ToString("F3"); if (SV.IndexOf(".") != -1) { if (SV.Substring(SV.Length - 1, 1) == "0") SV = SV.Substring(0, SV.Length - 1); if (SV.Substring(SV.Length - 1, 1) == "0") SV = SV.Substring(0, SV.Length - 1); if (SV.Substring(SV.Length - 1, 1) == "0") SV = SV.Substring(0, SV.Length - 1); if (SV.Substring(SV.Length - 1, 1) == ".") SV = SV.Substring(0, SV.Length - 1); } return SV; } public static GameObject Addknob(string N, float sx, float sy, string pos, float px, float py) { GameObject Knob = Get.o2("BTNPATERN", "knobMark"); GameObject K = Instantiate(Knob, new Vector3(0, 0, 0), Quaternion.identity); K.SetActive(true); K.name = "k" + N; K.transform.GetComponent().sizeDelta = new(3, 3); if (pos == "1") { px = px - sx / 2 + 2; py = py + sy / 2 - 2; } if (pos == "2") { py = py + sy / 2 - 2; } if (pos == "3") { px = px + sx / 2 - 2; py = py + sy / 2 - 2; } if (pos == "4") { px = px - sx / 2 + 2; } if (pos == "5") { } if (pos == "6") { px = px + sx / 2 - 2; } if (pos == "7") { px = px - sx / 2 + 2; py = py - sy / 2 + 2; } if (pos == "8") { py = py - sy / 2 + 2; } if (pos == "9") { px = px + sx / 2 - 2; py = py - sy / 2 + 2; } if (pos == "10") { px = px + sx / 2 - 2; py = py - sy / 2 + 2; } if (pos == "11") { px = px + sx / 2 - 2; py = py - sy / 2 + 2; } if (pos == "12") { px = px + sx / 2 - 2; py = py - sy / 2 + 2; } if (pos == "13") { px = px + sx / 2 - 2; py = py - sy / 2 + 2; } if (pos == "14") { px = px + sx / 2 - 2; py = py - sy / 2 + 2; } if (pos == "15") { px = px + sx / 2 - 2; py = py - sy / 2 + 2; } K.transform.position = new Vector3(px, py, 0); float scalew = 2f / scw; float scaleh = 2f / sch; K.transform.localScale = new Vector3(scalew, scaleh, 1); return K; } public static void AddDim(string L){ string CabLib="Cabinet";//if(UIT.TogOn("FILTERS")=="Ukitchenit")CabLib="CabinetUkitchenit"; string Code=UIT.Value(CabLib,_G.SC[0],L);//Code======1_30.5_60 Code======1_13_48 if(!string.IsNullOrEmpty(Code) && Code!="0"){ GameObject Letter = Get.o2("SHOWSELECTION/DIMS","InputField"+L); GameObject Fix = Get.o2("SHOWSELECTION/DIMS","Fix"+L); GameObject DD = Get.o2("SHOWSELECTION/DIMS","Dropdown"+L); Letter.SetActive(false); Fix.SetActive(false); DD.SetActive(false); string[] codeV=Code.Split('_'); string[] codeFV=Code.Split('?'); if(!string.IsNullOrEmpty(Code) && Code!="0") { //Variable Min Max if(codeV.Length>=3 && codeV[0] != codeV[2]) { Letter.SetActive(true); Letter.transform.Find("min").GetComponent().text=codeV[0]; Letter.transform.Find("max").GetComponent().text=codeV[2]; Letter.GetComponent().text=codeV[1]; } //Fix if(codeV.Length==3 && codeV[0] == codeV[2] || codeV.Length==1 && Code.IndexOf("?")==-1 ){ Fix.SetActive(true); Fix.GetComponent().text=Code; } //Fix Variable if(codeFV.Length>1){ DD.SetActive(true); List options = new(); for(int i=0; i().ClearOptions(); DD.GetComponent().AddOptions(options); } } // if(CabLib=="CabinetUkitchenit" ){ // Fix.SetActive(false); // DD.SetActive(false); // Letter.SetActive(true); // if(L=="K"){ // Letter.transform.Find("min").GetComponent().text="1"; // Letter.transform.Find("max").GetComponent().text="24"; // Letter.GetComponent().text=DOIT.CNs(_O.KH); // ResetInput("InputFieldK"); // } // if(L=="D"){ // Letter.transform.Find("min").GetComponent().text="1"; // Letter.transform.Find("max").GetComponent().text="60"; // Letter.GetComponent().text=DOIT.CNs(_O.CBH); // ResetInput("InputFieldD"); // } // if(L=="C"){ // Letter.transform.Find("min").GetComponent().text="1"; // Letter.transform.Find("max").GetComponent().text="60"; // Letter.GetComponent().text=DOIT.CNs(_O.CBD); // } // } } } }