Example #1
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;
                }
            }
        }
Example #2
0
 void DieTextButtonClicked(object sender, EventArgs e)
 {
     _TBDialog            = new TextBoxDialog();
     _TBDialog.SingleLine = true;
     _TBDialog.Value      = _DieText;
     _TBDialog.HeaderText = "Die Roll";
     _TBDialog.OKClicked += (x, ex) =>
     {
         _DieText = _TBDialog.Value;
         _DieTextButton.SetText(_DieText);
     };
     MainUI.MainView.Add(_TBDialog.View);
 }
Example #3
0
        void UpdateSubtypeFilterBox()
        {
            subtypePopover.Items.Clear();

            if (typeFilter == null || !Rule.Subtypes.ContainsKey(typeFilter))
            {
                subtypeFilterButton.Hidden = true;
                subtypeFilter = null;
            }
            else
            {
                subtypeFilterButton.Hidden = false;
                subtypePopover.Items.Add(new ButtonStringPopoverItem()
                {
                    Text = AllSubtypeText, Tag = null
                });


                foreach (string type in Rule.Subtypes[typeFilter].Values)
                {
                    subtypePopover.Items.Add(new ButtonStringPopoverItem()
                    {
                        Text = type.Capitalize(), Tag = type
                    });
                }
                subtypeFilter = null;
                subtypeFilterButton.SetText(AllSubtypeText);
            }
        }
Example #4
0
        private void BuildFilters()
        {
            float locX    = 0;
            float locY    = 5;
            float bHeight = 30;
            float marginX = 10;

            GradientButton b;


            //group filter
            b = new GradientButton();
            StyleFilterButton(b);
            b.Frame = new CGRect(locX, locY, 120, bHeight);
            locX   += (float)b.Frame.Width + marginX;
            b.SetText(AllGroupText);
            _GroupFilterPopover = new ButtonStringPopover(b);
            _GroupFilterPopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = AllGroupText, Tag = null
            });
            foreach (string s in MagicItem.Groups)
            {
                _GroupFilterPopover.Items.Add(new ButtonStringPopoverItem()
                {
                    Text = s, Tag = s
                });
            }
            _GroupFilterPopover.SetButtonText = true;
            _GroupFilterPopover.ItemClicked  += HandleTypeFilterItemClicked;;
            _GroupFilterButton = b;

            FilterView.AddSubview(b);

            //cl filter
            b = new GradientButton();
            StyleFilterButton(b);
            b.Frame = new CGRect(locX, locY, 75, bHeight);
            locX   += (float)b.Frame.Width + marginX;

            b.SetText(AllCLText);
            _CLFilterPopover = new ButtonStringPopover(b);

            _CLFilterPopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = AllCLText, Tag = null
            });
            foreach (int x in MagicItem.CLs)
            {
                _CLFilterPopover.Items.Add(new ButtonStringPopoverItem()
                {
                    Text = "CL " + x.PastTense(), Tag = new int?(x)
                });
            }
            _CLFilterPopover.SetButtonText = true;
            _CLFilterPopover.ItemClicked  += HandleCLFilterItemClicked;
            _CLFilterButton = b;

            FilterView.AddSubview(b);
        }
Example #5
0
 protected override void ResetButtonClicked()
 {
     typeFilter = null;
     typeFilterButton.SetText(AllTypesText);
     filterField.Text = "";
     Filter();
 }
            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);
            }
Example #7
0
        private void BuildFilters()
        {
            float locX    = 0;
            float locY    = 5;
            float bHeight = 30;
            float marginX = 10;

            GradientButton b;

            //type filter
            b = new GradientButton();
            StyleFilterButton(b);
            b.Frame = new CGRect(locX, locY, 220, bHeight);
            locX   += (float)b.Frame.Width + marginX;

            b.SetText(AllTypeText);
            typePopover = new ButtonStringPopover(b);

            typePopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = AllTypeText
            });
            foreach (String type in Rule.Types)
            {
                typePopover.Items.Add(new ButtonStringPopoverItem()
                {
                    Text = type.Capitalize(), Tag = type
                });
            }
            typePopover.SetButtonText = true;
            typePopover.ItemClicked  += HandleTypePopoverItemClicked;
            typeFilterButton          = b;
            typeFilterButton.Hidden   = false;

            FilterView.AddSubview(b);


            //subtype filter
            b = new GradientButton();
            StyleFilterButton(b);
            b.Frame = new CGRect(locX, locY, 100, bHeight);
            locX   += (float)b.Frame.Width + marginX;

            b.SetText(AllSubtypeText);
            subtypePopover = new ButtonStringPopover(b);

            subtypePopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = AllSubtypeText
            });

            subtypePopover.SetButtonText = true;
            subtypePopover.ItemClicked  += HandleSubtypePopoverItemClicked;
            subtypeFilterButton          = b;

            subtypeFilterButton.Hidden = true;

            FilterView.AddSubview(b);
        }
Example #8
0
        protected override void ResetButtonClicked()
        {
            _CLFilterButton.SetText(AllGroupText);
            _CLFilterValue = null;

            _GroupFilterButton.SetText(AllGroupText);
            _GroupFilterValue = null;

            filterField.Text = "";
            Filter();
        }
Example #9
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);
            }
Example #10
0
        protected override void ResetButtonClicked()
        {
            typeFilter = null;
            npcFilter  = 0;
            crFilter   = null;

            typeFilterButton.SetText(AllTypeText);
            setFilterButton.SetText(AllSetText);
            crFilterButton.SetText(AllCRText);

            filterField.Text = "";
            Filter();
        }
Example #11
0
        protected override void ResetButtonClicked()
        {
            schoolFilter = null;
            levelFilter  = null;
            classFilter  = null;

            schoolFilterButton.SetText(AllSchoolsText);
            levelFilterButton.SetText(AllLevelsText);
            classFilterButton.SetText(AllClassesText);

            filterField.Text = "";
            Filter();
        }
Example #12
0
        void HandleInitPopNumberModified(object sender, NumberModifyEventArgs args)
        {
            NumberModifyPopover pop = (NumberModifyPopover)sender;
            GradientButton      b   = (GradientButton)pop.ParentView;

            Character ch = (Character)pop.Data;

            if (args.Set)
            {
                ch.CurrentInitiative = args.Value.Value;
            }
            else
            {
                ch.CurrentInitiative += args.Value.Value;
            }

            pop.Value = ch.CurrentInitiative;
            b.SetText(ch.CurrentInitiative.ToString());
        }
Example #13
0
            public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
            {
                DataListViewCell cell = (DataListViewCell)tableView.DequeueReusableCell("CurrentFeatsViewCell");

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


                Spell.SpellAdjuster.LevelAdjusterInfo info = state._spell.Adjuster.Levels[indexPath.Row];


                cell.TextLabel.Text = info.Class;

                cell.TextLabel.Font = UIFont.SystemFontOfSize(15);

                GradientButton b = new GradientButton();

                b.Frame           = new CGRect(0, 3, 160, 22);
                b.TitleLabel.Font = UIFont.SystemFontOfSize(15);
                CMStyles.TextFieldStyle(b);
                b.SetText(info.Class);
                b.TouchUpInside += (sender, e) => state.SpellLevelClicked(info);
                UIView   view = new UIView();
                UIButton x    = new UIButton();
                UIImage  redx = UIImage.FromFile("Images/External/redx.png");

                x.SetImage(redx, UIControlState.Normal);
                x.Frame          = new CGRect(165, 0, redx.Size.Width, redx.Size.Height);
                x.TouchUpInside += (sender, e) => state.DeleteLevelClicked(info);

                view.Bounds = new CGRect(0, 0, x.Frame.Right, x.Frame.Bottom);
                view.Add(b);
                view.Add(x);


                cell.AccessoryView = view;


                return(cell);
            }
Example #14
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();
            }
        }
Example #15
0
        private void BuildFilters()
        {
            float locX    = 0;
            float locY    = 5;
            float bHeight = 30;
            float marginX = 10;

            GradientButton b;


            //type filter
            b = new GradientButton();
            StyleFilterButton(b);
            b.Frame = new CGRect(locX, locY, 100, bHeight);
            locX   += (float)b.Frame.Width + marginX;
            b.SetText(AllTypesText);
            typeFilterPopover = new ButtonStringPopover(b);
            typeFilterPopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = AllTypesText, Tag = null
            });

            foreach (String s in Feat.FeatTypes)
            {
                typeFilterPopover.Items.Add(new ButtonStringPopoverItem()
                {
                    Text = s, Tag = s
                });
            }
            typeFilterPopover.SetButtonText = true;
            typeFilterPopover.ItemClicked  += HandleTypeFilterPopoverItemClicked;;
            typeFilterButton = b;

            FilterView.AddSubview(b);

            b = new GradientButton();
            StyleDBButton(b);
            b.Frame = new CGRect(locX, locY, 90, bHeight);
            locX   += (float)b.Frame.Width + marginX;
            b.SetText("New");
            b.TouchUpInside += NewButtonClicked;

            FilterView.AddSubview(b);

            b = new GradientButton();
            StyleDBButton(b);
            b.Frame = new CGRect(locX, locY, 90, bHeight);
            locX   += (float)(b.Frame.Width + marginX);
            b.SetText("Customize");
            b.TouchUpInside += CustomizeButtonClicked;
            FilterView.AddSubview(b);


            b = new GradientButton();
            StyleDBButton(b);
            b.Frame = new CGRect(locX, locY, 90, bHeight);
            locX   += (float)b.Frame.Width + marginX;
            b.SetText("Edit");
            b.TouchUpInside += EditButtonClicked;
            FilterView.AddSubview(b);

            editButton = b;

            b = new GradientButton();
            StyleDBButton(b);
            b.Frame = new CGRect(locX, locY, 90, bHeight);
            locX   += (float)b.Frame.Width + marginX;
            b.SetText("Delete");
            b.TouchUpInside += DeleteButtonClicked;
            FilterView.AddSubview(b);

            deleteButton = b;
        }
Example #16
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);
        }
Example #17
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();
        }
Example #18
0
        private void BuildFilters()
        {
            float locX    = 0;
            float locY    = 5;
            float bHeight = 30;
            float marginX = 10;

            GradientButton b;


            //set filter
            b = new GradientButton();
            StyleFilterButton(b);
            b.Frame = new CGRect(locX, locY, 100, bHeight);
            locX   += (float)b.Frame.Width + marginX;
            b.SetText(AllSetText);
            setFilterPopover = new ButtonStringPopover(b);
            setFilterPopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = AllSetText, Tag = null
            });
            setFilterPopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = "Monsters", Tag = false
            });
            setFilterPopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = "NPCs", Tag = true
            });
            setFilterPopover.SetButtonText = true;
            setFilterPopover.ItemClicked  += HandleSetFilterPopoverItemClicked;
            setFilterButton = b;

            FilterView.AddSubview(b);

            //type filter
            b = new GradientButton();
            StyleFilterButton(b);
            b.Frame = new CGRect(locX, locY, 150, bHeight);
            locX   += (float)b.Frame.Width + marginX;

            b.SetText(AllTypeText);
            typePopover = new ButtonStringPopover(b);

            typePopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = AllTypeText
            });
            foreach (String type in Monster.CreatureTypeNames)
            {
                typePopover.Items.Add(new ButtonStringPopoverItem()
                {
                    Text = type.Capitalize(), Tag = type
                });
            }
            typePopover.SetButtonText = true;
            typePopover.ItemClicked  += HandleTypePopoverItemClicked;
            typeFilterButton          = b;

            FilterView.AddSubview(b);


            //CR filter
            b = new GradientButton();
            StyleFilterButton(b);
            b.Frame = new CGRect(locX, locY, 100, bHeight);
            locX   += (float)b.Frame.Width + marginX;

            b.SetText(AllCRText);
            crFilterPopover = new ButtonStringPopover(b);

            crFilterPopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = AllCRText
            });
            foreach (KeyValuePair <double, string> cr in LoadCRs())
            {
                crFilterPopover.Items.Add(new ButtonStringPopoverItem()
                {
                    Text = cr.Value, Tag = cr.Value
                });
            }
            crFilterPopover.SetButtonText = true;
            crFilterPopover.ItemClicked  += HandleCrFilterPopoverItemClicked;
            crFilterButton = b;

            FilterView.AddSubview(b);
        }
Example #19
0
        private void BuildFilters()
        {
            float locX    = 0;
            float locY    = 5;
            float bHeight = 30;
            float marginX = 10;

            GradientButton b;


            //class filter
            b = new GradientButton();
            StyleFilterButton(b);
            b.Frame = new CGRect(locX, locY, 100, bHeight);
            locX   += (float)b.Frame.Width + marginX;
            b.SetText(AllClassesText);
            classFilterPopover = new ButtonStringPopover(b);
            classFilterPopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = AllClassesText, Tag = null
            });
            List <String> classList = new List <String>()
            {
                "Alchemist", "Antipaladin", "Bard", "Cleric", "Druid",
                "Inquisitor", "Magus", "Oracle", "Paladin", "Ranger", "Sorcerer", "Summoner", "Witch", "Wizard"
            };

            foreach (String s in classList)
            {
                classFilterPopover.Items.Add(new ButtonStringPopoverItem()
                {
                    Text = s, Tag = s
                });
            }

            classFilterPopover.SetButtonText = true;
            classFilterPopover.ItemClicked  += HandleClassFilterPopoverItemClicked;
            classFilterButton = b;

            FilterView.AddSubview(b);


            //level filter
            b = new GradientButton();
            StyleFilterButton(b);
            b.Frame = new CGRect(locX, locY, 80, bHeight);
            locX   += (float)b.Frame.Width + marginX;
            b.SetText(AllLevelsText);
            levelFilterPopover = new ButtonStringPopover(b);
            levelFilterPopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = AllLevelsText, Tag = null
            });

            for (int i = 0; i <= 9; i++)
            {
                levelFilterPopover.Items.Add(new ButtonStringPopoverItem()
                {
                    Text = i.PastTense() + " Level", Tag = i
                });
            }

            levelFilterPopover.SetButtonText = true;
            levelFilterPopover.ItemClicked  += HandleLevelFilterPopoverItemClicked;
            levelFilterButton = b;

            FilterView.AddSubview(b);


            //school filter
            b = new GradientButton();
            StyleFilterButton(b);
            b.Frame = new CGRect(locX, locY, 100, bHeight);
            locX   += (float)b.Frame.Width + marginX;
            b.SetText(AllSchoolsText);
            schoolFilterPopover = new ButtonStringPopover(b);
            schoolFilterPopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = AllSchoolsText, Tag = null
            });
            foreach (string school in Spell.Schools)
            {
                schoolFilterPopover.Items.Add(new ButtonStringPopoverItem()
                {
                    Text = school, Tag = school
                });
            }
            schoolFilterPopover.SetButtonText = true;
            schoolFilterPopover.ItemClicked  += HandleSchoolFilterPopoverItemClicked;
            schoolFilterButton = b;

            FilterView.AddSubview(b);

            b = new GradientButton();
            StyleDBButton(b);
            b.Frame = new CGRect(locX, locY, 90, bHeight);
            locX   += (float)b.Frame.Width + marginX;
            b.SetText("New");
            b.TouchUpInside += NewButtonClicked;

            FilterView.AddSubview(b);

            b = new GradientButton();
            StyleDBButton(b);
            b.Frame = new CGRect(locX, locY, 90, bHeight);
            locX   += (float)b.Frame.Width + marginX;
            b.SetText("Customize");
            b.TouchUpInside += CustomizeButtonClicked;
            FilterView.AddSubview(b);


            b = new GradientButton();
            StyleDBButton(b);
            b.Frame = new CGRect(locX, locY, 90, bHeight);
            locX   += (float)b.Frame.Width + marginX;
            b.SetText("Edit");
            b.TouchUpInside += EditButtonClicked;
            FilterView.AddSubview(b);

            editButton = b;

            b = new GradientButton();
            StyleDBButton(b);
            b.Frame = new CGRect(locX, locY, 90, bHeight);
            locX   += (float)b.Frame.Width + marginX;
            b.SetText("Delete");
            b.TouchUpInside += DeleteButtonClicked;
            FilterView.AddSubview(b);

            deleteButton = b;
        }
        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();
        }
Example #22
0
        private void BuildFilters()
        {
            float locX    = 0;
            float locY    = 5;
            float bHeight = 30;
            float marginX = 10;

            GradientButton b;


            //set filter
            b = new GradientButton();
            StyleFilterButton(b);
            b.Frame = new CGRect(locX, locY, 100, bHeight);
            locX   += (float)b.Frame.Width + marginX;
            b.SetText(AllSetText);
            setFilterPopover = new ButtonStringPopover(b);
            setFilterPopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = AllSetText, Tag = 0
            });
            setFilterPopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = "Monsters", Tag = 1
            });
            setFilterPopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = "NPCs", Tag = 2
            });
            setFilterPopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = "Custom", Tag = 3
            });
            setFilterPopover.SetButtonText = true;
            setFilterPopover.ItemClicked  += HandleSetFilterPopoverItemClicked;
            setFilterButton = b;

            FilterView.AddSubview(b);

            //type filter
            b = new GradientButton();
            StyleFilterButton(b);
            b.Frame = new CGRect(locX, locY, 150, bHeight);
            locX   += (float)b.Frame.Width + marginX;

            b.SetText(AllTypeText);
            typePopover = new ButtonStringPopover(b);

            typePopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = AllTypeText
            });
            foreach (String type in Monster.CreatureTypeNames)
            {
                typePopover.Items.Add(new ButtonStringPopoverItem()
                {
                    Text = type.Capitalize(), Tag = type
                });
            }
            typePopover.SetButtonText = true;
            typePopover.ItemClicked  += HandleTypePopoverItemClicked;
            typeFilterButton          = b;

            FilterView.AddSubview(b);


            //CR filter
            b = new GradientButton();
            StyleFilterButton(b);
            b.Frame = new CGRect(locX, locY, 100, bHeight);
            locX   += (float)b.Frame.Width + marginX;

            b.SetText(AllCRText);
            crFilterPopover = new ButtonStringPopover(b);

            crFilterPopover.Items.Add(new ButtonStringPopoverItem()
            {
                Text = AllCRText
            });
            foreach (KeyValuePair <double, string> cr in LoadCRs())
            {
                crFilterPopover.Items.Add(new ButtonStringPopoverItem()
                {
                    Text = cr.Value, Tag = cr.Value
                });
            }
            crFilterPopover.SetButtonText = true;
            crFilterPopover.ItemClicked  += HandleCrFilterPopoverItemClicked;
            crFilterButton = b;

            FilterView.AddSubview(b);

            b = new GradientButton();
            StyleDBButton(b);
            b.Frame = new CGRect(locX, locY, 60, bHeight);
            locX   += (float)b.Frame.Width + marginX;
            b.SetText("New");
            b.TouchUpInside += NewButtonClicked;

            FilterView.AddSubview(b);

            b = new GradientButton();
            StyleDBButton(b);
            b.Frame = new CGRect(locX, locY, 75, bHeight);
            locX   += (float)(b.Frame.Width + marginX);
            b.SetText("Customize");
            b.TouchUpInside += CustomizeButtonClicked;
            FilterView.AddSubview(b);


            b = new GradientButton();
            StyleDBButton(b);
            b.Frame = new CGRect(locX, locY, 60, bHeight);
            locX   += (float)b.Frame.Width + marginX;
            b.SetText("Edit");
            b.TouchUpInside += EditButtonClicked;
            FilterView.AddSubview(b);

            //editButton = b;

            b = new GradientButton();
            StyleDBButton(b);
            b.Frame = new CGRect(locX, locY, 60, bHeight);
            locX   += (float)b.Frame.Width + marginX;
            b.SetText("Delete");
            b.TouchUpInside += DeleteButtonClicked;
            FilterView.AddSubview(b);

            //deleteButton = b;
        }