private void UpdateText(Text ht, HudBridgeElement hd) { ht.text = hd.Caption + NewLine + hd.Value; #if FULLLOG MoreDebug.Log("(" + hd.Key + ") Update text: " + hd.Caption + " / " + hd.Value); #endif }
// local protected int LoadHudData(StringGetter cb, UnityEvent datachange, UnityEvent datadone, string cap, string donecap, int slot) { #if FULLLOG MoreDebug.Log("go: " + gameObject.name); #endif HudBridgeElement data = new HudBridgeElement(); data.InitFromBridge(cb, datachange, datadone, cap, donecap, slot); hudkeys.Add(hud.RegisterHudData(data)); data.ForceUpdate(); return(hudkeys.Count - 1); }
// local public int RegisterHudData(HudBridgeElement data) { #if FULLLOG MoreDebug.Log("RegisterHudData"); #endif data.InitFromHud(indexcounter++, HudUpdate); SetTimeSlot(data); DataSlots.Add(data); return(data.Key); }
// Use ReleaseHudData to clear a time slot // event handlers public void HudUpdate(HudBridgeElement be) // display change event handler { #if FULLLOG MoreDebug.Log("HudUpdate: " + be.Key + " (" + be.DataIsValid + ")(" + be.ReleasePending + ")"); #endif be.Value = be.Callback(); if (be.TimeSlot == activetimeslots[be.DisplaySlot]) { UpdateText(TextSlots[be.DisplaySlot], be); } }
private void SetTimeSlot(HudBridgeElement hd) { #if FULLLOG MoreDebug.Log("SetTimeSlot"); #endif hd.TimeSlot = timeslotcounts[hd.DisplaySlot]; timeslotcounts[hd.DisplaySlot]++; if (timeslotcounts[hd.DisplaySlot] > maxtimeslot) { maxtimeslot = timeslotcounts[hd.DisplaySlot]; } }