using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class SliderColor : MonoBehaviour { public Slider slider; public Slider sliderIntensity; public GameObject colorchart; static public bool ignoreTextureChange; int CurrentAlpha255() { if (sliderIntensity == null) return 255; return Mathf.RoundToInt((sliderIntensity.value / sliderIntensity.maxValue) * 255); } public void Changing(){ int value=Mathf.RoundToInt(slider.value); Color actColor = colorchart.GetComponent().sprite.texture.GetPixel(value,0); string cols=ColorUtility.ToHtmlStringRGB(actColor); print("_G.PNL====="+_G.PNL); byte alpha = (byte)CurrentAlpha255(); _G.FLC[3]=cols; ChangingColor(_G.PNL,cols ,alpha ); } public void ChangingColor(string Panel,string cols, byte alpha ) { GameObject O=Get.o2(Panel,"SELECTION"); foreach(Transform tile in O.transform){ tile.transform.Find("Background").GetComponent().color=DOIT.CSc(cols,alpha); } } public void Intensity(){ float alpha = slider.value / slider.maxValue; SetIntensity(_G.PNL, alpha); } public void SetIntensity(string Panel, float alpha) { GameObject O=Get.o2(Panel,"SELECTION"); foreach(Transform tile in O.transform){ Image img = tile.transform.Find("Background").GetComponent(); Color c = img.color; c.a = alpha; img.color = c; } } public void Select(){ Color ClickColor = transform.Find("Background").GetComponent().color; string clos=ColorUtility.ToHtmlStringRGB(ClickColor); if(_G.PNL=="FLOORROOM"){ GameObject O=Get.o2("FLOORROOM","SELECTION"); foreach(Transform tile in O.transform){ tile.transform.Find("Background").GetComponent().color=DOIT.CSc(clos,255); } } if(_G.PNL=="DOORSTYLE"){ GameObject O=Get.o2("DOORSTYLE","SELECTION"); foreach(Transform tile in O.transform){ tile.transform.Find("Background").GetComponent().color=DOIT.CSc(clos,255); } } if(_G.PNL=="COUNTERTOPSTYLE"){ GameObject O=Get.o2("COUNTERTOPSTYLE","SELECTION"); foreach(Transform tile in O.transform){ tile.transform.Find("Background").GetComponent().color=DOIT.CSc(clos,255); } } } }