//using UnityEditor.Build; using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.UI; public class TopControl : MonoBehaviour { public static void ShowMesure() { bool isMoving = false; if (SceneModeManager.CompareSceneMode(SceneModes.MoveHandle)) isMoving = true; if (GameObject.Find("CONTROL")) { GameObject PNL = Get.o2("HIDER", "CONTROL"); int nO = Get.GetObjectIndex(SceneModeManager.SelectedName);//object number string[] C = _G.OBJs[nO]; GameObject sel = GameObject.Find(SceneModeManager.SelectedName); bool EDIT = false, LOCK = false, GHOST = false, OPENCLOSE = false, GLOBALS = false, MOVE = false, WALLDETACHED = false, RESIZE = true, TXTROTATION = false; //BUTTON CONDITION if (C[3] == "LOCK" && !SceneModeManager.CompareSceneMode(SceneModes.Follow)) { LOCK = true; } string Category = ""; if (C[1].Length >= 4) { Category = C[1][..4]; } ; if (new List { "VASE", "SMAL", "PICT", "MIRR", "STOO", "LAMP", "CHAI", "TABL", "STOV", "DISH", "CELL", "FRID", "HOOW", "BLOC", "WIND" }.Contains(Category) || C[2] == "Cabinet" || C[2] == "Panel" && _P.ListSwitch["EXTERIOR_SELECT"]) { EDIT = true; } if (_G.OBJs[nO][1] == "MIRR101" || _G.OBJs[nO][1] == "MIRR101") { EDIT = false; } for (int i = 1; i < _G.GHOSTLIST.Count; i++) { if (_G.GHOSTLIST[i] == SceneModeManager.SelectedName) { GHOST = true; } } if (C[22] != "floor" && C[22] != "ceil") { WALLDETACHED = true; } if (new List { "WIND", "DOOS", "DOOD", "DOWS", "DOWD", "PATI", "OPEN" }.Contains(Category)) { WALLDETACHED = false; } if (C[2] == "Cabinet" && _P.List["ALLOW_RESIZE_CABINET"] == "n") { RESIZE = false; } if (C[2] == "Bloc") { TXTROTATION = true; } //ADD BOUL PNL.transform.Find("BTNGROUP/btnEDIT").gameObject.SetActive(EDIT); PNL.transform.Find("Lock").gameObject.SetActive(LOCK); PNL.transform.Find("Ghost").gameObject.SetActive(GHOST); PNL.transform.Find("OPEN_CLOSE").gameObject.SetActive(OPENCLOSE); PNL.transform.Find("TextureLibrary").gameObject.SetActive(GLOBALS); PNL.transform.Find("BTNGROUP/btnMOVE").gameObject.SetActive(MOVE); PNL.transform.Find("Resize").gameObject.SetActive(RESIZE); PNL.transform.Find("RotateTexture").gameObject.SetActive(TXTROTATION); Set.alpha(PNL.transform.Find("MB").gameObject, WALLDETACHED); //CALCULATE DEMENTIONS float fillerL = 0; float fillerR = 0; if (C[2] == "Cabinet" && _P.List["FILLER_ON_MESURE"] == "n")//Filler on size { fillerL = DOIT.ConvertStringToNumber(_G.OBJs[nO][52]); fillerR = DOIT.ConvertStringToNumber(_G.OBJs[nO][53]); } float CounterHeight = 0; if (C[2] == "Cabinet" && _P.List["COUNTER_ON_MESURE"] == "n")//Counter on size { CounterHeight = DOIT.ConvertStringToNumber(_G.OBJs[nO][11]); } float Ow = sel.transform.localScale.x - 0.5f - fillerL - fillerR; float Oh = sel.transform.localScale.y - 0.5f - CounterHeight; float Od = sel.transform.localScale.z - 0.5f; //CACULATE DETACHED WALL AND FLOOR float mb = 0; float mu = 0; float mt = 0; if (C[22] != SceneModeManager.Floor.name && C[22] != SceneModeManager.Ceil.name) { //float os = DOIT.openOS(SceneModeManager.SelectedName); string stringToParse; string[] split = C[22].Split("_"); if (split.Length <= 0) { stringToParse = C[22]; } else { stringToParse = split[0]; } int Wallnum = int.Parse(stringToParse[1..]); GameObject wall = GameObject.Find("w" + Wallnum.ToString()); Vector3 WR = wall.transform.localRotation.eulerAngles; sel.transform.SetParent(wall.transform); wall.transform.localRotation = Quaternion.Euler(0, 0, 0); Vector3 wP = wall.transform.position; Vector3 sP = sel.transform.position; mb = wP.z - sP.z - (sel.transform.localScale.z - 0.5f) / 2; wall.transform.localRotation = Quaternion.Euler(WR.x, WR.y, WR.z); sel.transform.SetParent(SceneModeManager.Scene); } Vector3 Opos = sel.transform.position; mu = _G.HEIGHT * 0.5F + Opos.y - (sel.transform.localScale.y - 0.5f) * 0.5F; mt = _G.HEIGHT * 0.5F - Opos.y - (sel.transform.localScale.y - 0.5f) * 0.5F; // if( C[4] == "panel"){(Ow, Od) = (Od, Ow); } string nameCode = C[1]; //print("C[61]===TOPControl="+C[61]); if (C[2] == "Cabinet") { if (C[61] != "none" && C[61] != "nodoor") { string DoorID = C[61].Split('?')[0]; string DoorColorID = C[61].Split('?')[1]; DoorColorID = UIT.IDCheckExist(Library.CabTexture, DoorColorID); string AddtoCabinetCode = UIT.Value(Library.CabTexture, DoorColorID, Header.Unique_Name); AddtoCabinetCode += " " + UIT.Value(Library.Door, DoorID, Header.Unique_Name); AddtoCabinetCode += " " + UIT.Value(Library.CabTexture, DoorColorID, Header.Unique_Name); if (Get.PreferenceBool("CABINET_BY_FINISH_BOX")) { string Box_Finish = UIT.Value(Library.Door, DoorID, Header.Box_finish); if (Box_Finish == "All") AddtoCabinetCode = "_" + UIT.Value(Library.CabTexture, DoorColorID, Header.Unique_Name); else AddtoCabinetCode = "_" + UIT.Value(Library.CabTexture, Box_Finish, Header.Unique_Name); } nameCode += " " + AddtoCabinetCode; } else { nameCode += " " + TRANS.This("T_SansPorte");//Sans Porte } } if (C[2] == "Panel") { print("From panel C[61]===" + C[61]); if (C[61] != "none" && C[61] != "nodoor") { nameCode = ""; string ID = C[1]; string ColorID = C[61].Split("?")[0]; nameCode += " " + UIT.Value(Library.Panel, ID, Header.Unique_Name); nameCode += " " + UIT.Value(Library.CabTexture, ColorID, Header.Unique_Name); } (Ow, Od) = (Od, Ow); } //ADD VALUES W,H,D, WALLDETACHED,FLOORDETACHED PNL.transform.Find("nameCode").gameObject.GetComponent().text = nameCode;// Get.LibraryValue(nameCode, CsvHeaders.Unique_Name, DataTypes.Cabinet); PNL.transform.Find("ItemNum").gameObject.GetComponent().text = TRANS.This("C_ITEM NUMBER") + nO.ToString(); PNL.transform.Find("MH").transform.Find("mcH").gameObject.GetComponent().text = DOIT.CNs(Oh); PNL.transform.Find("MW").transform.Find("mcW").gameObject.GetComponent().text = DOIT.CNs(Ow); PNL.transform.Find("MD").transform.Find("mcD").gameObject.GetComponent().text = DOIT.CNs(Od); PNL.transform.Find("MB").transform.Find("mcB").gameObject.GetComponent().text = DOIT.CNs(mb); PNL.transform.Find("MU").transform.Find("mcU").gameObject.GetComponent().text = DOIT.CNs(mu); PNL.transform.Find("MT").transform.Find("mcT").gameObject.GetComponent().text = DOIT.CNs(mt); //Price if (!isMoving) { string Price = ""; if (!Get.PreferenceBool("SHOW_PRICE")) { Set.alpha(PNL.transform.Find("PRICE").gameObject, false); } else { if (C[2] == "Cabinet") { string Color_ID = "nodoor"; if (_G.OBJs[nO][61] != "nodoor") { Color_ID = _G.OBJs[nO][61].Split("?")[1]; } string PriceCode_ID = UIT.GetCabinetPriceID(_G.OBJs[nO][1], _G.OBJs[nO][61].Split("?")[0], Color_ID); Price = UIT.Value(Header.Price, PriceCode_ID, Header.Price + _G.StoreZone) + "$"; } if (C[2] == "Panel") { Price = UIT.GetPanelPrice(C[1], C[61].Split("?")[0]) + "$"; } PNL.transform.Find("PRICE").transform.Find("PRICE").gameObject.GetComponent().text = Price; } } GhostCommand.SetActiveGhostButton(_G.GHOSTLIST.Contains(SceneModeManager.SelectedName)); HideCommand.UpdateHideButtons(!_G.HIDELIST.Contains(SceneModeManager.SelectedName)); if (_G.MesureONOFF) Mesure.Show(); else Mesure.Hide(); //Hide language Set.alpha(Get.o2("Canvas", "Language"), false); //Global // if (_P.ListSwitch["CABS_HAS_ALL_DOORS"] && !isMoving && new List { "cabi", "pane", "bloc", "dish", "wine" }.Contains(C[0][..4])) // { // GameObject GlobalSelections = PNL.transform.Find("GlobalNumber").gameObject; // Set.GlobalColorBtn(GlobalSelections, "CONTROL", C[2]); // print("C[60]==" + C[60]); // if (C[60] == "UNIQUE") // { // DOIT.AllTogchildfalse(GlobalSelections); // } // } //if (_P.ListSwitch["CABS_HAS_ALL_DOORS"] && !isMoving && new List { "cabi", "pane", "bloc", "dish", "wine" }.Contains(C[0][..4])) if (!isMoving && new List { "cabi", "pane", "bloc", "dish", "wine" }.Contains(C[0][..4])) { PNL.transform.Find("TextureLibrary").gameObject.SetActive(true); GameObject Btn = PNL.transform.Find("btnG1").gameObject; if(C[0][..4]=="cabi")_Add.ShowDoorTexture(PNL.transform.Find("TextureLibrary").gameObject, Btn); if(C[0][..4]=="pane")_Add.ShowPanelTexture(PNL.transform.Find("TextureLibrary").gameObject, Btn); if(C[0][..4]=="bloc")_Add.ShowTexture(PNL.transform.Find("TextureLibrary").gameObject, Btn); } } //OPEN_CLOSE.Stop(); } }