123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 |
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- namespace Kasizuki
- {
- public class MaidMiniManagementCtrl : WfScreenChildren
- {
- public override void Awake()
- {
- base.Awake();
- this.m_SwitchingWindowDic = new Dictionary<string, NGUIWindow>();
- this.m_SwitchingWindowDic.Add("ステータス", UTY.GetChildObject(base.root_obj, "MaidMiniStatusPanel", false).GetComponent<NGUIWindow>());
- this.m_SwitchingWindowDic.Add("性癖", UTY.GetChildObject(base.root_obj, "MaidSeihekiPanel", false).GetComponent<NGUIWindow>());
- this.m_SwitchingWindowDic.Add("好感度", UTY.GetChildObject(base.root_obj, "MaidLikabilityPanel", false).GetComponent<NGUIWindow>());
- this.m_SwitchingWindowDic.Add("持ち込みアイテム", UTY.GetChildObject(base.root_obj, "Window Select Item", false).GetComponent<NGUIWindow>());
- this.m_SwitchingWindowDic.Add("パラメータロック", UTY.GetChildObject(base.root_obj, "Window Parameter Lock", false).AddComponent<NGUIWindow>());
- this.m_CharaSelectMgr = UTY.GetChildObject(base.root_obj, "CharacterSelectPanel", false).GetComponent<KasizukiCharacterSelectCtrl>();
- this.m_ButtonDic.Add("エディット", UTY.GetChildObject(base.root_obj, "ButtonParent/エディット", false).GetComponent<UIButton>());
- this.m_ButtonDic.Add("OK", UTY.GetChildObject(base.root_obj, "ButtonParent/OK", false).GetComponent<UIButton>());
- this.m_ButtonDic.Add("Cancel", UTY.GetChildObject(base.root_obj, "ButtonParent/Cancel", false).GetComponent<UIButton>());
- foreach (KeyValuePair<string, UIButton> keyValuePair in this.m_ButtonDic)
- {
- EventDelegate.Add(keyValuePair.Value.onClick, new EventDelegate.Callback(this.OnClickButton));
- }
- this.SetUpParameterLockWindow();
- }
- public void OnEnable()
- {
- this.m_SelectMaid = null;
- this.UpdateMaidInfoButtonEnable(false, true);
- }
- public void Open()
- {
- if (GameMain.Instance.KasizukiMgr.GetNowManType() == 10)
- {
- this.m_SwitchingWindowDic["パラメータロック"].GetCache<WFCheckBox>("好感度").enabled = false;
- this.m_SwitchingWindowDic["パラメータロック"].GetCache<WFCheckBox>("好感度").check = true;
- }
- else
- {
- this.m_SwitchingWindowDic["パラメータロック"].GetCache<WFCheckBox>("好感度").enabled = true;
- this.m_SwitchingWindowDic["パラメータロック"].GetCache<WFCheckBox>("好感度").check = GameMain.Instance.KasizukiMgr.GetSystemData<bool>(SystemDataType.好感度ロック);
- }
- this.UpdateMaidInfoButtonEnable(false, true);
- this.m_CharaSelectMgr.SetData();
- }
- protected override void OnCall()
- {
- this.m_CharaMgr = GameMain.Instance.CharacterMgr;
- this.edit_label_ = (base.parent_mgr as SceneKasizukiMainMenu).strScriptReturnLabelEdit;
- this.SetUpCharacterSelectManager();
- (this.m_SwitchingWindowDic["持ち込みアイテム"] as KasizukiItemCtrl).SetData();
- this.m_SwitchingWindowDic["持ち込みアイテム"].Close(0f, null);
- }
- private void SetUpCharacterSelectManager()
- {
- this.m_CharaSelectMgr.callbackSelectItem = new Action<Maid>(this.OnSelectChara);
- }
- private void SetUpParameterLockWindow()
- {
- KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
- NGUIWindow nguiwindow = this.m_SwitchingWindowDic["パラメータロック"];
- WFCheckBox wfcheckBox = nguiwindow.CacheChildObject<WFCheckBox>("ParentToggle/LockLikability/好感度", "好感度");
- WFCheckBox wfcheckBox2 = nguiwindow.CacheChildObject<WFCheckBox>("ParentToggle/LockPlayCount/仕事回数", "仕事回数");
- wfcheckBox.check = kasizukiMgr.GetSystemData<bool>(SystemDataType.好感度ロック);
- wfcheckBox2.check = kasizukiMgr.GetSystemData<bool>(SystemDataType.仕事回数ロック);
- wfcheckBox.onClick.Add(new Action<WFCheckBox>(this.OnChangeLock));
- wfcheckBox2.onClick.Add(new Action<WFCheckBox>(this.OnChangeLock));
- }
- private void OnSelectChara(Maid select_maid)
- {
- this.m_SelectMaid = select_maid;
- this.UpdateMaidInfoButtonEnable(this.m_SelectMaid != null, false);
- this.m_ButtonDic["OK"].isEnabled = (this.m_SelectMaid != null);
- this.m_ButtonDic["エディット"].gameObject.SetActive(this.m_SelectMaid != null);
- this.m_CharaSelectMgr.bigThumbnail.Visible = (this.m_SelectMaid != null);
- this.m_CharaSelectMgr.bigThumbnail.SetMaid(this.m_SelectMaid);
- this.m_SwitchingWindowDic["ステータス"].GetComponent<IStatusCtrl<Maid>>().SetData(this.m_SelectMaid);
- this.m_SwitchingWindowDic["性癖"].GetComponent<IStatusCtrl<Maid>>().SetData(this.m_SelectMaid);
- this.m_SwitchingWindowDic["好感度"].GetComponent<IStatusCtrl<Maid>>().SetData(this.m_SelectMaid);
- this.m_SwitchingWindowDic["ステータス"].Open(0.25f, null);
- this.m_SwitchingWindowDic["性癖"].Open(0.25f, null);
- this.m_SwitchingWindowDic["好感度"].Open(0.25f, null);
- this.m_SwitchingWindowDic["パラメータロック"].Open(0.25f, null);
- }
- private void OnClickButton()
- {
- string text = string.Empty;
- foreach (KeyValuePair<string, UIButton> keyValuePair in this.m_ButtonDic)
- {
- if (keyValuePair.Value == UIButton.current)
- {
- text = keyValuePair.Key;
- break;
- }
- }
- if (string.IsNullOrEmpty(text))
- {
- Debug.LogWarning("押されたボタンの名前が見つかりませんでした");
- return;
- }
- Debug.LogFormat("ボタン「{0}」が押された", new object[]
- {
- text
- });
- if (text == "エディット")
- {
- if (this.m_SelectMaid == null)
- {
- Debug.LogWarning("メイドが選択されていません");
- return;
- }
- if (string.IsNullOrEmpty(this.edit_label_))
- {
- Debug.LogWarning("エディットの飛び先ラベルがありません");
- return;
- }
- this.m_CharaMgr.SetActiveMaid(this.m_SelectMaid, 0);
- (base.parent_mgr as SceneKasizukiMainMenu).moveScreen.SetNextLabel(this.edit_label_);
- this.Finish();
- }
- else if (text == "OK")
- {
- if (this.m_OnClickOK != null)
- {
- this.m_OnClickOK();
- }
- else
- {
- Debug.LogWarning("OKボタンを押したときのコールバックが未登録です");
- }
- }
- else if (text == "Cancel")
- {
- if (this.m_OnClickCancel != null)
- {
- this.m_OnClickCancel();
- }
- else
- {
- Debug.LogWarning("Cancelボタンを押したときのコールバックが未登録です");
- }
- }
- else if (this.m_SelectMaid == null)
- {
- Debug.LogWarningFormat("ボタン「{0}」を押しましたが、選択しているメイドがnullでした", new object[]
- {
- text
- });
- }
- else
- {
- Debug.LogWarningFormat("ボタン「{0}」の処理はありません", new object[]
- {
- text
- });
- }
- }
- private void OnChangeLock(WFCheckBox checkBox)
- {
- NGUIWindow nguiwindow = this.m_SwitchingWindowDic["パラメータロック"];
- List<UnityEngine.Object> values = nguiwindow.cachedObjectDic.Values;
- if (!values.Contains(checkBox))
- {
- NDebug.Warning(string.Format("クリックされたボタン名に対応するボタンがありません\n{0}", checkBox.name));
- }
- if (!checkBox.GetComponent<Collider>().enabled)
- {
- return;
- }
- string name = checkBox.name;
- bool check = checkBox.check;
- if (name == "好感度")
- {
- KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
- kasizukiMgr.SetSystemData<bool>(SystemDataType.好感度ロック, check, false);
- Debug.LogFormat("好感度ロック:{0}", new object[]
- {
- check
- });
- }
- else if (name == "仕事回数")
- {
- KasizukiManager kasizukiMgr2 = GameMain.Instance.KasizukiMgr;
- kasizukiMgr2.SetSystemData<bool>(SystemDataType.仕事回数ロック, check, false);
- Debug.LogFormat("仕事回数ロック:{0}", new object[]
- {
- check
- });
- }
- }
- public void UpdateMaidInfoButtonEnable(bool isEnable, bool isImmediate = false)
- {
- float num = (!isImmediate) ? 0.25f : 0.01f;
- float num2 = (!isEnable) ? 0f : 1f;
- if (this.m_CharaSelectMgr && this.m_CharaSelectMgr.bigThumbnail)
- {
- this.m_CharaSelectMgr.bigThumbnail.Visible = isEnable;
- }
- }
- public void OpenSwitchingWindow(string name, bool isImmediate = false)
- {
- Dictionary<string, NGUIWindow> switchingWindowDic = this.m_SwitchingWindowDic;
- if (switchingWindowDic == null)
- {
- NDebug.Assert("ウィンドウの配列にnullが指定されました", false);
- }
- if (!switchingWindowDic.ContainsKey(name))
- {
- NDebug.Assert(string.Format("ウィンドウの配列には「{0}」のキーが存在しません", name), false);
- }
- foreach (KeyValuePair<string, NGUIWindow> keyValuePair in switchingWindowDic)
- {
- if (keyValuePair.Key == name)
- {
- if (isImmediate)
- {
- keyValuePair.Value.Open(0.01f, null);
- }
- else
- {
- keyValuePair.Value.Open(0.25f, null);
- }
- }
- else if (isImmediate)
- {
- keyValuePair.Value.Close(0.01f, null);
- }
- else
- {
- keyValuePair.Value.Close(0.25f, null);
- }
- }
- }
- public void CloseSwitchingWindowAll(bool isImmediate = false)
- {
- Dictionary<string, NGUIWindow> switchingWindowDic = this.m_SwitchingWindowDic;
- if (switchingWindowDic == null)
- {
- NDebug.Assert("ウィンドウの配列にnullが指定されました", false);
- }
- foreach (KeyValuePair<string, NGUIWindow> keyValuePair in switchingWindowDic)
- {
- if (isImmediate)
- {
- keyValuePair.Value.Close(0.01f, null);
- }
- else
- {
- keyValuePair.Value.Close(0.25f, null);
- }
- }
- }
- public T GetWindow<T>(string cachedName) where T : MonoBehaviour
- {
- if (!this.m_SwitchingWindowDic.ContainsKey(cachedName))
- {
- NDebug.Assert(string.Format("ウィンドウの配列には「{0}」\nというオブジェクトが存在しません", cachedName), false);
- Debug.LogError(string.Format("ウィンドウの配列には「{0}」\nというオブジェクトが存在しません", cachedName));
- return (T)((object)null);
- }
- NGUIWindow nguiwindow = this.m_SwitchingWindowDic[cachedName];
- T result;
- try
- {
- T t = nguiwindow as T;
- result = t;
- }
- catch (Exception ex)
- {
- NDebug.Assert(ex.ToString(), false);
- Debug.LogError(ex);
- result = (T)((object)null);
- }
- return result;
- }
- protected override void OnFinish()
- {
- SceneKasizukiMainMenu sceneKasizukiMainMenu = base.parent_mgr as SceneKasizukiMainMenu;
- if (sceneKasizukiMainMenu.moveScreen.next_label == this.edit_label_ && this.m_CharaMgr.GetMaid(0) != null)
- {
- this.m_CharaMgr.GetMaid(0).Visible = true;
- }
- if (!string.IsNullOrEmpty(sceneKasizukiMainMenu.moveScreen.next_label))
- {
- sceneKasizukiMainMenu.CallScreen("Move");
- }
- }
- public Action onClickOK
- {
- set
- {
- this.m_OnClickOK = value;
- }
- }
- public Action onClickCancel
- {
- set
- {
- this.m_OnClickCancel = value;
- }
- }
- public Maid selectMaid
- {
- get
- {
- return this.m_SelectMaid;
- }
- set
- {
- this.m_SelectMaid = value;
- }
- }
- public KasizukiCharacterSelectCtrl charaSelectMgr
- {
- get
- {
- return this.m_CharaSelectMgr;
- }
- }
- public Dictionary<string, UIButton> buttonDic
- {
- get
- {
- return this.m_ButtonDic;
- }
- }
- public static string BackUpSelectMaidGUID = string.Empty;
- public static float BackUpBarValue = 0f;
- private Action m_OnClickOK;
- private Action m_OnClickCancel;
- private Maid m_SelectMaid;
- private CharacterMgr m_CharaMgr;
- private KasizukiCharacterSelectCtrl m_CharaSelectMgr;
- private Dictionary<string, UIButton> m_ButtonDic = new Dictionary<string, UIButton>();
- private Dictionary<string, NGUIWindow> m_SwitchingWindowDic;
- private string edit_label_;
- }
- }
|