void onUiUpdate(UpdateUIEvent e) { List <GameObject> toDestroy = new List <GameObject>(); for (int i = 0; i < m_lifeBase.childCount; i++) { toDestroy.Add(m_lifeBase.GetChild(i).gameObject); } for (int i = 0; i < m_itemsBase.childCount; i++) { toDestroy.Add(m_itemsBase.GetChild(i).gameObject); } foreach (var g in toDestroy) { Destroy(g); } m_life.setText("A " + e.ship.maxLife, m_lifeColor); m_speed.setText("B " + e.ship.speed, m_speedColor); m_fireRate.setText("C " + e.ship.fireRate, m_fireRateColor); m_power.setText("D " + e.ship.power, m_powerColor); for (int i = 0; i < e.ship.maxLife; i++) { Color c = m_lifeColor; if (i >= e.ship.life) { c.r /= 3; c.g /= 3; c.b /= 3; } var obj = new GameObject("Life" + i); obj.transform.parent = m_lifeBase; obj.transform.localPosition = new Vector3(i * m_lifeSpacing, 0, 0); var comp = obj.AddComponent <SpriteRenderer>(); comp.sprite = m_lifeItemSprite; comp.color = c; } for (int i = 0; i < e.ship.modifiers.Count || i < GameInfos.playerModifierCount; i++) { var obj = new GameObject("Mod" + i); obj.transform.parent = m_itemsBase; obj.transform.localPosition = new Vector3(i * m_itemSpacing, 0, 0); var comp = obj.AddComponent <SpriteRenderer>(); if (i >= e.ship.modifiers.Count) { comp.sprite = m_noItemSprite; } else { comp.sprite = e.ship.modifiers[i].m_image; } } }
//--------------------------------------------------------------------- public void OnUpdateToggleMultiSel(object sender, Event e) { UpdateUIEvent ue = e as UpdateUIEvent; ue.Check = (m_listCtrl.StyleFlags & wx.WindowStyles.LC_SINGLE_SEL) == 0; }
//--------------------------------------------------------------------- public void OnUpdateShowColInfo(object sender, Event e) { UpdateUIEvent ue = e as UpdateUIEvent; ue.Enabled = (m_listCtrl.StyleFlags & wx.WindowStyles.LC_REPORT) != 0; }
public void UpdateFieldOnBoard(Cord cord) { UpdateUIEvent?.Invoke(GetFieldView(cord), cord.X * Arena.HEIGHT + cord.Y, A[cord].FloorStatus); }