internal ProcessConditionRow(GameObject go, bool header) { // Will never be equal to a valid status lastStatus = (ProcessCondition.Status)(-1); root = go; root.TryGetComponent(out freeze); root.TryGetComponent(out thaw); root.TryGetComponent(out tooltip); if (root.TryGetComponent(out HierarchyReferences hr)) { text = hr.GetReference <LocText>("Label"); if (header) { box = null; check = dash = null; } else { box = hr.GetReference <Image>("Box"); check = hr.GetReference <Image>("Check").gameObject; dash = hr.GetReference <Image>("Dash").gameObject; dash.SetActive(false); } } else { box = null; text = null; check = dash = null; } freeze.enabled = false; thaw.enabled = true; }
/// <summary> /// Sets the appearance of this row to match a process condition. /// </summary> /// <param name="condition">The condition to evaluate and display.</param> internal void SetCondition(ProcessCondition condition) { var status = condition.EvaluateCondition(); Color itemColor; if (status != lastStatus) { switch (status) { case ProcessCondition.Status.Warning: itemColor = ConditionListSideScreen.warningColor; break; case ProcessCondition.Status.Ready: itemColor = ConditionListSideScreen.readyColor; break; case ProcessCondition.Status.Failure: default: itemColor = ConditionListSideScreen.failedColor; break; } text.color = itemColor; box.color = itemColor; check.SetActive(status == ProcessCondition.Status.Ready); lastStatus = status; } SetTitle(condition.GetStatusMessage(status), condition.GetStatusTooltip( status)); }