public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
            {
                DataListViewCell cell = (DataListViewCell)tableView.DequeueReusableCell("AvailableFeatsViewCell");

                if (cell == null)
                {
                    cell = new DataListViewCell(UITableViewCellStyle.Default, "AvailableFeatsViewCell");
                }

                Feat f = state._FilteredFeats[indexPath.Row];

                GradientButton addButton = new GradientButton();

                addButton.Bounds = new CGRect(0, 0, 100, 24);
                addButton.SetText("Add");
                addButton.SetImage(UIExtensions.GetSmallIcon("prev"), UIControlState.Normal);
                addButton.ImageEdgeInsets = new UIEdgeInsets(0, 0, 0, 5);
                addButton.TouchUpInside  += (sender, e) => state.AddClicked(f);
                addButton.TitleLabel.Font = UIFont.SystemFontOfSize(15);
                addButton.CornerRadius    = 3.0f;
                cell.AccessoryView        = addButton;

                cell.TextLabel.Text = f.Name;
                cell.TextLabel.Font = UIFont.SystemFontOfSize(15);


                return(cell);
            }
Beispiel #2
0
        public LookupTab(CombatState state) : base(state)
        {
            BackgroundColor = CMUIColors.PrimaryColorDark;

            listTable            = new UITableView();
            listTable.Delegate   = new TableDelegate(this);
            listTable.DataSource = new TableSource(this);
            AddSubview(listTable);
            filterField                   = new UITextField(new CGRect(0, 0, 100, 23));
            filterField.BorderStyle       = UITextBorderStyle.RoundedRect;
            filterField.EditingChanged   += HandleFilterFieldEditingChanged;
            filterField.AllEditingEvents += HandleFilterFieldAllEditingEvents;
            filterField.ClearButtonMode   = UITextFieldViewMode.Always;
            AddSubview(filterField);
            filterText  = "";
            _FilterView = new UIView(new CGRect(0, 0, 100, 0));
            _FilterView.BackgroundColor = CMUIColors.PrimaryColorDark;
            AddSubview(_FilterView);
            _ResetButton = new GradientButton();
            _ResetButton.TouchUpInside += Handle_ResetButtonTouchUpInside;
            _ResetButton.SetImage(UIExtensions.GetSmallIcon("reset"), UIControlState.Normal);
            _FilterView.AddSubview(_ResetButton);

            if (ShowSideBar)
            {
                _SideTabBar              = new SideTabBar();
                _SideTabBar.TabSelected += HandleTabSelected;
                _SideTabBar.Hidden       = true;
                _SideTabBar.AddTab(new SideTab {
                    Name = DefaultTabName, Tag = null, Icon = DefaultTabImage
                });
                Add(_SideTabBar);

                List <LookupSideTabItem> tabItems = LoadTabItems();

                if (tabItems != null)
                {
                    foreach (LookupSideTabItem item in tabItems)
                    {
                        _SideTabBar.AddTab(new SideTab {
                            Name = item.Name, Tag = item, Icon = item.Icon
                        });
                    }
                }
            }



            Filter();
            webView = new UIWebView(new CGRect(100, 0, 100, 100));
            AddSubview(webView);

            if (currentViewItems.Count > 0)
            {
                SetSelectedItem(0);
            }
        }
Beispiel #3
0
        public static void MakeCheckButtonStyle(this GradientButton button, bool isChecked)
        {
            button.HorizontalAlignment = UIControlContentHorizontalAlignment.Left;
            button.ImageEdgeInsets     = new UIEdgeInsets(0, 6, 0, 12);
            UIEdgeInsets s = button.TitleEdgeInsets;

            s.Left = 12;
            button.TitleEdgeInsets = s;

            if (isChecked)
            {
                button.SetImage(UIImage.FromFile("Images/External/CheckBox.png"), UIControlState.Normal);
            }
            else
            {
                button.SetImage(UIImage.FromFile("Images/External/CheckBoxUnchecked.png"), UIControlState.Normal);
            }
        }
Beispiel #4
0
        void UpdateConditionDisplay()
        {
            if (View != null)
            {
                foreach (GradientButton b in ConditionButtons)
                {
                    b.RemoveFromSuperview();
                }


                ConditionButtons.Clear();

                float xLoc = ConditionMargin;
                float yLoc = 79 + ConditionMargin;
                foreach (ActiveCondition c in _Character.Monster.ActiveConditions)
                {
                    GradientButton b = new GradientButton();

                    b.Frame = new CGRect(xLoc, yLoc, ConditionWidth, ConditionHeight);
                    b.SetImage(UIExtensions.GetSmallIcon(c.Condition.Image), UIControlState.Normal);
                    View.AddSubview(b);
                    if (c.Turns != null)
                    {
                        b.SetText(c.Turns.ToString());
                    }
                    b.Data             = c;
                    c.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
                    {
                        if (e.PropertyName == "Turns")
                        {
                            string text = "";
                            if (c.Turns != null)
                            {
                                text = c.Turns.ToString();
                            }
                            b.SetText(text);
                            b.TitleLabel.AdjustsFontSizeToFitWidth = true;
                        }
                    };

                    ButtonStringPopover p = new ButtonStringPopover(b);
                    BuildConditionMenu(p, c);

                    xLoc += ConditionWidth + ConditionMargin;

                    if (xLoc + ConditionWidth > View.Bounds.Width)
                    {
                        xLoc  = ConditionMargin;
                        yLoc += ConditionHeight + ConditionMargin;
                    }
                    UIWebView v = new UIWebView(new CGRect(0, 0, 300, 300));
                    v.LoadHtmlString(ConditionViewController.ConditionHTML(c.Condition), new NSUrl("http://localhost/"));
                    p.AccessoryView = v;
                }
            }
        }
Beispiel #5
0
            public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
            {
                DataListViewCell cell = (DataListViewCell)tableView.DequeueReusableCell("HDEditorDialogCell");

                if (cell == null)
                {
                    cell = new DataListViewCell(UITableViewCellStyle.Default, "HDEditorDialogCell");
                }

                DieStep step = state._DieSteps[indexPath.Row];



                UIView         buttonView = new UIView(new CGRect(0, 0, bWidth * 4 + 1, bHeight));
                GradientButton b          = new GradientButton();

                b.SetText(step.Count.ToString());
                StyleButton(b);
                b.Frame          = new CGRect(0, 0, bWidth, bHeight);
                b.TouchUpInside += HandleCountTouchUpInside;
                b.Tag            = indexPath.Row;
                buttonView.AddSubview(b);

                UILabel l = new UILabel(new CGRect(bWidth, 0, bWidth, bHeight));

                l.Text            = "d";
                l.TextAlignment   = UITextAlignment.Center;
                l.BackgroundColor = UIColor.Clear;
                buttonView.AddSubview(l);

                b = new GradientButton();
                b.SetText(step.Die.ToString());
                StyleButton(b);
                b.Frame          = new CGRect(bWidth * 2, 0, bWidth, bHeight);
                b.TouchUpInside += HandleDieTouchUpInside;
                b.Tag            = indexPath.Row;
                buttonView.AddSubview(b);

                b = new GradientButton();
                b.SetImage(UIExtensions.GetSmallIcon("delete"), UIControlState.Normal);
                StyleButton(b);
                b.Frame = new CGRect(bWidth * 3, 0, bWidth + 1, bHeight);
                buttonView.AddSubview(b);
                b.Tag            = indexPath.Row;
                b.TouchUpInside += HandleDeleteTouchUpInside;


                cell.AccessoryView = buttonView;

                cell.Data = state._DieSteps[indexPath.Row];
                //cell.TextLabel.Text = state._DieSteps.ToString();

                return(cell);
            }
Beispiel #6
0
        public void InsertTab(int index, SideTab tab)
        {
            if (!_Tabs.Contains(tab))
            {
                GradientButton b = new GradientButton();
                b.SetText(tab.Name);
                b.SetImage(tab.Icon, UIControlState.Normal);
                b.Data            = tab;
                b.CornerRadii     = new float[] { 16, 4, 0, 0 };
                b.ImageEdgeInsets = new UIEdgeInsets(0, 0, 0, 5);
                b.TitleLabel.AdjustsFontSizeToFitWidth = true;
                b.TouchUpInside += TabButtonClicked;
                Add(b);
                _Tabs.Insert(index, tab);
                _Buttons.Insert(index, b);
                if (_SelectedTab == null)
                {
                    _SelectedTab = b;
                }

                StyleTabs();
            }
        }
Beispiel #7
0
        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();
        }
Beispiel #8
0
        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 TreasureGeneratorPage()
        {
            _SelectionView = new GradientView();
            _WebView       = new UIWebView();
            _EmailButton   = new GradientButton();
            _EmailButton.SetText("Email");
            _EmailButton.SetImage(UIExtensions.GetSmallIcon("mail"), UIControlState.Normal);
            _EmailButton.ImageEdgeInsets = new UIEdgeInsets(0, 0, 0, 15);
            _EmailButton.TouchUpInside  += EmailButtonClicked;

            Add(_SelectionView);
            Add(_WebView);
            Add(_EmailButton);



            _LevelTab = new GradientButton();
            _LevelTab.SetText("Level");
            CMStyles.StyleTab(_LevelTab, true);
            _SelectionView.StyleBasicPanel();
            _SelectionView.Gradient     = new GradientHelper(CMUIColors.SecondaryColorADark);
            _SelectionView.CornerRadius = 0f;
            _LevelTab.TouchUpInside    += LevelTabClicked;

            _ItemsTab = new GradientButton();
            _ItemsTab.SetText("Items");
            CMStyles.StyleTab(_ItemsTab, false);
            _ItemsTab.TouchUpInside += ItemsTabClicked;


            _SelectionView.Add(_LevelTab);
            _SelectionView.Add(_ItemsTab);

            _LevelView = new GradientView();

            _ItemsView = new GradientView();

            foreach (var v in new GradientView[] { _LevelView, _ItemsView })
            {
                v.StyleBasicPanel();
                v.Gradient = new GradientHelper(CMUIColors.SecondaryColorADarker);
            }

            _ItemsView.Hidden = true;

            _SelectionView.Add(_LevelView);
            _SelectionView.Add(_ItemsView);

            _GenerateButton = new GradientButton();
            _GenerateButton.SetText("Generate");
            _GenerateButton.SetSmallIcon("treasure");
            _SelectionView.Add(_GenerateButton);
            _GenerateButton.TouchUpInside += GenerateButtonClicked;


            //create level items
            _LevelButton = new GradientButton();
            _LevelButton.SetText("Level 1");
            _LevelButton.Tag = 1;
            _LevelView.Add(_LevelButton);
            _LevelPopover = new ButtonStringPopover(_LevelButton);
            _LevelPopover.SetButtonText = true;
            _LevelPopover.ItemClicked  += HandleLevelPopoverItemClicked;

            for (int i = 1; i <= 20; i++)
            {
                _LevelPopover.Items.Add(new ButtonStringPopoverItem()
                {
                    Text = "Level " + i, Tag = i
                });
            }

            _CoinButton = new GradientButton();
            _CoinButton.SetText("Normal Coins");
            _LevelView.Add(_CoinButton);
            _CoinPopover = new ButtonStringPopover(_CoinButton);
            AddLevelPopoverItems(_CoinPopover, "Coins");
            _CoinButton.Tag = 1;

            _GoodsButton = new GradientButton();
            _GoodsButton.SetText("Normal Goods");
            _LevelView.Add(_GoodsButton);
            _GoodsPopover = new ButtonStringPopover(_GoodsButton);
            AddLevelPopoverItems(_GoodsPopover, "Goods");
            _GoodsButton.Tag = 1;

            _ItemsButton = new GradientButton();
            _ItemsButton.SetText("Normal Items");
            _ItemsPopover = new ButtonStringPopover(_ItemsButton);
            _LevelView.Add(_ItemsButton);
            _ItemsButton.Tag = 1;
            AddLevelPopoverItems(_ItemsPopover, "Items");

            //create item items
            _CountButton = new GradientButton();
            _CountButton.SetText("1 Item");
            _CountButton.Tag = 1;

            _ItemsView.Add(_CountButton);
            _CountPopover = new ButtonStringPopover(_CountButton);
            for (int i = 1; i < 61; i++)
            {
                string text = i + (i == 1?" Item":" Items");
                _CountPopover.Items.Add(new ButtonStringPopoverItem()
                {
                    Text = text, Tag = i
                });
            }
            _CountPopover.ItemClicked  += HandleLevelPopoverItemClicked;
            _CountPopover.SetButtonText = true;

            _ChartLevelButton = new GradientButton();
            _ChartLevelButton.SetText("Minor");
            _ChartLevelButton.Tag = 0;
            _ItemsView.Add(_ChartLevelButton);
            _ChartLevelPopover = new ButtonStringPopover(_ChartLevelButton);
            _ChartLevelPopover.SetButtonText = true;
            _ChartLevelPopover.ItemClicked  += HandleItemLevelClicked;;
            _ChartLevelPopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = "Minor", Tag = 0
            });
            _ChartLevelPopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = "Medium", Tag = 1
            });
            _ChartLevelPopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = "Major", Tag = 2
            });

            foreach (var t in new TreasureGenerator.RandomItemType [] {
                TreasureGenerator.RandomItemType.MagicalArmor,
                TreasureGenerator.RandomItemType.MagicalWeapon,
                TreasureGenerator.RandomItemType.Potion,
                TreasureGenerator.RandomItemType.Wand,
                TreasureGenerator.RandomItemType.Ring,
                TreasureGenerator.RandomItemType.Rod,
                TreasureGenerator.RandomItemType.Scroll,
                TreasureGenerator.RandomItemType.Staff,
                TreasureGenerator.RandomItemType.MinorWondrous,
            })
            {
                var b = new GradientButton();
                b.SetText(TreasureGenerator.RandomItemString(t));
                b.Tag = (int)t;
                b.MakeCheckButtonStyle(true);
                b.Data           = true;
                b.TouchUpInside += CheckButtonChecked;
                _ItemsView.Add(b);
                _ItemCheckButtons.Add(b);

                if (t == TreasureGenerator.RandomItemType.Rod)
                {
                    _RodButton         = b;
                    _RodButton.Enabled = false;
                }
                else if (t == TreasureGenerator.RandomItemType.Staff)
                {
                    _StaffButton         = b;
                    _StaffButton.Enabled = false;
                }
            }

            _SelectAllButton = new GradientButton();
            _SelectAllButton.SetText("Select All");
            _ItemsView.Add(_SelectAllButton);
            _SelectAllButton.TouchUpInside += SelectButtonClicked;
            _SelectAllButton.Data           = true;

            _UnselectAllButton = new GradientButton();
            _UnselectAllButton.SetText("Unselect All");
            _ItemsView.Add(_UnselectAllButton);
            _UnselectAllButton.TouchUpInside += SelectButtonClicked;
            _UnselectAllButton.Data           = false;
        }
        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();
        }
Beispiel #11
0
        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;
        }
Beispiel #12
0
        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);
        }
Beispiel #13
0
        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);
        }
Beispiel #14
0
            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);
            }