123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- using System;
- using System.Collections.Generic;
- using Schedule;
- using UnityEngine;
- public class ScheduleMgr : BaseCreatePanel
- {
- public string CurrentActiveButton { get; set; }
- public Dictionary<string, ScheduleCtrl.MaidStatusAndTaskUnit> 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<ScheduleCtrl>();
- this.m_TaskCtrl = base.GetCtrl<ScheduleTaskCtrl>();
- this.m_MaidStatusListCtrl = base.GetCtrl<MaidStatusListCtrl>();
- 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<string, ScheduleCtrl.MaidStatusAndTaskUnit> 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<EventDelegate> 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<DailyMgr>();
- 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<string, ScheduleCtrl.MaidStatusAndTaskUnit> LoadData()
- {
- if (!this.m_initScheduleScene)
- {
- this.m_scheduleApi = new ScheduleScene();
- this.m_initScheduleScene = true;
- }
- Dictionary<string, ScheduleCtrl.MaidStatusAndTaskUnit> dictionary = new Dictionary<string, ScheduleCtrl.MaidStatusAndTaskUnit>();
- 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
- };
- dictionary.Add(string.Format("slot_{0}", maidStatusAndTaskUnit.slotNo), maidStatusAndTaskUnit);
- }
- }
- return dictionary;
- }
- private string GetTaskName(Slot slotInfo, int taskId)
- {
- List<ScheduleBase> 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<string, ScheduleCtrl.MaidStatusAndTaskUnit> 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
- }
- }
|