using System; using System.Collections.Generic; using UnityEngine; public class BasePhotoSubWindow : MonoBehaviour { protected void ResizeWindow() { int num = (int)this.WindowSize.x; int num2 = (int)this.WindowSize.y; this.WindowSize.x = (float)num; this.WindowSize.y = (float)num2; UTY.GetChildObject(base.gameObject, "Parent", false).GetComponent().size = new Vector3((float)num, (float)num2, 1f); UTY.GetChildObject(base.gameObject, "Parent", false).GetComponent().center = new Vector3((float)(num - 200) / 2f, (float)(num2 - 200) / -2f, 1f); UTY.GetChildObject(base.gameObject, "Parent/BG", false).GetComponent().width = num; UTY.GetChildObject(base.gameObject, "Parent/BG", false).GetComponent().height = num2; UTY.GetChildObject(base.gameObject, "Parent/BG2", false).GetComponent().width = num; UTY.GetChildObject(base.gameObject, "Parent/BG2", false).GetComponent().height = num2 - 20; UTY.GetChildObject(base.gameObject, "Parent/BG2", false).transform.localPosition = new Vector3(-100f, (float)((num2 - 100) * -1), 0f); UTY.GetChildObject(base.gameObject, "Parent/BG/TitleBar", false).GetComponent().width = num; UTY.GetChildObject(base.gameObject, "Parent/BG/TitleBar/Btn", false).transform.localPosition = new Vector3((float)(num - 10), -10f, 0f); UTY.GetChildObject(base.gameObject, "Parent/BG/TitleBar/Text", false).GetComponent().text = this.InitTitle; } public virtual void Initizalize(BasePhotoWindow parentWindow) { if (this.content_game_object_ != null) { return; } this.parent_window_ = parentWindow; this.ResizeWindow(); this.content_game_object_ = UTY.GetChildObject(base.gameObject, "Parent/ContentParent", false); GameObject childObject = UTY.GetChildObject(base.gameObject, "Parent/BG/TitleBar", false); if (this.panel_ == null) { this.panel_ = base.GetComponentInChildren(); } this.title_bar_label_ = UTY.GetChildObject(childObject, "Text", false).GetComponent(); Dictionary dictionary = new Dictionary(); dictionary.Add(BasePhotoSubWindow.BtnType.Help, "ヘルプ"); dictionary.Add(BasePhotoSubWindow.BtnType.Min, "最小化"); dictionary.Add(BasePhotoSubWindow.BtnType.Reset, "UI位置初期化"); dictionary.Add(BasePhotoSubWindow.BtnType.End, "閉じる"); this.btn_dic_ = new Dictionary>>(); for (int i = 0; i <= 3; i++) { BasePhotoSubWindow.BtnType key = (BasePhotoSubWindow.BtnType)i; this.btn_dic_.Add(key, new KeyValuePair>(UTY.GetChildObject(childObject, "Btn/" + key.ToString(), false).GetComponent(), new List())); EventDelegate.Add(this.btn_dic_[key].Key.onClick, new EventDelegate.Callback(this.OnButtonClickEvent)); this.mini_btn_init_pos_.Add(key, this.btn_dic_[key].Key.transform.localPosition); if (dictionary.ContainsKey(key)) { UIButton key2 = this.btn_dic_[key].Key; EventDelegate eventDelegate = new EventDelegate(this, "OnBtnMouseHoverIn"); eventDelegate.parameters[0].value = dictionary[key]; key2.gameObject.GetComponent().onHoverOver.Add(eventDelegate); EventDelegate.Add(key2.gameObject.GetComponent().onHoverOut, new EventDelegate.Callback(this.OnMouseHoverOut)); } } this.window_active_delegate_ = new EventDelegate(new EventDelegate.Callback(parentWindow.ActiveWindow)); this.init_pos_ = base.transform.localPosition; for (int j = 0; j <= 3; j++) { this.SetButtonEnabled((BasePhotoSubWindow.BtnType)j, false, false); } this.GetButtonOnClickEventList(BasePhotoSubWindow.BtnType.Reset).Add(delegate { this.ResetPosition(); }); if (!this.InitVisible) { this.visible = false; } } public void SetButtonEnabled(BasePhotoSubWindow.BtnType type, bool enabled, bool force_update = false) { this.btn_dic_[type].Key.gameObject.SetActive(enabled); foreach (KeyValuePair>> keyValuePair in this.btn_dic_) { keyValuePair.Value.Key.transform.localPosition = this.mini_btn_init_pos_[keyValuePair.Key]; } UIGrid component = this.btn_dic_[BasePhotoSubWindow.BtnType.Help].Key.transform.parent.gameObject.GetComponent(); if (component != null) { if (force_update) { component.Reposition(); } else { component.repositionNow = true; } } } public List GetButtonOnClickEventList(BasePhotoSubWindow.BtnType type) { return this.btn_dic_[type].Value; } public virtual void OnButtonClickEvent() { int instanceID = UIButton.current.GetInstanceID(); foreach (KeyValuePair>> keyValuePair in this.btn_dic_) { if (instanceID == keyValuePair.Value.Key.GetInstanceID()) { List value = keyValuePair.Value.Value; for (int i = 0; i < value.Count; i++) { value[i](); } } } } public virtual void ResetPosition() { base.transform.localPosition = this.init_pos_; } public virtual void OnActiveChangeWindowEvent(bool is_active) { } public string title { get { return this.title_bar_label_.text; } set { this.title_bar_label_.text = value; } } public int depth { get { return this.panel.GetComponentInChildren().depth / 10; } set { int num = value * 10; UIPanel[] componentsInChildren = this.panel.gameObject.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].depth = num++; } } } public bool visible { get { return this.panel.alpha != 0f; } set { this.panel.alpha = (float)((!value) ? 0 : 1); } } public UIPanel panel { get { if (this.panel_ == null) { this.panel_ = base.GetComponentInChildren(); } return this.panel_; } } public EventDelegate window_active_delegate { get { return this.window_active_delegate_; } } public virtual GameObject content_game_object { get { return this.content_game_object_; } } public BasePhotoWindowManager mgr { get { return this.parent_window_.mgr; } } protected void OnBtnMouseHoverIn(string text) { MouseExposition @object = MouseExposition.GetObject(); @object.text = text; } protected void OnMouseHoverOut() { MouseExposition @object = MouseExposition.GetObject(); @object.text = string.Empty; } public string InitTitle = "キャラクター"; public Vector2 WindowSize; public bool InitVisible = true; protected BasePhotoWindow parent_window_; protected UILabel title_bar_label_; protected UIPanel panel_; protected BasePhotoWindowManager mgr_; protected Dictionary>> btn_dic_; protected EventDelegate window_active_delegate_; protected GameObject content_game_object_; protected Vector3 init_pos_; private Dictionary mini_btn_init_pos_ = new Dictionary(); public enum BtnType { Help, Reset, Min, End } }