using System; using PlayerStatus; using UnityEngine; public class ScheduleMaidStatusUnit : MonoBehaviour { public void Init(ResultWorkMgr resultWorkMgr, int slotNo) { this.slotNo = slotNo; this.resultWorkMgr = resultWorkMgr; GameObject childObject = UTY.GetChildObject(base.gameObject, "Frame", false); childObject.SetActive(true); this.basicPanel = new ScheduleMaidStatusUnit.Panel(UTY.GetChildObject(base.gameObject, "PanelBasicParam", false)); this.subPanel = new ScheduleMaidStatusUnit.Panel(UTY.GetChildObject(base.gameObject, "PanelSubParam", false)); this.traineePanel = new ScheduleMaidStatusUnit.Panel(UTY.GetChildObject(base.gameObject, "PanelTraineeParam", false)); this.facilityPanel = UTY.GetChildObject(base.gameObject, "PanelFacilityParam", false); GameObject childObject2 = UTY.GetChildObject(base.gameObject, "LabelWaring", false); this.wariningLabel = childObject2.GetComponent(); this.facilityPanelBasic = new ScheduleMaidStatusUnit.Panel(UTY.GetChildObject(base.gameObject, "PanelFacilityParam/Panel_Basic", false)); this.facilityPanelAdd = new ScheduleMaidStatusUnit.Panel(UTY.GetChildObject(base.gameObject, "PanelFacilityParam/Panel_Add", false)); this.basicPanel.SetActive(false); this.subPanel.SetActive(false); this.traineePanel.SetActive(false); this.facilityPanel.SetActive(false); this.wariningLabel.gameObject.SetActive(false); this.successLv = this.GetMaidWorkSuccessLv(slotNo); } public void SetViewer(ScheduleMaidStatusUnit.DataType type) { bool flag = true; if (this.successLv == ScheduleData.WorkSuccessLv.Unexecuted) { this.Warinig(type); return; } switch (type) { case ScheduleMaidStatusUnit.DataType.Yotogi: if (this.successLv == ScheduleData.WorkSuccessLv.Miss) { this.Warinig(type); return; } this.SetViewer_Yotogi(); break; case ScheduleMaidStatusUnit.DataType.Work: this.SetViewer_Work(); break; case ScheduleMaidStatusUnit.DataType.Training: this.SetViewer_Training(); break; case ScheduleMaidStatusUnit.DataType.Facility: flag = this.SetViewer_Facility(); break; case ScheduleMaidStatusUnit.DataType.Trainee: this.SetViewer_Trainee(); break; case ScheduleMaidStatusUnit.DataType.Trainer: this.Warinig(type); return; } if (!flag) { return; } if (type == ScheduleMaidStatusUnit.DataType.Facility) { this.facilityPanel.SetActive(true); this.facilityPanelBasic.SetActive(true); this.facilityPanelAdd.SetActive(true); this.facilityPanelBasic.Repostion(); this.facilityPanelAdd.Repostion(); } else if (type == ScheduleMaidStatusUnit.DataType.Trainee) { this.traineePanel.SetActive(true); this.traineePanel.Repostion(); } else { this.basicPanel.SetActive(true); this.subPanel.SetActive(true); this.basicPanel.Repostion(); this.subPanel.Repostion(); } } private void Warinig(ScheduleMaidStatusUnit.DataType type) { string text = string.Empty; switch (type) { case ScheduleMaidStatusUnit.DataType.Yotogi: text = "夜伽がキャンセルされました"; break; case ScheduleMaidStatusUnit.DataType.Work: { Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(this.slotNo); ScheduleMgr.ScheduleTime scheduleTime = ScheduleMgr.ScheduleTime.DayTime; if (this.resultWorkMgr.GetCurrentResultType() == ResultWorkMgr.ResultType.Daytime) { scheduleTime = ScheduleMgr.ScheduleTime.DayTime; } else if (this.resultWorkMgr.GetCurrentResultType() == ResultWorkMgr.ResultType.Night) { scheduleTime = ScheduleMgr.ScheduleTime.Night; } Facility maidAssignedFacility = GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(scheduleSlot, scheduleTime); if (maidAssignedFacility != null) { text = string.Concat(new string[] { "ROOM ", GameMain.Instance.FacilityMgr.GetFacilityIndex(maidAssignedFacility).ToString().PadLeft(2, '0'), " 「", maidAssignedFacility.facilityName, "」" }); text += "\n稼動に必要なメイドが足りません"; string text2 = text; text = string.Concat(new object[] { text2, "\nあと", maidAssignedFacility.minMaidCount - maidAssignedFacility.NowMaidCount(scheduleTime), "人必要です" }); } break; } case ScheduleMaidStatusUnit.DataType.Facility: text = "施設の強化がキャンセルされました"; break; case ScheduleMaidStatusUnit.DataType.Trainer: text = "メイド研修を実施しました"; break; } if (text != string.Empty) { this.wariningLabel.text = text; this.wariningLabel.gameObject.SetActive(true); } } private void SetViewer_Training() { ResultWorkCtrl.UpperMaidStatus maidStatusBySlotNo = this.GetMaidStatusBySlotNo(this.slotNo); this.basicPanel.AddParam("お世話", maidStatusBySlotNo.care, false); this.basicPanel.AddParam("可\u3000燐", maidStatusBySlotNo.lovely, false); this.basicPanel.AddParam("料\u3000理", maidStatusBySlotNo.cooking, false); this.basicPanel.AddParam("接\u3000待", maidStatusBySlotNo.reception, false); this.basicPanel.AddParam("気\u3000品", maidStatusBySlotNo.elegance, false); this.basicPanel.AddParam("ボーカル", maidStatusBySlotNo.vocal, false); this.basicPanel.AddParam("指\u3000導", maidStatusBySlotNo.teach, false); this.basicPanel.AddParam("魅\u3000惑", maidStatusBySlotNo.charm, false); this.basicPanel.AddParam("ダンス", maidStatusBySlotNo.dance, false); this.subPanel.AddParam("取得資金", (int)maidStatusBySlotNo.income, false); this.subPanel.AddParam("ジョブメイド経験値", maidStatusBySlotNo.maidClassExp, false); } private void SetViewer_Trainee() { ResultWorkCtrl.UpperMaidStatus maidStatusBySlotNo = this.GetMaidStatusBySlotNo(this.slotNo); this.traineePanel.AddParam("お世話", maidStatusBySlotNo.care, false); this.traineePanel.AddParam("可\u3000燐", maidStatusBySlotNo.lovely, false); this.traineePanel.AddParam("料\u3000理", maidStatusBySlotNo.cooking, false); this.traineePanel.AddParam("接\u3000待", maidStatusBySlotNo.reception, false); this.traineePanel.AddParam("気\u3000品", maidStatusBySlotNo.elegance, false); this.traineePanel.AddParam("ボーカル", maidStatusBySlotNo.vocal, false); this.traineePanel.AddParam("魅\u3000惑", maidStatusBySlotNo.charm, false); this.traineePanel.AddParam("ダンス", maidStatusBySlotNo.dance, false); this.traineePanel.AddParam("淫欲", maidStatusBySlotNo.inyoku, false); this.traineePanel.AddParam("M性", maidStatusBySlotNo.m_value, false); this.traineePanel.AddParam("奉仕", maidStatusBySlotNo.housi, false); this.traineePanel.AddParam("変態", maidStatusBySlotNo.hentai, false); } private void SetViewer_Work() { ResultWorkCtrl.UpperMaidStatus maidStatusBySlotNo = this.GetMaidStatusBySlotNo(this.slotNo); this.basicPanel.AddParam("お世話", maidStatusBySlotNo.care, false); this.basicPanel.AddParam("可\u3000燐", maidStatusBySlotNo.lovely, false); this.basicPanel.AddParam("料\u3000理", maidStatusBySlotNo.cooking, false); this.basicPanel.AddParam("接\u3000待", maidStatusBySlotNo.reception, false); this.basicPanel.AddParam("気\u3000品", maidStatusBySlotNo.elegance, false); this.basicPanel.AddParam("ボーカル", maidStatusBySlotNo.vocal, false); this.basicPanel.AddParam("指\u3000導", maidStatusBySlotNo.teach, false); this.basicPanel.AddParam("魅\u3000惑", maidStatusBySlotNo.charm, false); this.basicPanel.AddParam("ダンス", maidStatusBySlotNo.dance, false); this.subPanel.AddParam("取得資金", (int)maidStatusBySlotNo.workingFunds, true); this.subPanel.AddParam("取得客評価", maidStatusBySlotNo.evaluation, false); this.subPanel.AddParam("接客回数", maidStatusBySlotNo.othersPlayCount, false); this.subPanel.AddParam("ジョブメイド経験値", maidStatusBySlotNo.maidClassExp, false); } private void SetViewer_Yotogi() { ResultWorkCtrl.UpperMaidStatus maidStatusBySlotNo = this.GetMaidStatusBySlotNo(this.slotNo); this.basicPanel.AddParam("お世話", maidStatusBySlotNo.care, false); this.basicPanel.AddParam("接\u3000待", maidStatusBySlotNo.reception, false); this.basicPanel.AddParam("指\u3000導", maidStatusBySlotNo.teach, false); this.basicPanel.AddParam("淫\u3000欲", maidStatusBySlotNo.inyoku, false); this.basicPanel.AddParam("M\u3000性", maidStatusBySlotNo.m_value, false); this.basicPanel.AddParam("変\u3000態", maidStatusBySlotNo.hentai, false); this.basicPanel.AddParam("奉\u3000仕", maidStatusBySlotNo.housi, false); this.subPanel.AddParam("夜伽回数", maidStatusBySlotNo.yotogiPlayCount, false); this.subPanel.AddParam("習得率", maidStatusBySlotNo.studyRate, false); this.subPanel.AddParam("取得資金", (int)maidStatusBySlotNo.workingFunds, true); this.subPanel.AddParam("取得客評価", maidStatusBySlotNo.evaluation, false); this.subPanel.AddParam("接客回数", maidStatusBySlotNo.othersPlayCount, false); } private bool SetViewer_Facility() { FacilityManager facilityMgr = GameMain.Instance.FacilityMgr; CharacterMgr characterMgr = GameMain.Instance.CharacterMgr; Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(this.slotNo); if (scheduleSlot == null) { return false; } Facility facility; Facility.RecipeData recipeData; if (!facilityMgr.TryGetCacheFacilityPowerUpResult(scheduleSlot, out facility, out recipeData)) { return false; } UILabel label = this.GetLabel(this.facilityPanel, "RoomNo"); label.text = "ROOM " + (facilityMgr.GetFacilityIndex(facility) + 1).ToString().PadLeft(2, '0'); UILabel label2 = this.GetLabel(this.facilityPanel, "InfoParent/RoomName"); label2.text = facility.facilityName; UILabel label3 = this.GetLabel(this.facilityPanel, "InfoParent/RecipeNo"); string str = string.Format("{0:D4}", recipeData.id); label3.text = "RECIPE " + str; UILabel label4 = this.GetLabel(this.facilityPanel, "InfoParent/Recipe"); label4.text = recipeData.name; GameObject childObject = UTY.GetChildObject(this.facilityPanel, "Thumbnail", false); UITexture component = childObject.GetComponent(); Sprite facilityThumbnail = FacilityDataTable.GetFacilityThumbnail(facility.defaultData.ID, true); if (facilityThumbnail != null) { component.mainTexture = facilityThumbnail.texture; } Facility.FacilityParameter facilityParameter = recipeData.defaultParameter; for (int i = 0; i < facilityParameter.Length; i++) { string parameterName = facilityParameter.GetParameterName(i); int value = facilityParameter[i]; this.facilityPanelBasic.AddParam(parameterName, value, false); } facilityParameter = recipeData.additionalParameter; for (int j = 0; j < facilityParameter.Length; j++) { string parameterName2 = facilityParameter.GetParameterName(j); int value2 = facilityParameter[j]; this.facilityPanelAdd.AddParam(parameterName2, value2, false); } return true; } private UILabel GetLabel(GameObject parent, string path) { GameObject childObject = UTY.GetChildObject(parent, path, false); return childObject.GetComponent(); } protected ResultWorkCtrl.UpperMaidStatus GetMaidStatusBySlotNo(int slotNo) { ResultWorkCtrl.ResultWork resultWorkBySlotNo = this.resultWorkMgr.Ctrl.GetResultWorkBySlotNo(slotNo); if (resultWorkBySlotNo.upperMaidStatus != null) { return resultWorkBySlotNo.upperMaidStatus; } return null; } protected ScheduleData.WorkSuccessLv GetMaidWorkSuccessLv(int slotNo) { ResultWorkCtrl.ResultWork resultWorkBySlotNo = this.resultWorkMgr.Ctrl.GetResultWorkBySlotNo(slotNo); if (resultWorkBySlotNo != null) { return resultWorkBySlotNo.successLv; } return ScheduleData.WorkSuccessLv.Unexecuted; } private ResultWorkMgr resultWorkMgr; private int slotNo; private ScheduleData.WorkSuccessLv successLv; private ScheduleMaidStatusUnit.Panel basicPanel; private ScheduleMaidStatusUnit.Panel subPanel; private ScheduleMaidStatusUnit.Panel traineePanel; private GameObject facilityPanel; private ScheduleMaidStatusUnit.Panel facilityPanelBasic; private ScheduleMaidStatusUnit.Panel facilityPanelAdd; private UILabel wariningLabel; public enum DataType { Yotogi, Work, Training, Facility, Trainee, Trainer } private enum PanelType { Basic, Sub, Facility } public class Panel { public Panel(GameObject panelObj) { this.baseObj = panelObj; this.paramParent = UTY.GetChildObject(panelObj, "ParamParent", false); this.paramObj = UTY.GetChildObject(panelObj, "Param", false); this.grid = this.paramParent.GetComponent(); this.paramObj.SetActive(false); } public void AddParam(string name, int value, bool money = false) { if (value <= 0) { return; } GameObject gameObject = UnityEngine.Object.Instantiate(this.paramObj); gameObject.SetActive(true); gameObject.transform.parent = this.paramParent.transform; gameObject.transform.localPosition = new Vector3(0f, 0f, 0f); gameObject.transform.localScale = new Vector3(1f, 1f, 1f); UILabel component = gameObject.GetComponent(); UILabel component2 = UTY.GetChildObject(gameObject, "Value", false).GetComponent(); component.text = name; if (money) { component2.text = "+ " + this.ValueToMoney(value); } else { component2.text = "+ " + value.ToString(); } } public void Repostion() { BaseCreateViewerCtrl.Reposition(this.paramParent); } public void SetActive(bool active) { this.baseObj.SetActive(active); } private string ValueToMoney(int value) { return string.Format("{0:#,0}", value); } public GameObject baseObj; public GameObject paramParent; public GameObject paramObj; public UIGrid grid; } }