using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.Events; using System; public class TextureCall : MonoBehaviour { //-----Add to selected-------------------- public static void TextureSplash(string code, string global_unique) { if (global_unique == "UNIQUE") { SetSplashTexturesOnObject(code, SceneModeManager.SelectedName); } else { for (int i = 0; i < _G.OBJnum; i++) { if (DOIT.exist(i)) { string objGlobal = _G.OBJs[i][60]; if (objGlobal != global_unique) continue; SetSplashTexturesOnObject(code, _G.OBJs[i][0]); } } } } private static void SetSplashTexturesOnObject(string code, string objectName) { GameObject go = Get.o2("SCENE", objectName); foreach (Transform t in go.GetComponentsInChildren(true)) { if (t.CompareTag("splash")) { _G.OBJs[Get.GetObjectIndex(objectName)][54] = code; t.GetComponent().material = CREATE.GetMatfromRawCode(code, "SCENE"); Material material = t.GetComponent().material; material.EnableKeyword("_ALPHATEST_ON"); } } } public static void TextureWall(string code) { print("code===tex====================" + code); if (PAINT.SEL == "ceil") { GameObject ceil = Get.o1(PAINT.SEL); Material Mat = ceil.GetComponent().material; CREATE.ResetMaterialFromCode(Mat, code, "Variable"); _G.ceilm = ceil.GetComponent().material; //Debug.Log("texture call ceil"); } else if (PAINT.SEL == "AWAL") // { for (int i = 0; i < _G.NW; i++) { string key = "w" + (i + 1).ToString(); GameObject wall = Get.o1(key); if (wall == null) { continue; } foreach (Transform child in wall.transform) { Material Mat = child.GetComponent().material; CREATE.ResetMaterialFromCode(Mat, code, "Variable"); } _G. WallsMaterial[i] = wall.transform.Find("s1").GetComponent().material; } //Debug.Log("texture call all wall"); } else { GameObject O = Get.o1(PAINT.SEL); foreach (Transform child in O.transform) { Material Mat = child.GetComponent().material; CREATE.ResetMaterialFromCode(Mat, code, "Variable"); } int wallindex = int.Parse(O.name[1..]) - 1; _G. WallsMaterial[wallindex] = O.transform.Find("s1").GetComponent().material; //Debug.Log("texture call single wall"); } } public static void TextureWall(List codes) { int indexCode = 0; if (PAINT.SEL == "AWAL") // { for (int i = 0; i < _G.NW; i++) { string key = "w" + (i + 1).ToString(); GameObject wall = Get.o1(key); if (wall == null) { continue; } foreach (Transform child in wall.transform) { Material Mat = child.GetComponent().material; CREATE.ResetMaterialFromCode(Mat, codes[indexCode], "Variable"); indexCode++; } _G. WallsMaterial[i] = wall.transform.Find("s1").GetComponent().material; } } } public static void TextureBloc(string code,string category) { print("----code from TextureBloc===================================================" + code); GameObject O = SceneModeManager.Selected; int ind = Get.GetObjectIndex(O.name); switch (category) { case "Block": case "Bloc": _G.OBJs[ind][41] = code; //_G.OBJs[ind][61] = code; break; case "Panel": if(_G.OBJs[ind][90] != "FakeDoor") { string newCode = "PA_" + code.Split("?")[0].Split("_")[1]; _G.OBJs[ind][61] = newCode; } break; } foreach (Transform child in O.transform) { if (Get.Bool(child.name, "top_front_left_right_under_back_Cube1_Cube2_Cube3_Arch")) { if (code.Split('?').Length==2) { //child.GetComponent().material = CREATE.Texture_CAB(colorID: code.Split('?')[0], rotation: code.Split('?')[1], MaterialDisplayMode.SceneMaterial); //string name, float W, float H, string R, DataTypes cat,string CAB_PNL) child.GetComponent().material = UIT_MATERIAL.GetMaterial(code);//CREATE.Texture_CAB(code.Split('?')[0],18,18, code.Split('?')[1], "Bloc","CAB"); } else { child.GetComponent().material = Instantiate(_G.TEXTURE); CREATE.ResetMaterialFromCode(child.GetComponent().material, code, "Variable"); } } if (Get.Bool(child.name, "Cyl1_Cyl2_Cyl3_Cyl4")) { if (code.Split('?').Length==2) { child.transform.GetChild(0).GetComponent().material = UIT_MATERIAL.GetMaterial(code.Split('?')[0]);//CREATE.Texture_CAB(code.Split('?')[0],18,18, code.Split('?')[1], "Bloc","CAB"); } else { child.transform.GetChild(0).GetComponent().material = Instantiate(_G.TEXTURE); CREATE.ResetMaterialFromCode(child.transform.GetChild(0).GetComponent().material, code, "Cylinder"); } } if (Get.Bool(child.name, "Cylinder")) { if (code.Split('?').Length==2) { child.transform.GetChild(0).GetComponent().material = UIT_MATERIAL.GetMaterial(code.Split('?')[0]);//CREATE.Texture_CAB(code.Split('?')[0],18,18, code.Split('?')[1], "Bloc","CAB"); } else { child.transform.GetChild(0).GetComponent().material = Instantiate(_G.TEXTURE); CREATE.ResetMaterialFromCode(child.transform.GetChild(0).GetComponent().material, code, "Cylinder"); } } //for Panel if (Get.Bool(child.name, "Top_Front_Left_Right_Under_Back_Cube1_Cube2_Cube3")) { if (code.Split('?').Length==2) { child.GetComponent().material = UIT_MATERIAL.GetMaterial(code.Split('?')[0]);//CREATE.Texture_CAB(code.Split('?')[0],18,18, code.Split('?')[1], "Bloc","CAB"); } else { child.GetComponent().material = Instantiate(_G.TEXTURE); CREATE.ResetMaterialFromCode(child.GetComponent().material, code, "Variable"); } } } // int ind = Get.GetObjectIndex(SceneModeManager.SelectedName); // _G.OBJs[ind][41] = code; // GameObject O = Get.o1(SceneModeManager.SelectedName); // foreach (Transform child in O.transform) // { // if (child.name != "Group") CREATE.ResetMaterialFromCode(child.GetComponent().material, code, "Variable"); // //if(child.name!="Group")child.GetComponent().material=CREATE.resetMaterial(child.GetComponent().material,code); //} } public static void TextureFloor(string code) { _G.FLCs = code; CreateFloor.SetFloor(); ConstructOpen.RedrawOpen(); } public static void TextureCounter(List name) { //print("----------------TextureCall--------------" + name); //COUN.1?1?1?FFFFFF?FFFFFF?1?90?S?ffffff?1?1?0.05?0.5?0 string CodeString=""; for(int i=0; i CodeList=new(){ Tname, ColorUtility.ToHtmlStringRGBA(MAT.GetColor("_c1")), ColorUtility.ToHtmlStringRGBA(MAT.GetColor("_c2")), ColorUtility.ToHtmlStringRGBA(MAT.GetColor("_c3")), Tile, MAT.GetFloat("_Rotation").ToString(), Contrast, MAT.GetFloat("_Smoothness").ToString(), MAT.GetFloat("_Metallic").ToString(), MAT.GetFloat("_Relief").ToString() }; for(int i=0; i