using System; using System.Collections.Generic; using System.IO; using UnityEngine; public class WindowPartsInputColorrPalette : MonoBehaviour { public void Awake() { this.ColorPalette.onChangeValue.Add(delegate(Color color_val) { for (int j = 0; j < this.onChangeValue.Count; j++) { this.onChangeValue[j](this, color_val); } }); this.btn_list_.Clear(); if (this.ResetBtn != null) { this.btn_list_.Add(this.ResetBtn); EventDelegate.Add(this.btn_list_[this.btn_list_.Count - 1].onClick, new EventDelegate.Callback(this.OnReset)); EventDelegate eventDelegate = new EventDelegate(this, "OnMouseHoverIn"); eventDelegate.parameters[0].value = "ScenePhotoMode/リセット"; this.btn_list_[this.btn_list_.Count - 1].gameObject.GetComponent().onHoverOver.Add(eventDelegate); } if (this.CopyBtn != null) { this.btn_list_.Add(this.CopyBtn); EventDelegate.Add(this.btn_list_[this.btn_list_.Count - 1].onClick, new EventDelegate.Callback(this.OnCopy)); EventDelegate eventDelegate = new EventDelegate(this, "OnMouseHoverIn"); eventDelegate.parameters[0].value = "ScenePhotoMode/コピー"; this.btn_list_[this.btn_list_.Count - 1].gameObject.GetComponent().onHoverOver.Add(eventDelegate); } if (this.PasteBtn != null) { this.btn_list_.Add(this.PasteBtn); EventDelegate.Add(this.btn_list_[this.btn_list_.Count - 1].onClick, new EventDelegate.Callback(this.OnPaste)); EventDelegate eventDelegate = new EventDelegate(this, "OnMouseHoverIn"); eventDelegate.parameters[0].value = "ScenePhotoMode/ペースト"; this.btn_list_[this.btn_list_.Count - 1].gameObject.GetComponent().onHoverOver.Add(eventDelegate); } for (int i = 0; i < this.btn_list_.Count; i++) { EventDelegate.Add(this.btn_list_[i].gameObject.GetComponent().onHoverOut, new EventDelegate.Callback(this.OnMouseHoverOut)); EventDelegate.Add(this.btn_list_[i].gameObject.GetComponent().onRelease, new EventDelegate.Callback(this.OnMouseHoverOut)); } } public void OnReset() { this.ColorPalette.SetColor(this.ResetNum); } public void OnCopy() { StringWriter stringWriter = new StringWriter(); Color color = this.ColorPalette.GetColor(); float[] array = new float[] { color.r, color.g, color.b }; for (int i = 0; i < array.Length; i++) { stringWriter.WriteLine(array[i]); } for (int j = 0; j < this.onCopyEvent.Count; j++) { this.onCopyEvent[j](stringWriter); } BasePhotoWindowManager.SetCopyData(this.copy_data_title, stringWriter.ToString()); } public void OnPaste() { string copyData = BasePhotoWindowManager.GetCopyData(this.copy_data_title); if (string.IsNullOrEmpty(copyData)) { return; } float[] array = new float[] { 1f, 1f, 1f }; StringReader stringReader = new StringReader(copyData); for (int i = 0; i < array.Length; i++) { array[i] = float.Parse(stringReader.ReadLine()); } this.ColorPalette.SetColor(new Color(array[0], array[1], array[2])); for (int j = 0; j < this.onPasteEvent.Count; j++) { this.onPasteEvent[j](stringReader); } } public void OnMouseHoverIn(string text) { MouseExposition @object = MouseExposition.GetObject(); @object.textFromLanguageTerm = text; } public void OnMouseHoverOut() { MouseExposition @object = MouseExposition.GetObject(); @object.text = string.Empty; } public Color value { get { return this.ColorPalette.GetColor(); } set { this.ColorPalette.SetColor(value); } } public string copy_data_title { get { return this.CopyDataTitle; } } public new bool enabled { get { return this.ColorPalette.enabled; } set { this.ColorPalette.enabled = value; if (this.ResetBtn != null) { this.ResetBtn.isEnabled = value; } if (this.CopyBtn != null) { this.CopyBtn.isEnabled = value; } if (this.PasteBtn != null) { this.PasteBtn.isEnabled = value; } } } public bool visible { get { return base.gameObject.activeSelf; } set { base.gameObject.SetActive(value); } } public ColorrPaletteParts ColorPalette; public UIButton ResetBtn; public UIButton CopyBtn; public UIButton PasteBtn; public Color ResetNum; public string CopyDataTitle = "WindowPartsInputColorrPalette"; public List> onChangeValue = new List>(); public List> onCopyEvent = new List>(); public List> onPasteEvent = new List>(); private List btn_list_ = new List(); }