public DieRollerView() { Roller = this; BackgroundColor = CMUIColors.PrimaryColorDark; ClipsToBounds = true; _TitleButton = new GradientButton(); _TitleButton.SetText("Die Roller"); _TitleButton.Font = UIFont.BoldSystemFontOfSize(17); _TitleButton.CornerRadius = 0; _TitleButton.TouchUpInside += (object sender, EventArgs e) => { Collapsed = !Collapsed; }; _OutputView = new UIWebView(); _RollButton = new GradientButton(); _RollButton.TouchUpInside += RollButtonClicked; _RollButton.SetText("Roll"); _RollButton.SetImage(UIExtensions.GetSmallIcon("dice"), UIControlState.Normal); _RollButton.ImageEdgeInsets = new UIEdgeInsets(0, 0, 0, 7); _RollButton.CornerRadius = 0; _RollButton.Gradient = new GradientHelper(CMUIColors.SecondaryColorADarker, CMUIColors.SecondaryColorADark); _RollButton.Font = UIFont.BoldSystemFontOfSize(17); _ClearButton = new GradientButton(); _ClearButton.TouchUpInside += ClearButtonClicked; _ClearButton.SetText("Clear"); _ClearButton.CornerRadius = 0; _ClearButton.Font = UIFont.BoldSystemFontOfSize(17); _ClearButton.Gradient = new GradientHelper(CMUIColors.SecondaryColorBDarker, CMUIColors.SecondaryColorBDark); _ClearHtmlButton = new GradientButton(); _ClearHtmlButton.TouchUpInside += _ClearHtmlButtonClicked; _ClearHtmlButton.SetText("Reset"); _ClearHtmlButton.SetImage(UIExtensions.GetSmallIcon("reset"), UIControlState.Normal); _ClearHtmlButton.ImageEdgeInsets = new UIEdgeInsets(0, 0, 0, 7); _ClearHtmlButton.Font = UIFont.BoldSystemFontOfSize(17); _ClearHtmlButton.CornerRadius = 0; _ClearHtmlButton.Gradient = new GradientHelper(CMUIColors.SecondaryColorADarker, CMUIColors.SecondaryColorADark); _BottomView = new GradientView(); _BottomView.ClipsToBounds = true; _BottomView.Gradient = new GradientHelper(CMUIColors.PrimaryColorDarker); Add(_TitleButton); Add(_OutputView); Add(_BottomView); Add(_ClearHtmlButton); _BottomView.AddSubviews(_RollButton, _ClearButton); BringSubviewToFront(_BottomView); _DieButtons = new List <UIButton>(); foreach (var v in new int [] { 4, 6, 8, 10, 12, 20, 100 }) { GradientButton b = new GradientButton(); b.CornerRadius = 0; b.SetText(v.ToString()); b.Tag = v; b.TouchUpInside += DieClicked; UIImage im = null; switch (v) { case 4: case 6: case 8: case 10: case 12: case 100: im = UIExtensions.GetSmallIcon("d" + v); break; case 20: im = UIExtensions.GetSmallIcon("d20p"); break; } if (im != null) { b.BonusImage = im; b.ContentEdgeInsets = new UIEdgeInsets(25, 0, 0, 0); } _BottomView.AddSubview(b); _DieButtons.Add(b); UISwipeGestureRecognizer rec = new UISwipeGestureRecognizer(); rec.Direction = UISwipeGestureRecognizerDirection.Up | UISwipeGestureRecognizerDirection.Down; rec.Delegate = new SwipeGestureDelegate(); rec.AddTarget(this, new ObjCRuntime.Selector("HandleDieSwipe:")); _Recs[rec] = b; b.AddGestureRecognizer(rec); } _DieTextButton = new GradientButton(); CMStyles.TextFieldStyle(_DieTextButton); _BottomView.Add(_DieTextButton); _DieTextButton.TouchUpInside += DieTextButtonClicked; _DieTextButton.TitleLabel.AdjustsFontSizeToFitWidth = true; BringSubviewToFront(_TitleButton); }
public CharacterListView(CombatState state, bool monsters) { listView = new UITableView(); listView.SeparatorStyle = UITableViewCellSeparatorStyle.None; listView.SeparatorColor = CMUIColors.PrimaryColorMedium; listView.BackgroundColor = UIExtensions.ARGBColor(0x0); BackgroundColor = CMUIColors.PrimaryColorDarker; AddSubview(listView); viewDelegate = new ViewDelegate(this); viewDataSource = new ViewDataSource(this); listView.Delegate = viewDelegate; listView.DataSource = viewDataSource; _combatState = state; _monsters = monsters; _combatState.Characters.CollectionChanged += Handle_combatStateCombatListCollectionChanged; _combatState.CharacterSortCompleted += Handle_combatStateCharacterSortCompleted; _combatState.PropertyChanged += Handle_combatStatePropertyChanged; blankButton = new GradientButton(); StyleButton(blankButton); blankButton.SetTitle("", UIControlState.Normal); blankButton.SetImage(UIExtensions.GetSmallIcon("invisible"), UIControlState.Normal); blankButton.TouchUpInside += HandleBlankButtonTouchUpInside; AddSubview(blankButton); monsterButton = new GradientButton(); StyleButton(monsterButton); monsterButton.SetTitle("", UIControlState.Normal); monsterButton.SetImage(UIExtensions.GetSmallIcon("monster"), UIControlState.Normal); monsterButton.TouchUpInside += HandleMonsterButtonTouchUpInside; AddSubview(monsterButton); openButton = new GradientButton(); StyleButton(openButton); openButton.SetText(""); openButton.SetImage(UIExtensions.GetSmallIcon("openhs"), UIControlState.Normal); openButton.TouchUpInside += HandleOpenButtonTouchUpInside; AddSubview(openButton); saveButton = new GradientButton(); StyleButton(saveButton); saveButton.SetText(""); saveButton.SetImage(UIExtensions.GetSmallIcon("savehs"), UIControlState.Normal); saveButton.TouchUpInside += HandleSaveButtonTouchUpInside; AddSubview(saveButton); bottomView = new GradientView(); AddSubview(bottomView); bottomLabel = new UILabel(); bottomView.AddSubview(bottomLabel); bottomView.CornerRadius = 0f; bottomView.Gradient = new GradientHelper( CMUIColors.PrimaryColorLight, CMUIColors.PrimaryColorLight); clearButton = new GradientButton(); StyleButton(clearButton); clearButton.SetText(""); clearButton.SetImage(UIExtensions.GetSmallIcon("delete"), UIControlState.Normal); clearButton.TouchUpInside += HandleClearButtonTouchUpInside; AddSubview(clearButton); _monsterAddView = new MonsterAddView(); _monsterAddView.IsMonsters = monsters; _monsterAddView.ShouldClose += Handle_monsterAddViewShouldClose; _controller = new UIPopoverController(_monsterAddView); _monsterAddView.CombatState = _combatState; SetBottomText(); }
public CombatListView() { ClipsToBounds = true; _Font = UIFont.SystemFontOfSize(14); _FontBold = UIFont.BoldSystemFontOfSize(14); _ReadyingImage = UIExtensions.GetSmallIcon("target"); _DelayingImage = UIExtensions.GetSmallIcon("hourglass"); _LinkImage = UIExtensions.GetSmallIcon("link"); _ListView = new UITableView(); AddSubview(_ListView); _CurrentCharacterView = new GradientView(); AddSubview(_CurrentCharacterView); _CurrentCharacterLabel = new UILabel(); _CurrentCharacterLabel.TextAlignment = UITextAlignment.Center; _CurrentCharacterLabel.BackgroundColor = UIExtensions.ARGBColor(0x0); _CurrentCharacterLabel.TextColor = UIColor.White; _CurrentCharacterLabel.AdjustsFontSizeToFitWidth = true; _CurrentCharacterLabel.Font = UIFont.BoldSystemFontOfSize(UIFont.LabelFontSize); _CurrentCharacterView.AddSubview(_CurrentCharacterLabel); _CurrentCharacterView.Gradient = new GradientHelper(CMUIColors.SecondaryColorBDark); _CurrentCharacterView.BorderColor = UIColor.Gray; _CurrentCharacterView.CornerRadius = 0; _RoundView = new GradientView(); AddSubview(_RoundView); _RoundLabel = new UILabel(); _RoundLabel.BackgroundColor = UIExtensions.ARGBColor(0x0); _RoundLabel.TextAlignment = UITextAlignment.Center; _RoundLabel.TextColor = UIColor.White; _RoundLabel.Font = UIFont.BoldSystemFontOfSize(UIFont.LabelFontSize); _CurrentCharacterLabel.AdjustsFontSizeToFitWidth = true; _RoundView.AddSubview(_RoundLabel); _RoundView.BorderColor = UIColor.Gray; _RoundView.Gradient = new GradientHelper(CMUIColors.SecondaryColorBDark); _RoundView.CornerRadius = 0; _NextButton = new GradientButton(); StyleButton(_NextButton); _NextButton.SetTitle("Next", UIControlState.Normal); _NextButton.SetImage(UIImage.FromFile("Images/External/RightArrow-24.png"), UIControlState.Normal); _NextButton.ImageEdgeInsets = new UIEdgeInsets(0, 0, 0, 5); _NextButton.TouchUpInside += HandleNextButtonTouchUpInside; AddSubview(_NextButton); _PrevButton = new GradientButton(); StyleButton(_PrevButton); _PrevButton.SetTitle("Prev", UIControlState.Normal); _PrevButton.SetImage(UIImage.FromFile("Images/External/LeftArrow-24.png"), UIControlState.Normal); _PrevButton.ImageEdgeInsets = new UIEdgeInsets(0, 0, 0, 5); _PrevButton.TouchUpInside += HandlePrevButtonTouchUpInside; AddSubview(_PrevButton); _MoveUpButton = new GradientButton(); StyleButton(_MoveUpButton); _MoveUpButton.SetTitle("Up", UIControlState.Normal); _MoveUpButton.SetImage(UIImage.FromFile("Images/External/arrowup-16.png"), UIControlState.Normal); _MoveUpButton.TouchUpInside += HandleMoveUpButtonTouchUpInside;; AddSubview(_MoveUpButton); _MoveDownButton = new GradientButton(); StyleButton(_MoveDownButton); _MoveDownButton.SetTitle("Down", UIControlState.Normal); _MoveDownButton.SetImage(UIImage.FromFile("Images/External/arrowdown-16.png"), UIControlState.Normal); _MoveDownButton.TouchUpInside += HandleMoveDownButtonTouchUpInside;; AddSubview(_MoveDownButton); _RollButton = new GradientButton(); StyleButton(_RollButton); _RollButton.SetImage(UIImage.FromFile("Images/External/d20-32.png"), UIControlState.Normal); _RollButton.SetTitle("Roll Initiative", UIControlState.Normal); _RollButton.TouchUpInside += HandleRollButtonTouchUpInside; AddSubview(_RollButton); _SortButton = new GradientButton(); StyleButton(_SortButton); _SortButton.SetTitle("Sort", UIControlState.Normal); _SortButton.ImageEdgeInsets = new UIEdgeInsets(0, 0, 0, 10); _SortButton.SetImage(UIImage.FromFile("Images/Sort.png"), UIControlState.Normal); _SortButton.TouchUpInside += HandleSortButtonTouchUpInside; AddSubview(_SortButton); _ResetButton = new GradientButton(); StyleButton(_ResetButton); _ResetButton.SetTitle("Reset", UIControlState.Normal); _ResetButton.ImageEdgeInsets = new UIEdgeInsets(0, 0, 0, 10); _ResetButton.SetImage(UIImage.FromFile("Images/Refresh.png"), UIControlState.Normal); _ResetButton.TouchUpInside += HandleResetButtonTouchUpInside; AddSubview(_ResetButton); }