public void SetBarHudState(eHeadBarHud hudtype, Hashtable data, bool state) { if (_HeadBar != null) { _HeadBar.SetBarHudState(hudtype, data, state); } }
public void SetBarHudState(eHeadBarHud hudtype, Hashtable data, bool state) { if (mHeadBars2DMonitor == null) { return; } int type = (int)hudtype; if (state) { HeadBarHud tmp; if (mHeadBars2DMonitor.Bars.ContainsKey(type)) { tmp = mHeadBars2DMonitor.Bars[type].transform.GetMonoILRComponent <HeadBarHud>(); } else { tmp = GetHUDByType(hudtype); if (tmp != null) { mHeadBars2DMonitor.Bars.Add(type, tmp.mDMono.GetComponent <HeadBarHUDMonitor>()); } } if (tmp != null) { tmp.SetBarState(data, state); mHeadBars2DMonitor.UpdatePosition(); } } else { HeadBarHud tmp; if (mHeadBars2DMonitor.Bars.ContainsKey(type) && mHeadBars2DMonitor.Bars[type] != null) { tmp = mHeadBars2DMonitor.Bars[type].transform.GetMonoILRComponent <HeadBarHud>(); if (tmp == null) { return; } } else { return; } mHeadBars2DMonitor.Bars.Remove(type); tmp.SetBarState(data, state); tmp.Recycle(); tmp = null; } }
private HeadBarHud GetHUDByType(eHeadBarHud hudtype) { HeadBarHud result = null; switch (hudtype) { case eHeadBarHud.PlayerHeadBarHud: result = PlayerHeadBarHudController.Instance != null?PlayerHeadBarHudController.Instance.GetHUD() : null; break; case eHeadBarHud.FightStateHud: result = FightingHeadBarHudController.Instance != null?FightingHeadBarHudController.Instance.GetHUD() : null; break; default: result = null; break; } return(result); }