123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- using System;
- using System.Collections.Generic;
- using Yotogis;
- public class YotogiOldSubCharacterSelectManager : WfScreenChildren
- {
- public int GetPlayerSelectNum()
- {
- if (this.yotogi_mgr_ == null)
- {
- return 0;
- }
- if (this.yotogi_mgr_.is_free_mode)
- {
- Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);
- int num = 1;
- int[] keyArray = maid.status.yotogiSkill.oldDatas.GetKeyArray();
- for (int i = 0; i < keyArray.Length; i++)
- {
- Skill.Old.Data skillData = YotogiOld.GetSkillData(keyArray[i]);
- num = Math.Max(num, skillData.player_num);
- }
- return ((this.yotogi_mgr_.GetPlayPossibleMaidCount() >= num) ? num : this.yotogi_mgr_.GetPlayPossibleMaidCount()) - 1;
- }
- if (this.yotogi_mgr_.play_skill_array == null)
- {
- return 0;
- }
- int num2 = 0;
- for (int j = 0; j < this.yotogi_mgr_.play_skill_array.Length; j++)
- {
- if (this.yotogi_mgr_.play_skill_array[j] != null && this.yotogi_mgr_.play_skill_array[j].skill_pair.base_data != null)
- {
- if (num2 < this.yotogi_mgr_.play_skill_array[j].skill_pair.base_data.player_num)
- {
- num2 = this.yotogi_mgr_.play_skill_array[j].skill_pair.base_data.player_num;
- }
- }
- }
- return ((this.yotogi_mgr_.GetPlayPossibleMaidCount() >= num2) ? num2 : this.yotogi_mgr_.GetPlayPossibleMaidCount()) - 1;
- }
- public override void Awake()
- {
- base.Awake();
- this.yotogi_mgr_ = base.GetComponentInParent<YotogiOldManager>();
- this.chara_select_ = base.root_obj.GetComponentInChildren<CharacterSelectManager>();
- this.ok_btn_ = UTY.GetChildObject(base.root_obj, "Ok", false).GetComponent<UIButton>();
- this.ok_btn_.onClick.Add(new EventDelegate(this, "OnClickOK"));
- if (UTY.GetChildObject(base.root_obj, "Cancel", true) != null)
- {
- UIButton component = UTY.GetChildObject(base.root_obj, "Cancel", false).GetComponent<UIButton>();
- component.onClick.Add(new EventDelegate(this, "OnClickCancel"));
- }
- }
- protected override void OnCall()
- {
- CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
- this.maid_ = this.yotogi_mgr_.maid;
- if (UTY.GetChildObject(base.root_obj, "Cancel", true) != null)
- {
- UTY.GetChildObject(base.root_obj, "Cancel", false).SetActive(!string.IsNullOrEmpty(this.cancel_label));
- }
- for (int i = 0; i < characterMgr.GetMaidCount(); i++)
- {
- Maid maid = characterMgr.GetMaid(i);
- if (maid != null && maid.Visible)
- {
- maid.Visible = false;
- }
- }
- for (int j = 0; j < characterMgr.GetManCount(); j++)
- {
- Maid man = characterMgr.GetMan(j);
- if (man != null && man.Visible)
- {
- man.Visible = false;
- }
- }
- this.ok_btn_.isEnabled = false;
- this.loded_chara_ = false;
- this.loaded_check_maid_.Clear();
- int select_chara_num = this.GetPlayerSelectNum();
- this.chara_select_.SetCallBackMaidList(new CharacterSelectManager.CallBackMaidList(this.yotogi_mgr_.GetSubMaidList));
- if (1 < select_chara_num || select_chara_num == 0)
- {
- CharacterSelectManager.CallBackOnMultiSelect callBackOnMultiSelect = delegate(Maid[] maid_array)
- {
- int select_chara_num = select_chara_num;
- int num = 0;
- this.loaded_check_maid_.Clear();
- for (int k = 0; k < maid_array.Length; k++)
- {
- if (maid_array[k] != null)
- {
- this.loaded_check_maid_.Add(maid_array[k]);
- num++;
- }
- }
- if (0 < select_chara_num)
- {
- this.ok_btn_.isEnabled = (select_chara_num == num);
- }
- };
- this.chara_select_.SetCallBackOnMultiSelect(callBackOnMultiSelect);
- if (select_chara_num == 0)
- {
- this.chara_select_.Create(CharacterSelectManager.Type.Multiple, 3, true);
- }
- else
- {
- this.chara_select_.Create(CharacterSelectManager.Type.Multiple, select_chara_num, true);
- }
- }
- else
- {
- CharacterSelectManager.CallBackOnSelect callBackCallBackOnSelect = delegate(Maid select_maid)
- {
- this.loaded_check_maid_.Clear();
- this.loaded_check_maid_.Add(select_maid);
- };
- this.chara_select_.SetCallBackCallBackOnSelect(callBackCallBackOnSelect);
- this.chara_select_.Create(CharacterSelectManager.Type.Select, 3, true);
- this.ok_btn_.isEnabled = true;
- }
- }
- protected override bool IsCallFadeIn()
- {
- if (this.maid_.IsBusy)
- {
- return false;
- }
- this.maid_.FaceAnime("通常", 0f, 0);
- this.maid_.FaceBlend("無し");
- return true;
- }
- private void OnClickOK()
- {
- if (this.loaded_check_maid_.Count <= 0)
- {
- return;
- }
- this.loded_chara_ = true;
- this.Finish();
- }
- private void OnClickCancel()
- {
- if (string.IsNullOrEmpty(this.cancel_label))
- {
- return;
- }
- this.yotogi_mgr_.null_mgr.SetNextLabel(this.cancel_label);
- this.Finish();
- }
- protected override void OnFinish()
- {
- if (!this.loded_chara_)
- {
- return;
- }
- CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
- int num = 1;
- for (int i = 0; i < this.loaded_check_maid_.Count; i++)
- {
- if (!(this.loaded_check_maid_[i] == null))
- {
- characterMgr.SetActiveMaid(this.loaded_check_maid_[i], num++);
- this.loaded_check_maid_[i].Visible = true;
- this.loaded_check_maid_[i].AllProcPropSeqStart();
- }
- }
- }
- protected override void OnFadeEnd()
- {
- if (this.loaded_check_maid_.Count == 0 || !this.loded_chara_)
- {
- if (this.yotogi_mgr_.null_mgr.IsExistNextLabel())
- {
- this.yotogi_mgr_.CallScreen(YotogiOldManager.CallScreenType.Null.ToString());
- }
- else
- {
- this.yotogi_mgr_.CallScreen(YotogiOldManager.CallScreenType.SkillSelect.ToString());
- }
- }
- bool flag = true;
- for (int i = 0; i < this.loaded_check_maid_.Count; i++)
- {
- if (!(this.loaded_check_maid_[i] == null))
- {
- if (this.loaded_check_maid_[i].IsBusy)
- {
- flag = false;
- break;
- }
- }
- }
- if (flag)
- {
- this.loaded_check_maid_.Clear();
- if (this.yotogi_mgr_.null_mgr.IsExistNextLabel())
- {
- this.yotogi_mgr_.CallScreen(YotogiOldManager.CallScreenType.Null.ToString());
- }
- else
- {
- this.yotogi_mgr_.CallScreen(YotogiOldManager.CallScreenType.SkillSelect.ToString());
- }
- }
- }
- public string cancel_label
- {
- get
- {
- return this.cancel_label_;
- }
- set
- {
- this.cancel_label_ = value;
- }
- }
- private Maid maid_;
- private YotogiOldManager yotogi_mgr_;
- private CharacterSelectManager chara_select_;
- private UIButton ok_btn_;
- private List<Maid> loaded_check_maid_ = new List<Maid>();
- private string cancel_label_ = string.Empty;
- private bool loded_chara_;
- }
|