private void Redraw() { if (myTextButtons != null) { foreach (var btn in myTextButtons) { myNumCtnr.Remove(btn); } m_SelectedButton = null; } var numsToShow = Math.Min(m_TotalPages, (int)Math.Floor((double)m_Width / 15)); myTextButtons = new UIClickableLabel[numsToShow]; for (int i = 0; i < numsToShow; i++) { var btn = new UIClickableLabel() { X = i * ItemSize, Caption = (i + 1).ToString(), Size = new Microsoft.Xna.Framework.Vector2(ItemSize, ItemSize), CaptionStyle = TextStyle }; myTextButtons[i] = btn; myTextButtons[i].OnButtonClick += new ButtonClickDelegate(UIPaginationBar_OnButtonClick); myNumCtnr.Add(myTextButtons[i]); } SetSize(m_Width, m_Height); SelectedPage = m_SelectedPage; }
public void RemoveScreen(UIScreen Screen) { if (Screen == currentScreen) { currentScreen = null; } Screen.OnHide(); mainUI.Remove(Screen); m_Screens.Remove(Screen); /** Put the previous screen back into the UI **/ if (m_Screens.Count > 0) { currentScreen = m_Screens.Last(); mainUI.AddAt(0, currentScreen); } }
void UpdateZoneChanges() { bool didAnything = zoneChanges.Count > 0; for (int Idx = 0; Idx < zoneChanges.Count; ++Idx) { KeyValuePair <ConvergeObject, ConvergeZone> kv = zoneChanges[Idx]; ConvergeObject obj = kv.Key; ConvergeZone newZone = kv.Value; ConvergeZone oldZone = obj.zone; if (newZone.zoneId == ConvergeZoneId.DiscardPile && TriggerSystem.HasTriggers(ConvergeTriggerType.Discarded)) { TriggerSystem.CheckTriggers(ConvergeTriggerType.Discarded, new TriggerData(newZone.owner, null, obj, 0)); } newZone.Add(obj); if (newZone.inPlay && (oldZone == null || !oldZone.inPlay) && TriggerSystem.HasTriggers(ConvergeTriggerType.EnterPlay)) { TriggerSystem.CheckTriggers(ConvergeTriggerType.EnterPlay, new TriggerData(newZone.owner, obj, null, 0)); } if (obj.ui == null && !newZone.isHidden && obj.zone == newZone) { obj.ui = new ConvergeUIObject(obj); ui.Add(obj.ui); } else if (obj.ui != null && newZone.isHidden && obj.zone == newZone) { ui.Remove(obj.ui); obj.ui = null; } } zoneChanges.Clear(); }