123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using I2.Loc;
- using MaidStatus;
- using Schedule;
- using UnityEngine;
- public class ScheduleCtrl : BaseCreateViewerCtrl
- {
- public Dictionary<string, ScheduleCtrl.MaidStatusAndTaskUnit> GetDicMaidStatusAndTask()
- {
- return this.m_dicMaidStatusAndTask;
- }
- public Dictionary<ScheduleCtrl.ExclusiveViewer, GameObject> DicExclusiveViewer { get; set; }
- public Color GetActiveColor()
- {
- return this.activeColor;
- }
- public Color GetInActiveColor()
- {
- return this.inActiveColor;
- }
- public Color GetDisableColor()
- {
- return this.disableColor;
- }
- public string GetMaidId()
- {
- return this.m_maidId;
- }
- public string GetActiveSlotNo()
- {
- return this.m_activeSlotNo;
- }
- public void SetActiveSlotNo(string slotNo)
- {
- this.m_activeSlotNo = slotNo;
- }
- public GameObject GetUnitParent
- {
- get
- {
- return this.m_goUnitParent;
- }
- }
- public Maid SelectedMaid
- {
- get
- {
- return this.selectedMaid;
- }
- }
- public void Init(ScheduleMgr scheduleMgr, GameObject goPanel)
- {
- this.m_scheduleMgr = scheduleMgr;
- this.m_goPanel = goPanel;
- }
- private void InitViewer()
- {
- GameObject childObject = UTY.GetChildObject(this.m_goPanel, "ScheduleTaskViewer", false);
- GameObject childObject2 = UTY.GetChildObject(this.m_goPanel, "CharacterSelectPanel", false);
- UIButton component = UTY.GetChildObject(this.m_goPanel, "SelectedMaidViewer/Ok", false).GetComponent<UIButton>();
- EventDelegate.Add(component.onClick, new EventDelegate.Callback(this.m_scheduleMgr.CheckSelectedDataBeforeClosePanel));
- this.activeColor = new Color(component.defaultColor.r, component.defaultColor.g, component.defaultColor.b, 1f);
- this.inActiveColor = component.defaultColor;
- this.disableColor = new Color(0.7f, 0.7f, 0.7f, 1f);
- this.m_unitPrefabPath = "SceneDaily/Schedule/Prefab/MaidStatusUnit";
- this.m_goUnitParent = UTY.GetChildObject(this.m_goPanel, "SelectedMaidViewer/Contents/SelectedMaidUnitParent", false);
- this.DicExclusiveViewer = new Dictionary<ScheduleCtrl.ExclusiveViewer, GameObject>();
- this.DicExclusiveViewer.Add(ScheduleCtrl.ExclusiveViewer.MaidStatusList, childObject2);
- this.DicExclusiveViewer.Add(ScheduleCtrl.ExclusiveViewer.Task, childObject);
- GameObject x = GameObject.Find("__GameMain__/SystemUI Root");
- NDebug.Assert(x != null, string.Format("{0}が見つかりませんでした。", "UI Root"));
- this.m_charSelMgr = UTY.GetChildObject(this.m_goPanel, "CharacterSelectPanel", false).GetComponent<CharacterSelectManager>();
- }
- public void CreateRoomViewer()
- {
- }
- public void CreateSelectedMaidViewer(Dictionary<string, ScheduleCtrl.MaidStatusAndTaskUnit> dicMaidStatusAndTaskInfo)
- {
- if (!this.m_bInit)
- {
- this.InitViewer();
- this.m_bInit = true;
- }
- this.m_dicMaidStatusAndTask = dicMaidStatusAndTaskInfo;
- this.SetViewerActive(ScheduleCtrl.ExclusiveViewer.None);
- base.CreateViewerWhenDataNotExist<string, ScheduleCtrl.MaidStatusAndTaskUnit>(dicMaidStatusAndTaskInfo);
- }
- protected override void SetDataForViewer()
- {
- for (int i = 0; i < 40; i++)
- {
- GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_goUnitPrefab);
- ScheduleCtrl.MaidStatusAndTaskUnit maidStatusAndTaskUnit = null;
- if (this.m_dicMaidStatusAndTask.TryGetValue(string.Format("slot_{0}", i), out maidStatusAndTaskUnit))
- {
- if (maidStatusAndTaskUnit.isEmpty)
- {
- maidStatusAndTaskUnit = this.CreateEmptyUnit(i);
- ScheduleCtrl.SetEmptyMaidStatus(gameObject);
- }
- else
- {
- ScheduleCtrl.SetMaidStatus(UTY.GetChildObject(gameObject, "MaidStatus", false), maidStatusAndTaskUnit);
- int num = int.Parse(maidStatusAndTaskUnit.daytimeTaskId);
- if (!ScheduleCSVData.AllData.ContainsKey(num))
- {
- Debug.LogWarning(string.Concat(new object[]
- {
- "昼スロットNo[",
- maidStatusAndTaskUnit.slotNo,
- "]に存在するタスクID[",
- num,
- "]のデータが見つけられませんでした"
- }));
- maidStatusAndTaskUnit.daytimeTaskId = 2001.ToString();
- }
- num = int.Parse(maidStatusAndTaskUnit.nightTaskId);
- if (!ScheduleCSVData.AllData.ContainsKey(num))
- {
- Debug.LogWarning(string.Concat(new object[]
- {
- "夜スロットNo[",
- maidStatusAndTaskUnit.slotNo,
- "]に存在するタスクID[",
- num,
- "]のデータが見つけられませんでした"
- }));
- maidStatusAndTaskUnit.nightTaskId = 10000.ToString();
- }
- }
- }
- else
- {
- maidStatusAndTaskUnit = this.CreateEmptyUnit(i);
- ScheduleCtrl.SetEmptyMaidStatus(gameObject);
- }
- gameObject.name = string.Format("slot_{0}", i);
- base.SetTransformInfo(gameObject);
- GameObject childObject = UTY.GetChildObject(gameObject, "MaidStatus", false);
- UIButton component = childObject.GetComponent<UIButton>();
- maidStatusAndTaskUnit.uiBtnMaidStatus = component;
- EventDelegate.Add(component.onClick, new EventDelegate.Callback(this.m_scheduleMgr.ClickMaidStatus));
- GameObject childObject2 = UTY.GetChildObject(childObject, "SelectCursor", false);
- childObject2.SetActive(false);
- maidStatusAndTaskUnit.goSelectCursorMaidStatus = childObject2;
- childObject.name = string.Format("slot_{0}_" + ScheduleCtrl.SlotColumn.MaidStatus, i);
- GameObject childObject3 = UTY.GetChildObject(gameObject, "DaytimeTask", false);
- UIButton component2 = childObject3.GetComponent<UIButton>();
- maidStatusAndTaskUnit.uiBtnDaytimeTask = component2;
- this.m_scheduleMgr.ClickTaskEvent(ScheduleMgr.ScheduleTime.DayTime, ref component2.onClick);
- if (!string.IsNullOrEmpty(maidStatusAndTaskUnit.daytimeTaskId))
- {
- UITexture component3 = childObject3.GetComponent<UITexture>();
- component3.mainTexture = maidStatusAndTaskUnit.taskIcon;
- maidStatusAndTaskUnit.uiDaytimeTaskIcon = component3;
- }
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
- GameObject childObject4 = UTY.GetChildObject(childObject3, "SelectCursor", false);
- childObject4.SetActive(false);
- maidStatusAndTaskUnit.goSelectCursorDaytimeTask = childObject4;
- OnHoverTaskIcon component4 = childObject3.GetComponent<OnHoverTaskIcon>();
- component4.Init(maidStatusAndTaskUnit.daytimeTaskName, scheduleSlot, ScheduleMgr.ScheduleTime.DayTime);
- childObject3.name = string.Format("slot_{0}_" + ScheduleCtrl.SlotColumn.DaytimeTask, i);
- GameObject childObject5 = UTY.GetChildObject(gameObject, "NightTask", false);
- UIButton component5 = childObject5.GetComponent<UIButton>();
- maidStatusAndTaskUnit.uiBtnNightTask = component5;
- this.m_scheduleMgr.ClickTaskEvent(ScheduleMgr.ScheduleTime.Night, ref component5.onClick);
- if (!string.IsNullOrEmpty(maidStatusAndTaskUnit.nightTaskId))
- {
- UITexture component6 = childObject5.GetComponent<UITexture>();
- component6.mainTexture = maidStatusAndTaskUnit.nightTaskIcon;
- maidStatusAndTaskUnit.uiNightTaskIcon = component6;
- }
- GameObject childObject6 = UTY.GetChildObject(childObject5, "SelectCursor", false);
- childObject6.SetActive(false);
- maidStatusAndTaskUnit.goSelectCursorNightTask = childObject6;
- OnHoverTaskIcon component7 = childObject5.GetComponent<OnHoverTaskIcon>();
- component7.Init(maidStatusAndTaskUnit.nightTaskName, scheduleSlot, ScheduleMgr.ScheduleTime.Night);
- childObject5.name = string.Format("slot_{0}_" + ScheduleCtrl.SlotColumn.NightTask, i);
- GameObject childObject7 = UTY.GetChildObject(gameObject, "CommuNoon", false);
- maidStatusAndTaskUnit.uiTglCommuDaytime = this.SettingToggle(childObject7, ScheduleMgr.ScheduleTime.DayTime, maidStatusAndTaskUnit);
- if (!maidStatusAndTaskUnit.uiTglCommuDaytime)
- {
- childObject7.SetActive(false);
- }
- GameObject childObject8 = UTY.GetChildObject(gameObject, "CommuNight", false);
- maidStatusAndTaskUnit.uiTglCommuNight = this.SettingToggle(childObject8, ScheduleMgr.ScheduleTime.Night, maidStatusAndTaskUnit);
- if (!maidStatusAndTaskUnit.uiTglCommuNight)
- {
- childObject8.SetActive(false);
- }
- }
- }
- private UIToggle SettingToggle(GameObject obj, ScheduleMgr.ScheduleTime time, ScheduleCtrl.MaidStatusAndTaskUnit unit)
- {
- if (unit.isEmpty)
- {
- return null;
- }
- int key = 0;
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(unit.slotNo);
- if (time == ScheduleMgr.ScheduleTime.DayTime)
- {
- if (!int.TryParse(unit.daytimeTaskId, out key))
- {
- scheduleSlot.status.noonCommu = false;
- return null;
- }
- }
- else if (time == ScheduleMgr.ScheduleTime.Night && !int.TryParse(unit.nightTaskId, out key))
- {
- scheduleSlot.status.nightCommu = false;
- return null;
- }
- ScheduleCSVData.ScheduleBase scheduleBase = (!ScheduleCSVData.AllData.ContainsKey(key)) ? null : ScheduleCSVData.AllData[key];
- if (scheduleBase == null || !scheduleBase.isCommu)
- {
- if (time == ScheduleMgr.ScheduleTime.DayTime)
- {
- scheduleSlot.status.noonCommu = false;
- }
- if (time == ScheduleMgr.ScheduleTime.Night)
- {
- scheduleSlot.status.nightCommu = false;
- }
- return null;
- }
- UIToggle component = obj.GetComponent<UIToggle>();
- if (time == ScheduleMgr.ScheduleTime.DayTime)
- {
- component.startsActive = unit.daytimeCommu;
- }
- if (time == ScheduleMgr.ScheduleTime.Night)
- {
- component.startsActive = unit.nightCommu;
- }
- component.optionCanBeNone = true;
- component.group = (int)(1 + time);
- EventDelegate eventDelegate = new EventDelegate(this, "ClickCommu");
- eventDelegate.parameters[0].value = time;
- eventDelegate.parameters[1].value = unit.maidStatus.id;
- eventDelegate.parameters[2].obj = component;
- EventDelegate.Add(component.onChange, eventDelegate);
- return component;
- }
- private void ClickCommu(ScheduleMgr.ScheduleTime time, string guid, UIToggle toggle)
- {
- if (toggle != UIToggle.current)
- {
- return;
- }
- this.m_scheduleMgr.TaskCtrl.SetCommu(time, guid, toggle.value);
- }
- private ScheduleCtrl.MaidStatusAndTaskUnit CreateEmptyUnit(int slotNo)
- {
- ScheduleCtrl.MaidStatusAndTaskUnit maidStatusAndTaskUnit = new ScheduleCtrl.MaidStatusAndTaskUnit();
- maidStatusAndTaskUnit.slotNo = slotNo;
- maidStatusAndTaskUnit.isEmpty = true;
- MaidStatusListCtrl.MaidStatusButton maidStatus = new MaidStatusListCtrl.MaidStatusButton();
- maidStatusAndTaskUnit.maidStatus = maidStatus;
- this.m_dicMaidStatusAndTask[string.Format("slot_{0}", maidStatusAndTaskUnit.slotNo)] = maidStatusAndTaskUnit;
- return maidStatusAndTaskUnit;
- }
- public static void SetMaidStatus(GameObject maidStatus, ScheduleCtrl.MaidStatusAndTaskUnit unit = null)
- {
- UILabel component = UTY.GetChildObject(maidStatus, "Ranking/Value", false).GetComponent<UILabel>();
- if (unit != null)
- {
- component.text = ScheduleCtrl.ConvertValueWhenDefault(unit.maidStatus.Rranking, "-");
- }
- else
- {
- component.text = null;
- }
- UITexture component2 = UTY.GetChildObject(maidStatus, "Ranking/Icon", false).GetComponent<UITexture>();
- if (unit != null)
- {
- component2.mainTexture = unit.maidStatus.crownIcon;
- }
- else
- {
- component2.mainTexture = null;
- }
- GameObject childObject = UTY.GetChildObject(maidStatus, "Status", false);
- UILabel component3 = UTY.GetChildObject(childObject, "Name/FirstName", false).GetComponent<UILabel>();
- if (unit != null)
- {
- component3.text = unit.maidStatus.firstName;
- }
- else
- {
- component3.text = null;
- }
- UILabel component4 = UTY.GetChildObject(childObject, "Name/LastName", false).GetComponent<UILabel>();
- if (unit != null)
- {
- component4.text = unit.maidStatus.lastName;
- }
- else
- {
- component4.text = null;
- }
- UILabel component5 = UTY.GetChildObject(childObject, "ContractType/Value", false).GetComponent<UILabel>();
- if (Product.SPP && unit != null)
- {
- Vector3 localPosition = component5.transform.localPosition;
- component5.transform.localPosition = new Vector3(180f, localPosition.y, localPosition.z);
- }
- if (unit != null)
- {
- component5.text = unit.maidStatus.contractTypeName;
- Localize component6 = component5.GetComponent<Localize>();
- if (component6 != null)
- {
- bool flag = false;
- Contract contract = Contract.Trainee;
- foreach (string value in Enum.GetNames(typeof(Contract)))
- {
- Contract contract2 = (Contract)Enum.Parse(typeof(Contract), value);
- string @string = EnumConvert.GetString(contract2);
- if (@string == unit.maidStatus.contractTypeName)
- {
- contract = contract2;
- flag = true;
- break;
- }
- }
- if (flag)
- {
- component6.SetTerm(EnumConvert.GetTerm(contract));
- }
- else
- {
- component6.SetTerm("MaidStatus/契約タイプ/" + unit.maidStatus.contractTypeName);
- }
- }
- }
- else
- {
- component5.text = null;
- }
- UITexture component7 = UTY.GetChildObject(maidStatus, "Figure/Icon", false).GetComponent<UITexture>();
- if (unit != null)
- {
- component7.mainTexture = unit.maidStatus.maidIcon;
- unit.maidStatus.uiMaidIcon = component7;
- }
- else
- {
- component7.mainTexture = null;
- }
- GameObject childObject2 = UTY.GetChildObject(maidStatus, "Status/Reader", false);
- if (unit != null)
- {
- childObject2.SetActive(unit.maidStatus.isReader);
- }
- else
- {
- childObject2.SetActive(false);
- }
- }
- public static string ConvertValueWhenDefault(int input, string output)
- {
- if (input == 0)
- {
- return output;
- }
- return input.ToString();
- }
- public static void SetEmptyMaidStatus(GameObject maidStatusUnit)
- {
- GameObject childObject = UTY.GetChildObject(maidStatusUnit, "MaidStatus", false);
- UTY.GetChildObject(childObject, "Ranking", false).SetActive(false);
- UTY.GetChildObject(childObject, "Figure", false).SetActive(false);
- UTY.GetChildObject(childObject, "Status", false).SetActive(false);
- GameObject childObject2 = UTY.GetChildObject(maidStatusUnit, "DaytimeTask", false);
- childObject2.SetActive(false);
- GameObject childObject3 = UTY.GetChildObject(maidStatusUnit, "NightTask", false);
- childObject3.SetActive(false);
- }
- public static void SetEmptyMaidStatusResult(GameObject maidStatusUnit)
- {
- GameObject childObject = UTY.GetChildObject(maidStatusUnit, "MaidStatus", false);
- childObject.SetActive(false);
- UTY.GetChildObject(childObject, "Ranking", false).SetActive(false);
- UTY.GetChildObject(childObject, "Figure", false).SetActive(false);
- UTY.GetChildObject(childObject, "Status", false).SetActive(false);
- GameObject childObject2 = UTY.GetChildObject(maidStatusUnit, "Task", false);
- childObject2.SetActive(false);
- GameObject childObject3 = UTY.GetChildObject(maidStatusUnit, "CommuNoon", false);
- childObject3.SetActive(false);
- }
- public void SetViewerActive(ScheduleCtrl.ExclusiveViewer viewer)
- {
- foreach (KeyValuePair<ScheduleCtrl.ExclusiveViewer, GameObject> keyValuePair in this.DicExclusiveViewer)
- {
- ScheduleCtrl.ExclusiveViewer key = keyValuePair.Key;
- GameObject value = keyValuePair.Value;
- if (key == viewer)
- {
- value.SetActive(true);
- this.m_currentActiveViewer = key;
- }
- else
- {
- value.SetActive(false);
- }
- }
- }
- public string GetMaidIdByButtonName(string buttonName)
- {
- ScheduleCtrl.MaidStatusAndTaskUnit maidStatusAndTaskUnitByButtonName = this.GetMaidStatusAndTaskUnitByButtonName(buttonName);
- if (maidStatusAndTaskUnitByButtonName != null)
- {
- return maidStatusAndTaskUnitByButtonName.maidStatus.id;
- }
- return null;
- }
- public Maid GetMaidByButtonName(string buttonName)
- {
- ScheduleCtrl.MaidStatusAndTaskUnit maidStatusAndTaskUnitByButtonName = this.GetMaidStatusAndTaskUnitByButtonName(buttonName);
- if (maidStatusAndTaskUnitByButtonName != null && maidStatusAndTaskUnitByButtonName.maidStatus != null && maidStatusAndTaskUnitByButtonName.maidStatus.maid != null)
- {
- return maidStatusAndTaskUnitByButtonName.maidStatus.maid;
- }
- return null;
- }
- public ScheduleCtrl.MaidStatusAndTaskUnit GetMaidStatusAndTaskUnitByButtonName(string buttonName)
- {
- ScheduleCtrl.Slot slotByButtonName = ScheduleCtrl.GetSlotByButtonName(buttonName);
- ScheduleCtrl.MaidStatusAndTaskUnit result = null;
- if (this.m_dicMaidStatusAndTask.TryGetValue(slotByButtonName.slotNo, out result))
- {
- return result;
- }
- return null;
- }
- public static ScheduleCtrl.Slot GetSlotByButtonName(string buttonName)
- {
- ScheduleCtrl.Slot slot = new ScheduleCtrl.Slot();
- if (string.IsNullOrEmpty(buttonName))
- {
- return slot;
- }
- if (buttonName.EndsWith(ScheduleCtrl.SlotColumn.MaidStatus.ToString()))
- {
- int num = buttonName.IndexOf(ScheduleCtrl.SlotColumn.MaidStatus.ToString());
- slot.slotNo = buttonName.Substring(0, num - 1);
- slot.slotColumn = ScheduleCtrl.SlotColumn.MaidStatus;
- }
- if (buttonName.EndsWith(ScheduleCtrl.SlotColumn.DaytimeTask.ToString()))
- {
- int num2 = buttonName.IndexOf(ScheduleCtrl.SlotColumn.DaytimeTask.ToString());
- slot.slotNo = buttonName.Substring(0, num2 - 1);
- slot.slotColumn = ScheduleCtrl.SlotColumn.DaytimeTask;
- }
- if (buttonName.EndsWith(ScheduleCtrl.SlotColumn.NightTask.ToString()))
- {
- int num3 = buttonName.IndexOf(ScheduleCtrl.SlotColumn.NightTask.ToString());
- slot.slotNo = buttonName.Substring(0, num3 - 1);
- slot.slotColumn = ScheduleCtrl.SlotColumn.NightTask;
- }
- return slot;
- }
- public static int GetSlotNoByButtonName(string buttonName)
- {
- ScheduleCtrl.Slot slotByButtonName = ScheduleCtrl.GetSlotByButtonName(buttonName);
- return ScheduleCtrl.ToIntSlotNo(slotByButtonName.slotNo);
- }
- public void SetSelectedRowActive(string buttonName)
- {
- if (string.IsNullOrEmpty(buttonName))
- {
- return;
- }
- ScheduleCtrl.Slot slotByButtonName = ScheduleCtrl.GetSlotByButtonName(buttonName);
- ScheduleCtrl.Slot slotByButtonName2 = ScheduleCtrl.GetSlotByButtonName(this.m_scheduleMgr.CurrentActiveButton);
- this.m_activeSlotNo = slotByButtonName.slotNo;
- if (slotByButtonName.slotNo == slotByButtonName2.slotNo)
- {
- ScheduleCtrl.MaidStatusAndTaskUnit unit = null;
- if (this.m_dicMaidStatusAndTask.TryGetValue(slotByButtonName.slotNo, out unit))
- {
- this.SetSelectCursorActive(unit, slotByButtonName.slotColumn, true);
- this.SetSelectCursorActive(unit, slotByButtonName2.slotColumn, false);
- }
- }
- else
- {
- ScheduleCtrl.MaidStatusAndTaskUnit unit2 = null;
- if (this.m_dicMaidStatusAndTask.TryGetValue(slotByButtonName.slotNo, out unit2))
- {
- this.SetSelectCursorActive(unit2, slotByButtonName.slotColumn, true);
- this.SetSlotRowActiveColor(unit2, true);
- }
- ScheduleCtrl.MaidStatusAndTaskUnit unit3 = null;
- if (this.m_dicMaidStatusAndTask.TryGetValue(slotByButtonName2.slotNo, out unit3))
- {
- this.SetSelectCursorActive(unit3, slotByButtonName2.slotColumn, false);
- this.SetSlotRowActiveColor(unit3, false);
- }
- }
- }
- private void SetSelectCursorActive(ScheduleCtrl.MaidStatusAndTaskUnit unit, ScheduleCtrl.SlotColumn slotColumn, bool active)
- {
- if (slotColumn != ScheduleCtrl.SlotColumn.MaidStatus)
- {
- if (slotColumn != ScheduleCtrl.SlotColumn.DaytimeTask)
- {
- if (slotColumn == ScheduleCtrl.SlotColumn.NightTask)
- {
- unit.goSelectCursorNightTask.SetActive(active);
- }
- }
- else
- {
- unit.goSelectCursorDaytimeTask.SetActive(active);
- }
- }
- else
- {
- unit.goSelectCursorMaidStatus.SetActive(active);
- }
- }
- private void SetSlotRowActiveColor(ScheduleCtrl.MaidStatusAndTaskUnit unit, bool active)
- {
- if (active)
- {
- unit.uiBtnMaidStatus.defaultColor = this.activeColor;
- unit.uiBtnDaytimeTask.defaultColor = this.activeColor;
- unit.uiBtnNightTask.defaultColor = this.activeColor;
- }
- else
- {
- unit.uiBtnMaidStatus.defaultColor = this.inActiveColor;
- unit.uiBtnDaytimeTask.defaultColor = this.inActiveColor;
- unit.uiBtnNightTask.defaultColor = this.inActiveColor;
- }
- }
- public static int SetActiveExceptForNothing(List<ScheduleCtrl.VariableItem> list, string condition)
- {
- int num = 0;
- foreach (ScheduleCtrl.VariableItem variableItem in list)
- {
- if (variableItem.value.text == condition)
- {
- variableItem.item.SetActive(false);
- }
- else
- {
- variableItem.item.SetActive(true);
- num++;
- }
- }
- return num;
- }
- public bool ExistSelectedMaid()
- {
- if (this.m_dicMaidStatusAndTask != null || this.m_dicMaidStatusAndTask.Count > 0)
- {
- IEnumerable<ScheduleCtrl.MaidStatusAndTaskUnit> source = from value in this.m_dicMaidStatusAndTask.Values
- where !value.isEmpty
- select value;
- if (source.Count<ScheduleCtrl.MaidStatusAndTaskUnit>() > 0)
- {
- return true;
- }
- }
- GameMain.Instance.SysDlg.Show("スケジュールにキャラクターが\n設定されておりません。", SystemDialog.TYPE.OK, null, null);
- return false;
- }
- public void SetMaidIdByButtonName(string buttonName)
- {
- this.m_maidId = this.GetMaidIdByButtonName(buttonName);
- this.selectedMaid = this.GetMaidByButtonName(buttonName);
- }
- public void DeleteMaidStatus(ScheduleScene scheduleApi, string buttonName)
- {
- this.m_scheduleApi = scheduleApi;
- string maidName = this.GetMaidName(buttonName);
- this.m_deleteSlotNo = ScheduleCtrl.GetSlotByButtonName(buttonName).slotNo;
- if (Product.SPP)
- {
- GameMain.Instance.SysDlg.ShowFromLanguageTerm("Dialog/スケジュールから削除して宜しいですか。", null, SystemDialog.TYPE.OK_CANCEL, new SystemDialog.OnClick(this.DeleteMaidAndReDraw), null);
- }
- else
- {
- GameMain.Instance.SysDlg.Show(string.Format("名前:{0}\nスケジュールから削除して\n宜しいですか。", maidName), SystemDialog.TYPE.OK_CANCEL, new SystemDialog.OnClick(this.DeleteMaidAndReDraw), null);
- }
- }
- private void DeleteMaidAndReDraw()
- {
- string text = null;
- if (this.m_dicMaidStatusAndTask.ContainsKey(this.m_deleteSlotNo))
- {
- text = this.m_scheduleMgr.CurrentActiveButton;
- int slotId = ScheduleCtrl.ToIntSlotNo(this.m_deleteSlotNo);
- this.m_scheduleApi.SetSlot_Safe(slotId, null, true, true);
- if (this.DicExclusiveViewer[ScheduleCtrl.ExclusiveViewer.MaidStatusList].activeSelf)
- {
- this.m_charSelMgr.MoveGridArea(this.GetMaidBySlotNo(this.m_deleteSlotNo));
- }
- this.m_scheduleMgr.UpdateMaidStatus();
- }
- GameMain.Instance.SysDlg.Close();
- if (!string.IsNullOrEmpty(text))
- {
- if (text.Contains(this.m_deleteSlotNo))
- {
- this.SetViewerActive(ScheduleCtrl.ExclusiveViewer.None);
- }
- else
- {
- this.SetSelectedRowActive(text);
- this.m_scheduleMgr.CurrentActiveButton = text;
- this.SetViewerActive(this.m_currentActiveViewer);
- if (this.DicExclusiveViewer[ScheduleCtrl.ExclusiveViewer.Task].activeSelf)
- {
- this.m_scheduleMgr.UpdateTask("-1");
- }
- }
- }
- this.m_deleteSlotNo = null;
- this.m_scheduleApi = null;
- }
- public bool CanDeleteData(string buttonName)
- {
- ScheduleCtrl.MaidStatusAndTaskUnit maidStatusAndTaskUnitByButtonName = this.GetMaidStatusAndTaskUnitByButtonName(buttonName);
- return !maidStatusAndTaskUnitByButtonName.isEmpty && (!maidStatusAndTaskUnitByButtonName.maidStatus.isReader || this.GetSettingMaidCount() != 1);
- }
- private int GetSettingMaidCount()
- {
- int num = 0;
- foreach (ScheduleCtrl.MaidStatusAndTaskUnit maidStatusAndTaskUnit in this.m_dicMaidStatusAndTask.Values)
- {
- if (!maidStatusAndTaskUnit.isEmpty)
- {
- num++;
- }
- }
- return num;
- }
- private string GetMaidName(string buttonName)
- {
- ScheduleCtrl.MaidStatusAndTaskUnit maidStatusAndTaskUnitByButtonName = this.GetMaidStatusAndTaskUnitByButtonName(buttonName);
- if (!maidStatusAndTaskUnitByButtonName.isEmpty)
- {
- return maidStatusAndTaskUnitByButtonName.maidStatus.lastName + " " + maidStatusAndTaskUnitByButtonName.maidStatus.firstName;
- }
- return string.Empty;
- }
- public Maid GetMaidByMaidId(string maidId)
- {
- Dictionary<string, ScheduleCtrl.MaidStatusAndTaskUnit> dicMaidStatusAndTask = this.GetDicMaidStatusAndTask();
- foreach (KeyValuePair<string, ScheduleCtrl.MaidStatusAndTaskUnit> keyValuePair in dicMaidStatusAndTask)
- {
- ScheduleCtrl.MaidStatusAndTaskUnit value = keyValuePair.Value;
- if (!value.isEmpty && value.maidStatus.id == maidId)
- {
- return value.maidStatus.maid;
- }
- }
- return null;
- }
- public Maid GetMaidBySlotNo(string slotNo)
- {
- ScheduleCtrl.MaidStatusAndTaskUnit maidStatusAndTaskUnit = null;
- if (this.m_dicMaidStatusAndTask.TryGetValue(slotNo, out maidStatusAndTaskUnit))
- {
- return maidStatusAndTaskUnit.maidStatus.maid;
- }
- return null;
- }
- public Maid GetMaidByActiveSlot()
- {
- ScheduleCtrl.MaidStatusAndTaskUnit maidStatusAndTaskUnit = null;
- if (this.m_dicMaidStatusAndTask.TryGetValue(this.m_activeSlotNo, out maidStatusAndTaskUnit))
- {
- return maidStatusAndTaskUnit.maidStatus.maid;
- }
- return null;
- }
- public static int ToIntSlotNo(string slotNo)
- {
- if (!string.IsNullOrEmpty(slotNo))
- {
- return int.Parse(slotNo.Replace("slot_", string.Empty));
- }
- Debug.LogError(string.Format("不適切なスロットNoが指定されました。指定されたスロットNo={0}", slotNo));
- return 9999;
- }
- private ScheduleMgr m_scheduleMgr;
- private CharacterSelectManager m_charSelMgr;
- private ScheduleScene m_scheduleApi;
- private ScheduleCtrl.ExclusiveViewer m_currentActiveViewer;
- private Dictionary<string, ScheduleCtrl.MaidStatusAndTaskUnit> m_dicMaidStatusAndTask;
- private GameObject m_goPanel;
- private Color activeColor;
- private Color inActiveColor;
- private Color disableColor;
- private string m_activeSlotNo;
- private string m_maidId;
- private bool m_bInit;
- [SerializeField]
- private Maid selectedMaid;
- private const string UNIT_PARENT_PATH = "SelectedMaidViewer/Contents/SelectedMaidUnitParent";
- private const string UNIT_PREFAB_PATH = "SceneDaily/Schedule/Prefab/MaidStatusUnit";
- private const string SYSTEM_UI_ROOT_PATH = "__GameMain__/SystemUI Root";
- private const string MAID_STATUS_BUTTON_NAME_SUFFIX = "_maidStatus";
- private const string DAYTIME_TASK_BUTTON_NAME_SUFFIX = "_daytime";
- private const string NIGHT_TASK_BUTTON_NAME_SUFFIX = "_night";
- private const string DIALOG_MESSAGE_TO_DELETE = "名前:{0}\nスケジュールから削除して\n宜しいですか。";
- private const string DIALOG_MESSAGE_TO_DELETE_TERM = "Dialog/スケジュールから削除して宜しいですか。";
- private const string DIALOG_MESSAGE_NOT_SELECTED_MAID = "スケジュールにキャラクターが\n設定されておりません。";
- private string m_deleteSlotNo;
- private const int ERROR_CODE_FOR_SLOTNO = 9999;
- public enum SlotColumn
- {
- MaidStatus,
- DaytimeTask,
- NightTask
- }
- public enum ExclusiveViewer
- {
- None,
- MaidStatusList,
- Task,
- Room
- }
- public class MaidStatusAndTaskUnit
- {
- public int slotNo;
- public bool isEmpty;
- public MaidStatusListCtrl.MaidStatusButton maidStatus;
- public string daytimeTaskId;
- public string nightTaskId;
- public bool daytimeCommu;
- public bool nightCommu;
- public string daytimeTaskName;
- public string nightTaskName;
- public Texture2D taskIcon;
- public Texture2D nightTaskIcon;
- public UITexture uiDaytimeTaskIcon;
- public UITexture uiNightTaskIcon;
- public UIButton uiBtnMaidStatus;
- public UIButton uiBtnDaytimeTask;
- public UIButton uiBtnNightTask;
- public UIToggle uiTglCommuDaytime;
- public UIToggle uiTglCommuNight;
- public BoxCollider colliderMaidStatus;
- public GameObject goSelectCursorMaidStatus;
- public GameObject goSelectCursorDaytimeTask;
- public GameObject goSelectCursorNightTask;
- }
- public class Slot
- {
- public Slot()
- {
- this.slotNo = string.Empty;
- }
- public string slotNo;
- public ScheduleCtrl.SlotColumn slotColumn;
- }
- public class VariableItem
- {
- public VariableItem(GameObject item, UILabel label)
- {
- this.item = item;
- this.value = label;
- }
- public GameObject item;
- public UILabel value;
- }
- }
|