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) { GameObject PAPA = GameObject.Find(P); if (PAPA == null) return;// objet absent (ex: scene vide) : rien a supprimer foreach (Transform obj in PAPA.transform) { obj.gameObject.SetActive(true); } for (int i = PAPA.transform.childCount - 1; i >= 0; i--) { GameObject.DestroyImmediate(PAPA.transform.GetChild(i).gameObject); } } 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 float getScenePos(string v,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[..1] == "w") // { // int wn = int.Parse(_G.WallSELECTED[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.WallsPointCenter[wn - 1].x + osx; // pz = _G.WallsPointCenter[wn - 1].y + osz; // } // float value = 0; // if (v == "px") value = px; // if (v == "pz") value = pz; // if (v == "ry") value = ry; // return value; float value = 0; 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[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; } //----------------------------------------------------------------------------------------------------------------------------// //---------------------------------------------------------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