void HandleTypeButtonClicked(object sender, EventArgs e) { TypeTab newTab = (TypeTab)((GradientButton)sender).Data; if (newTab != _SelectedTab) { _SelectedTab = newTab; switch (_SelectedTab) { case TypeTab.MeleeTab: SetupMeleeTab(); break; case TypeTab.RangedTab: SetupRangedTab(); break; } SetupAttackViews(); MeleeButton.StyleTab(_SelectedTab == TypeTab.MeleeTab); RangedButton.StyleTab(_SelectedTab == TypeTab.RangedTab); NaturalButton.StyleTab(_SelectedTab == TypeTab.NaturalTab); } }
public override void ViewDidLoad() { base.ViewDidLoad(); StyleButton(OKButton); StyleButton(CancelButton); StylePanel1(this.AttackTextView); StyleBackground(BackgroundView); CMStyles.StyleBasicPanel(EditingView); MeleeView.Editable = false; MeleeView.Text = _Monster.MeleeString(_Attacks); RangedView.Editable = false; RangedView.Text = _Monster.RangedString(_Attacks); _ScrollView = new UIScrollView(); _SetChoiceView = new GradientView(); _SetControlView = new GradientView(); _NextSetButton = new GradientButton(); _NextSetButton.SetImage(UIExtensions.GetSmallIcon("next"), UIControlState.Normal); _NextSetButton.TouchUpInside += HandleNextSetButtonClicked; _LastSetButton = new GradientButton(); _LastSetButton.SetImage(UIExtensions.GetSmallIcon("prev"), UIControlState.Normal); _LastSetButton.TouchUpInside += HandleLastSetButtonClicked; _SetLabel = new UILabel(); _SetLabel.Font = UIFont.BoldSystemFontOfSize(16); _SetLabel.BackgroundColor = 0x00000000.UIColor(); _SetLabel.TextColor = 0xFFFFFFFF.UIColor(); _SetLabel.TextAlignment = UITextAlignment.Center; _SetChoiceView.Add(_NextSetButton); _SetChoiceView.Add(_LastSetButton); _SetChoiceView.Add(_SetLabel); _AddAttackButton = new GradientButton(); _AddAttackButton.SetText("Add Attack"); StyleButton(_AddAttackButton); _AddSetButton = new GradientButton(); _AddSetButton.SetText("Add"); StyleButton(_AddSetButton); _SetChoiceView.Add(_AddSetButton); _DeleteSetButton = new GradientButton(); _DeleteSetButton.SetText("Delete"); StyleButton(_DeleteSetButton); _SetChoiceView.Add(_DeleteSetButton); MeleeButton.Data = TypeTab.MeleeTab; RangedButton.Data = TypeTab.RangedTab; NaturalButton.Data = TypeTab.NaturalTab; foreach (var v in new GradientButton[] { MeleeButton, RangedButton, NaturalButton }) { v.TouchUpInside += HandleTypeButtonClicked; v.StyleTab(false); v.Border = 2; } EditingView.Add(_ScrollView); EditingView.Add(_SetChoiceView); EditingView.Add(_SetControlView); _SetControlView.Add(_AddAttackButton); CMStyles.StyleBasicPanel(_SetChoiceView); CMStyles.StyleBasicPanel(_SetControlView); _SetChoiceView.CornerRadii = new float[] { _SetChoiceView.CornerRadius, _SetChoiceView.CornerRadius, 0, 0 }; _SetControlView.CornerRadii = new float[] { 0, 0, _SetChoiceView.CornerRadius, _SetChoiceView.CornerRadius }; _AddSetButton.TouchUpInside += HandleAddSetButtonClicked; _DeleteSetButton.TouchUpInside += HandleDeleteSetClicked; _AddAttackPopover = new ButtonStringPopover(_AddAttackButton); _AddAttackPopover.WillShowPopover += HandleWillShowAddAttacksPopover; _AddAttackPopover.ItemClicked += HandleAddAttackItemClicked; _SelectedTab = TypeTab.MeleeTab; MeleeButton.StyleTab(true); SetupMeleeTab(); SetupAttackViews(); }