using System; using I2.Loc; using Schedule; using UnityEngine; public class OnHoverTaskIcon : MonoBehaviour { public void Init(string taskName, Maid maid, ScheduleMgr.ScheduleTime time) { this.taskName = taskName; this.maid = maid; if (string.IsNullOrEmpty(taskName)) { return; } this.m_goNamePlate = UTY.GetChildObject(base.gameObject, "NamePlate", false); this.spritePlate = this.m_goNamePlate.GetComponent(); this.labelName = UTY.GetChildObject(this.m_goNamePlate, "Name", false).GetComponent(); this.labelName.width = 0; this.SetText(taskName, -1); this.m_goNamePlate.SetActive(false); this.WariningFacilty = UTY.GetChildObject(base.gameObject, "WarningFacilty", false).GetComponent(); this.WariningFacilty.gameObject.SetActive(false); this.time = time; int key = 0; if (maid != null) { if (time == ScheduleMgr.ScheduleTime.DayTime) { key = maid.status.noonWorkId; } else if (time == ScheduleMgr.ScheduleTime.Night) { key = maid.status.nightWorkId; } ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[key]; if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Work) { this.workData = (ScheduleCSVData.Work)scheduleBase; this.facility = GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(maid, time); } } } private void Update() { if (this.workData != null && this.workData.id != ScheduleCSVData.faclilityPowerUpWorkId) { this.WariningFacilty.gameObject.SetActive(!this.facility.IsOperation(this.time)); } } public void SetText(string message, int needNum = -1) { UISprite component = this.m_goNamePlate.GetComponent(); if (Product.supportMultiLanguage) { string text = message; if (message.IndexOf('\n') != -1) { text = message.Split(new char[] { '\n' })[0]; } string text2 = string.Empty; text2 = LocalizationManager.GetTranslation("SceneDaily/スケジュール/項目/" + text, true, 0, true, false, null, null); if (string.IsNullOrEmpty(text2)) { text2 = LocalizationManager.GetTranslation("SceneFacilityManagement/施設名/" + text, true, 0, true, false, null, null); } if (string.IsNullOrEmpty(text2)) { text2 = text; } string text3 = string.Empty; if (needNum != -1) { text3 = LocalizationManager.GetTranslation("SceneDaily/あと{0}人必要です", true, 0, true, false, null, null); } string text4 = text2; if (!string.IsNullOrEmpty(text3)) { text4 = text4 + "\n" + string.Format(text3, needNum); } this.labelName.text = text4; this.labelName.MakePixelPerfect(); } else { this.labelName.text = message; this.labelName.MakePixelPerfect(); } string[] array = message.Split(new char[] { '\n' }); int num = 0; foreach (string text5 in array) { if (num < text5.Length) { num = text5.Length; } } component.width = this.labelName.width + 15; component.height = array.Length * 33; } private void OnHover(bool isOver) { if (isOver) { if (this.m_goNamePlate != null) { if (Product.supportMultiLanguage) { this.SetText(this.taskName, -1); } this.m_goNamePlate.SetActive(true); } if (this.workData != null && this.workData.id != ScheduleCSVData.faclilityPowerUpWorkId) { this.CheckFacilityState(); } } else { if (this.m_goNamePlate != null) { this.m_goNamePlate.SetActive(false); } if (this.WariningFacilty != null) { this.WariningFacilty.gameObject.SetActive(false); } } } private void CheckFacilityState() { if (!this.facility.IsOperation(this.time)) { int num; if (this.time == ScheduleMgr.ScheduleTime.DayTime) { num = this.facility.minMaidCount - this.facility.nowDayTimeMaidCount; } else { num = this.facility.minMaidCount - this.facility.nowNightMaidCount; } this.SetText(string.Concat(new object[] { this.taskName, "\nあと[FF0000]", num, "人[-]必要です" }), num); } else { this.SetText(this.taskName, -1); } } private GameObject m_goNamePlate; private UISprite spritePlate; private UILabel labelName; private const int SIDE_OFFSET = 15; private const int VERT_OFFSET = 33; private string taskName; private ScheduleCSVData.Work workData; public UISprite WariningFacilty; private ScheduleMgr.ScheduleTime time; private Facility facility; private Maid maid; }