using UnityEngine; using System.Globalization; using UnityEngine.UI; using System.Collections.Generic; public class DOIT : MonoBehaviour { public static bool Mousecheck() { bool mouseTF = false; #if UNITY_EDITOR if (Input.mousePosition.x > 100 && Input.mousePosition.y > 60 && Input.mousePosition.x <= 860 && Input.mousePosition.y <= 385) { mouseTF = true; } #else if (Input.mousePosition.x <= Screen.width*100/960 && Input.mousePosition.y <= Screen.height*60/460 && Input.mousePosition.x >= Screen.width - Screen.width*100/960 && Input.mousePosition.y >= Screen.height - Screen.height*75/460) {mouseTF = true;} #endif //print("X=====" + Input.mousePosition.x + " Y==" + Input.mousePosition.y); return mouseTF; } public static void DELETEAllChild(string P) { foreach (Transform obj in GameObject.Find(P).gameObject.transform) { obj.gameObject.SetActive(true); } GameObject PAPA = GameObject.Find(P).gameObject; for (int i = PAPA.transform.childCount - 1; i >= 0; i--) { GameObject.DestroyImmediate(PAPA.transform.GetChild(i).gameObject); } } public static void ResetRoomSelect() { Material MAT = Resources.Load("MATERIALS/SHADEWALL") as Material; if (GameObject.Find("m1")) GameObject.Find("m1").GetComponent().material = MAT; if (GameObject.Find("m2")) GameObject.Find("m2").GetComponent().material = MAT; if (GameObject.Find("m3")) GameObject.Find("m3").GetComponent().material = MAT; if (GameObject.Find("m4")) GameObject.Find("m4").GetComponent().material = MAT; if (GameObject.Find("m5")) GameObject.Find("m5").GetComponent().material = MAT; if (GameObject.Find("m6")) GameObject.Find("m6").GetComponent().material = MAT; if (GameObject.Find("sceil")) GameObject.Find("sceil").GetComponent().material = MAT; if (GameObject.Find("sfloor")) GameObject.Find("sfloor").GetComponent().material = MAT; //PAINT.SEL = ""; } public static void CloseALLPNL() { GameObject[] pnl; pnl = GameObject.FindGameObjectsWithTag("pnl"); foreach (GameObject p in pnl) { p.gameObject.SetActive(false); } GameObject[] menu; menu = GameObject.FindGameObjectsWithTag("menu"); foreach (GameObject m in menu) { m.gameObject.SetActive(false); } if (GameObject.Find("SAVEWEBpnl")) GameObject.Find("SAVEWEBpnl").transform.GetComponent().alpha = 1; if (GameObject.Find("LOADpnl")) GameObject.Find("LOADpnl").transform.GetComponent().alpha = 1; _G.SELECTED = ""; } public static void CloseALLPNLONLY() { GameObject[] pnl; pnl = GameObject.FindGameObjectsWithTag("pnl"); foreach (GameObject p in pnl) { p.gameObject.SetActive(false); } GameObject[] menu; menu = GameObject.FindGameObjectsWithTag("menu"); foreach (GameObject m in menu) { m.gameObject.SetActive(false); } if (GameObject.Find("SAVEWEBpnl")) GameObject.Find("SAVEWEBpnl").transform.GetComponent().alpha = 1; if (GameObject.Find("LOADpnl")) GameObject.Find("LOADpnl").transform.GetComponent().alpha = 1; } public static void CloseALLMenu() { GameObject[] pnl; pnl = GameObject.FindGameObjectsWithTag("menu"); foreach (GameObject p in pnl) { p.gameObject.SetActive(false); } } public static void disableActionsDropdown() { GameObject.Find("HIDER").transform.Find("SELECT").gameObject.SetActive(false); } public static void AllTogchildfalse(GameObject O) { for (int i = 0; i < O.transform.childCount; i++) { O.transform.GetChild(i).GetComponent().isOn = false; } } public static void AllChildOff(GameObject O) { for (int i = 0; i < O.transform.childCount; i++) { O.transform.GetChild(i).gameObject.gameObject.SetActive(false); } } public static int getWA()//wall angle { int ON = getint(_G.SELECTED); int Wallnum = int.Parse(_G.OBJs[ON][22].Substring(1, 1)); int num = 0; GameObject wall = GameObject.Find("w" + Wallnum.ToString()).gameObject; Vector3 ANGLE = wall.transform.eulerAngles; num = (int)(ANGLE.y); return num; } public static float getPn(string p)//Position xyz of wall { int nO = getint(_G.SELECTED); int Wallnum = int.Parse(_G.OBJs[nO][22].Substring(1, 1)); float num = 0; GameObject wall = GameObject.Find("w" + Wallnum.ToString()).gameObject; Vector3 pos = wall.transform.position; if (p == "x") num = pos.x; if (p == "y") num = pos.y; if (p == "z") num = pos.z; return num; } public static float getScenePos(string v, float w, float h, float d, float os) { float px = 0; float pz = 0; float ry = 0; float osx = 0; float osz = 0; if (_G.WallSELECTED == "floor") { px = 0; pz = 0; ry = 0; } if (_G.WallSELECTED.Substring(0, 1) == "w") { int wn = int.Parse(_G.WallSELECTED.Substring(1, _G.WallSELECTED.Length - 1)); ry = _G.wa[wn - 1]; if (ry == 0) { osx = 0; osz = -os; } if (ry == 45) { osx = -os * 0.707f; osz = -os * 0.707f; } if (ry == 90) { osx = -os; osz = 0; } if (ry == 135) { osx = -os * 0.707f; osz = +os * 0.707f; } if (ry == 180) { osx = 0; osz = os; } if (ry == 225) { osx = +os * 0.707f; osz = +os * 0.707f; } if (ry == 270) { osx = os; osz = 0; } if (ry == 315) { osx = os * 0.707f; osz = -os * 0.707f; } px = _G.wCP[wn - 1].x + osx; pz = _G.wCP[wn - 1].y + osz; } float value = 0; if (v == "px") value = px; if (v == "pz") value = pz; if (v == "ry") value = ry; return value; } public static string getColectionNamebyAbr(string str) { string N = ""; if (str == "CO") N = "SENSATION"; if (str == "BL") N = "FINESE"; if (str == "EG") N = "ÉLÉGANCE"; return N; } public static void AllTogdOff(GameObject O) { for (int i = 0; i < O.transform.childCount; i++) { O.transform.GetChild(i).GetComponent().isOn = false; } } public static int getint(string On) { int nO = int.Parse(On.Substring(4, On.Length - 4)); return nO; } public static string getAbrCol(string str) { string c = ""; if (str == "BROWN") c = "CO"; if (str == "WHITE") c = "BL"; if (str == "GRAY") c = "EG"; return c; } public static string getCABCollectionNamebyColAbr(string CD) { string col = TRANS.This(CD); return col; } public static string getColorTextPNLbyDoorcab(string CD) { string num = CD.Substring(6, 1); string col = "TEXT10" + num + ",2,FFFFFF,r0,SG"; return col; } public static float xfzf(string xz, int Wallnum) { float f = 1; float Ww = 0; float a = 0; for (int i = 1; i < _G.NW + 1; i++) { if (Wallnum == i) { Ww = _G.wW[i - 1]; a = _G.wa[i - 1]; } } //print("Wallnum==="+Wallnum); //print("a==="+a); float xf = Mathf.Cos(a * Mathf.Deg2Rad); float zf = Mathf.Sin(a * Mathf.Deg2Rad); if (xz == "x") f = xf; if (xz == "z") f = zf; if (xz == "ww") f = Ww; return f; } //----------------------------------------------------------------------------------------------------------------------------// //---------------------------------------------------------Check------------------------------------------------------------// //----------------------------------------------------------------------------------------------------------------------------// public static void NoSelection(GameObject S) { for (int i = 0; i < S.transform.childCount; i++) { S.transform.GetChild(i).transform.GetComponent().isOn = false; } } //----------------------------------------------------------------------------------------------------------------------------// //---------------------------------------------------------EMPTY PANEL------------------------------------------------------------// //----------------------------------------------------------------------------------------------------------------------------// public static Color GetIsColor(string S) { Color c; c = GameObject.Find(S).transform.GetComponent().material.color; return c; } public static void btnColor() { ColorBlock theColor; string Ncol = _G.Color1;//"1664B5"; GameObject[] btn = GameObject.FindGameObjectsWithTag("btn"); foreach (GameObject obj in btn) { theColor = obj.GetComponent