using System; using System.Collections.Generic; using com.workman.cm3d2.scene.dailyEtc; using MaidStatus; using PlayerStatus; using UnityEngine; using wf; public class MaidManagementMain : WfScreenChildren { public override void Awake() { base.Awake(); this.mainUIFade = base.root_obj.GetComponent(); NDebug.AssertNull(this.mainUIFade); this.status_mgr_ = base.root_obj.GetComponent(); this.status_mgr_.Init(); this.status_mgr_.BaseInit(); this.yotogi_info_object_ = UTY.GetChildObject(base.root_obj, "YotogiInfo", false); this.yotogi_info_object_.SetActive(true); UIWFTabPanel componentInChildren = this.yotogi_info_object_.GetComponentInChildren(); UIWFTabButton[] componentsInChildren = componentInChildren.GetComponentsInChildren(); foreach (UIWFTabButton uiwftabButton in componentsInChildren) { EventDelegate.Add(uiwftabButton.onSelect, new EventDelegate.Callback(this.OnClickYotogiInfoTab)); } this.yotogi_skill_list_mgr_ = UTY.GetChildObject(this.yotogi_info_object_, "YotogiSkillList", false).GetComponent(); this.yotogi_class_list_mgr_ = UTY.GetChildObject(this.yotogi_info_object_, "YotogiClassList", false).GetComponent(); this.status_panel_ = UTY.GetChildObject(base.root_obj, "StatusPanel", false); this.class_change_panel_ = UTY.GetChildObject(base.root_obj, "ClassChangePanel", false).GetComponent(); if (!this.class_change_panel_.gameObject.activeSelf) { this.class_change_panel_.gameObject.SetActive(true); } this.parent_grid_ = UTY.GetChildObject(base.root_obj, "ButtonParent/Tower/Grid", false).GetComponent(); this.button_dic_.Add("雇用", UTY.GetChildObject(this.parent_grid_.gameObject, "雇用", false).GetComponent()); this.button_dic_.Add("移籍", UTY.GetChildObject(this.parent_grid_.gameObject, "移籍", false).GetComponent()); this.button_dic_.Add("解雇", UTY.GetChildObject(this.parent_grid_.gameObject, "解雇", false).GetComponent()); this.button_dic_.Add("メイド長", UTY.GetChildObject(this.parent_grid_.gameObject, "メイド長", false).GetComponent()); this.button_dic_.Add("エディット", UTY.GetChildObject(this.parent_grid_.gameObject, "エディット", false).GetComponent()); this.button_dic_.Add("ランキング", UTY.GetChildObject(this.parent_grid_.gameObject, "ランキング", false).GetComponent()); this.button_dic_.Add("クラス変更", UTY.GetChildObject(this.parent_grid_.gameObject, "クラス変更", false).GetComponent()); this.button_dic_.Add("夜伽スキル", UTY.GetChildObject(this.parent_grid_.gameObject, "夜伽スキル", false).GetComponent()); this.button_dic_.Add("ステータス", UTY.GetChildObject(base.root_obj, "ButtonParent/Tower/ステータス", false).GetComponent()); this.button_dic_.Add("View", UTY.GetChildObject(base.root_obj, "ButtonParent/View", false).GetComponent()); this.button_dic_.Add("Cancel", UTY.GetChildObject(base.root_obj, "ButtonParent/Cancel", false).GetComponent()); foreach (KeyValuePair keyValuePair in this.button_dic_) { EventDelegate.Add(keyValuePair.Value.onClick, new EventDelegate.Callback(this.OnClickButton)); } this.chara_select_mgr_ = UTY.GetChildObject(base.root_obj, "CharacterSelectPanel", false).GetComponent(); this.employmentSelectUIFade.GetComponent().alpha = 0f; if (MaidManagement.compatibilityMode) { base.root_obj.transform.localPosition = new Vector3(-340f, 404f, 0f); this.button_dic_["Cancel"].transform.localPosition = new Vector3(1231f, -877f, 0f); } } protected override void OnCall() { GameMain.Instance.SysShortcut.strSceneHelpName = "SceneMaidManagement"; uGUITutorialPanel.OpenTutorial("SceneMaidManagement", null, false); this.chara_mgr_ = GameMain.Instance.CharacterMgr; base.SetCallInFadeWaitFrame(2); this.is_night_ = !this.chara_mgr_.status.isDaytime; this.status_mgr_.SetDurationToFadeIn(0.2f); this.status_mgr_.SetDurationToFadeOut(0.2f); PlayerStatus.Status status = GameMain.Instance.CharacterMgr.status; GameMain.Instance.MainLight.Reset(); GameMain.Instance.CharacterMgr.ResetCharaPosAll(); GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true); GameMain.Instance.SoundMgr.VoiceStopAll(); if (!this.is_night_) { GameMain.Instance.SoundMgr.PlayBGM(DailyAPI.dayBgm, 0.5f, true); GameMain.Instance.BgMgr.ChangeBg(DailyAPI.dayBg); } else { GameMain.Instance.SoundMgr.PlayBGM(DailyAPI.nightBgm, 0.5f, true); GameMain.Instance.BgMgr.ChangeBg(DailyAPI.nightBg); } this.button_dic_["雇用"].gameObject.SetActive(status.isAvailableEmploymentAndBanishment); this.button_dic_["移籍"].gameObject.SetActive(this.isLegacy); this.button_dic_["解雇"].gameObject.SetActive(status.isAvailableEmploymentAndBanishment); this.button_dic_["クラス変更"].gameObject.SetActive(status.isAvailableClassChange); this.button_dic_["ランキング"].gameObject.SetActive(status.isAvailableRanking); UIWFTabPanel componentInChildren = this.yotogi_info_object_.GetComponentInChildren(); componentInChildren.Select(componentInChildren.GetComponentsInChildren(true)[0]); this.yotogi_info_object_.SetActive(false); this.VisibleClassChangePanel(false); this.parent_grid_.repositionNow = true; this.select_maid_ = null; for (int i = 0; i < this.chara_mgr_.GetStockMaidCount(); i++) { if (this.chara_mgr_.GetStockMaid(i).status.leader) { this.cur_maid_leader_ = this.chara_mgr_.GetStockMaid(i); break; } } this.chara_select_mgr_.SetCallBackCallBackOnSelect(new CharacterSelectManager.CallBackOnSelect(this.OnSelectChara)); this.chara_select_mgr_.SetCallBackMaidList(delegate(List draw_maid_list) { if (!MaidManagement.compatibilityMode) { CharacterSelectManager.DefaultMaidList(draw_maid_list); return; } List list = new List(); CharacterSelectManager.DefaultMaidList(list); for (int k = 0; k < list.Count; k++) { if (list[k].status.heroineType == HeroineType.Transfer) { draw_maid_list.Add(list[k]); } } }); this.chara_select_mgr_.Create(CharacterSelectManager.Type.Select, 3, true); if (!string.IsNullOrEmpty(MaidManagementMain.BackUpSelectMaidGUID)) { this.chara_select_mgr_.SelectMaid(this.chara_mgr_.GetStockMaid(MaidManagementMain.BackUpSelectMaidGUID)); MaidManagementMain.BackUpSelectMaidGUID = string.Empty; if (1f <= MaidManagementMain.BackUpBarValue && this.chara_mgr_.GetStockMaidCount() <= 7) { this.chara_select_mgr_.scroll_bar.value = 0f; } else { this.chara_select_mgr_.scroll_bar.value = MaidManagementMain.BackUpBarValue; } MaidManagementMain.BackUpBarValue = 0f; if (MaidManagementMain.BackUpRightPanelVisible) { this.ChangeRankingMode(); MaidManagementMain.BackUpRightPanelVisible = false; } } if (this.is_night_) { this.button_dic_["雇用"].gameObject.SetActive(false); this.button_dic_["移籍"].gameObject.SetActive(false); this.button_dic_["解雇"].gameObject.SetActive(false); this.button_dic_["メイド長"].gameObject.SetActive(false); } if (MaidManagement.compatibilityMode) { this.button_dic_["雇用"].gameObject.SetActive(false); this.button_dic_["移籍"].gameObject.SetActive(false); this.button_dic_["解雇"].gameObject.SetActive(false); this.button_dic_["メイド長"].gameObject.SetActive(false); this.button_dic_["ランキング"].gameObject.SetActive(false); } if (this.button_dic_["雇用"].isEnabled) { this.button_dic_["雇用"].isEnabled = (this.GetMaidNumber() < 200); } if (this.button_dic_["移籍"].gameObject.activeInHierarchy && this.button_dic_["移籍"].isEnabled) { this.button_dic_["移籍"].isEnabled = (GameMain.Instance.CharacterMgr.status.isAvailableTransfer && this.GetMaidNumber() < 200); } for (int j = 0; j < this.chara_mgr_.GetMaidCount(); j++) { if (this.chara_mgr_.GetMaid(j) != null) { this.chara_mgr_.GetMaid(j).Visible = false; } } } public void SetMaidManagement(MaidManagement maid_management, string edit_label, string new_edit_label, string transfer_label) { this.maid_management_ = maid_management; this.edit_label_ = edit_label; this.new_edit_label_ = new_edit_label; this.transfer_label_ = transfer_label; } private void OnSelectChara(Maid select_maid) { this.select_maid_ = select_maid; if (this.select_maid_.status.heroineType == HeroineType.Sub) { this.button_dic_["エディット"].isEnabled = this.select_maid_.status.subCharaData.isEditPossible; this.button_dic_["メイド長"].isEnabled = false; this.button_dic_["クラス変更"].isEnabled = false; this.button_dic_["解雇"].isEnabled = false; this.button_dic_["夜伽スキル"].isEnabled = false; this.VisibleClassChangePanel(false); this.VisibleYotogiSkillList(false); if (this.status_panel_.activeSelf) { this.chara_select_mgr_.big_thumbnail.Visible = false; } } else { if (this.select_maid_.status.leader || this.select_maid_.status.contract == Contract.Trainee || this.select_maid_.status.heroineType == HeroineType.Transfer) { this.button_dic_["メイド長"].isEnabled = false; } else { this.button_dic_["メイド長"].isEnabled = true; } if (this.button_dic_["クラス変更"].gameObject.activeSelf) { this.button_dic_["クラス変更"].isEnabled = true; } if (this.select_maid_.status.leader || this.select_maid_.status.mainChara) { this.button_dic_["解雇"].isEnabled = false; } else { this.button_dic_["解雇"].isEnabled = true; } this.button_dic_["夜伽スキル"].isEnabled = true; } this.class_change_panel_.SetTargetMaid(select_maid); if (this.status_panel_.activeSelf) { this.status_mgr_.UpdateMaidStatus(select_maid); } if (this.yotogi_info_object_.activeSelf) { this.yotogi_skill_list_mgr_.CreateData(this.select_maid_); this.yotogi_class_list_mgr_.CreateData(this.select_maid_); } } private void OnClickButton() { string text = string.Empty; foreach (KeyValuePair keyValuePair in this.button_dic_) { if (keyValuePair.Value == UIButton.current) { text = keyValuePair.Key; break; } } if (string.IsNullOrEmpty(text)) { return; } if (text == "雇用") { this.OnClickEmploymentButton(); } else if (text == "移籍") { WfFadeJob.Create(this.employmentSelectUIFade, null, 0f, iTween.EaseType.easeOutSine); this.OnClickTransferButton(); } else if (text == "解雇" && this.select_maid_ != null && 2 <= this.chara_mgr_.GetStockMaidCount() && !this.select_maid_.status.leader) { int banishmentPrice = this.select_maid_.status.banishmentPrice; string f_strMsg = this.select_maid_.status.fullNameJpStyle + "\nを解雇しますか?\n資金 +" + Utility.ConvertMoneyText(banishmentPrice) + "CR"; GameMain.Instance.SysDlg.Show(f_strMsg, SystemDialog.TYPE.OK_CANCEL, new SystemDialog.OnClick(this.BanishmentMaid), null); } else { if (text == "メイド長" && this.select_maid_ != null) { if (!this.select_maid_.status.leader) { if (this.cur_maid_leader_ != null) { this.cur_maid_leader_.status.leader = false; this.chara_select_mgr_.UpdateMaidPlate(this.cur_maid_leader_); } this.select_maid_.status.leader = true; this.chara_select_mgr_.UpdateMaidPlate(this.select_maid_); this.cur_maid_leader_ = this.select_maid_; this.button_dic_["メイド長"].isEnabled = !this.select_maid_.status.leader; this.button_dic_["解雇"].isEnabled = !this.select_maid_.status.leader; this.chara_select_mgr_.scroll_view.ResetPosition(); this.chara_select_mgr_.Reposition(); } return; } if (text == "ランキング") { this.ChangeRankingMode(); } else if (text == "クラス変更") { this.VisibleClassChangePanel(!this.class_change_panel_.gameObject.activeSelf); } else if (text == "エディット" && this.select_maid_ != null) { if (string.IsNullOrEmpty(this.edit_label_)) { return; } this.chara_mgr_.SetActiveMaid(this.select_maid_, 0); MaidManagementMain.BackUpSelectMaidGUID = this.select_maid_.status.guid; MaidManagementMain.BackUpBarValue = this.chara_select_mgr_.scroll_bar.value; MaidManagementMain.BackUpRightPanelVisible = this.chara_select_mgr_.IsRightVisible(); this.maid_management_.move_screen.SetNextLabel(this.edit_label_); this.Finish(); } else if (text == "夜伽スキル" && this.select_maid_ != null) { this.yotogi_skill_list_mgr_.CreateData(this.select_maid_); this.yotogi_class_list_mgr_.CreateData(this.select_maid_); this.VisibleYotogiSkillList(!this.yotogi_info_object_.activeSelf); } else if (text == "ステータス" && this.select_maid_ != null) { this.status_mgr_.UpdateMaidStatus(this.select_maid_); this.VisibleStatusPanel(!this.status_panel_.activeSelf); } else if (text == "Cancel") { this.Finish(); } } } public void OnClickEmploymentButton() { if (string.IsNullOrEmpty(this.new_edit_label_)) { return; } int num = this.employmentPrice; if (this.chara_mgr_.status.money - (long)num < 0L) { string f_strMsg = "新しいメイドを雇用するには\n" + Utility.ConvertMoneyText(num) + "CRが必要です。"; GameMain.Instance.SysDlg.Show(f_strMsg, SystemDialog.TYPE.OK, null, null); } else { string f_strMsg2 = "新しいメイドを雇用しますか?\n資金 -" + Utility.ConvertMoneyText(num) + "CR"; GameMain.Instance.SysDlg.Show(f_strMsg2, SystemDialog.TYPE.OK_CANCEL, new SystemDialog.OnClick(this.Employment), null); } } public void OnClickTransferButton() { if (string.IsNullOrEmpty(this.transfer_label_)) { return; } int num = this.transferPrice; if (this.chara_mgr_.status.money - (long)num < 0L) { string f_strMsg = "メイドを移籍するには\n" + Utility.ConvertMoneyText(num) + "CRが必要です。"; GameMain.Instance.SysDlg.Show(f_strMsg, SystemDialog.TYPE.OK, null, null); } else { string f_strMsg2 = "メイドを移籍しますか?\n資金 -" + Utility.ConvertMoneyText(num) + "CR"; GameMain.Instance.SysDlg.Show(f_strMsg2, SystemDialog.TYPE.OK_CANCEL, delegate { GameMain.Instance.SysDlg.Close(); this.transferMain.Call(delegate { WfFadeJob.Create(null, this.employmentSelectUIFade, 0f, iTween.EaseType.easeOutSine); }); }, null); } } public void OnClickEmploymentSelectCancel() { if (UIButton.current != null) { UIButton.current.SetState(UIButtonColor.State.Normal, true); } WfFadeJob.Create(null, this.employmentSelectUIFade, 0.3f, iTween.EaseType.easeOutSine); } private void OnClickYotogiInfoTab() { if (!UIWFSelectButton.current.isSelected) { return; } if (UIWFSelectButton.current.name.ToLower() == "class") { this.yotogi_skill_list_mgr_.gameObject.SetActive(false); this.yotogi_class_list_mgr_.gameObject.SetActive(true); } else { this.yotogi_skill_list_mgr_.gameObject.SetActive(true); this.yotogi_class_list_mgr_.gameObject.SetActive(false); } } public void ChangeRankingMode() { GameObject childObject = UTY.GetChildObject(base.root_obj, "ButtonParent/Tower", false); if (!this.ranking_mode_) { this.VisibleClassChangePanel(false); this.VisibleStatusPanel(false); this.VisibleYotogiSkillList(false); this.ranking_mode_ = true; this.chara_select_mgr_.SetRightVisible(true); this.chara_select_mgr_.SetSortType(CharacterSelectManager.SortType.Ranking); childObject.transform.localPosition = new Vector3(265f, 0f, 0f); this.chara_select_mgr_.big_thumbnail.Visible = false; } else { this.ranking_mode_ = false; this.chara_select_mgr_.SetRightVisible(false); this.chara_select_mgr_.SetSortType(CharacterSelectManager.SortType.Normal); childObject.transform.localPosition = Vector3.zero; this.chara_select_mgr_.big_thumbnail.Visible = true; } if (this.chara_select_mgr_.scroll_bar.alpha <= 0f) { this.chara_select_mgr_.scroll_bar.value = 0f; } } public void VisibleClassChangePanel(bool value) { if (this.ranking_mode_) { this.ChangeRankingMode(); } if (value) { this.VisibleStatusPanel(false); this.VisibleYotogiSkillList(false); } this.class_change_panel_.gameObject.SetActive(value); this.chara_select_mgr_.big_thumbnail.Visible = !value; } public void VisibleStatusPanel(bool value) { if (this.status_panel_.activeSelf && !value) { this.chara_select_mgr_.big_thumbnail.Visible = true; this.status_mgr_.CloseStatusPanel(); } else if (!this.status_panel_.activeSelf && value) { this.VisibleClassChangePanel(false); this.VisibleYotogiSkillList(false); this.chara_select_mgr_.big_thumbnail.Visible = false; this.status_mgr_.OpenStatusPanel(); } } public void VisibleYotogiSkillList(bool value) { if (this.ranking_mode_) { this.ChangeRankingMode(); } if (value) { this.VisibleStatusPanel(false); this.VisibleClassChangePanel(false); } this.yotogi_info_object_.SetActive(value); this.chara_select_mgr_.big_thumbnail.Visible = !value; } public void Employment() { GameMain.Instance.SysDlg.Close(); int num = this.employmentPrice; GameMain.Instance.CharacterMgr.status.money += (long)(num * -1); Maid maid = this.chara_mgr_.AddStockMaid(); MaidManagementMain.BackUpSelectMaidGUID = maid.status.guid; MaidManagementMain.BackUpBarValue = 1f; MaidManagementMain.BackUpRightPanelVisible = this.chara_select_mgr_.IsRightVisible(); this.chara_mgr_.SetActiveMaid(maid, 0); this.maid_management_.move_screen.SetNextLabel(this.new_edit_label_); this.Finish(); } public void Transfer(string loadSaveFilePath, OldDataConverter.MaidData oldData) { int num = this.transferPrice; GameMain.Instance.CharacterMgr.status.money += (long)(num * -1); Maid maid = this.chara_mgr_.AddStockMaid(); maid.DeserializeOldData(oldData, false); MaidManagementMain.BackUpSelectMaidGUID = maid.status.guid; MaidManagementMain.BackUpBarValue = 1f; MaidManagementMain.BackUpRightPanelVisible = this.chara_select_mgr_.IsRightVisible(); this.chara_mgr_.SetActiveMaid(maid, 0); this.maid_management_.move_screen.SetNextLabel(this.transfer_label_); this.Finish(); } public void BanishmentMaid() { string f_strMsg = this.select_maid_.status.fullNameJpStyle + "\nを解雇しました"; int banishmentPrice = this.select_maid_.status.banishmentPrice; GameMain.Instance.CharacterMgr.status.money += (long)banishmentPrice; int i; for (i = 0; i < this.chara_mgr_.GetStockMaidCount(); i++) { if (this.chara_mgr_.GetStockMaid(i) == this.select_maid_) { break; } } this.chara_select_mgr_.RemoveMaidPlate(this.select_maid_); this.chara_mgr_.BanishmentMaid(i); this.button_dic_["雇用"].isEnabled = (this.GetMaidNumber() < 200); this.button_dic_["移籍"].isEnabled = (GameMain.Instance.CharacterMgr.status.isAvailableTransfer && this.GetMaidNumber() < 200); GameMain.Instance.SysDlg.Show(f_strMsg, SystemDialog.TYPE.OK, null, null); } private int GetMaidNumber() { int num = 0; for (int i = 0; i < this.chara_mgr_.GetStockMaidCount(); i++) { Maid stockMaid = this.chara_mgr_.GetStockMaid(i); if (stockMaid != null && (stockMaid.status.heroineType == HeroineType.Original || stockMaid.status.heroineType == HeroineType.Transfer)) { num++; } } return num; } protected override void OnFinish() { if ((this.maid_management_.move_screen.next_label == this.edit_label_ || this.maid_management_.move_screen.next_label == this.new_edit_label_ || this.maid_management_.move_screen.next_label == this.transfer_label_) && this.chara_mgr_.GetMaid(0) != null) { this.chara_mgr_.GetMaid(0).Visible = true; } if (!string.IsNullOrEmpty(this.maid_management_.move_screen.next_label)) { this.maid_management_.CallScreen("Move"); } } private bool isLegacy { get { return !string.IsNullOrEmpty(GameMain.Instance.CMSystem.CM3D2Path) && PluginData.IsEnabled("Legacy"); } } public static string BackUpSelectMaidGUID = string.Empty; public static float BackUpBarValue = 0f; public static bool BackUpRightPanelVisible = false; [SerializeField] public int employmentPrice = 3000000; [SerializeField] public int transferPrice = 3000000; [SerializeField] public WfFadeBehaviour employmentSelectUIFade; [SerializeField] public MaidTransferLoadMain transferMain; private WfFadeBehaviour mainUIFade; private MaidManagement maid_management_; private ClassChangePanel class_change_panel_; private GameObject status_panel_; private CharaSelectStatusMgr status_mgr_; private GameObject yotogi_info_object_; private YotogiSkillListManager yotogi_skill_list_mgr_; private YotogiClassListManager yotogi_class_list_mgr_; private Maid cur_maid_leader_; private Maid select_maid_; private CharacterMgr chara_mgr_; private CharacterSelectManager chara_select_mgr_; private UIGrid parent_grid_; private Dictionary button_dic_ = new Dictionary(); private string edit_label_; private string new_edit_label_; private string transfer_label_; private bool ranking_mode_; private bool is_night_; }