123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334 |
- using System;
- using UnityEngine;
- namespace scoutmode
- {
- public class ScoutMainScreenManager : WfScreenChildren
- {
- public new SceneScoutScreenManager parent_mgr
- {
- get
- {
- return base.parent_mgr as SceneScoutScreenManager;
- }
- }
- public ScoutMaidData scoutingMaidData { get; private set; }
- public ScoutMaidData selectedScoutMaid { get; private set; }
- public string SelectedStageName
- {
- get
- {
- return this.progressInformation.SelectStage.ToString();
- }
- }
- private ScoutManager Manager
- {
- get
- {
- return ScoutManager.Instance;
- }
- }
- public override void Awake()
- {
- base.Awake();
- if (this.menus != null)
- {
- ScoutMainScreenManager.MenuButton[] array = this.menus;
- for (int i = 0; i < array.Length; i++)
- {
- ScoutMainScreenManager.MenuButton menu = array[i];
- ScoutMainScreenManager $this = this;
- if (menu.button != null)
- {
- EventDelegate.Add(menu.button.onClick, delegate()
- {
- $this.OnClickMenuButton(menu.type);
- });
- }
- }
- }
- }
- protected override void OnCall()
- {
- GameMain.Instance.MainLight.Reset();
- GameMain.Instance.CharacterMgr.ResetCharaPosAll();
- GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
- GameMain.Instance.CharacterMgr.DeactivateCharaAll();
- GameMain.Instance.CharacterMgr.Deactivate(0, false);
- GameMain.Instance.SoundMgr.PlayBGM("BGM015.ogg", 1f, true);
- GameMain.Instance.BgMgr.ChangeBg((!GameMain.Instance.CharacterMgr.status.isDaytime) ? "ShinShitsumu_ChairRot_Night" : "ShinShitsumu_ChairRot");
- this.showStatusPanel = false;
- this.OnSelectedScoutMaid(null);
- this.scoutCharaSelect.callbackGetScoutMaidList = (() => this.Manager.scoutMaidList);
- this.scoutCharaSelect.callbackSelectItem = new Action<ScoutMaidData>(this.OnSelectedScoutMaid);
- this.scoutCharaSelect.SetData();
- this.progressInformation.SetStage((!GameMain.Instance.CharacterMgr.status.isDaytime) ? ScoutProgressInformation.Stage.Club : ScoutProgressInformation.Stage.ShoppingMall);
- foreach (ScoutMaidData scoutMaidData in this.Manager.scoutMaidList)
- {
- if (scoutMaidData.instanceData.enabled && scoutMaidData.instanceData.stageName == this.SelectedStageName)
- {
- this.scoutingMaidData = scoutMaidData;
- break;
- }
- }
- this.UpdateProgressInfoCharacter();
- ScoutOption scoutOption = this.scoutOption;
- scoutOption.onChangeValue = (Action<ScoutOption.SettingType, string>)Delegate.Combine(scoutOption.onChangeValue, new Action<ScoutOption.SettingType, string>(delegate(ScoutOption.SettingType type, string value)
- {
- if (type == ScoutOption.SettingType.BaseChara)
- {
- this.UpdateProgressInfoCharacter();
- }
- }));
- foreach (ScoutMainScreenManager.MenuButton menuButton in this.menus)
- {
- if (menuButton.type == ScoutMainScreenManager.ButtonType.Cancel)
- {
- menuButton.button.transform.parent.gameObject.SetActive(false);
- break;
- }
- }
- uGUITutorialPanel.OpenTutorial("SceneScout", null, false);
- GameMain.Instance.SysShortcut.strSceneHelpName = "SceneScout";
- }
- public void OnClickMenuButton(ScoutMainScreenManager.ButtonType type)
- {
- Debug.Log(type.ToString());
- if (type == ScoutMainScreenManager.ButtonType.AddScoutMaid)
- {
- this.AddScoutMaid();
- }
- else if (type == ScoutMainScreenManager.ButtonType.DeleteScoutMaid)
- {
- this.DeleteScoutMaid(this.scoutCharaSelect.selectedMaidData);
- }
- else if (type == ScoutMainScreenManager.ButtonType.Start)
- {
- this.StartScout();
- }
- else if (type == ScoutMainScreenManager.ButtonType.ShowStatus)
- {
- this.showStatusPanel = !this.showStatusPanel;
- this.UpdateShowPanels();
- }
- else if (type == ScoutMainScreenManager.ButtonType.Exist)
- {
- this.parent_mgr.CallExist(this);
- }
- else if (type == ScoutMainScreenManager.ButtonType.Cancel)
- {
- this.Manager.CancelScout(this.scoutingMaidData);
- this.scoutingMaidData = null;
- this.UpdateProgressInfoCharacter();
- this.UpdateShowPanels();
- }
- }
- private bool StartScout()
- {
- ScoutMaidData callScoutMaid = null;
- if (this.scoutingMaidData == null)
- {
- callScoutMaid = this.selectedScoutMaid;
- if (!ScoutManager.Instance.options.baseCharaSelect)
- {
- callScoutMaid = this.Manager.GetRandomWaitingScoutmaid();
- }
- else if (callScoutMaid != null && callScoutMaid.instanceData.enabled)
- {
- GameMain.Instance.SysDlg.Show("指定キャラクターは既にスカウト中のため開始できません", SystemDialog.TYPE.OK, null, null);
- return false;
- }
- if (callScoutMaid == null)
- {
- GameMain.Instance.SysDlg.Show("新たにスカウトを開始するメイドが存在しません", SystemDialog.TYPE.OK, null, null);
- return false;
- }
- this.Manager.CreateRandomScoutMaidData(callScoutMaid, ScoutManager.Instance.options);
- }
- else
- {
- foreach (ScoutMaidData scoutMaidData in this.Manager.scoutMaidList)
- {
- if (scoutMaidData.instanceData.enabled && scoutMaidData.instanceData.stageName == this.SelectedStageName)
- {
- callScoutMaid = scoutMaidData;
- break;
- }
- }
- }
- if (callScoutMaid == null)
- {
- return false;
- }
- this.onFinishEvent = delegate()
- {
- this.Manager.StartScout(this.Manager.ActiveScoutMaid(callScoutMaid, 0), this.SelectedStageName, ScoutManager.Instance.options);
- this.progressInformation.ChangeBg(this.progressInformation.SelectStage);
- };
- this.parent_mgr.CallStart(this);
- return true;
- }
- private void AddScoutMaid()
- {
- this.onFinishEvent = delegate()
- {
- Maid maid = GameMain.Instance.CharacterMgr.AddStockMaid();
- maid.Visible = true;
- GameMain.Instance.CharacterMgr.SetActiveMaid(maid, 0);
- };
- this.parent_mgr.CallAddScoutCharacter(this);
- }
- private void DeleteScoutMaid(ScoutMaidData scoutMaid)
- {
- if (scoutMaid == null)
- {
- return;
- }
- if (scoutMaid.instanceData.enabled)
- {
- GameMain.Instance.SysDlg.Show("スカウト中のため削除できません", SystemDialog.TYPE.OK, null, null);
- return;
- }
- this.Manager.RemoveScoutMaid(scoutMaid);
- this.scoutCharaSelect.DeleteItem(scoutMaid);
- if (this.scoutCharaSelect.selectedMaidData == null)
- {
- this.OnSelectedScoutMaid(null);
- }
- }
- public void OnSelectedScoutMaid(ScoutMaidData scoutMaid)
- {
- foreach (ScoutMainScreenManager.MenuButton menuButton in this.menus)
- {
- if (!(menuButton.button == null) && ScoutMainScreenManager.ButtonType.Start > menuButton.type)
- {
- if (menuButton.type == ScoutMainScreenManager.ButtonType.DeleteScoutMaid || menuButton.type == ScoutMainScreenManager.ButtonType.ShowStatus)
- {
- menuButton.button.isEnabled = (scoutMaid != null);
- }
- }
- }
- if (scoutMaid != null)
- {
- this.scoutCharaSelect.bigThumbnail.SetFile(new string[]
- {
- ScoutMaidData.GetThumbnailFilePath(scoutMaid.status.guid, true),
- ScoutMaidData.GetThumbnailFilePath(scoutMaid.status.guid, false)
- });
- }
- else
- {
- this.scoutCharaSelect.bigThumbnail.SetFile(null);
- }
- this.selectedScoutMaid = scoutMaid;
- this.UpdateProgressInfoCharacter();
- this.UpdateShowPanels();
- }
- public void OnAddedScoutMaidReturned()
- {
- Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);
- this.Manager.AddScoutMaid(maid);
- GameMain.Instance.CharacterMgr.BanishmentMaid(maid);
- }
- private void UpdateShowPanels()
- {
- this.scoutCharaSelect.bigThumbnail.Visible = (!this.showStatusPanel && this.selectedScoutMaid != null);
- this.statusPanel.visible = (this.showStatusPanel && this.selectedScoutMaid != null);
- if (this.statusPanel.visible)
- {
- this.statusPanel.SetDrawStatus(this.selectedScoutMaid);
- }
- }
- private void UpdateProgressInfoCharacter()
- {
- bool isEnabled = false;
- if (this.scoutingMaidData != null)
- {
- this.progressInformation.SetCharacter(this.scoutingMaidData, true);
- isEnabled = true;
- }
- else if (this.Manager.options.baseCharaSelect)
- {
- this.progressInformation.SetCharacter(this.selectedScoutMaid, false);
- isEnabled = (this.selectedScoutMaid != null);
- }
- else if (this.Manager.GetRandomWaitingScoutmaid() != null)
- {
- this.progressInformation.SetCharacterRandom();
- isEnabled = true;
- }
- else
- {
- this.progressInformation.SetCharacter(null, false);
- }
- foreach (ScoutMainScreenManager.MenuButton menuButton in this.menus)
- {
- if (menuButton.type == ScoutMainScreenManager.ButtonType.Start)
- {
- menuButton.button.isEnabled = isEnabled;
- break;
- }
- }
- }
- protected override void OnFinish()
- {
- if (this.onFinishEvent != null)
- {
- this.onFinishEvent();
- }
- this.parent_mgr.CallScreen("Move");
- }
- [SerializeField]
- private ScoutMainScreenManager.MenuButton[] menus;
- [SerializeField]
- private ScoutCharacterSelectCtrl scoutCharaSelect;
- [SerializeField]
- private ScoutOption scoutOption;
- [SerializeField]
- private ScoutProgressInformation progressInformation;
- [SerializeField]
- private ScoutStatusPanel statusPanel;
- private Action onFinishEvent;
- private bool showStatusPanel;
- public enum ButtonType
- {
- AddScoutMaid = 10,
- DeleteScoutMaid = 20,
- ShowStatus = 30,
- Start = 100,
- Exist = 110,
- Cancel = 120
- }
- [Serializable]
- private struct MenuButton
- {
- public ScoutMainScreenManager.ButtonType type;
- public UIButton button;
- }
- }
- }
|