using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; using UnityEngine.UIElements.Experimental; public class CabTextureShow : MonoBehaviour { static Material Mat; public GameObject _SHOWSELECTION; public GameObject Previwe1; public GameObject Previwe2; public static void DIY_Pnl(string TextureID){ Get.o2("CREATORpnl","SHOWSELECTION").SetActive(true); print("---Reach DIY_PNL-----"+TextureID); string Texture = UIT.TogOn("TEXTCOL"); // Texture2D T=Instantiate(Resources.Load("TEXTURES/TEXT/"+Texture)); // Color C1=Get.o2("CREATORpnl/COLOR_SET/ColorPickerCabTexture/","Preview").GetComponent().color; // Color C2=Get.o2("CREATORpnl/COLOR_SET/ColorPicker2CabTexture/","Preview").GetComponent().color; string c1 = Get.o2("CREATORpnl/COLOR_SET/ColorPickerCabTexture/","InputField").GetComponent().text; string c2 = Get.o2("CREATORpnl/COLOR_SET/ColorPicker2CabTexture/","InputField").GetComponent().text; //ModifyTexture.ModifyTexturePixels(T,C1,C2,Color.black); // Mat=Instantiate(_G.TEXTURE); // Mat.SetTexture("_Texture", T); // Mat.SetFloat("_Metallic", 0.5f); // Mat.SetFloat("_Smoothness", 0.3f); // Mat.SetColor("_c1", C1); // Mat.SetColor("_c2", C2); //Texture,c1,c2,c3,tile,rotation,smoothness,metalic,contrast ////Texture,c1,c2,c3,tile,rotation,smoothness,metalic,contrast /// //string Texture = UIT.Value(Library.CabTexture,TextureID,Header.Texture); string Code=Texture+","+c1+","+c2+",#ffffff,1,0.5,0.3,1.2"; print("Code====="+Code); Mat=UIT_MATERIAL.GetMaterial(Code); GameObject Inputs=Get.o2(_G.PON,"INPUTS"); DOIT.AllChildOff(Inputs); float w=20,h=30,d=1; Model_T_01(w,h,d,Mat); } ///MODELS public static void Model_T_01(float w,float h, float d,Material Mat){ GameObject Texture=new("Texture"); AddMCX.AddCenter(Texture, w,h,d,d,0,Mat); LibraryCreator.Add3DtoScene(Texture,w,h); } public void ChangeColorCabTextureShow(){ if(_SHOWSELECTION.activeInHierarchy==true){ print("Should work"); Color C1=Previwe1.GetComponent().color;//Get.o2("CREATORpnl/COLOR_SET/ColorPickerCabTexture/","Preview").GetComponent().color; Color C2=Previwe2.GetComponent().color;//Get.o2("CREATORpnl/COLOR_SET/ColorPicker2CabTexture/","Preview").GetComponent().color; ChangeColorCabTextureShowStatic(C1,C2); }; } public static void ChangeColorCabTextureShowStatic(Color C1,Color C2){ print("---ChangeColorCabTextureShow---1-"); GameObject Object3D= Get.o2("3D Object Show/Texture","Center"); if(Object3D!=null){ print("---ChangeColorCabTextureShow---2-"); GameObject Center=Get.o2("3D Object Show/Texture","Center"); Material Mat= Center.GetComponent().material; string TextureName=Mat.GetTexture("_Texture").name.Replace("(Clone)",""); print("TextureName=="+TextureName); Texture2D sourceTexture = Instantiate(Resources.Load("TEXTURES/TEXT/"+TextureName)); ModifyTexture.ModifyTexturePixels(sourceTexture,C1,C2,Color.black); Mat.SetTexture("_Texture", sourceTexture); Mat.SetColor("_c1", C1); Mat.SetColor("_c2", C2); StaticCoroutine.Start( LibraryCreator.RTImageCaroutine( Get.o2( "CREATORpnl/SHOWSELECTION/IMAGE","RawImage" ))); //Get.o2("CREATORpnl/SHOWSELECTION/IMAGE","RawImage").GetComponent().texture=LibraryCreator.RTImage(); } } public void ChangeColorImageShow(){ //if(_SHOWSELECTION.activeInHierarchy==true){ Color C1=Get.o2(_G.PON+"/COLORS/ColorPickerDeco1","Preview1").GetComponent().color; Color C2=Get.o2(_G.PON+"/COLORS/ColorPickerDeco2","Preview2").GetComponent().color; ChangeColorCabTextureShow(C1,C2); //}; } public void ChangeColorImageShowHEX(){ print("_G.PON===="+_G.PON); string C1=Get.o2(_G.PON+"/COLORS/ColorPickerDeco1","HexValue").GetComponent().text; string C2=Get.o2(_G.PON+"/COLORS/ColorPickerDeco2","HexValue").GetComponent().text; GameObject Object= Get.o1("3D Object Show").transform.GetChild(0).gameObject; if(Object!=null) { for(int i=0; i().material; M.SetColor("_c1", DOIT.CSc(C1,255)); M.SetColor("_c2", DOIT.CSc(C2,255)); } StaticCoroutine.Start( LibraryCreator.RTImageCaroutine( Get.o2(_G.PON+"SHOWSELECTION/IMAGE","RawImage") )); } } public static void ChangeColorCabTextureShow(Color C1,Color C2){ print("---ChangeColorCabTextureShow---1-"); GameObject Object= Get.o1("3D Object Show").transform.GetChild(0).gameObject; if(Object!=null){ for(int i=0; i().material; M.SetColor("_c1", C1); M.SetColor("_c2", C2); } StaticCoroutine.Start( LibraryCreator.RTImageCaroutine( Get.o2(_G.PON+"SHOWSELECTION/IMAGE","RawImage") )); } } //Finish public static void FillFinishDropdown(){ TMP_Dropdown Finish = Get.o2(_G.PON+"/COLORS","Finish").GetComponent(); if(Finish.options.Count==1){ Finish.ClearOptions(); List list = new(){TRANS.This("T_Matt"),TRANS.This("T_Semi"),TRANS.This("T_Gloss") }; Finish.AddOptions(list); Finish.value=1; } } }