using System; using System.Collections.Generic; using com.workman.cm3d2.scene.dailyEtc; using UnityEngine; namespace SceneNPCEdit { public class NPCEditMain : WfScreenChildren { public override void Awake() { base.Awake(); this.mainUIFade = base.root_obj.GetComponent(); NDebug.AssertNull(this.mainUIFade); 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("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)); } } protected override void OnCall() { base.SetCallInFadeWaitFrame(2); GameMain.Instance.MainLight.Reset(); GameMain.Instance.CharacterMgr.ResetCharaPosAll(); GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true); GameMain.Instance.SoundMgr.VoiceStopAll(); GameMain.Instance.CharacterMgr.DeactivateCharaAll(); GameMain.Instance.CharacterMgr.DeactivateMaid(0); if (this.charaMgr.status.isDaytime) { 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.parent_grid_.repositionNow = true; this.select_maid_ = null; for (int i = 0; i < this.charaMgr.GetStockMaidCount(); i++) { if (this.charaMgr.GetStockMaid(i).status.leader) { this.cur_maid_leader_ = this.charaMgr.GetStockMaid(i); break; } } for (int j = 0; j < this.charaMgr.GetMaidCount(); j++) { if (this.charaMgr.GetMaid(j) != null) { this.charaMgr.GetMaid(j).Visible = false; } } } public void SetScreenManager(NPCEdit maid_management, string edit_label, string new_edit_label, string transfer_label) { this.screenManager = 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; } private void OnClickButton() { if (!PluginData.IsEnabled("GP001")) { return; } string a = string.Empty; foreach (KeyValuePair keyValuePair in this.button_dic_) { if (keyValuePair.Value == UIButton.current) { a = keyValuePair.Key; break; } } if (a == "エディット" && this.npcEditCharaSelect.selectNPC != null) { if (string.IsNullOrEmpty(this.edit_label_)) { return; } Maid maid = this.charaMgr.ActivateNpc(0); this.npcEditCharaSelect.selectNPC.npcData.Apply(maid, true); NPCCharaSelect.editTargetNPCData = this.npcEditCharaSelect.selectNPC; this.screenManager.move_screen.SetNextLabel(this.edit_label_); this.Finish(); } if (a == "リセット" && this.npcEditCharaSelect.selectNPC != null) { SaveData.RemovePreset(this.npcEditCharaSelect.selectNPC.id); this.npcEditCharaSelect.UpdateSelectData(); } else if (a == "Cancel") { this.Finish(); } } protected override void OnFinish() { if ((this.screenManager.move_screen.next_label == this.edit_label_ || this.screenManager.move_screen.next_label == this.new_edit_label_ || this.screenManager.move_screen.next_label == this.transfer_label_) && this.charaMgr.GetMaid(0) != null) { this.charaMgr.GetMaid(0).Visible = true; } if (!string.IsNullOrEmpty(this.screenManager.move_screen.next_label)) { this.screenManager.CallScreen("Move"); } } private CharacterMgr charaMgr { get { return GameMain.Instance.CharacterMgr; } } [SerializeField] private NPCCharaSelect npcEditCharaSelect; private WfFadeBehaviour mainUIFade; private NPCEdit screenManager; private Maid cur_maid_leader_; private Maid select_maid_; private UIGrid parent_grid_; private Dictionary button_dic_ = new Dictionary(); private string edit_label_; private string new_edit_label_; private string transfer_label_; } }