private static LabeledInformation CreateHitPoints() { LabeledInformation result = LabeledInformation.Create(); result.gameObject.name = "panel_HitPoints"; result.caption = "Hit Points"; SetRectTransformSize(result.gameObject, itemSize_HitPoints); return(result); }
private static LabeledInformation CreateScore() { LabeledInformation result = LabeledInformation.Create(); result.gameObject.name = "panel_Score"; result.caption = "Score"; SetRectTransformSize(result.gameObject, itemSize_Score); return(result); }
private static LabeledInformation CreateLabeledInformation(Buff buff) { LabeledInformation result = LabeledInformation.Create(); result.gameObject.name = itemPrefix + buff.caption; result.caption = buff.caption.Substring(0, shortCaptionLength); result.value = buff.duration.ToString(); return(result); }
public static void Test() { LabeledInformation Li = LabeledInformation.Create(); Li.gameObject.AddComponent <AlignIterator> (); RectTransform rt = Li.gameObject.transform as RectTransform; rt.offsetMin = new Vector2(5, 1); rt.offsetMax = rt.offsetMin + new Vector2(2, 1); Li.caption = "caption"; Li.value = "value"; Li.Rebuild(); }
private void UpdateCaptions() // place for optimization here { if (buffs == null || items == null) { return; } foreach (Buff buff in buffs) { if (buff == null) { continue; } GameObject item = items.Find(x => x.gameObject.name == itemPrefix + buff.caption); if (item == null) { continue; } LabeledInformation Li = item.GetComponent <LabeledInformation> (); if (Li == null) { continue; } if (buff.duration == Buff.unlimitedDuration) { Li.value = infinitySymbol; } else { Li.value = string.Format("{0:F2}", buff.timeLeft); } } }
public static new LabeledInformation Create() { LabeledInformation result = PanelWithChildren.Create <LabeledInformation>(); result.gameObject.name = "panel_LabeledInformation"; result.SetAligner_AdaptiveTile(2, 1); result.alignDirection = Aligner.AlignDirection.adTop; result.items = new List <GameObject> (); GameObject item = Instantiate(Prefab.textItem); item.name = "text_Caption"; result.fCaption = item.GetComponent <Text> (); result.items.Add(item); item = Instantiate(Prefab.textItem); item.name = "text_Value"; result.fValue = item.GetComponent <Text> (); result.items.Add(item); return(result as LabeledInformation); }