using System; using System.Collections.Generic; using Schedule; using UnityEngine; public class ScheduleMgr : BaseCreatePanel { public string CurrentActiveButton { get; set; } public Dictionary GetMaidStatusAndTask() { return this.m_Ctrl.GetDicMaidStatusAndTask(); } public ScheduleScene GetScheduleApi() { return this.m_scheduleApi; } public void SetCurrentDaytimeTaskActiveButton(string taskId) { this.currentDaytimeTaskActiveButton = taskId; } public void SetCurrentNightTaskActiveButton(string taskId) { this.currentNightTaskActiveButton = taskId; } public MaidStatusListCtrl MaidStatusListCtrl { get { return this.m_MaidStatusListCtrl; } } public ScheduleTaskCtrl TaskCtrl { get { return this.m_TaskCtrl; } } public override void Init() { this.m_goPanel = base.GetPanel("SchedulePanel"); this.m_Ctrl = base.GetCtrl(); this.m_TaskCtrl = base.GetCtrl(); this.m_MaidStatusListCtrl = base.GetCtrl(); this.m_Ctrl.Init(this, this.m_goPanel); this.m_TaskCtrl.Init(this, this.m_Ctrl, this.m_goPanel); this.m_MaidStatusListCtrl.Init(this, this.m_Ctrl, this.m_goPanel); this.m_goPanel.SetActive(false); } protected override void OpenPanel() { Debug.Log("スケジュールをオープンしました。"); GameMain.Instance.TutorialPanel.SetImage(TutorialPanel.ImageSet.Schedule, false); GameMain.Instance.SysShortcut.strSceneHelpName = "SceneSchedule"; this.m_dicMaidStatusAndTask = this.LoadData(); this.CreateSelectedMaidViewer(this.m_dicMaidStatusAndTask); } public void CreateSelectedMaidViewer(Dictionary dicMaidStatusAndTask) { this.CurrentActiveButton = string.Empty; this.m_Ctrl.CreateSelectedMaidViewer(dicMaidStatusAndTask); } public void CheckSelectedDataBeforeClosePanel() { if (this.m_Ctrl.ExistSelectedMaid()) { base.BaseClosePanel(); } } public void UpdateMaidStatus() { this.m_dicMaidStatusAndTask = this.LoadData(); this.CreateSelectedMaidViewer(this.m_dicMaidStatusAndTask); if (!DailyMgr.IsLegacy) { GameMain.Instance.FacilityMgr.UpdateFacilityAssignedMaidData(); } } public void ClickMaidStatus() { string name = UIButton.current.name; if (UICamera.currentTouchID == -1) { if (this.CurrentActiveButton == name) { return; } Debug.Log(string.Format("{0}ボタンがクリックされました。", name)); this.m_MaidStatusListCtrl.CreateTaskViewer(name); this.CurrentActiveButton = name; } else if (UICamera.currentTouchID == -2) { Debug.Log(string.Format("{0}ボタンが右クリックされました。", name)); if (this.m_Ctrl.CanDeleteData(name)) { this.m_Ctrl.DeleteMaidStatus(this.m_scheduleApi, name); } } } public void ClickTask(ScheduleMgr.ScheduleTime time) { string name = UIButton.current.name; if (this.CurrentActiveButton == name) { return; } Debug.Log(string.Format("{0}ボタンがクリックされました。", name)); this.m_TaskCtrl.CreateTaskViewer(name, time); this.CurrentActiveButton = name; } public EventDelegate ClickTaskEvent(ScheduleMgr.ScheduleTime time, ref List events) { EventDelegate eventDelegate = new EventDelegate(this, "ClickTask"); eventDelegate.parameters[0].value = time; EventDelegate.Add(events, eventDelegate); return eventDelegate; } public void ClickMaidStatusInListViewer(Maid maid) { string guid = maid.status.guid; this.m_MaidStatusListCtrl.MoveMaidToSlot(this.m_scheduleApi, maid); } public void ClickTaskInTaskViewer() { string name = UIButton.current.name; if (this.currentNightTaskActiveButton == name) { return; } if (this.m_TaskCtrl.CanSetTask(ScheduleTaskCtrl.TaskType.Yotogi, int.Parse(name))) { this.m_TaskCtrl.UpdateSelectedMaidTask(name); } else { this.m_TaskCtrl.UpdateTaskViewer(name); } this.currentNightTaskActiveButton = name; } public void UpdateTask(string taskId) { this.m_TaskCtrl.UpdateSelectedMaidTask(taskId); } public void SetActiveSlotNo(string slotNo) { this.m_Ctrl.SetActiveSlotNo(slotNo); } public Maid GetMaidBySlotNo(string slotNo) { return this.m_Ctrl.GetMaidBySlotNo(slotNo); } protected override void SetFadeTargetPanel() { this.fadeTargetPanel = this.m_goPanel; } protected override void AfterFadeOut() { DailyMgr manager = base.GetManager(); manager.BaseOpenPanel(manager.GetCurrentDaily().ToString()); base.AfterFadeOut(); } protected override void BeforeClose() { UICamera.InputEnable = false; } protected override void AfterClose() { UICamera.InputEnable = true; } private void OnDestroy() { if (this.m_scheduleApi != null) { this.m_scheduleApi.Dispace(); } } private Dictionary LoadData() { if (!this.m_initScheduleScene) { this.m_scheduleApi = new ScheduleScene(); this.m_initScheduleScene = true; } Dictionary dictionary = new Dictionary(); if (this.m_scheduleApi.slot == null || this.m_scheduleApi.slot.Length <= 0) { return dictionary; } foreach (Slot slot2 in this.m_scheduleApi.slot) { if (!(slot2.maid == null)) { ScheduleCtrl.MaidStatusAndTaskUnit maidStatusAndTaskUnit = new ScheduleCtrl.MaidStatusAndTaskUnit(); maidStatusAndTaskUnit.slotNo = slot2.slotId; maidStatusAndTaskUnit.daytimeTaskId = slot2.noonWorkId.ToString(); maidStatusAndTaskUnit.taskIcon = slot2.noon_icon; maidStatusAndTaskUnit.daytimeTaskName = this.GetTaskName(slot2, slot2.noonWorkId); maidStatusAndTaskUnit.daytimeCommu = slot2.noonCommuFlag; maidStatusAndTaskUnit.nightTaskId = slot2.nightWorkId.ToString(); maidStatusAndTaskUnit.nightTaskIcon = slot2.night_icon; maidStatusAndTaskUnit.nightTaskName = this.GetTaskName(slot2, slot2.nightWorkId); maidStatusAndTaskUnit.nightCommu = slot2.nightCommuFlag; maidStatusAndTaskUnit.maidStatus = new MaidStatusListCtrl.MaidStatusButton { maid = slot2.maid, id = slot2.maid.status.guid, isReader = slot2.leader, maidIcon = slot2.icon, firstName = slot2.first_name, lastName = slot2.last_name, Rranking = slot2.popular_rank, crownIcon = slot2.popular_rank_icon, contractTypeName = slot2.contract_type_name, contractTypeNameTerm = slot2.contract_type_name_term, personalName = slot2.personal_name, personalNameTerm = slot2.personal_name_term }; dictionary.Add(string.Format("slot_{0}", maidStatusAndTaskUnit.slotNo), maidStatusAndTaskUnit); } } return dictionary; } private string GetTaskName(Slot slotInfo, int taskId) { List noonWorksData = slotInfo.noonWorksData; foreach (ScheduleBase scheduleBase in noonWorksData) { if (scheduleBase.id == taskId) { return scheduleBase.name; } } return string.Empty; } public const string BUTTON_NAME_TEMPLATE = "slot_{0}"; public const int MAX_SLOT_COUNT = 9; private Dictionary m_dicMaidStatusAndTask; private ScheduleCtrl m_Ctrl; private ScheduleTaskCtrl m_TaskCtrl; private MaidStatusListCtrl m_MaidStatusListCtrl; private ScheduleScene m_scheduleApi; private bool m_initScheduleScene; private string currentDaytimeTaskActiveButton; private string currentNightTaskActiveButton; private const int MIN_MAID_COUNT = 1; private const int LeftClick = -1; private const int RightClick = -2; public enum ScheduleTime { DayTime, Night } }