123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- using System;
- using UnityEngine;
- using UnityEngine.UI;
- using wf;
- namespace MyRoomCustom
- {
- public class CreativeRoomUISaveLoad : MonoBehaviour
- {
- private void Start()
- {
- }
- public void OpenSavePanel()
- {
- if (this.m_IsOpenSave)
- {
- base.gameObject.SetActive(false);
- this.m_IsOpenSave = false;
- return;
- }
- this.m_IsOpenSave = true;
- this.m_IsOpenLoad = false;
- this.m_UITextTitle.text = "セーブ";
- Utility.SetLocalizeTerm(this.m_UITextTitle, "ScenePhotoMode/メニュー/セーブ", false);
- NDebug.Assert(this.m_Manager, "部屋作成シーンのマネージャが見つかりませんでした");
- base.gameObject.SetActive(true);
- GameObject uiparentButtonArea = this.m_UIParentButtonArea;
- Transform transform = uiparentButtonArea.transform;
- int childCount = transform.childCount;
- for (int i = 0; i < childCount; i++)
- {
- int number = i;
- Transform child = transform.GetChild(number);
- Button componentInChildren = child.GetComponentInChildren<Button>();
- Text textDate = child.GetComponentInChildren<Text>();
- uGUIInputField componentInChildren2 = child.GetComponentInChildren<uGUIInputField>();
- CreativeRoomManager.CreativeRoomHeader saveDataHeader = this.m_Manager.GetSaveDataHeader(number);
- if (saveDataHeader != null)
- {
- componentInChildren.interactable = true;
- componentInChildren2.interactable = true;
- textDate.text = this.m_Manager.DateTimeParse(saveDataHeader.lastWriteTime);
- componentInChildren2.text = saveDataHeader.comment;
- }
- else
- {
- componentInChildren.interactable = true;
- componentInChildren2.interactable = false;
- textDate.text = string.Empty;
- componentInChildren2.text = string.Empty;
- }
- componentInChildren.onClick.RemoveAllListeners();
- componentInChildren.onClick.AddListener(delegate()
- {
- if (!GameMain.Instance.SysDlg.IsDecided)
- {
- return;
- }
- GameMain.Instance.SysDlg.ShowFromLanguageTerm("Dialog/セーブロード/データを保存しますか?", null, SystemDialog.TYPE.OK_CANCEL, delegate
- {
- CreativeRoomManager.CreativeRoomHeader creativeRoomHeader = this.m_Manager.Save(number);
- textDate.text = this.m_Manager.DateTimeParse(creativeRoomHeader.lastWriteTime);
- GameMain.Instance.SysDlg.Close();
- }, delegate
- {
- GameMain.Instance.SysDlg.Close();
- });
- });
- componentInChildren2.onEndEdit.RemoveAllListeners();
- componentInChildren2.onEndEdit.AddListener(delegate(string value)
- {
- this.m_Manager.SaveComment(number, value);
- });
- }
- }
- public void OpenLoadPanel()
- {
- if (this.m_IsOpenLoad)
- {
- base.gameObject.SetActive(false);
- this.m_IsOpenLoad = false;
- return;
- }
- this.m_IsOpenSave = false;
- this.m_IsOpenLoad = true;
- this.m_UITextTitle.text = "ロード";
- Utility.SetLocalizeTerm(this.m_UITextTitle, "ScenePhotoMode/メニュー/ロード", false);
- NDebug.Assert(this.m_Manager, "[CreativeRoom] 部屋作成シーンのマネージャクラスが見つかりませんでした");
- base.gameObject.SetActive(true);
- GameObject uiparentButtonArea = this.m_UIParentButtonArea;
- Transform transform = uiparentButtonArea.transform;
- int childCount = transform.childCount;
- for (int i = 0; i < childCount; i++)
- {
- int number = i;
- Transform child = transform.GetChild(number);
- Button componentInChildren = child.GetComponentInChildren<Button>();
- Text componentInChildren2 = child.GetComponentInChildren<Text>();
- uGUIInputField componentInChildren3 = child.GetComponentInChildren<uGUIInputField>();
- CreativeRoomManager.CreativeRoomHeader head = this.m_Manager.GetSaveDataHeader(number);
- if (head != null)
- {
- componentInChildren.interactable = true;
- componentInChildren3.interactable = true;
- componentInChildren2.text = this.m_Manager.DateTimeParse(head.lastWriteTime);
- componentInChildren3.text = head.comment;
- }
- else
- {
- componentInChildren.interactable = false;
- componentInChildren3.interactable = false;
- componentInChildren2.text = string.Empty;
- componentInChildren3.text = string.Empty;
- }
- componentInChildren.onClick.RemoveAllListeners();
- componentInChildren.onClick.AddListener(delegate()
- {
- if (head == null)
- {
- return;
- }
- if (!GameMain.Instance.SysDlg.IsDecided)
- {
- return;
- }
- GameMain.Instance.SysDlg.ShowFromLanguageTerm("Dialog/セーブロード/データをロードしますか?", null, SystemDialog.TYPE.OK_CANCEL, delegate
- {
- this.m_Manager.Load(number);
- GameMain.Instance.SysDlg.Close();
- this.gameObject.SetActive(false);
- }, delegate
- {
- GameMain.Instance.SysDlg.Close();
- });
- });
- componentInChildren3.onEndEdit.RemoveAllListeners();
- componentInChildren3.onEndEdit.AddListener(delegate(string value)
- {
- this.m_Manager.SaveComment(number, value);
- });
- }
- }
- private void OnDisable()
- {
- if (this.m_IsQuittingApplication)
- {
- return;
- }
- this.m_IsOpenSave = false;
- this.m_IsOpenLoad = false;
- }
- private void OnApplicationQuit()
- {
- this.m_IsQuittingApplication = (true && Application.isEditor);
- }
- [SerializeField]
- [Tooltip("セーブ、ロードを行うウィンドウのタイトルテキスト")]
- private Text m_UITextTitle;
- [SerializeField]
- [Tooltip("セーブ用のボタンを並べる親オブジェクト")]
- private GameObject m_UIParentButtonArea;
- [SerializeField]
- [Tooltip("部屋作成シーンのマネージャクラス")]
- private CreativeRoomManager m_Manager;
- private bool m_IsOpenSave;
- private bool m_IsOpenLoad;
- private bool m_IsQuittingApplication;
- }
- }
|