123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- namespace Kasizuki
- {
- public class KasizukiMainMenu : WfScreenChildren
- {
- public override void Awake()
- {
- base.Awake();
- GameObject gameObject = base.transform.parent.parent.gameObject;
- this.m_SwitchingWindowDic = new Dictionary<string, NGUIWindow>();
- this.m_SwitchingWindowDic.Add("部屋選択", UTY.GetChildObject(gameObject, "Window Select Club", false).GetComponent<NGUIWindow>());
- this.m_SwitchingWindowDic.Add("メインメニュー", base.root_obj.GetComponent<NGUIWindow>());
- this.m_SwitchingWindowDic.Add("メイド情報", UTY.GetChildObject(gameObject, "MaidMiniManagement", false).AddComponent<NGUIWindow>());
- this.m_SwitchingWindowDic.Add("セーブロード", UTY.GetChildObject(gameObject, "SaveAndLoadPanel", false).GetComponent<NGUIWindow>());
- this.m_SwitchingWindowDic.Add("男選択", UTY.GetChildObject(gameObject, "Window Select Man", false).GetComponent<NGUIWindow>());
- this.m_SwitchingWindowDic.Add("施設情報", UTY.GetChildObject(gameObject, "Window Play Info", false).GetComponent<NGUIWindow>());
- this.SetUpMainMenu();
- this.SetUpSelectRoom();
- this.SetUpSaveLoad();
- this.SetUpManSelect();
- this.SetUpPlayInfo();
- }
- protected override void OnCall()
- {
- this.m_SwitchingWindowDic["部屋選択"].GetCache<UIButton>("OK").isEnabled = (KasizukiMainMenu.m_NowSelectingRoom != null);
- this.m_SwitchingWindowDic["メイド情報"].OnOpen = delegate()
- {
- MaidMiniManagementCtrl component = base.parent_mgr.children_dic["MaidInfo"].GetComponent<MaidMiniManagementCtrl>();
- component.buttonDic["エディット"].gameObject.SetActive(component.selectMaid != null);
- };
- if ((base.parent_mgr as SceneKasizukiMainMenu).isReturnEdit)
- {
- MaidMiniManagementCtrl maidMiniManagementCtrl = base.parent_mgr.children_dic["MaidInfo"] as MaidMiniManagementCtrl;
- if (KasizukiMainMenu.m_NowSelectingRoom != null)
- {
- KasizukiCharacterSelectCtrl charaSelect = maidMiniManagementCtrl.charaSelectMgr;
- maidMiniManagementCtrl.selectMaid = null;
- charaSelect.callbackGetMaidList = delegate()
- {
- ManDataType nowManType = (ManDataType)GameMain.Instance.KasizukiMgr.GetNowManType();
- List<PlayData.Data> playDatas = KasizukiMainMenu.m_NowSelectingRoom.GetPlayDatas();
- List<PlayData.Data> list = new List<PlayData.Data>();
- foreach (PlayData.Data data in playDatas)
- {
- if (data.enableManTypeDic[nowManType])
- {
- list.Add(data);
- }
- }
- HashSet<Maid> hashSet = new HashSet<Maid>();
- foreach (PlayData.Data data2 in list)
- {
- List<Maid> filteringPlayDataMaidArray = data2.GetFilteringPlayDataMaidArray(nowManType);
- foreach (Maid item in filteringPlayDataMaidArray)
- {
- hashSet.Add(item);
- }
- }
- charaSelect.callbackGetMaidList = null;
- return new List<Maid>(hashSet);
- };
- }
- this.OpenSwitchingWindow("メイド情報", true);
- this.SetMaidInfoWindowParameter(KasizukiMainMenu.m_BackUpBeforeMaidInfoParameter);
- }
- else
- {
- this.OpenSwitchingWindow("メインメニュー", true);
- }
- if ((base.parent_mgr as SceneKasizukiMainMenu).isUpdateMaidStatus)
- {
- CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
- Maid maid = characterMgr.GetMaid(0);
- if (maid != null)
- {
- Debug.Log("メイドの仕事回数、好感度を更新");
- KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
- bool systemData = kasizukiMgr.GetSystemData<bool>(SystemDataType.仕事回数ロック);
- int num = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.仕事回数, false);
- if (!systemData)
- {
- kasizukiMgr.SetMaidData<int>(maid, MaidDataType.仕事回数, num + 1, false);
- }
- if (!kasizukiMgr.GetSystemData<bool>(SystemDataType.好感度ロック))
- {
- if (kasizukiMgr.GetNowManType() != 10)
- {
- if (kasizukiMgr.GetNowManType() == 20)
- {
- num = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男1, false);
- num += 4;
- kasizukiMgr.SetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男1, num, false);
- }
- else if (kasizukiMgr.GetNowManType() == 30)
- {
- num = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男2, false);
- num += 4;
- kasizukiMgr.SetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男2, num, false);
- }
- else if (kasizukiMgr.GetNowManType() == 40)
- {
- num = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男3, false);
- num += 4;
- kasizukiMgr.SetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男3, num, false);
- }
- else if (kasizukiMgr.GetNowManType() == 50)
- {
- num = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男4, false);
- num += 4;
- kasizukiMgr.SetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男4, num, false);
- }
- else if (kasizukiMgr.GetNowManType() == 60)
- {
- num = kasizukiMgr.GetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男5, false);
- num += 4;
- kasizukiMgr.SetMaidData<int>(maid, MaidDataType.好感度\uFF3F傅き男5, num, false);
- }
- }
- }
- Debug.Log("プレイ回数を更新");
- num = kasizukiMgr.GetSystemData<int>(SystemDataType.プレイ回数);
- num++;
- kasizukiMgr.SetSystemData<int>(SystemDataType.プレイ回数, num, false);
- }
- }
- }
- private void SetUpMainMenu()
- {
- NGUIWindow nguiwindow = this.m_SwitchingWindowDic["メインメニュー"];
- foreach (UIButton uibutton in new List<UIButton>
- {
- nguiwindow.CacheChildObject<UIButton>("parent button/Grid/男選択", "男選択"),
- nguiwindow.CacheChildObject<UIButton>("parent button/Grid/クラブ", "クラブ"),
- nguiwindow.CacheChildObject<UIButton>("parent button/Grid/セーブ", "セーブ"),
- nguiwindow.CacheChildObject<UIButton>("parent button/Grid/ロード", "ロード"),
- nguiwindow.CacheChildObject<UIButton>("parent button/Grid/ヒロイン", "ヒロイン"),
- nguiwindow.CacheChildObject<UIButton>("parent button/Grid/フリー", "フリー"),
- nguiwindow.CacheChildObject<UIButton>("parent button/Grid/タイトルに戻る", "タイトルに戻る")
- })
- {
- EventDelegate.Add(uibutton.onClick, new EventDelegate.Callback(this.OnClickButton));
- }
- }
- private void SetUpSelectRoom()
- {
- NGUIWindow nguiwindow = this.m_SwitchingWindowDic["部屋選択"];
- nguiwindow.CacheChildObject<UIButton>("OK", "OK");
- nguiwindow.CacheChildObject<UIButton>("Cancel", "Cancel");
- EventDelegate.Add(nguiwindow.GetCache<UIButton>("OK").onClick, delegate()
- {
- this.OnOKRoom();
- });
- EventDelegate.Add(nguiwindow.GetCache<UIButton>("Cancel").onClick, delegate()
- {
- this.OpenSwitchingWindow("メインメニュー", false);
- });
- nguiwindow.GetComponent<ClubRoomSelectCtrl>().SetCallbackOnClick(new Action<RoomData.Data>(this.OnSelectRoom));
- }
- private void SetUpSaveLoad()
- {
- NGUIWindow nguiwindow = this.m_SwitchingWindowDic["セーブロード"];
- KasizukiSaveAndLoadCtrl component = nguiwindow.GetComponent<KasizukiSaveAndLoadCtrl>();
- NDebug.Assert(component != null, "セーブロードUIが取得できない");
- KasizukiSaveAndLoadCtrl kasizukiSaveAndLoadCtrl = component;
- kasizukiSaveAndLoadCtrl.onClickCancel = (Action)Delegate.Combine(kasizukiSaveAndLoadCtrl.onClickCancel, new Action(delegate()
- {
- this.OpenSwitchingWindow("メインメニュー", false);
- }));
- KasizukiSaveAndLoadCtrl kasizukiSaveAndLoadCtrl2 = component;
- kasizukiSaveAndLoadCtrl2.onClickNewGame = (Action)Delegate.Combine(kasizukiSaveAndLoadCtrl2.onClickNewGame, new Action(delegate()
- {
- SceneKasizukiMainMenu mgr = base.parent_mgr as SceneKasizukiMainMenu;
- mgr.CameraFadeOut(delegate
- {
- mgr.UpdateMan(delegate
- {
- mgr.CameraFadeIn(null);
- this.OpenSwitchingWindow("メインメニュー", true);
- });
- }, 0.5f);
- }));
- KasizukiSaveAndLoadCtrl kasizukiSaveAndLoadCtrl3 = component;
- kasizukiSaveAndLoadCtrl3.onLoad = (Action)Delegate.Combine(kasizukiSaveAndLoadCtrl3.onLoad, new Action(delegate()
- {
- SceneKasizukiMainMenu mgr = base.parent_mgr as SceneKasizukiMainMenu;
- mgr.CameraFadeOut(delegate
- {
- mgr.UpdateMan(delegate
- {
- mgr.CameraFadeIn(null);
- this.OpenSwitchingWindow("メインメニュー", true);
- });
- }, 0.5f);
- }));
- KasizukiSaveAndLoadCtrl kasizukiSaveAndLoadCtrl4 = component;
- kasizukiSaveAndLoadCtrl4.onSave = (Action)Delegate.Combine(kasizukiSaveAndLoadCtrl4.onSave, new Action(delegate()
- {
- int nowOriginSaveDataNumber = GameMain.Instance.KasizukiMgr.NowOriginSaveDataNumber;
- if (GameMain.Instance.GetSaveDataHeader(nowOriginSaveDataNumber) == null)
- {
- NDebug.Assert("本編セーブデータ" + nowOriginSaveDataNumber + "番の取得に失敗しました", false);
- return;
- }
- GameMain.Instance.SerializeKasizukiOnly(nowOriginSaveDataNumber);
- }));
- KasizukiSaveAndLoadCtrl kasizukiSaveAndLoadCtrl5 = component;
- kasizukiSaveAndLoadCtrl5.onDelete = (Action)Delegate.Combine(kasizukiSaveAndLoadCtrl5.onDelete, new Action(delegate()
- {
- int nowOriginSaveDataNumber = GameMain.Instance.KasizukiMgr.NowOriginSaveDataNumber;
- if (GameMain.Instance.GetSaveDataHeader(nowOriginSaveDataNumber) == null)
- {
- NDebug.Assert("本編セーブデータ" + nowOriginSaveDataNumber + "番の取得に失敗しました", false);
- return;
- }
- GameMain.Instance.SerializeKasizukiOnly(nowOriginSaveDataNumber);
- }));
- }
- private void SetUpManSelect()
- {
- NGUIWindow nguiwindow = this.m_SwitchingWindowDic["男選択"];
- nguiwindow.CacheChildObject<UIButton>("OK", "OK");
- nguiwindow.CacheChildObject<UIButton>("Cancel", "Cancel");
- EventDelegate.Add(nguiwindow.GetCache<UIButton>("OK").onClick, delegate()
- {
- this.OpenSwitchingWindow("メインメニュー", false);
- });
- EventDelegate.Add(nguiwindow.GetCache<UIButton>("Cancel").onClick, delegate()
- {
- this.OpenSwitchingWindow("メインメニュー", false);
- });
- KasizukiManSelectCtrl compManSelect = nguiwindow.GetComponent<KasizukiManSelectCtrl>();
- if (compManSelect)
- {
- NGUIWindow nguiwindow2 = nguiwindow;
- nguiwindow2.OnOpen = (Action)Delegate.Combine(nguiwindow2.OnOpen, new Action(delegate()
- {
- int nowManType = GameMain.Instance.KasizukiMgr.GetNowManType();
- compManSelect.OnClickManListButton(nowManType);
- }));
- KasizukiManSelectCtrl compManSelect2 = compManSelect;
- compManSelect2.OnClickManTypeButton = (Action<int>)Delegate.Combine(compManSelect2.OnClickManTypeButton, new Action<int>(delegate(int manTypeID)
- {
- KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
- kasizukiMgr.SetNowManType(manTypeID);
- SceneKasizukiMainMenu sceneMgr = this.parent_mgr as SceneKasizukiMainMenu;
- sceneMgr.UpdateMan(delegate
- {
- sceneMgr.CameraFadeIn(null);
- });
- }));
- }
- }
- private void SetUpPlayInfo()
- {
- NGUIWindow window = this.m_SwitchingWindowDic["施設情報"];
- window.CacheChildObject<UIButton>("OK", "OK");
- window.CacheChildObject<UIButton>("Cancel", "Cancel");
- KasizukiPlayInfoCtrl comp = window.GetComponent<KasizukiPlayInfoCtrl>();
- RoomData.Data selectingRoomData = null;
- ManData.Data selectingManData = null;
- PlayData.Data selectingPlayData = null;
- EventDelegate.Add(window.GetCache<UIButton>("OK").onClick, delegate()
- {
- MaidMiniManagementCtrl maidMiniManagementCtrl = this.parent_mgr.children_dic["MaidInfo"] as MaidMiniManagementCtrl;
- this.StartFree(maidMiniManagementCtrl.selectMaid, selectingRoomData, selectingManData, selectingPlayData);
- });
- EventDelegate.Set(window.GetCache<UIButton>("Cancel").onClick, delegate()
- {
- this.OpenSwitchingWindow("メインメニュー", false);
- });
- Action actResetDescriptionWindow = delegate()
- {
- UILabel cache = comp.descriptionCache.GetCache<UILabel>("説明文");
- uGUIListViewer cache2 = comp.descriptionCache.GetCache<uGUIListViewer>("条件一覧");
- cache.text = string.Empty;
- cache2.ResetList();
- };
- Action<PlayData.Data> actSetDescriptionWindow = delegate(PlayData.Data playData)
- {
- UILabel cache = comp.descriptionCache.GetCache<UILabel>("説明文");
- cache.text = playData.strDescription;
- uGUIListViewer cache2 = comp.descriptionCache.GetCache<uGUIListViewer>("条件一覧");
- string[] strConditionArray = playData.strConditionArray;
- cache2.Show<Transform>(strConditionArray.Length, delegate(int index, Transform trans)
- {
- UILabel component = UTY.GetChildObject(trans.gameObject, "Value", false).GetComponent<UILabel>();
- UILabel component2 = UTY.GetChildObject(trans.gameObject, "Number", false).GetComponent<UILabel>();
- component.text = strConditionArray[index];
- component2.text = (index + 1).ToString();
- });
- cache2.GetComponent<UIGrid>().Reposition();
- };
- Action<RoomData.Data, ManData.Data, PlayData.Data> actSetOKButtonEnable = delegate(RoomData.Data roomData, ManData.Data manData, PlayData.Data playData)
- {
- UIButton cache = window.GetCache<UIButton>("OK");
- cache.isEnabled = (roomData != null && manData != null && playData != null);
- };
- NGUIWindow window2 = window;
- window2.OnOpen = (Action)Delegate.Combine(window2.OnOpen, new Action(delegate()
- {
- selectingManData = ManData.GetData(GameMain.Instance.KasizukiMgr.GetNowManType());
- List<RoomData.Data> datas;
- if (!GameMain.Instance.CharacterMgr.status.lockNTRPlay)
- {
- datas = RoomData.GetDatas(delegate(RoomData.Data data)
- {
- if (!data.isExistUpwardRoom)
- {
- return false;
- }
- if (data.isOnlyNTR)
- {
- return false;
- }
- MaidMiniManagementCtrl maidMiniManagementCtrl = this.parent_mgr.children_dic["MaidInfo"] as MaidMiniManagementCtrl;
- foreach (PlayData.Data data2 in data.GetPlayDatas())
- {
- if (data2.IsCorrectPersonal(maidMiniManagementCtrl.selectMaid))
- {
- return true;
- }
- }
- return false;
- });
- }
- else
- {
- datas = RoomData.GetDatas(delegate(RoomData.Data data)
- {
- RoomData.Data subordinateRoomData = data.GetSubordinateRoomData();
- if (subordinateRoomData != null)
- {
- return false;
- }
- if (!data.enableManTypeDic[ManDataType.主人公])
- {
- return false;
- }
- if (!data.isEnableNTR && !data.isOnlyNTR)
- {
- return false;
- }
- List<PlayData.Data> playDatas = data.GetPlayDatas();
- for (int i = 0; i < playDatas.Count; i++)
- {
- if (playDatas[i].enableManTypeDic[ManDataType.主人公])
- {
- return true;
- }
- }
- return false;
- });
- }
- comp.OpenRoomList(datas, selectingRoomData);
- if (selectingRoomData != null)
- {
- comp.onClickRoom(selectingRoomData);
- }
- actResetDescriptionWindow();
- actSetOKButtonEnable(selectingRoomData, selectingManData, selectingPlayData);
- }));
- KasizukiPlayInfoCtrl comp6 = comp;
- comp6.onClickRoom = (Action<RoomData.Data>)Delegate.Combine(comp6.onClickRoom, new Action<RoomData.Data>(delegate(RoomData.Data roomData)
- {
- selectingRoomData = roomData;
- comp.OpenManList(ManData.GetAllDatas(true, true), selectingManData, delegate(UIWFTabButton item, ManData.Data data)
- {
- bool flag = false;
- MaidMiniManagementCtrl maidMiniManagementCtrl = this.parent_mgr.children_dic["MaidInfo"] as MaidMiniManagementCtrl;
- foreach (PlayData.Data data2 in selectingRoomData.GetPlayDatas())
- {
- if (data2.enableManTypeDic[data.manType] && data2.IsCorrectPersonal(maidMiniManagementCtrl.selectMaid))
- {
- flag = true;
- break;
- }
- }
- if (!flag && item.isSelected)
- {
- item.SetSelect(false);
- }
- item.gameObject.SetActive(flag);
- });
- List<PlayData.Data> datas = PlayData.GetDatas(delegate(PlayData.Data data)
- {
- if (data.roomID != selectingRoomData.ID)
- {
- return false;
- }
- if (!data.enableManTypeDic[selectingManData.manType])
- {
- return false;
- }
- MaidMiniManagementCtrl maidMiniManagementCtrl = this.parent_mgr.children_dic["MaidInfo"] as MaidMiniManagementCtrl;
- return data.IsCorrectPersonal(maidMiniManagementCtrl.selectMaid);
- });
- comp.OpenPlayList(datas, null);
- actResetDescriptionWindow();
- selectingPlayData = null;
- actSetOKButtonEnable(selectingRoomData, selectingManData, selectingPlayData);
- }));
- KasizukiPlayInfoCtrl comp2 = comp;
- comp2.onClickMan = (Action<ManData.Data>)Delegate.Combine(comp2.onClickMan, new Action<ManData.Data>(delegate(ManData.Data manData)
- {
- selectingManData = manData;
- List<PlayData.Data> datas = PlayData.GetDatas((PlayData.Data data) => data.roomID == selectingRoomData.ID && data.enableManTypeDic[selectingManData.manType]);
- comp.OpenPlayList(datas, null);
- actResetDescriptionWindow();
- selectingPlayData = null;
- actSetOKButtonEnable(selectingRoomData, selectingManData, selectingPlayData);
- }));
- KasizukiPlayInfoCtrl comp3 = comp;
- comp3.onClickPlay = (Action<PlayData.Data>)Delegate.Combine(comp3.onClickPlay, new Action<PlayData.Data>(delegate(PlayData.Data playData)
- {
- selectingPlayData = playData;
- actSetDescriptionWindow(selectingPlayData);
- actSetOKButtonEnable(selectingRoomData, selectingManData, selectingPlayData);
- }));
- KasizukiPlayInfoCtrl comp4 = comp;
- comp4.onHoverPlay = (Action<PlayData.Data>)Delegate.Combine(comp4.onHoverPlay, new Action<PlayData.Data>(delegate(PlayData.Data playData)
- {
- actSetDescriptionWindow(playData);
- }));
- KasizukiPlayInfoCtrl comp5 = comp;
- comp5.onOutPlay = (Action<PlayData.Data>)Delegate.Combine(comp5.onOutPlay, new Action<PlayData.Data>(delegate(PlayData.Data playData)
- {
- if (selectingPlayData == null)
- {
- actResetDescriptionWindow();
- }
- else
- {
- actSetDescriptionWindow(selectingPlayData);
- }
- }));
- }
- protected void OnClickButton()
- {
- NGUIWindow nguiwindow = this.m_SwitchingWindowDic["メインメニュー"];
- List<UnityEngine.Object> values = nguiwindow.cachedObjectDic.Values;
- if (!values.Contains(UIButton.current))
- {
- NDebug.Warning(string.Format("クリックされたボタン名に対応するボタンがありません\n{0}", UIButton.current.name));
- }
- string name = UIButton.current.name;
- if (name == "男選択")
- {
- this.OpenSwitchingWindow("男選択", false);
- }
- else if (name == "クラブ")
- {
- if (!this.CheckPlayableRoom())
- {
- GameMain.Instance.SysDlg.Show("利用可能な施設がありません。", SystemDialog.TYPE.OK, null, null);
- return;
- }
- if (!this.CheckPlayableMaid())
- {
- GameMain.Instance.SysDlg.Show("プレイ可能なメイドがいません。", SystemDialog.TYPE.OK, null, null);
- return;
- }
- this.OnSelectRoom(null);
- this.OpenSwitchingWindow("部屋選択", false);
- (this.m_SwitchingWindowDic["部屋選択"] as ClubRoomSelectCtrl).SetData();
- }
- else if (name == "セーブ")
- {
- this.OpenSwitchingWindow("セーブロード", false);
- KasizukiSaveAndLoadCtrl component = this.m_SwitchingWindowDic["セーブロード"].GetComponent<KasizukiSaveAndLoadCtrl>();
- component.Open(SaveAndLoadMgr.ViewType.Save, true);
- }
- else if (name == "ロード")
- {
- this.OpenSwitchingWindow("セーブロード", false);
- KasizukiSaveAndLoadCtrl component2 = this.m_SwitchingWindowDic["セーブロード"].GetComponent<KasizukiSaveAndLoadCtrl>();
- component2.Open(SaveAndLoadMgr.ViewType.Load, true);
- }
- else if (name == "ヒロイン")
- {
- this.OpenSwitchingWindow("メイド情報", false);
- this.SetMaidInfoWindowParameter("ヒロイン情報");
- }
- else if (name == "フリー")
- {
- this.OpenSwitchingWindow("メイド情報", false);
- this.SetMaidInfoWindowParameter("フリーモード");
- }
- else if (name == "タイトルに戻る")
- {
- GameMain.Instance.SysDlg.Show("保存されていない情報は失われます。\nタイトルに戻りますか?", SystemDialog.TYPE.YES_NO, delegate
- {
- GameMain.Instance.SysDlg.Close();
- GameMain.Instance.LoadScene("SceneToTitle");
- GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
- }, delegate
- {
- GameMain.Instance.SysDlg.Close();
- });
- }
- }
- 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);
- }
- if (name == "メインメニュー")
- {
- MaidMiniManagementCtrl maidMiniManagementCtrl = base.parent_mgr.children_dic["MaidInfo"] as MaidMiniManagementCtrl;
- maidMiniManagementCtrl.selectMaid = null;
- }
- 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);
- }
- }
- }
- private bool CheckPlayableRoom()
- {
- ManDataType nowManType = (ManDataType)GameMain.Instance.KasizukiMgr.GetNowManType();
- foreach (RoomData.Data data in RoomData.GetAllDatas(true))
- {
- if (data.enableManTypeDic[nowManType])
- {
- if (data.IsExistFacility())
- {
- return true;
- }
- }
- }
- return false;
- }
- private bool CheckPlayableMaid()
- {
- ManDataType nowManType = (ManDataType)GameMain.Instance.KasizukiMgr.GetNowManType();
- foreach (RoomData.Data data in RoomData.GetAllDatas(true))
- {
- if (data.enableManTypeDic[nowManType])
- {
- if (data.IsExistFacility())
- {
- foreach (PlayData.Data data2 in data.GetPlayDatas())
- {
- if (data2.enableManTypeDic[nowManType])
- {
- List<Maid> filteringPlayDataMaidArray = data2.GetFilteringPlayDataMaidArray(nowManType);
- if (filteringPlayDataMaidArray != null && filteringPlayDataMaidArray.Count > 0)
- {
- return true;
- }
- }
- }
- }
- }
- }
- return false;
- }
- private void OnSelectRoom(RoomData.Data roomData)
- {
- KasizukiMainMenu.m_NowSelectingRoom = roomData;
- this.m_SwitchingWindowDic["部屋選択"].GetCache<UIButton>("OK").isEnabled = (KasizukiMainMenu.m_NowSelectingRoom != null);
- }
- private void OnOKRoom()
- {
- if (KasizukiMainMenu.m_NowSelectingRoom == null)
- {
- NDebug.Warning("現在選択している部屋の情報がnullでした");
- return;
- }
- MaidMiniManagementCtrl maidMiniManagementCtrl = base.parent_mgr.children_dic["MaidInfo"] as MaidMiniManagementCtrl;
- KasizukiCharacterSelectCtrl charaSelect = maidMiniManagementCtrl.charaSelectMgr;
- maidMiniManagementCtrl.selectMaid = null;
- charaSelect.callbackGetMaidList = delegate()
- {
- ManDataType nowManType = (ManDataType)GameMain.Instance.KasizukiMgr.GetNowManType();
- List<PlayData.Data> playDatas = KasizukiMainMenu.m_NowSelectingRoom.GetPlayDatas();
- List<PlayData.Data> list = new List<PlayData.Data>();
- foreach (PlayData.Data data in playDatas)
- {
- if (data.enableManTypeDic[nowManType])
- {
- list.Add(data);
- }
- }
- HashSet<Maid> hashSet = new HashSet<Maid>();
- foreach (PlayData.Data data2 in list)
- {
- List<Maid> filteringPlayDataMaidArray = data2.GetFilteringPlayDataMaidArray(nowManType);
- foreach (Maid item in filteringPlayDataMaidArray)
- {
- hashSet.Add(item);
- }
- }
- charaSelect.callbackGetMaidList = null;
- return new List<Maid>(hashSet);
- };
- GameMain.Instance.KasizukiMgr.SetSystemData<int>(SystemDataType.選択部屋, KasizukiMainMenu.m_NowSelectingRoom.ID, true);
- this.OpenSwitchingWindow("メイド情報", false);
- this.SetMaidInfoWindowParameter("ヒロイン選択");
- }
- private void SetMaidInfoWindowParameter(string openType)
- {
- MaidMiniManagementCtrl window = base.parent_mgr.children_dic["MaidInfo"] as MaidMiniManagementCtrl;
- window.Open();
- window.Call();
- if (openType == "ヒロイン情報")
- {
- window.onClickOK = delegate()
- {
- this.OpenSwitchingWindow("メインメニュー", false);
- };
- window.buttonDic["OK"].isEnabled = true;
- window.buttonDic["Cancel"].gameObject.SetActive(false);
- if (window.selectMaid == null)
- {
- window.CloseSwitchingWindowAll(true);
- }
- window.UpdateMaidInfoButtonEnable(window.selectMaid != null, true);
- MaidMiniStatusCtrl window4 = window.GetWindow<MaidMiniStatusCtrl>("ステータス");
- Collider component = window4.GetCache<UIInput>("FreeComment").GetComponent<Collider>();
- component.enabled = true;
- window4.GetCache<MaidAppealComment>("Appeal").SetEnableEditing(true);
- window.GetWindow<NGUIWindow>("パラメータロック").transform.localScale = Vector3.one;
- }
- else if (openType == "ヒロイン選択")
- {
- window.onClickOK = delegate()
- {
- this.StartSenario(window.selectMaid, KasizukiMainMenu.m_NowSelectingRoom);
- };
- window.onClickCancel = delegate()
- {
- this.OpenSwitchingWindow("部屋選択", false);
- this.OnSelectRoom(null);
- (this.m_SwitchingWindowDic["部屋選択"] as ClubRoomSelectCtrl).SetData();
- };
- window.buttonDic["OK"].isEnabled = (window.selectMaid != null);
- window.buttonDic["Cancel"].gameObject.SetActive(true);
- if (window.selectMaid == null)
- {
- window.CloseSwitchingWindowAll(true);
- }
- window.UpdateMaidInfoButtonEnable(window.selectMaid != null, true);
- MaidMiniStatusCtrl window2 = window.GetWindow<MaidMiniStatusCtrl>("ステータス");
- Collider component2 = window2.GetCache<UIInput>("FreeComment").GetComponent<Collider>();
- component2.enabled = false;
- window2.GetCache<MaidAppealComment>("Appeal").SetEnableEditing(false);
- window.GetWindow<NGUIWindow>("パラメータロック").transform.localScale = Vector3.one;
- }
- else if (openType == "フリーモード")
- {
- window.onClickOK = delegate()
- {
- this.OpenSwitchingWindow("施設情報", false);
- UIButton cache = this.m_SwitchingWindowDic["施設情報"].GetCache<UIButton>("Cancel");
- EventDelegate.Set(cache.onClick, delegate()
- {
- this.OpenSwitchingWindow("メイド情報", false);
- this.SetMaidInfoWindowParameter("フリーモード");
- });
- };
- window.onClickCancel = delegate()
- {
- this.OpenSwitchingWindow("メインメニュー", false);
- };
- window.buttonDic["OK"].isEnabled = (window.selectMaid != null);
- window.buttonDic["Cancel"].gameObject.SetActive(true);
- if (window.selectMaid == null)
- {
- window.CloseSwitchingWindowAll(true);
- }
- window.UpdateMaidInfoButtonEnable(window.selectMaid != null, true);
- MaidMiniStatusCtrl window3 = window.GetWindow<MaidMiniStatusCtrl>("ステータス");
- Collider component3 = window3.GetCache<UIInput>("FreeComment").GetComponent<Collider>();
- component3.enabled = false;
- window3.GetCache<MaidAppealComment>("Appeal").SetEnableEditing(false);
- window.GetWindow<NGUIWindow>("パラメータロック").transform.localScale = Vector3.zero;
- }
- else
- {
- NDebug.Warning(string.Format("メイド情報ウィンドウのレイアウト設定の文字列が対応していません\n渡された文字列:{0}", openType));
- }
- KasizukiMainMenu.m_BackUpBeforeMaidInfoParameter = openType;
- }
- private void StartSenario(Maid targetMaid, RoomData.Data targetRoom)
- {
- ManData.Data data = ManData.GetData(GameMain.Instance.KasizukiMgr.GetNowManType());
- Debug.LogFormat("傅きモードのシナリオを開始します\r\n選択状態↓\r\nメイド:{0}\r\n選択した部屋:{1}\r\n選択した男:{2}\r\n", new object[]
- {
- targetMaid.status.fullNameJpStyle,
- targetRoom.drawName,
- data.drawName
- });
- PlayData.Data optimalConditionData = PlayData.GetOptimalConditionData(targetMaid, targetRoom, data.manType);
- string scenarioFileNameReplace = optimalConditionData.GetScenarioFileNameReplace(targetMaid);
- Debug.LogFormat("呼び出すシナリオは「{0}」になりました", new object[]
- {
- scenarioFileNameReplace
- });
- if (!GameUty.FileSystem.IsExistentFile(scenarioFileNameReplace + ".ks"))
- {
- NDebug.Warning(string.Format("シナリオファイル「{0}」が見つかりません。\nシナリオ呼び出しは行いません。", scenarioFileNameReplace + ".ks"));
- return;
- }
- SceneKasizukiMainMenu sceneKasizukiMainMenu = base.parent_mgr as SceneKasizukiMainMenu;
- if (!sceneKasizukiMainMenu.moveScreen.IsExistNextLabel())
- {
- sceneKasizukiMainMenu.moveScreen.SetNextLabel(sceneKasizukiMainMenu.strScriptReturnLabel);
- }
- this.Finish();
- }
- private void StartFree(Maid targetMaid, RoomData.Data targetRoom, ManData.Data targetMan, PlayData.Data targetPlay)
- {
- if (!this.CheckCorrectPlayData(targetMaid, targetMan, targetPlay))
- {
- return;
- }
- Debug.LogFormat("傅きモードの回想を開始します\r\n選択状態↓\r\nメイド:{0}\r\n選択した部屋:{1}\r\n選択した男:{2}\r\n選択したプレイ情報:{3}\r\n", new object[]
- {
- targetMaid.status.fullNameJpStyle,
- targetRoom.drawName,
- targetMan.drawName,
- targetPlay.drawName
- });
- string scenarioFileNameReplace = targetPlay.GetScenarioFileNameReplace(targetMaid);
- Debug.LogFormat("呼び出すシナリオは「{0}」になりました", new object[]
- {
- scenarioFileNameReplace
- });
- if (!GameUty.FileSystem.IsExistentFile(scenarioFileNameReplace + ".ks"))
- {
- NDebug.Warning(string.Format("シナリオファイル「{0}」が見つかりません。\nシナリオ呼び出しは行いません。", scenarioFileNameReplace + ".ks"));
- return;
- }
- Debug.Log("システムデータのフラグを一時的に書き換え");
- KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
- kasizukiMgr.SetSystemData<int>(SystemDataType.選択部屋, targetRoom.ID, false);
- kasizukiMgr.SetNowManType(targetMan.ID);
- GameMain.Instance.ScriptMgr.EvalScript("tf['傅き再生_ファイル名'] = '" + scenarioFileNameReplace + "';");
- SceneKasizukiMainMenu sceneKasizukiMainMenu = base.parent_mgr as SceneKasizukiMainMenu;
- if (!sceneKasizukiMainMenu.moveScreen.IsExistNextLabel())
- {
- sceneKasizukiMainMenu.moveScreen.SetNextLabel(sceneKasizukiMainMenu.strScriptReturnLabelFree);
- }
- this.Finish();
- }
- private bool CheckCorrectPlayData(Maid targetMaid, ManData.Data targetMan, PlayData.Data targetPlay)
- {
- NDebug.AssertNull(targetMaid != null);
- NDebug.AssertNull(targetMan != null);
- NDebug.AssertNull(targetPlay != null);
- if (!targetPlay.IsCorrectPersonal(targetMaid))
- {
- GameMain.Instance.SysDlg.Show("メイドの性格が対応していません。", SystemDialog.TYPE.OK, null, null);
- return false;
- }
- return true;
- }
- protected override void OnFinish()
- {
- this.CloseSwitchingWindowAll(true);
- KasizukiManager kasizukiMgr = GameMain.Instance.KasizukiMgr;
- Maid man = kasizukiMgr.GetMan();
- kasizukiMgr.SetManModel(man, (ManDataType)kasizukiMgr.GetNowManType());
- kasizukiMgr.UpdateManModel(man, null);
- man.Visible = false;
- CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
- MaidMiniManagementCtrl maidMiniManagementCtrl = base.parent_mgr.children_dic["MaidInfo"] as MaidMiniManagementCtrl;
- characterMgr.SetActiveMaid(maidMiniManagementCtrl.selectMaid, 0);
- maidMiniManagementCtrl.selectMaid.Visible = true;
- maidMiniManagementCtrl.selectMaid.AllProcPropSeqStart();
- base.StartCoroutine(this.CoroutineWaitPropSeq(maidMiniManagementCtrl.selectMaid, delegate
- {
- SceneKasizukiMainMenu sceneKasizukiMainMenu = base.parent_mgr as SceneKasizukiMainMenu;
- if (!string.IsNullOrEmpty(sceneKasizukiMainMenu.moveScreen.next_label))
- {
- sceneKasizukiMainMenu.CallScreen("Move");
- }
- }));
- }
- private IEnumerator CoroutineWaitPropSeq(Maid target, Action callback)
- {
- while (target.IsBusy)
- {
- yield return null;
- }
- if (callback != null)
- {
- callback();
- }
- yield break;
- }
- private static string m_BackUpBeforeMaidInfoParameter = string.Empty;
- private const string STR_MESSAGE_NOTHING_ROOM = "利用可能な施設がありません。";
- private const string STR_MESSAGE_NOTHING_MAID = "プレイ可能なメイドがいません。";
- private const string STR_MESSAGE_END = "保存されていない情報は失われます。\nタイトルに戻りますか?";
- private const string STR_MESSAGE_INCORRECT_PERSONAL = "メイドの性格が対応していません。";
- private static RoomData.Data m_NowSelectingRoom;
- private Dictionary<string, NGUIWindow> m_SwitchingWindowDic;
- }
- }
|