using System.Collections; using System.Collections.Generic; using System.Linq; using TMPro; using UnityEngine; using UnityEngine.UI; public class SaveToLibrary : MonoBehaviour { public static void Panel(string LineCode){ print("Code to save is===="+LineCode); _G.UIT_LibraryPanels.Add(LineCode); } public static void CabTexture(){ string LineCode=""; string IDNumber = GetCabTextureNewID().ToString(); LineCode+=IDNumber;//ID LineCode+=",Texture"+IDNumber;//Unique_Name LineCode+=",Texture"+IDNumber;//L1 LineCode+=",Texture"+IDNumber;//L2 LineCode+=",Texture"+IDNumber;//L3 LineCode+=",Ukitchenit";//Supplier string Text=UIT.Value(Library.CabTexture,UIT.TogOn("TEXTCOL"),Header.Texture);//----------------------------------------------------------Texture LineCode+=","+Text;//Texture print("Text========="+Text); TMP_Dropdown FinishDropDown = Get.o2(_G.PON+"/COLORS","Finish").GetComponent(); string Finish=FinishDropDown.options[FinishDropDown.value].text; LineCode+=","+Finish;//Finish string Rotation=GetRotation(); LineCode+=","+Rotation;//Rotation LineCode+=",1";//Contrast string C1 = GetColorHex("1");//Get.o2(_G.PON+"/COLORS/ColorPickerDeco1","HexValue").GetComponent().text;//----------------------------------------------------------C1 LineCode+=","+ C1;//C1 string C2=GetColorHex("2");//Get.o2(_G.PON+"/COLORS/ColorPickerDeco2","HexValue").GetComponent().text;//----------------------------------------------------------C2 LineCode+=","+C2;//C2 LineCode+=",#ffffff";//C3 LineCode+=",Standard";//Library LineCode+=",end";//End print("LineCode======"+LineCode); bool isLibrary=false; foreach(string Line in _G.UIT_LibraryCabTextures){ string[] L=Line.Split(','); if(L.Contains( Text) && L.Contains(Finish) && L.Contains(C1) && L.Contains(C2)){ isLibrary=true; } } if( !isLibrary ){ //Texture,c1,c2,finish _G.UIT_LibraryCabTextures.Add(LineCode); } } public static string GetColorHex(string Number){ if(_G.PON=="CABDOORpnl"){ string C1=Get.TogOn(Get.o2("CABDOORpnl","PresetColors")).name; if(Number=="1") return C1; if(Number=="2") return DoorCabPNL.HexColor2(C1); } return Get.o2(_G.PON+"/COLORS/ColorPickerDeco"+Number,"HexValue").GetComponent().text; } public static int GetCabTextureNewID(){ int index = 0; for(int i = 1; i< _G.UIT_LibraryCabTextures.Count; i++ ){ string Line=_G.UIT_LibraryCabTextures[i]; if(!string.IsNullOrEmpty(Line)){ int indexOnList=int.Parse(_G.UIT_LibraryCabTextures[i].Split(",")[0]); if(indexOnList>index)index=indexOnList; } } return index+1; } public static string GetRotation(){ return Get.ToggleOnInChild(_G.PON+"ROTATION"); } }