using System; using System.Collections; using System.Collections.Generic; using Schedule; using UnityEngine; public class DescScheduleBase : MonoBehaviour { public virtual void Init(ScheduleTaskCtrl taskCtrl) { this.taskCtrl = taskCtrl; this.m_goMaidParameter = UTY.GetChildObject(base.gameObject, "MaidParameter", false); this.m_goMaidParameterParent = UTY.GetChildObject(base.gameObject, "MaidParameter/ParameterParent", false); this.m_listMaidItem = new List(); this.m_spBGOfParameterViewer = UTY.GetChildObject(base.gameObject, "MaidParameter/BG", false).GetComponent(); this.m_goTitleOfMaidParameter = UTY.GetChildObject(base.gameObject, "MaidParameter/Title", false); this.m_heightOfMaidParameterTitle = this.m_goTitleOfMaidParameter.GetComponent().height; } public void UpdateViewCommon(ScheduleCSVData.ScheduleBase work_data) { if (work_data == null || !int.TryParse(work_data.id.ToString(), out this.intTaskInd)) { this.Active(false); return; } this.UpdateView(work_data); } protected virtual void UpdateView(ScheduleCSVData.ScheduleBase work_data) { } protected virtual void UpdateCurentValue() { } protected virtual void UpdateAddValue(MaidParams maidParam) { } protected void Active(bool active) { base.gameObject.SetActive(active); } protected string Sign(int input, string format = null) { if (input <= 0) { return input.ToString(); } if (format != null) { return "+" + input.ToString(format); } return "+" + input.ToString(); } public static void Reposition(GameObject parent) { UITable component = parent.GetComponent(); if (component) { component.Reposition(); return; } UIGrid component2 = parent.GetComponent(); if (component2) { component2.Reposition(); return; } } protected void ExamineDisplayItem() { int num = ScheduleCtrl.SetActiveExceptForNothing(this.m_listMaidItem, "0"); bool flag = num > 0; this.m_goTitleOfMaidParameter.SetActive(flag); if (!flag) { this.Active(false); return; } this.Active(true); DescScheduleBase.Reposition(this.m_goMaidParameterParent); this.AdjustParameterViewer(num); } protected void AdjustParameterViewer(int displayMaidParameterCount) { float num = 15f; float num2 = 25f; float num3 = 0f; if (displayMaidParameterCount > 0) { num3 += (float)this.m_heightOfMaidParameterTitle + num; float y = this.m_goMaidParameterParent.GetComponent().padding.y; IEnumerator enumerator = this.m_goMaidParameterParent.transform.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; Transform transform = (Transform)obj; if (transform.gameObject.activeSelf) { UILabel component = transform.GetComponent(); num3 += (float)component.height + y * 2f; } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } num3 += num2; } if (num3 > 0f) { this.m_spBGOfParameterViewer.height = (int)num3; } } protected int m_heightOfMaidParameterTitle; protected GameObject m_goTitleOfMaidParameter; protected UISprite m_spBGOfParameterViewer; protected const string NOTHING = "0"; protected ScheduleTaskCtrl taskCtrl; protected List m_listMaidItem; protected GameObject m_goMaidParameter; protected GameObject m_goMaidParameterParent; protected int intTaskInd; public class ParamSet { public ParamSet(GameObject parent, string childObjName, bool useCurrentValue = true) { this.baseObj = UTY.GetChildObject(parent, childObjName, false); if (this.baseObj == null) { return; } GameObject childObject = UTY.GetChildObject(this.baseObj, "Value", false); if (childObject != null) { this.addValue = childObject.GetComponent(); } if (useCurrentValue) { GameObject childObject2 = UTY.GetChildObject(this.baseObj, "CurrentValue", false); if (childObject2 != null) { this.currentValue = childObject2.GetComponent(); } } } public string AddValueText { set { if (this.addValue != null) { this.addValue.text = value; } } } public string CurrentValueText { set { if (this.currentValue != null) { this.currentValue.text = value; } } } public ScheduleCtrl.VariableItem GetVariableItem() { return new ScheduleCtrl.VariableItem(this.baseObj, this.addValue); } private GameObject baseObj; private UILabel addValue; private UILabel currentValue; } }