public ToolbarView() { BackgroundColor = new UIColor(1, 0, 0, 0); List <String> names = new List <String>() { "Combat", "Monsters", "Feats", "Spells", "Rules", "Treasure" }; List <String> images = new List <String>() { "sword", "monster", "star", "scroll", "book", "treasure" }; float pos = 0; float buttonWidth = 110; float buttonGap = -1; int i = 0; foreach (string s in names) { GradientButton b = new GradientButton(); b.Frame = (new CGRect(pos, 0, buttonWidth, 50)); b.SetImage(UIExtensions.GetSmallIcon(images[i]), UIControlState.Normal); b.Border = 1; b.CornerRadii = new float[] { 4, 16, 0, 0 }; b.SetTitle(s, UIControlState.Normal); UIEdgeInsets si = b.ImageEdgeInsets; si.Right += 10; b.ImageEdgeInsets = si; pos += buttonWidth + buttonGap; buttons.Add(b); b.Tag = i; b.TouchUpInside += HandleBTouchUpInside; i++; AddSubview(b); } clickedButton = buttons[0]; clickedButton.Gradient = new GradientHelper(CMUIColors.PrimaryColorDarker, CMUIColors.PrimaryColorMedium); _SettingsButton = new GradientButton(); _SettingsButton.SetImage(UIImage.FromFile("Images/settings.png"), UIControlState.Normal); //_SettingsButton.Border = 0; //_SettingsButton.BackgroundColor = UIColor.Clear; //_SettingsButton.Gradient = new GradientHelper(0x00000000.UIColor()); _SettingsButton.CornerRadius = 0; _SettingsButton.TouchUpInside += SettingsButtonClicked; _SettingsButton.Frame = new CGRect(Bounds.Width - 64, (Bounds.Height - 48.0f) / 2.0f, 48f, 48f); //AddSubview (_SettingsButton); _AboutButton = new GradientButton(); _AboutButton.SetImage(UIImage.FromFile("Images/External/info.png"), UIControlState.Normal); // _AboutButton.Border = 0; //_AboutButton.BackgroundColor = UIColor.Clear; //_AboutButton.Gradient = new GradientHelper(0x00000000.UIColor()); _AboutButton.CornerRadius = 0; _AboutButton.TouchUpInside += AboutButtonClicked; _AboutButton.Frame = new CGRect(Bounds.Width - 23, (Bounds.Height - 48.0f) / 2.0f, 48f, 48f); Add(_AboutButton); BackgroundColor = UIColor.Black; }
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); }
public ToolbarView() { BackgroundColor = new UIColor(1, 0, 0, 0); List <String> names = new List <String>() { "Combat", "Monsters", "Feats", "Spells", "Rules", "Treasure" }; List <String> images = new List <String>() { "sword", "monster", "star", "scroll", "book", "treasure" }; float pos = 0; float buttonWidth = 110; float buttonGap = -1; int i = 0; foreach (string s in names) { GradientButton b = new GradientButton(); b.Frame = (new CGRect(pos, 0, buttonWidth, 50)); b.SetImage(UIExtensions.GetSmallIcon(images[i]), UIControlState.Normal); b.Border = 1; b.CornerRadii = new float[] { 4, 16, 0, 0 }; b.SetTitle(s, UIControlState.Normal); UIEdgeInsets si = b.ImageEdgeInsets; si.Right += 10; b.ImageEdgeInsets = si; pos += buttonWidth + buttonGap; buttons.Add(b); b.Tag = i; b.TouchUpInside += HandleBTouchUpInside; i++; AddSubview(b); } clickedButton = buttons[0]; clickedButton.Gradient = new GradientHelper(CMUIColors.PrimaryColorDarker, CMUIColors.PrimaryColorMedium); _SettingsButton = new GradientButton(); _SettingsButton.SetImage(UIImage.FromFile("Images/settings.png"), UIControlState.Normal); //_SettingsButton.Border = 0; //_SettingsButton.BackgroundColor = UIColor.Clear; //_SettingsButton.Gradient = new GradientHelper(0x00000000.UIColor()); _SettingsButton.CornerRadius = 0; _SettingsButton.TouchUpInside += SettingsButtonClicked; _SettingsButton.Frame = new CGRect(Bounds.Width - 64, (Bounds.Height - 48.0f) / 2.0f, 48f, 48f); AddSubview(_SettingsButton); settingsPopover = new ButtonStringPopover(_SettingsButton); var pi = new ButtonStringPopoverItem() { Text = "Import" }; settingsPopover.Items.Add(pi); pi = new ButtonStringPopoverItem { Text = "Export" }; settingsPopover.Items.Add(pi); settingsPopover.Items.Add(new ButtonStringPopoverItem()); serverItem = new ButtonStringPopoverItem { Text = "Run Local Service" }; SetLocalServiceIcon(); settingsPopover.Items.Add(serverItem); pi = new ButtonStringPopoverItem { Text = "Local Service Port" }; settingsPopover.Items.Add(pi); pi = new ButtonStringPopoverItem { Text = "Local Service Passcode" }; settingsPopover.Items.Add(pi); settingsPopover.ItemClicked += (sender, eee) => { switch (eee.Index) { case 0: Import(); break; case 1: Export(); break; case 2: LocalServiceClicked(); break; case 4: LocalServicePortClicked(); break; case 5: LocalServicePasscodeClicked(); break; } }; _AboutButton = new GradientButton(); _AboutButton.SetImage(UIImage.FromFile("Images/External/info.png"), UIControlState.Normal); // _AboutButton.Border = 0; //_AboutButton.BackgroundColor = UIColor.Clear; //_AboutButton.Gradient = new GradientHelper(0x00000000.UIColor()); _AboutButton.CornerRadius = 0; _AboutButton.TouchUpInside += AboutButtonClicked; _AboutButton.Frame = new CGRect(Bounds.Width - 23, (Bounds.Height - 48.0f) / 2.0f, 48f, 48f); Add(_AboutButton); BackgroundColor = UIColor.Black; MobileSettings.Instance.PropertyChanged += MobileSettingsPropertyChanged; }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { DataListViewCell cell = (DataListViewCell)tableView.DequeueReusableCell("CombatListViewCell"); if (cell == null) { cell = new DataListViewCell(UITableViewCellStyle.Default, "CombatListViewCell"); } Character ch = state.CombatState.CombatList[indexPath.Row]; ch.PropertyChanged += state.HandleChPropertyChanged; ch.Monster.ActiveConditions.CollectionChanged += delegate { state.UpdateCharacter(ch); }; state.UpdateCell(ch, cell); float accHeight = 30f; UIView buttonView = new UIView(new CGRect(0, 0, 79, accHeight)); float xPos = 0; GradientButton b = new GradientButton(); if (ch.IsReadying || ch.IsDelaying) { UIImageView view = new UIImageView(); view.Image = ch.IsReadying?state._ReadyingImage:state._DelayingImage; view.Frame = new CGRect(new CGPoint(xPos, (accHeight - 16f) / 2.0f), new CGSize(16, 16)); buttonView.Add(view); xPos += 18; } if (ch.HasFollowers) { UIImageView view = new UIImageView(); view.Image = state._LinkImage; view.Frame = new CGRect(new CGPoint(xPos, (accHeight - 16f) / 2.0f), new CGSize(16, 16)); buttonView.Add(view); xPos += 18; } b.SetTitle(ch.CurrentInitiative.ToString(), UIControlState.Normal); b.CornerRadius = 0; b.Frame = new CGRect(xPos, 0, 40, accHeight); b.TouchUpInside += state.InitButtonTouchUpInside; b.Data = ch; buttonView.AddSubview(b); xPos += (float)(b.Frame.Width - 1); b = new GradientButton(); b.SetImage(UIExtensions.GetSmallIcon("lightning"), UIControlState.Normal); b.CornerRadius = 0; b.Frame = new CGRect(xPos, 0, 40, accHeight); buttonView.AddSubview(b); b.Data = ch; xPos += (float)(b.Frame.Width - 1); buttonView.SetWidth(xPos); ButtonStringPopover actionsPopover = new ButtonStringPopover(b); actionsPopover.WillShowPopover += state.WillShowActionsPopover; actionsPopover.Data = ch; actionsPopover.ItemClicked += HandleActionsPopoverItemClicked; cell.AccessoryView = buttonView; return(cell); }