using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using System; using System.Collections.Specialized; using Unity.VisualScripting; public class MakeList : MonoBehaviour { static int Numc = 1; static List CABS; float Y = 0; public void List() { //print("------------Make list-----------------"); DOIT.DELETEAllChild("LISTpnl/Panel/Viewport/Content"); Y = 0; Numc = 1; Addlist(); //Get.o2("LISTpnl","CREATOR").SetActive(false); //if(_G.User=="Admin"){ Get.o2("LISTpnl","CREATOR").SetActive(true);} Get.o2("LISTpnl/Panel/Viewport", "Content").GetComponent().cellSize = new(870, 100); //Get.o2("LISTpnl/CREATOR/","Btns").SetActive(false); } public void Addlist() { SceneModeManager.Instance.SetSceneMode(SceneModes.Calcule); List Cablist = DOLIST.CABLISTint(); Dictionary CABdict = CABLISTQTY(Cablist); Dictionary PNLdict = PNLLISTQTY(); Dictionary KICKdict = KICKLISTQTY(Cablist); Dictionary FASCIAdict = FASCIAQTY(); Dictionary VALANCEdict = VALANCELISTQTY(); Dictionary OGEEdict = OGEELISTQTY(); Dictionary FILLERdict = FILLERQTY(Cablist); // Dictionary KNOBdict = KNOBLISTQTY(); ADDcab(CABdict); if (_P.ListSwitch.ContainsKey("CABINET_DOOR_RECIPE") && _P.ListSwitch["CABINET_DOOR_RECIPE"]) { Dictionary DOORdict = DOORLISTQTY(Cablist); ADDdoor(DOORdict); } ADDpanel(PNLdict); ADDMolding("KICK", KICKdict); ADDMolding("FASCIA", FASCIAdict); ADDMolding("FILLER", FILLERdict); ADDMolding("VALANCE", VALANCEdict); ADDMolding("OGEE", OGEEdict); Get.o2("LISTpnl", "DropdownItems").SetActive(_P.ListSwitch["ADD_ITEM_LIST"]); if (_P.ListSwitch["ADD_ITEM_LIST"]) { AddToListItems.Option_Items(); ADDItems(_G.LibraryItems); } } //ADD TO LIST--------------------------------------------ADD TO LIST void ADDcab(Dictionary dict) { foreach (KeyValuePair pair in dict) { //print("pair.Key====from ADDcab===" + pair.Key); //HH-B36?W36 ''x H34 3/4''x D23 5/16''? 1 ? 1 ?Already assemble 2 doors 36 base cabinet with adjustable legs?0_0_0_0_0_0_0?F ? All //Code ? Size ? DoorModel ? DoorColor ? description ? finish side ? Sens FV ? BoxFinish //HH-HMO24? W24 ''x H30 ''x D11 13/16'' ?3?3? Already assemble White Micro-wave cabinet 24 x 30 wall cabinet?1_1_1_1_1_1_0?F?All //AB12? // W11 15/16''x H34 1/2''x D23 5/8''? // 1? // 1? // BASE CABINET 12 - 1 DOOR? // 0_0_0_0_0_0_0? // L? // 1 string PriceColumn= ""; if (Get.PreferenceBool("STORE_SELECTION")) { PriceColumn = _G.StoreZone; } string[] CODE = pair.Key.Split('?'); string CaseName = CODE[0] + CODE[1]; if (Get.PreferenceBool("CABINET_DOOR_RECIPE")) {CaseName+= UIT.Value(Library.Cabinet, CODE[0], Header.Door_Recipe); } ; if (Get.PreferenceBool("CABINET_BY_MODEL_DOOR")){CaseName+= CODE[2];} if (Get.PreferenceBool("CABINET_BY_FINISH_BOX")){CaseName+= CODE[7];} GameObject CASE = SetCase(CaseName); //string[] CODE = pair.Key.Split('?'); string[] VALUE = pair.Value.Split('?'); string DoorLanguage = ""; string DoorUniqueName = ""; string DoorColorUniqueName = ""; ///Kwizine No Door----------------- if (CODE[3] != "MELAMINEWHITE" && CODE[2] != "NO_DOOR") { DoorColorUniqueName = UIT.Value(Library.CabTexture, CODE[3], Header.Unique_Name); } if (CODE[2] != "NO_DOOR") { DoorLanguage = UIT.Value(Library.Door, CODE[2], "L" + _G.L.ToString()); DoorColorUniqueName = UIT.Value(Library.CabTexture, CODE[3], Header.Unique_Name); DoorUniqueName = UIT.Value(Library.Door, CODE[2], Header.Unique_Name); } if (CODE[2] == "NO_DOOR" && CODE[3] == "MELAMINEWHITE") { DoorUniqueName = TRANS.This("L_No doors"); DoorColorUniqueName = TRANS.This("L_No doors"); } if (CODE[2] == "NO_DOOR" && CODE[3] != "MELAMINEWHITE" && CODE[3].IndexOf("TEXT") == -1) { DoorUniqueName = TRANS.This("L_No doors"); DoorColorUniqueName = UIT.Value(Library.CabTexture, CODE[3], Header.Unique_Name); } if (CODE[2] == "NO_DOOR" && CODE[3].IndexOf("TEXT") != -1) { DoorUniqueName = TRANS.This("L_No doors"); DoorColorUniqueName = TRANS.This("L_No doors"); } ///Kwizine No Door----------------- string Door_Recipe = " " + UIT.Value(Library.Cabinet, CODE[0], Header.Door_Recipe); if (UIT.Ind(Library.Cabinet, Header.Door_Recipe) == 0 || CODE[2] == "NO_DOOR") Door_Recipe = ""; string item = TRANS.This("G_DOOR") + ": " + DoorLanguage + " " + DoorUniqueName; //E commerce code string PriceCode_ID = UIT.GetCabinetPriceID(CODE[0], CODE[2], CODE[3]); string CodeFromECommerce = ""; if (_P.ListSwitch["PDF_SHOW_ECOMMERCE_CODE"]) { CodeFromECommerce = " / " + UIT.Value(Header.Price, PriceCode_ID, Header.Ecommerce_ID); } //Price string PriceShow = ""; float Qty = DOIT.ConvertStringToNumber(VALUE[0]); if (_P.ListSwitch["SHOW_PRICE"]) { float UniquePrice = DOIT.ConvertStringToNumber(UIT.Value(Header.Price, PriceCode_ID, Header.Price + PriceColumn)); if (UniquePrice != 0) { float Pricetotal = Mathf.Round(UniquePrice * Qty * 100f) / 100f; PriceShow = Pricetotal.ToString("F2") + "$"; } } if (Get.PreferenceBool("CABINET_DOOR_RECIPE")) { item = Door_Recipe; } ; //ADD TEXT CASE.transform.Find("Code").gameObject.GetComponent().text = TRANS.This("G_CABINET") + ":" + PriceCode_ID + CodeFromECommerce;//CODE[0].Replace("_G","").Replace("_L","")+CodeFromECommerce; CASE.transform.Find("Item").gameObject.GetComponent().text = item ; CASE.transform.Find("Size").gameObject.GetComponent().text = CODE[1]; CASE.transform.Find("Des").gameObject.GetComponent().text = UIT.Value(Library.Cabinet, CODE[0], "Des_L" + _G.L.ToString()); CASE.transform.Find("Qty").gameObject.GetComponent().text = VALUE[0]; CASE.transform.Find("ItemNum").gameObject.GetComponent().text = VALUE[1]; CASE.transform.Find("Price").gameObject.GetComponent().text = PriceShow; //Image // print("CODE[0])===" + CODE[0]); // CabinetListData c = Get.CabinetCode(CODE[0]); // GameObject SP = CASE.transform.Find("Image").gameObject; // SP.name = "CASE IMAGE"; // AddPaternCab(SP, c.Pattern_Door_1, c.Pattern_Door_2, 0, 0, c.GetPropertyValue(CsvHeaders.ID)); //Finih CASE.transform.Find("ItemNum").gameObject.GetComponent().text = "No." + Numc; Numc += 1; } } void ADDdoor(Dictionary dict) { foreach (KeyValuePair pair in dict) { string PriceColumn= ""; if (Get.PreferenceBool("STORE_SELECTION")) { PriceColumn = _G.StoreZone; } print("pair.Key====from ADDdoor===" + pair.Key);//pair.Key====from ADDdoor===HH1830-SHA-BL //pair.Key====from ADDdoor===B-MAGOG string DoorUniqueName = pair.Key; GameObject CASE = SetCase(DoorUniqueName); string Code_ID = pair.Key;//B-MAGOG string DoorColorUniqueName=pair.Key; if (Get.PreferenceBool("DOOR_BY_GROUP")) { Code_ID = Code_ID.Split('-')[0];//B DoorUniqueName = DoorUniqueName.Split('-')[1]; string Door_ID = UIT.GetIDByUnique_Name(Library.Door, DoorUniqueName); PriceColumn = UIT.Value(Library.Door, Door_ID, Header.Group); DoorColorUniqueName = DoorUniqueName + " " + UIT.Value(Library.CabTexture, Door_ID, "L" + _G.L.ToString()); } else { DoorColorUniqueName = Code_ID.Split('-')[2];//HH1830-SHA-BL } string Description = UIT.Value(Library.Price, Code_ID, "L" + _G.L.ToString()); string CodeFromECommerce = " / " + UIT.Value(Library.Price, Code_ID, Header.Ecommerce_ID); int Qty = pair.Value; CASE.transform.Find("Code").gameObject.GetComponent().text = TRANS.This("M_DOOR") + ": " + Code_ID + CodeFromECommerce; CASE.transform.Find("Item").gameObject.GetComponent().text = TRANS.This("T_COLOR") + ":" + DoorColorUniqueName; CASE.transform.Find("Size").gameObject.GetComponent().text = ""; CASE.transform.Find("Des").gameObject.GetComponent().text = Description; CASE.transform.Find("Qty").gameObject.GetComponent().text = Qty.ToString(); CASE.transform.Find("ItemNum").gameObject.GetComponent().text = ""; CASE.transform.Find("Price").gameObject.GetComponent().text = ""; //Price if (_P.ListSwitch["SHOW_PRICE"]) { float UniquePrice = float.Parse(UIT.Value(Library.Price, Code_ID, Header.Price + PriceColumn)); if (UniquePrice != 0) { float Pricetotal = Mathf.Round(UniquePrice * Qty * 100f) / 100f; CASE.transform.Find("Price").gameObject.GetComponent().text = Pricetotal.ToString("F2") + "$"; } } Numc += 1; } } public static void AddPaternCab(GameObject Cab, string patern25, string patern26, float x, float y, string cat) { string[] code25 = patern25.Split('_'); string[] code26 = patern26.Split('_'); GameObject CabImage = new GameObject(Cab.name); PaternDraw.Paterns(CabImage, code25, code26, cat); CabImage.transform.SetParent(Cab.transform); CabImage.transform.localPosition = new Vector3(x, y, 1); CabImage.transform.localScale = new Vector3(1f, 1f, 1); //string catcab = Get.CabValue(Cab.name, 25); string catcab = Get.LibraryValue(Cab.name, CsvHeaders.Cab_Sub_Category, DataTypes.Cabinet); PaternDraw.Paterns(CabImage, code25, code26, cat); CabImage.transform.SetParent(Cab.transform); CabImage.transform.localPosition = new Vector3(x, y, 1); CabImage.transform.localScale = new Vector3(0.8f, 0.8f, 1); } void ADDpanel(Dictionary dict) { //CASECOUNT = dict.Count; foreach (KeyValuePair pair in dict) { //Set new case string PriceColumn= ""; if (Get.PreferenceBool("STORE_SELECTION")) { PriceColumn = _G.StoreZone; } string[] Code = pair.Key.Split('?'); string Casename = UIT.Value(Library.Panel, Code[0], Header.Unique_Name) + "-" + UIT.Value(Library.CabTexture, Code[1], Header.Unique_Name); GameObject CASE = SetCase(Casename);//"NONE?1?90?0" //Case32?10 //1?1?90 2 //print("pair.Key=p===" + pair.Key);//5?1?0.625 //pair.Key=p===3?1?0.625 //pair.Key=p===12?12 string CodeID = Code[0]; string ColorID = Code[1]; string PanelUniqueName = UIT.Value(Library.Panel, CodeID, Header.Unique_Name); string ColorUniqueName = UIT.Value(Library.CabTexture, ColorID, Header.Unique_Name); string ColorDescrition = UIT.Value(Library.CabTexture, ColorID, "L" + _G.L.ToString()); string Wide = UIT.Value(Library.Panel, CodeID, Header.Wide); if(Wide.Contains("_")) {Wide = Wide.Split("_")[2];} string Height = UIT.Value(Library.Panel, CodeID, Header.Height); string Thickness = UIT.Value(Library.Panel, CodeID, Header.Thick); string Size = Wide + " x " + Height + " x " + Thickness; string Description = UIT.Value(Library.Panel, CodeID, "L" + _G.L.ToString()); int Qty = pair.Value; string model = UIT.Value(Library.Panel, CodeID, Header.Model); string Category = "M_PANEL"; string PriceCode_ID = UIT.GetPanelPriceCode_ID(PanelUniqueName, ColorUniqueName, ""); if (model[..2] == "D_") { Category = "M_DOOR"; PriceCode_ID = UIT.GetPanelPriceCode_ID(PanelUniqueName, "", "SHA-" + ColorUniqueName); } print("PriceCode_ID====" + PriceCode_ID); string CodeFromECommerce = ""; if (_P.ListSwitch["PDF_SHOW_ECOMMERCE_CODE"]) { CodeFromECommerce = " / " + UIT.Value(Library.Price, PriceCode_ID, Header.Ecommerce_ID); } if (Get.PreferenceBool("PANEL_BY_GROUP")) { PriceCode_ID = UIT.GetMoldingPriceCode_ID(PanelUniqueName, ""); ColorUniqueName = ""; Description = UIT.Value(Library.Panel, Code[0], "L" + _G.L.ToString()); PriceColumn = UIT.Value(Library.CabTexture, Code[1], Header.Group); } CASE.transform.Find("Code").gameObject.GetComponent().text = TRANS.This(Category) + ": " + PriceCode_ID + CodeFromECommerce; CASE.transform.Find("Item").gameObject.GetComponent().text = TRANS.This("T_COLOR") + ": " + ColorDescrition + " " + ColorUniqueName; CASE.transform.Find("Size").gameObject.GetComponent().text = Size; CASE.transform.Find("Des").gameObject.GetComponent().text = Description; CASE.transform.Find("Qty").gameObject.GetComponent().text = Qty.ToString(); CASE.transform.Find("ItemNum").gameObject.GetComponent().text = ""; CASE.transform.Find("Price").gameObject.GetComponent().text = ""; //Price if (_P.ListSwitch["SHOW_PRICE"]) { print("UniquePrice=====Panel" + UIT.GetPanelPrice(CodeID, ColorID)); //float UniquePrice = DOIT.ConvertStringToNumber(UIT.GetPanelPrice(CodeID,ColorID)); float UniquePrice = DOIT.ConvertStringToNumber(UIT.Value(Library.Price, PriceCode_ID, Header.Price + PriceColumn)); if (UniquePrice != 0) { print("UniquePrice===== Qty===" + Qty); float Pricetotal = Mathf.Round(UniquePrice * Qty * 100f) / 100f; CASE.transform.Find("Price").gameObject.GetComponent().text = Pricetotal.ToString("F2") + "$"; } } // //Image // //CabinetListData c = Get.CabinetCode(CODE[1]); // GameObject SP = CASE.transform.Find("Image").gameObject; // SP.name = "CASE IMAGE PNL"; // string CS = CODE[1].Replace("W", "").Replace("H", "").Replace("D", "").Replace("x ", "_"); // print("CS==" + CS); // string[] CSS = CS.Split('_'); //Finih // GameObject.Find("Case").SetActive(false); Numc += 1; } } void ADDMolding(string Category, Dictionary dict) { foreach (KeyValuePair pair in dict) { string PriceColumn= ""; if (Get.PreferenceBool("STORE_SELECTION")) { PriceColumn = _G.StoreZone; } string[] CODE = pair.Key.Split('?'); string Casename = UIT.Value(Library.Molding, CODE[0], Header.Unique_Name) + "-" + UIT.Value(Library.CabTexture, CODE[1], Header.Unique_Name); GameObject CASE = SetCase(Casename);//"NONE?1?90?0" //Case32?10 string MoldingUniqueName = UIT.Value(Library.Molding, CODE[0], Header.Unique_Name); string ColorUniqueName = UIT.Value(Library.CabTexture, CODE[1], Header.Unique_Name); string Length = UIT.Value(Library.Molding, CODE[0], Header.Wide); string Height = UIT.Value(Library.Molding, CODE[0], Header.Height); string ColorDescrition = UIT.Value(Library.CabTexture, CODE[1], "L" + _G.L.ToString()); if (Height.Split('_').Length > 2) { Height = Height.Split('_')[1]; } string Depth = UIT.Value(Library.Molding, CODE[0], Header.Depth); string Size = Length + "x" + Height + "x" + Depth; float QtyLinear = pair.Value; float MoldingLength = DOIT.ConvertStringToNumber(Length); float Qty = 1; if (Category == "FILLER") { MoldingLength = DOIT.ConvertStringToNumber(Height); } if (!_P.ListSwitch["FILLER_BY_ITEMS"]) { Qty = Mathf.Ceil(QtyLinear / MoldingLength); } if (new List { "FASCIA", "VALANCE", "OGEE", "KICK" }.Contains(Category)) { Qty = Mathf.Ceil(QtyLinear / MoldingLength); } string Code_ID = UIT.GetMoldingPriceCode_ID(MoldingUniqueName, ColorUniqueName); string CodeFromECommerce = ""; if (_P.ListSwitch["PDF_SHOW_ECOMMERCE_CODE"]) { CodeFromECommerce = " / " + UIT.Value(Library.Price, Code_ID, Header.Ecommerce_ID); } string Description = UIT.Value(Library.Molding, CODE[0], "L" + _G.L.ToString()) + " " + UIT.Value(Library.CabTexture, CODE[1], "L" + _G.L.ToString()); if (Get.PreferenceBool("MOLDING_BY_GROUP")) { Code_ID = UIT.GetMoldingPriceCode_ID(MoldingUniqueName, ""); ColorUniqueName = ""; Description = UIT.Value(Library.Molding, CODE[0], "L" + _G.L.ToString()); PriceColumn = UIT.Value(Library.CabTexture, CODE[1], Header.Group); } CASE.transform.Find("Code").gameObject.GetComponent().text = TRANS.This("G_" + Category) + ": " + Code_ID + CodeFromECommerce; CASE.transform.Find("Item").gameObject.GetComponent().text = TRANS.This("T_COLOR") + ": " + ColorDescrition + " " + ColorUniqueName; CASE.transform.Find("Size").gameObject.GetComponent().text = Size;//qtys; CASE.transform.Find("Des").gameObject.GetComponent().text = Description; CASE.transform.Find("Qty").gameObject.GetComponent().text = Qty.ToString(); CASE.transform.Find("ItemNum").gameObject.GetComponent().text = "";//"No." + code[3]; CASE.transform.Find("Price").gameObject.GetComponent().text = ""; //Price if (_P.ListSwitch["SHOW_PRICE"]) { print("UniquePrice=====" + UIT.GetMoldingPrice(CODE[0], CODE[1])); //float UniquePrice=DOIT.ConvertStringToNumber(UIT.GetMoldingPrice(CODE[0],CODE[1])); float UniquePrice = DOIT.ConvertStringToNumber(UIT.Value(Header.Price, Code_ID, Header.Price + PriceColumn)); UniquePrice = Mathf.Round(UniquePrice * 100f) / 100f; if (UniquePrice != 0) { print("UniquePrice===== Qty===" + Qty); float Pricetotal = Qty * UniquePrice; Pricetotal = Mathf.Round(Pricetotal * 100f) / 100f; CASE.transform.Find("Price").gameObject.GetComponent().text = Pricetotal.ToString("F2") + "$"; } } // //Image // string path = "ICONS/"; // path = path + "MOLDING/FILLER"; // Sprite S = Resources.Load(path); // CASE.transform.Find("Image").gameObject.GetComponent().sprite = S; // Finih Numc += 1; } } // void ADDkick(Dictionary dict) // { // //"K_01?1?90" // foreach (KeyValuePair pair in dict) // { // print("Kick===rrreeeaachhh====="+pair.Key); // GameObject CASE = SetCase(pair.Key); // string[] CODE = pair.Key.Split('?'); // string KickUniqueName=UIT.Value(Library.Molding,CODE[0],Header.Unique_Name); // string ColorUniqueName=UIT.Value(Library.CabTexture,CODE[1],Header.Unique_Name); // string Length=UIT.Value(Library.Molding,CODE[0],Header.Wide); // string Height=UIT.Value(Library.Molding,CODE[0],Header.Height); // string Depth=UIT.Value(Library.Molding,CODE[0],Header.Depth); // string Size=Length+"x"+Height+"x"+ Depth; // float Qty=pair.Value; // CASE.transform.Find("Code").gameObject.GetComponent().text = TRANS.This("G_KICK") + ": " +KickUniqueName;//Get.LibraryValue(code[2], CsvHeaders.Unique_Name, DataTypes.Filler); // CASE.transform.Find("Item").gameObject.GetComponent().text = TRANS.This("T_COLOR") + ": " +ColorUniqueName; // CASE.transform.Find("Size").gameObject.GetComponent().text = Size;//qtys; // CASE.transform.Find("Des").gameObject.GetComponent().text = UIT.Value(Library.Molding,CODE[0],"L"+_G.L.ToString()); // CASE.transform.Find("Qty").gameObject.GetComponent().text = Mathf.Ceil(Qty / DOIT.ConvertStringToNumber(Length)).ToString(); // CASE.transform.Find("ItemNum").gameObject.GetComponent().text = "";//"No." + code[3]; // //Price // float UniquePrice=DOIT.ConvertStringToNumber(UIT.GetMoldingPrice(CODE[0],CODE[1])); // if(UniquePrice!=0){ // float Pricetotal=Mathf.Ceil(Qty /DOIT.ConvertStringToNumber(Length))*UniquePrice; // Pricetotal=Mathf.Round(Pricetotal * 100f) / 100f; // CASE.transform.Find("Price").gameObject.GetComponent().text = Pricetotal.ToString("F2")+"$"; // } // else CASE.transform.Find("Price").gameObject.GetComponent().text = ""; // //Image // //string c = code[0].Split('?')[0]; // //string Rs = code[0].Split('?')[1]; // //CASE.transform.Find("Image").gameObject.GetComponent().material = CREATE.Texture_CAB(c, 18, 18, Rs, DataTypes.Filler,"PNL"); // //Finih // Numc += 1; // } // } // void ADDknob(Dictionary dict) // { // foreach (KeyValuePair pair in dict) // { // GameObject.Find("LISTpnl").transform.Find("Case").gameObject.SetActive(true); // GameObject CASE = Instantiate(GameObject.Find("Case").transform.gameObject, GameObject.Find("Case").transform.position, GameObject.Find("Case").transform.rotation); // CASE.name = "Case" + pair.Key; // CASE.transform.SetParent(Get.o2("LISTpnl/Panel/Viewport","Content").transform); // CASE.transform.GetComponent().localPosition = new Vector3(0, Y, 0); // CASE.transform.GetComponent().localScale = new Vector3(1, 1, 1); // Y -= 100; // string softModel = pair.Key.Split(',')[0]; // string color = Get.LibraryValue(softModel, CsvHeaders.Language, DataTypes.Knob); // string nameimage = Get.LibraryValue(softModel, CsvHeaders.FBX, DataTypes.Knob); // float QTY = pair.Value; // string qtys = QTY.ToString("F0"); // CASE.transform.Find("Code").gameObject.GetComponent().text = TRANS.This("T_Knob") + ": " + Get.LibraryValue(softModel, CsvHeaders.Unique_Name, DataTypes.Knob); // CASE.transform.Find("Qty").gameObject.GetComponent().text = qtys; // CASE.transform.Find("Item").gameObject.GetComponent().text = color; // //Image // print("softModel==" + nameimage); // CASE.transform.Find("Image").gameObject.GetComponent().sprite = Resources.Load("ICONS/KNOBS/" + nameimage); // //Finih // GameObject.Find("Case").SetActive(false); // Numc += 1; // } // } // void ADDfiller(Dictionary dict) // { // // print("filler===rrreeeaachhh"); // // foreach (KeyValuePair pair in dict) // // { // // GameObject CASE = SetCase(pair.Key); // // string[] CODE = pair.Key.Split('?'); // // string FillerUniqueName=UIT.Value(Library.Molding,CODE[0],Header.Unique_Name); // // string ColorUniqueName=UIT.Value(Library.CabTexture,CODE[1],Header.Unique_Name); // // string Description = UIT.Value(Library.Molding,CODE[0],"L"+_G.L.ToString()); // // string Length=UIT.Value(Library.Molding,CODE[0],Header.Wide); // // string Height=UIT.Value(Library.Molding,CODE[0],Header.Height); // // if(Height.Split('_').Length>2){Height=Height.Split('_')[1];} // // string Depth=UIT.Value(Library.Molding,CODE[0],Header.Depth); // // string Sizes=Length+"x"+Height+"x"+ Depth; // // float Qty=pair.Value; // // CASE.transform.Find("Code").gameObject.GetComponent().text = TRANS.This("G_FILLER") + ": " + FillerUniqueName;//Get.LibraryValue(code[2], CsvHeaders.Unique_Name, DataTypes.Filler); // // CASE.transform.Find("Item").gameObject.GetComponent().text = TRANS.This("T_COLOR") + ": " +ColorUniqueName; // // CASE.transform.Find("Size").gameObject.GetComponent().text = Sizes; // // CASE.transform.Find("Des").gameObject.GetComponent().text = Description; // // CASE.transform.Find("Qty").gameObject.GetComponent().text = Qty.ToString(); // // CASE.transform.Find("ItemNum").gameObject.GetComponent().text = "";//"No." + code[3]; // // //Price // // if(_P.ListSwitch["SHOW_PRICE"]){ // // float UniquePrice=DOIT.ConvertStringToNumber(UIT.PriceMolding(CODE[0],CODE[1])); // // if(UniquePrice!=0){ // // float Pricetotal=Mathf.Ceil(Qty / DOIT.ConvertStringToNumber(Length))*UniquePrice; // // Pricetotal=Mathf.Round(Pricetotal * 100f) / 100f; // // CASE.transform.Find("Price").gameObject.GetComponent().text = Pricetotal.ToString()+"$"; // // } // // else CASE.transform.Find("Price").gameObject.GetComponent().text = ""; // // } // // if(_P.ListSwitch["FILLER_BY_ITEMS"]) {} // // //Image // // //string c = code[0].Split('?')[0]; // // //string Rs = code[0].Split('?')[1]; // // //CASE.transform.Find("Image").gameObject.GetComponent().material = CREATE.Texture_CAB(c, 18, 18, Rs, DataTypes.Filler,"PNL"); // // //Finih // // Numc += 1; // // } // } // void ADDrecover(Dictionary dict) // { // foreach (KeyValuePair pair in dict) // { // GameObject.Find("LISTpnl").transform.Find("Case").gameObject.SetActive(true); // GameObject CASE = Instantiate(GameObject.Find("Case").transform.gameObject, GameObject.Find("Case").transform.position, GameObject.Find("Case").transform.rotation); // CASE.name = "Case" + pair.Key; // CASE.transform.SetParent(Get.o2("LISTpnl/Panel/Viewport","Content").transform); // CASE.transform.GetComponent().localPosition = new Vector3(0, Y, 0); // CASE.transform.GetComponent().localScale = new Vector3(1, 1, 1); // Y -= 100; // print("Knobs pair.Key====" + pair.Key); // print("pair.Value====" + pair.Value); // string[] code = pair.Key.Split('#'); // CASE.transform.Find("Code").gameObject.GetComponent().text = TRANS.This("G_RECOVER") + ": " + Get.LibraryValue(code[3], CsvHeaders.Unique_Name, DataTypes.Panel); // CASE.transform.Find("Qty").gameObject.GetComponent().text = pair.Value.ToString(); // CASE.transform.Find("Item").gameObject.GetComponent().text = code[0].Split('?')[0]; // CASE.transform.Find("Size").gameObject.GetComponent().text = code[1] + " x " + code[2]; // CASE.transform.Find("ItemNum").gameObject.GetComponent().text = "No." + code[4]; // //Image // string c = code[0].Split('?')[0]; // //string Rs = Get.CabTextureValue(c, 10); // still used? // //string Col = Get.CabTextureValue(c, 11); // still used? // string Rs = Get.LibraryValue(c, CsvHeaders.Texture, DataTypes.CabTexture); // still used? // string Col = Get.LibraryValue(c, CsvHeaders.Texture, DataTypes.CabTexture); // still used? // CASE.transform.Find("Image").gameObject.GetComponent().sprite = CREATE.SPRITETEXTURE(c, Rs, 256, 256); // CASE.transform.Find("Image").gameObject.GetComponent().color = DOIT.CSc(Col, 255); // //Finih // GameObject.Find("Case").SetActive(false); // Numc += 1; // } // } // void ADDogee(Dictionary dict) // { // //CASECOUNT = dict.Count; // foreach (KeyValuePair pair in dict) // { // GameObject.Find("LISTpnl").transform.Find("Case").gameObject.SetActive(true); // GameObject CASE = Instantiate(GameObject.Find("Case").transform.gameObject, GameObject.Find("Case").transform.position, GameObject.Find("Case").transform.rotation) as GameObject; // CASE.name = "Case" + pair.Key; // CASE.transform.SetParent(Get.o2("LISTpnl/Panel/Viewport","Content").transform); // CASE.transform.GetComponent().localPosition = new Vector3(0, Y, 0); // CASE.transform.GetComponent().localScale = new Vector3(1, 1, 1); // Y -= 100; // print("pair.Key===" + pair.Key);//OGEE105_FFFFFF // int IN_ = pair.Key.IndexOf("_"); // string model= pair.Key.Substring(4,3); // string color= pair.Key.Substring(IN_+1, pair.Key.Length-IN_-1); // string col = TRANS.This("T_COLOR") + ":" + DOIT.getColorString(color); // string size = _P.MOL.ToString(); // string tex = TRANS.This("T_TEXTURE") + ":" + pair.Key.Substring(4, 3); // //Image // string path = "ICONS/"; // path = path + "OGEE/OGEE" + model; // Sprite S = Resources.Load(path); // CASE.transform.Find("Image").gameObject.GetComponent().sprite = S; // //CODE // CASE.transform.Find("Item").gameObject.GetComponent().text = TRANS.This("T_OGEE"); // CASE.transform.Find("Code").gameObject.GetComponent().text = "Item # " + model; // //Description // CASE.transform.Find("Des").gameObject.GetComponent().text = TRANS.This("T_OGEE") +" "+ _P.MOL + _G.Sys + "\n"+ tex + " "+ col; // //Qty // float qty = Mathf.Ceil(pair.Value / _P.MOL); // CASE.transform.Find("Qty").gameObject.GetComponent().text = qty.ToString(); // //Price // CASE.transform.Find("Price").gameObject.GetComponent().text = (_P.MO* qty).ToString("F2"); // CASE.transform.Find("PU").gameObject.GetComponent().text = _P.MO.ToString("F2"); // //Finih // GameObject.Find("Case").SetActive(false); // CASE.transform.Find("ItemNum").gameObject.GetComponent().text = "No." + Numc; // Numc += 1; // } // } // void ADDvalance(Dictionary dict) // { // foreach (KeyValuePair pair in dict) // { // GameObject CASE = SetCase(pair.Key);//"NONE?1?90?0" // string[] CODE = pair.Key.Split('?'); // CASE.transform.Find("Code").gameObject.GetComponent().text = TRANS.This("G_VALANCE") + ": " + CODE[0]; // CASE.transform.Find("Item").gameObject.GetComponent().text = CODE[0]; // CASE.transform.Find("Size").gameObject.GetComponent().text = CODE[3] + "" + _G.Sys;//qtys; // CASE.transform.Find("Des").gameObject.GetComponent().text = UIT.Value(Library.Molding,CODE[0],"L"+_G.L.ToString()); // CASE.transform.Find("Qty").gameObject.GetComponent().text = Mathf.Ceil(pair.Value / 84).ToString(); // CASE.transform.Find("ItemNum").gameObject.GetComponent().text = "";//"No." + code[3]; // //Price // float UniquePrice=DOIT.ConvertStringToNumber(UIT.GetMoldingPrice(CODE[0],CODE[2]+"?"+CODE[3] )); // float Pricetotal=Mathf.Ceil(pair.Value / 84)*UniquePrice; // Pricetotal=Mathf.Round(Pricetotal * 100f) / 100f; // CASE.transform.Find("Price").gameObject.GetComponent().text = Pricetotal.ToString("F2")+"$"; // // //Image // // string path = "ICONS/"; // // path = path + "MOLDING/FILLER"; // // Sprite S = Resources.Load(path); // // CASE.transform.Find("Image").gameObject.GetComponent().sprite = S; // // Finih // Numc += 1; // } // } public static void ADDItems(Dictionary dict) { foreach (KeyValuePair pair in dict) { DeleteItem(pair.Key); if (pair.Value > 0) { int Qty = pair.Value; GameObject CASE = SetCase(pair.Key); string CodeUniqueName = UIT.Value(Library.Items, pair.Key, Header.Unique_Name); string Color_ID = UIT.Value(Library.Items, pair.Key, Header.Color_ID); string ColorUniqueName = UIT.Value(Library.CabTexture, Color_ID, Header.Unique_Name); string ColorLanguage = UIT.Value(Library.CabTexture, Color_ID, "L" + _G.L.ToString()); string ColorDescription = TRANS.This("T_COLOR") + "; " + ColorLanguage + " " + ColorUniqueName; CASE.transform.Find("Code").gameObject.GetComponent().text = pair.Key; CASE.transform.Find("Item").gameObject.GetComponent().text = ColorDescription; CASE.transform.Find("Qty").gameObject.GetComponent().text = pair.Value.ToString(); CASE.transform.Find("Des").gameObject.GetComponent().text = UIT.Value(Library.Items, pair.Key, "L" + _G.L.ToString()); CASE.transform.Find("Price").gameObject.GetComponent().text = ""; CASE.transform.Find("Size").gameObject.GetComponent().text = ""; //Price if (_P.ListSwitch["SHOW_PRICE"]) { float UniquePrice = DOIT.ConvertStringToNumber(UIT.Value(Library.Price, pair.Key, Header.Price + _G.StoreZone)); if (UniquePrice != 0) { float Pricetotal = Mathf.Round(UniquePrice * Qty * 100f) / 100f; CASE.transform.Find("Price").gameObject.GetComponent().text = Pricetotal.ToString("F2") + "$"; } } if (_P.ListSwitch["PDF_SHOW_ECOMMERCE_CODE"]) { string CodeEcomerce = CodeUniqueName + "-" + Color_ID; CASE.transform.Find("Code").gameObject.GetComponent().text = pair.Key + " / " + CodeEcomerce; } } } } //CALCULATE----------------------------------------------CALCULATE public static Dictionary CABLISTQTY(List CABLISTQTY) { Dictionary dict = new(); foreach (int i in CABLISTQTY) { string number = _G.OBJs[i][0][4..]; string code = _G.OBJs[i][1]; string size = "W" + _G.OBJs[i][6] + "x H" + _G.OBJs[i][7] + "x D" + _G.OBJs[i][8]; //Door string DoorCode = _G.OBJs[i][61]; if (DoorCode == "none" || DoorCode == "nodoor") { DoorCode = "NO_DOOR?"; //Melamine or Finish string ColorCase = UIT.Value(Library.Cabinet, _G.OBJs[i][1], Header.Color_ID); if (ColorCase == "Melamine") { DoorCode += _G.OBJs[i][62].Split("?")[0]; } else { DoorCode += _G.OBJs[i][69].Split("?")[0]; } } print("DoorCode====" + DoorCode); string color = DoorCode.Split('?')[1];//; string model = DoorCode.Split('?')[0];//Get.LibraryValue(modelID, CsvHeaders.Model, DataTypes.Door); string Des = UIT.Value(Library.Cabinet, _G.OBJs[i][1], "Des_L" + _G.L);//_G.G+Get.LibraryValue(_G.OBJs[i][1], CsvHeaders.Description_Language, DataTypes.Cabinet); string Finicote = _G.OBJs[i][83]; string sens = _G.OBJs[i][23]; string BoxColor = UIT.Value(Library.Cabinet, _G.OBJs[i][1], Header.Box_finish); string fullcode = code + "?" + size + "?" + model + "?" + color + "?" + Des + "?" + Finicote + "?" + sens + "?" + BoxColor;//+"#"+number; int qty = 1; string qtys = qty.ToString() + "?" + number.ToString(); if (!dict.ContainsKey(fullcode)) dict.Add(fullcode, qtys); else { int ind = dict[fullcode].IndexOf("?"); qty = int.Parse(dict[fullcode][..ind]) + 1; print(" ind=====" + ind); string nums = dict[fullcode][ind..] + " / " + number.ToString(); qtys = qty.ToString() + nums; dict[fullcode] = qtys; } } return dict; } public static Dictionary DOORLISTQTY(List CABLISTQTY) { Dictionary dict = new(); foreach (int i in CABLISTQTY) { string number = _G.OBJs[i][0][4..]; string code = _G.OBJs[i][1]; string[] DoorCode = _G.OBJs[i][61].Split("?"); if (DoorCode[0] != "none" && DoorCode[0] != "nodoor") { string fullcode = ""; string DoorRecipe = UIT.Value(Library.Cabinet, code, Header.Door_Recipe).Replace("X", "x"); string[] Door_recipe = DoorRecipe.Split("_"); string DoorUniqueName = UIT.Value(Library.Door, DoorCode[0], Header.Unique_Name); int qty; foreach (string Door in Door_recipe) {//"2XHH1830" fullcode = Door.Split("x")[1] + "-" + DoorUniqueName;//HH1830+SHA-BL qty = int.Parse(Door.Split("x")[0]); if (!dict.ContainsKey(fullcode)) dict.Add(fullcode, qty); else { int ActuelQty = dict[fullcode]; qty += ActuelQty; dict[fullcode] = qty; } } } } return dict; } public static Dictionary KICKLISTQTY(List CABLISTQTY) { Dictionary dict = new(); foreach (int i in CABLISTQTY) { string[] C = _G.OBJs[i]; float w = DOIT.ConvertStringToNumber(C[6]); float d = DOIT.ConvertStringToNumber(C[8]); float e = DOIT.ConvertStringToNumber(C[28]); float f = DOIT.ConvertStringToNumber(C[29]); string[] KR = C[34].Split('_');//Kick recipe string[] Code = C[63].Split('?'); string ID = Code[0]; if (ID != "NONE" && Code[2] != "0") { if (C[4] == "B1" || C[4] == "T1") { if (KR[1] != "0") { AddITEMFloat(dict, C[63], d); } if (KR[2] != "0") { AddITEMFloat(dict, C[63], w); } if (KR[3] != "0") { AddITEMFloat(dict, C[63], d); } if (KR[4] != "0") { AddITEMFloat(dict, C[63], w); } } if (C[4] == "B2" || C[4] == "B9") { if (KR[1] != "0") { AddITEMFloat(dict, C[63], e); } if (KR[2] != "0") { AddITEMFloat(dict, C[63], d); } if (KR[3] != "0") { AddITEMFloat(dict, C[63], w); } if (KR[4] != "0") { AddITEMFloat(dict, C[63], f); } if (KR[5] != "0") { AddITEMFloat(dict, C[63], w - e); } if (KR[6] != "0") { AddITEMFloat(dict, C[63], d - f); } } if (C[4] == "B3" || C[4] == "B10") { if (KR[1] != "0") { AddITEMFloat(dict, C[63], e); } if (KR[2] != "0") { AddITEMFloat(dict, C[63], w); } if (KR[3] != "0") { AddITEMFloat(dict, C[63], d); } if (KR[4] != "0") { AddITEMFloat(dict, C[63], f); } if (KR[5] != "0") { AddITEMFloat(dict, C[63], d - e); } if (KR[6] != "0") { AddITEMFloat(dict, C[63], w - f); } } if (C[4] == "B4") { if (KR[1] != "0") { AddITEMFloat(dict, C[63], e); } if (KR[2] != "0") { AddITEMFloat(dict, C[63], d); } if (KR[3] != "0") { AddITEMFloat(dict, C[63], w); } if (KR[4] != "0") { AddITEMFloat(dict, C[63], f); } if (KR[5] != "0") { AddITEMFloat(dict, C[63], (w - e) * 0.707f); } } if (C[4] == "B5") { if (KR[1] != "0") { AddITEMFloat(dict, C[63], e); } if (KR[2] != "0") { AddITEMFloat(dict, C[63], w); } if (KR[3] != "0") { AddITEMFloat(dict, C[63], d); } if (KR[4] != "0") { AddITEMFloat(dict, C[63], f); } if (KR[5] != "0") { AddITEMFloat(dict, C[63], (d - e) * 0.707f); } } } } return dict; } public static Dictionary PNLLISTQTY() { Dictionary dict = new(); string Code_ID, ColorID, fullcode; int qty; for (var i = 0; i < _G.OBJnum + 1; i++) { if (DOIT.exist(i)) { if (_G.OBJs[i][2] == "Panel" && _G.OBJs[i][0] != "null") { Code_ID = _G.OBJs[i][1]; print("_G.OBJs[i][61]====" + _G.OBJs[i][61]); // if(_G.OBJs[i][61].Split('?').Length==1){ // string Panel_ID=UIT.GetIDByUnique_Name(Library.Panel,_G.OBJs[i][1]); // _G.OBJs[i][61]=Panel_ID+"?"+_G.OBJs[i][84]; // } ColorID = _G.OBJs[i][61].Split("?")[0]; fullcode = Code_ID + "?" + ColorID; qty = 1; if (!dict.ContainsKey(fullcode)) dict.Add(fullcode, qty); else { qty = dict[fullcode] + 1; dict[fullcode] = qty; } } //print("pair.Key=p==="+_G.OBJs[i][81]); if (_G.OBJs[i][2] == "Cabinet" && _G.OBJs[i][81] != "0_0_0_0_0_0_0") { string[] CoverPanel = _G.OBJs[i][81].Split("_"); foreach (string Panel in CoverPanel) { if (Panel != "0") { if (!dict.ContainsKey(Panel)) dict.Add(Panel, 1); else { qty = dict[Panel] + 1; dict[Panel] = qty; } } } } } } return dict; } public static Dictionary OGEELISTQTY() { Dictionary dictOGEE = new(); GameObject[] OL = GameObject.FindGameObjectsWithTag("cabwall"); foreach (GameObject obj in OL) { int nO = Get.GetObjectIndex(obj.name); string[] C = _G.OBJs[nO]; string[] Code = C[64].Split('?');//O_1?3?3 string ID = Code[0]; //print("C[64]=="+C[64]);/C[64]==O_1?3?3 if (ID != "NONE") { float w = DOIT.ConvertStringToNumber(C[6]); float d = DOIT.ConvertStringToNumber(C[8]); float e = DOIT.ConvertStringToNumber(C[28]); float f = DOIT.ConvertStringToNumber(C[29]); string[] OR = C[70].Split(","[0]);//OGEE Recipe if (_G.OBJs[nO][4] == "W1" || _G.OBJs[nO][4] == "T1") { if (OR[0] != "0") { AddITEMFloat(dictOGEE, C[64], d); } if (OR[1] != "0") { AddITEMFloat(dictOGEE, C[64], w); } if (OR[2] != "0") { AddITEMFloat(dictOGEE, C[64], d); } if (OR[3] != "0") { AddITEMFloat(dictOGEE, C[64], w); } } if (_G.OBJs[nO][4] == "W2" || _G.OBJs[nO][4] == "W3") { if (OR[0] != "0") { AddITEMFloat(dictOGEE, C[64], 12); } if (OR[1] != "0") { AddITEMFloat(dictOGEE, C[64], d); } if (OR[2] != "0") { AddITEMFloat(dictOGEE, C[64], w); } if (OR[3] != "0") { AddITEMFloat(dictOGEE, C[64], 12); } } if (_G.OBJs[nO][4] == "W2" || _G.OBJs[nO][4] == "W3" || _G.OBJs[nO][4] == "W4" || _G.OBJs[nO][4] == "W5" || _G.OBJs[nO][4] == "W9" || _G.OBJs[nO][4] == "W10" || _G.OBJs[nO][4] == "W24" || _G.OBJs[nO][4] == "W25") { if (OR[0] != "0") { AddITEMFloat(dictOGEE, C[64], 12); } if (OR[1] != "0") { AddITEMFloat(dictOGEE, C[64], d); } if (OR[2] != "0") { AddITEMFloat(dictOGEE, C[64], w); } if (OR[3] != "0") { AddITEMFloat(dictOGEE, C[64], 12); } } //if (obj.transform.Find("h1") && obj.transform.Find("h4") && model != "0") AddITEMFloat(dictOGEE, model + "_" + color, 6); //if (obj.transform.Find("h4") && obj.transform.Find("h3") && model != "0") AddITEMFloat(dictOGEE, model + "_" + color, 6); if (obj.transform.Find("")) } //string model = _G.OBJs[nO][64].Split(","[0])[1]; //string color = _G.OBJs[nO][64].Split(","[0])[2]; //float w = DOIT.ConvertStringToNumber(_G.OBJs[nO][6]); //float d = DOIT.ConvertStringToNumber(_G.OBJs[nO][8]); //string[] OC = _G.OBJs[nO][70].Split(","[0]);//print("_G.OBJs[nO][70]===" + _G.OBJs[nO][70]); } return dictOGEE; } public static Dictionary HEADLISTQTY() { Dictionary dictHEAD = new Dictionary(); GameObject[] OL = GameObject.FindGameObjectsWithTag("cabwall"); foreach (GameObject obj in OL) { int nO = Get.GetObjectIndex(obj.name); string model = _G.OBJs[nO][66].Split(","[0])[0]; string hh = _G.OBJs[nO][66].Split(","[0])[1]; string color = _G.OBJs[nO][66].Split(","[0])[2]; float w = DOIT.ConvertStringToNumber(_G.OBJs[nO][6]); float d = DOIT.ConvertStringToNumber(_G.OBJs[nO][8]); string[] OC = _G.OBJs[nO][72].Split(","[0]); if (_G.OBJs[nO][4] == "W1" || _G.OBJs[nO][4] == "T1") { if (OC[0] != "0" && hh != "0") { AddITEMFloat(dictHEAD, model + "_" + color, d); } if (OC[1] != "0" && hh != "0") { AddITEMFloat(dictHEAD, model + "_" + color, w); } if (OC[2] != "0" && hh != "0") { AddITEMFloat(dictHEAD, model + "_" + color, d); } if (OC[3] != "0" && hh != "0") { AddITEMFloat(dictHEAD, model + "_" + color, w); } } if (_G.OBJs[nO][4] == "W2" || _G.OBJs[nO][4] == "W3") { if (OC[0] != "0" && hh != "0") { AddITEMFloat(dictHEAD, model + "_" + color, 12); } if (OC[1] != "0" && hh != "0") { AddITEMFloat(dictHEAD, model + "_" + color, d); } if (OC[2] != "0" && hh != "0") { AddITEMFloat(dictHEAD, model + "_" + color, w); } if (OC[3] != "0" && hh != "0") { AddITEMFloat(dictHEAD, model + "_" + color, 12); } } if (_G.OBJs[nO][4] == "W2" || _G.OBJs[nO][4] == "W3" || _G.OBJs[nO][4] == "W4" || _G.OBJs[nO][4] == "W5" || _G.OBJs[nO][4] == "W9" || _G.OBJs[nO][4] == "W10" || _G.OBJs[nO][4] == "W24" || _G.OBJs[nO][4] == "W25") { if (OC[0] != "0" && hh != "0") { AddITEMFloat(dictHEAD, model + "_" + color, 12); } if (OC[1] != "0" && hh != "0") { AddITEMFloat(dictHEAD, model + "_" + color, d); } if (OC[2] != "0" && hh != "0") { AddITEMFloat(dictHEAD, model + "_" + color, w); } if (OC[3] != "0" && hh != "0") { AddITEMFloat(dictHEAD, model + "_" + color, 12); } } if (obj.transform.Find("h1") && obj.transform.Find("h4") && hh != "0") AddITEMFloat(dictHEAD, model + "_" + color, 6); if (obj.transform.Find("h4") && obj.transform.Find("h3") && hh != "0") AddITEMFloat(dictHEAD, model + "_" + color, 6); } return dictHEAD; } public static Dictionary VALANCELISTQTY() { Dictionary dictVALANCE = new(); GameObject[] OL = GameObject.FindGameObjectsWithTag("cabwall"); foreach (GameObject obj in OL)//"NONE?1?90?0" { //Get if fascia int nO = Get.GetObjectIndex(obj.name); string[] C = _G.OBJs[nO]; string[] Code = C[65].Split('?'); string ID = Code[0]; if (ID != "NONE") { float w = DOIT.ConvertStringToNumber(C[6]); float d = DOIT.ConvertStringToNumber(C[8]); float e = DOIT.ConvertStringToNumber(C[28]); float f = DOIT.ConvertStringToNumber(C[29]); string[] FR = _G.OBJs[nO][71].Split(","[0]); //Fascia recipe if (C[4] == "W1") { if (FR[0] != "0") { AddITEMFloat(dictVALANCE, C[65], d); } if (FR[1] != "0") { AddITEMFloat(dictVALANCE, C[65], w); } if (FR[2] != "0") { AddITEMFloat(dictVALANCE, C[65], d); } if (FR[3] != "0") { AddITEMFloat(dictVALANCE, C[65], w); } } if (C[4] == "W2" || C[4] == "W9") { if (FR[0] != "0") { AddITEMFloat(dictVALANCE, C[66], e); } //if (FR[1] != "0" ) { AddITEMFloat(dictVALANCE, C[66], d); } //if (FR[2] != "0" ) { AddITEMFloat(dictVALANCE, C[66], w); } if (FR[2] != "0") { AddITEMFloat(dictVALANCE, C[66], f); } if (FR[3] != "0") { AddITEMFloat(dictVALANCE, C[66], w - e); } if (FR[3] != "0") { AddITEMFloat(dictVALANCE, C[66], d - f); } } if (C[4] == "W3" || C[4] == "W10") { if (FR[0] != "0") { AddITEMFloat(dictVALANCE, C[66], e); } //if (FR[1] != "0" ) { AddITEMFloat(dictVALANCE, C[66], w); } //if (FR[2] != "0" ) { AddITEMFloat(dictVALANCE, C[66], d); } if (FR[2] != "0") { AddITEMFloat(dictVALANCE, C[66], f); } if (FR[3] != "0") { AddITEMFloat(dictVALANCE, C[66], d - e); } if (FR[3] != "0") { AddITEMFloat(dictVALANCE, C[66], w - f); } } if (C[4] == "W4") { if (FR[0] != "0") { AddITEMFloat(dictVALANCE, C[66], e); } //if (FR[1] != "0" ) { AddITEMFloat(dictVALANCE, C[66], d); } //if (FR[2] != "0" ) { AddITEMFloat(dictVALANCE, C[66], w); } if (FR[2] != "0") { AddITEMFloat(dictVALANCE, C[66], f); } if (FR[3] != "0") { AddITEMFloat(dictVALANCE, C[66], (w - e) * 0.707f); } } if (C[4] == "W5") { if (FR[0] != "0") { AddITEMFloat(dictVALANCE, C[66], e); } //if (FR[1] != "0" ) { AddITEMFloat(dictVALANCE, C[66], w); } //if (FR[2] != "0" ) { AddITEMFloat(dictVALANCE, C[66], d); } if (FR[2] != "0") { AddITEMFloat(dictVALANCE, C[66], f); } if (FR[3] != "0") { AddITEMFloat(dictVALANCE, C[66], (w - f) * 0.707f); } } } } return dictVALANCE; } public static Dictionary FASCIAQTY() { Dictionary dictFASCIA = new(); GameObject[] OL = GameObject.FindGameObjectsWithTag("cabwall"); foreach (GameObject obj in OL)//"NONE?1?90?0" { //Get if fascia int nO = Get.GetObjectIndex(obj.name); string[] C = _G.OBJs[nO]; string[] Code = C[66].Split('?'); string ID = Code[0]; if (ID != "NONE") { float w = DOIT.ConvertStringToNumber(C[6]); float d = DOIT.ConvertStringToNumber(C[8]); float e = DOIT.ConvertStringToNumber(C[28]); float f = DOIT.ConvertStringToNumber(C[29]); string[] FR = _G.OBJs[nO][72].Split(","[0]); //Fascia recipe if (C[4] == "W1" || C[4] == "T1") { if (FR[0] != "0") { AddITEMFloat(dictFASCIA, C[66], d); } if (FR[1] != "0") { AddITEMFloat(dictFASCIA, C[66], w); } if (FR[2] != "0") { AddITEMFloat(dictFASCIA, C[66], d); } if (FR[3] != "0") { AddITEMFloat(dictFASCIA, C[66], w); } } if (C[4] == "W2" || C[4] == "W9") { if (FR[0] != "0") { AddITEMFloat(dictFASCIA, C[66], e); } //if (FR[1] != "0" ) { AddITEMFloat(dictFASCIA, C[66], d); } //if (FR[2] != "0" ) { AddITEMFloat(dictFASCIA, C[66], w); } if (FR[2] != "0") { AddITEMFloat(dictFASCIA, C[66], f); } if (FR[3] != "0") { AddITEMFloat(dictFASCIA, C[66], w - e); } if (FR[3] != "0") { AddITEMFloat(dictFASCIA, C[66], d - f); } } if (C[4] == "W3" || C[4] == "W10") { if (FR[0] != "0") { AddITEMFloat(dictFASCIA, C[66], e); } //if (FR[1] != "0" ) { AddITEMFloat(dictFASCIA, C[66], w); } //if (FR[2] != "0" ) { AddITEMFloat(dictFASCIA, C[66], d); } if (FR[2] != "0") { AddITEMFloat(dictFASCIA, C[66], f); } if (FR[3] != "0") { AddITEMFloat(dictFASCIA, C[66], d - e); } if (FR[3] != "0") { AddITEMFloat(dictFASCIA, C[66], w - f); } } if (C[4] == "W4") { if (FR[0] != "0") { AddITEMFloat(dictFASCIA, C[66], e); } //if (FR[1] != "0" ) { AddITEMFloat(dictFASCIA, C[66], d); } //if (FR[2] != "0" ) { AddITEMFloat(dictFASCIA, C[66], w); } if (FR[2] != "0") { AddITEMFloat(dictFASCIA, C[66], f); } if (FR[3] != "0") { AddITEMFloat(dictFASCIA, C[66], (w - e) * 0.707f); } } if (C[4] == "W5") { if (FR[0] != "0") { AddITEMFloat(dictFASCIA, C[66], e); } //if (FR[1] != "0" ) { AddITEMFloat(dictFASCIA, C[66], w); } //if (FR[2] != "0" ) { AddITEMFloat(dictFASCIA, C[66], d); } if (FR[2] != "0") { AddITEMFloat(dictFASCIA, C[66], f); } if (FR[3] != "0") { AddITEMFloat(dictFASCIA, C[66], (w - f) * 0.707f); } } } } return dictFASCIA; } public static Dictionary FILLERQTY(List CABLISTQTY) { Dictionary dict = new(); foreach (int nO in CABLISTQTY) { string[] C = _G.OBJs[nO]; float h = DOIT.ConvertStringToNumber(C[7]) - DOIT.ConvertStringToNumber(C[35]); if (_P.ListSwitch["FILLER_BY_ITEMS"]) h = 1; if (C[50] != "NONE") AddITEMFloat(dict, C[50], h); if (C[51] != "NONE") AddITEMFloat(dict, C[51], h); } return dict; } public static Dictionary KNOBLISTQTY() { Dictionary dict = new Dictionary(); CABS = DOLIST.CABLISTString(); foreach (string nOs in CABS) { if (_G.OBJs[int.Parse(nOs)][5] != "PNL") { string[] C = _G.OBJs[int.Parse(nOs)]; string[] knob25 = C[25].Split('_'); string[] knob26 = C[26].Split('_'); string K85 = C[85].Split('?')[0]; string K86 = C[86].Split('?')[0]; if (K85 != "NONE") { for (int i = 5; i < knob25.Length; i += 4) { if (knob25[i] != "0" && knob25[i - 3] != "t" && K85 != "KN.33") { AddITEMFloat(dict, K85, 1); } if (knob25[i] != "0" && knob25[i - 3] == "t" && K86 != "KN.33") { AddITEMFloat(dict, K86, 1); } } } if (K86 != "NONE") { for (int i = 5; i < knob26.Length; i += 4) { if (knob26[i] != "0" && knob26[i - 3] != "t" && K85 != "KN.33") { AddITEMFloat(dict, K85, 1); } if (knob26[i - 3] == "t" && knob25[i - 3] == "t" && K86 != "KN.33") { AddITEMFloat(dict, K86, 1); } } } } } return dict; } public static Dictionary RECOVERQTY() { Dictionary dict = new Dictionary(); CABS = DOLIST.CABLISTString(); foreach (string nOs in CABS) { int nO = int.Parse(nOs); string[] C = _G.OBJs[nO]; string CAB = C[4]; string w = C[6]; string h = C[7]; string d = C[8]; string sl = C[28]; string sr = C[29]; string[] c81 = C[81].Split('_'); string name = "PB"; float D = DOIT.ConvertStringToNumber(C[8]); float Dt = _G.cadt; float SL = DOIT.ConvertStringToNumber(C[28]); float SR = DOIT.ConvertStringToNumber(C[29]); float BP = 0.125f;//back projection switch (CAB) { case "B1": name = "PB"; D += Dt + BP; d = D.ToString("F3"); break; case "B2": name = "PB"; SL += Dt + BP; sl = SL.ToString("F3"); SR += Dt; sr = SR.ToString("F3"); break; case "B3": name = "PB"; SL += Dt + BP; sl = SL.ToString("F3"); SR += Dt; sr = SR.ToString("F3"); break; case "B4": name = "PB"; SL += BP; sl = SL.ToString("F3"); SR += BP; sr = SR.ToString("F3"); break; case "B5": name = "PB"; SL += BP; sl = SL.ToString("F3"); SR += BP; sr = SR.ToString("F3"); break; case "B9": name = "PB"; D += Dt + BP; d = D.ToString("F3"); break; case "B10": name = "PB"; D += Dt + BP; d = D.ToString("F3"); break; case "W1": name = "PH"; D += Dt + BP; d = D.ToString("F3"); break; case "W2": name = "PH"; SL += Dt + BP; sl = SL.ToString("F3"); SR += Dt + BP; sr = SR.ToString("F3"); break; case "W3": name = "PH"; SL += Dt + BP; sl = SL.ToString("F3"); SR += Dt + BP; sr = SR.ToString("F3"); break; case "W4": name = "PH"; SL += BP; sl = SL.ToString("F3"); SR += BP; sr = SR.ToString("F3"); break; case "W5": name = "PH"; SL += BP; sl = SL.ToString("F3"); SR += BP; sr = SR.ToString("F3"); break; case "W9": name = "PH"; D += Dt; d = D.ToString("F3"); break; case "W10": name = "PH"; D += Dt + BP; d = D.ToString("F3"); break; case "T1": name = "PPGM"; D += Dt + BP; d = D.ToString("F3"); break; } if (d.Substring(d.Length - 1, 1) == "0") d = d.Substring(0, d.Length - 1); if (d.Substring(d.Length - 1, 1) == "0") d = d.Substring(0, d.Length - 1); //d=d.Replace(".500",".5").Replace(".000",".0").Replace(".750",".75").Replace(".250",".25"); if (CAB == "B1" || CAB == "W1" || CAB == "T1") { if (c81[0] != "0") AddITEMFloat(dict, C[80] + "#" + d + "#" + h + "#" + name + "" + "#" + (Get.GetObjectIndex(C[0]).ToString()), 1); if (c81[1] != "0") AddITEMFloat(dict, C[80] + "#" + w + "#" + h + "#" + name + "" + "#" + (Get.GetObjectIndex(C[0]).ToString()), 1); if (c81[2] != "0") AddITEMFloat(dict, C[80] + "#" + d + "#" + h + "#" + name + "" + "#" + (Get.GetObjectIndex(C[0]).ToString()), 1); } if (CAB == "B2" || CAB == "B4" || CAB == "W2" || CAB == "W4" || CAB == "B8" || CAB == "W9") { if (c81[0] != "0") AddITEMFloat(dict, _G.OBJs[nO][80] + "#" + sl + "#" + h + "#" + name + " " + "#" + (Get.GetObjectIndex(_G.OBJs[nO][0]).ToString()), 1); if (c81[1] != "0") AddITEMFloat(dict, _G.OBJs[nO][80] + "#" + d + "#" + h + "#" + name + " " + "#" + (Get.GetObjectIndex(_G.OBJs[nO][0]).ToString()), 1); if (c81[2] != "0") AddITEMFloat(dict, _G.OBJs[nO][80] + "#" + w + "#" + h + "#" + name + " " + "#" + (Get.GetObjectIndex(_G.OBJs[nO][0]).ToString()), 1); if (c81[3] != "0") AddITEMFloat(dict, _G.OBJs[nO][80] + "#" + sr + "#" + h + "#" + name + " " + "#" + (Get.GetObjectIndex(_G.OBJs[nO][0]).ToString()), 1); } if (CAB == "B3" || CAB == "B5" || CAB == "W3" || CAB == "W5" || CAB == "B10" || CAB == "W10") { if (c81[0] != "0") AddITEMFloat(dict, _G.OBJs[nO][80] + "#" + sl + "#" + h + "#" + name + " " + "#" + (Get.GetObjectIndex(_G.OBJs[nO][0]).ToString()), 1); if (c81[1] != "0") AddITEMFloat(dict, _G.OBJs[nO][80] + "#" + w + "#" + h + "#" + name + " " + "#" + (Get.GetObjectIndex(_G.OBJs[nO][0]).ToString()), 1); if (c81[2] != "0") AddITEMFloat(dict, _G.OBJs[nO][80] + "#" + d + "#" + h + "#" + name + " " + "#" + (Get.GetObjectIndex(_G.OBJs[nO][0]).ToString()), 1); if (c81[3] != "0") AddITEMFloat(dict, _G.OBJs[nO][80] + "#" + sr + "#" + h + "#" + name + " " + "#" + (Get.GetObjectIndex(_G.OBJs[nO][0]).ToString()), 1); } } return dict; } public static void AddITEMString(Dictionary dict, string P, float Q) { if (!dict.ContainsKey(P)) dict.Add(P, Q.ToString()); else { dict[P] = (DOIT.ConvertStringToNumber(dict[P]) + Q).ToString(); } } public static void AddITEMFloat(Dictionary dict, string P, float Q) { if (!dict.ContainsKey(P)) dict.Add(P, Q); else { dict[P] += Q; } } public void addOption() { if (_P.O1p != 0) addOptionNum("1", _P.O1p, _P.O1q, _P.O1s); if (_P.O2p != 0) addOptionNum("2", _P.O2p, _P.O2q, _P.O2s); if (_P.O3p != 0) addOptionNum("3", _P.O3p, _P.O3q, _P.O3s); if (_P.O4p != 0) addOptionNum("4", _P.O4p, _P.O4q, _P.O4s); if (_P.O5p != 0) addOptionNum("5", _P.O5p, _P.O5q, _P.O5s); } public void addOptionNum(string num, float OP, float OQ, string OD) { GameObject.Find("LISTpnl").transform.Find("Case").gameObject.SetActive(true); GameObject CASE = Instantiate(GameObject.Find("Case").transform.gameObject, GameObject.Find("Case").transform.position, GameObject.Find("Case").transform.rotation) as GameObject; CASE.name = "Case Option " + num; CASE.transform.SetParent(Get.o2("LISTpnl/Panel/Viewport", "Content").transform); CASE.transform.GetComponent().localPosition = new Vector3(0, Y, 0); CASE.transform.GetComponent().localScale = new Vector3(1, 1, 1); Y -= 100; //Description CASE.transform.Find("Des").gameObject.GetComponent().text = OD; CASE.transform.Find("Qty").gameObject.GetComponent().text = OQ.ToString(); CASE.transform.Find("Price").gameObject.GetComponent().text = (OP * OQ).ToString("F2"); CASE.transform.Find("PU").gameObject.GetComponent().text = OP.ToString("F2"); CASE.transform.Find("Item").gameObject.GetComponent().text = TRANS.This("T_OPTION"); //Finih GameObject.Find("Case").SetActive(false); Numc += 1; } public static GameObject SetCase(string name) { GameObject CASE = Instantiate(Get.o2("LISTpnl", "Case")); CASE.SetActive(true); CASE.name = "Case" + name; CASE.transform.SetParent(Get.o2("LISTpnl/Panel/Viewport", "Content").transform); CASE.transform.GetComponent().localScale = new Vector3(1, 1, 1); return CASE; } public static void DeleteItem(string CaseName) { Transform ListContainer = Get.o2("LISTpnl/Panel/Viewport", "Content").transform; for (int i = 0; i < ListContainer.childCount; i++) { if (ListContainer.GetChild(i).name == "Case" + CaseName) { Destroy(ListContainer.GetChild(i).gameObject); } } } }