123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- 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<UIEventTrigger>().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<UIEventTrigger>().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<UIEventTrigger>().onHoverOver.Add(eventDelegate);
- }
- for (int i = 0; i < this.btn_list_.Count; i++)
- {
- EventDelegate.Add(this.btn_list_[i].gameObject.GetComponent<UIEventTrigger>().onHoverOut, new EventDelegate.Callback(this.OnMouseHoverOut));
- EventDelegate.Add(this.btn_list_[i].gameObject.GetComponent<UIEventTrigger>().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<Action<WindowPartsInputColorrPalette, Color>> onChangeValue = new List<Action<WindowPartsInputColorrPalette, Color>>();
- public List<Action<StringWriter>> onCopyEvent = new List<Action<StringWriter>>();
- public List<Action<StringReader>> onPasteEvent = new List<Action<StringReader>>();
- private List<UIButton> btn_list_ = new List<UIButton>();
- }
|