Esempio n. 1
0
        public CombatTab(CombatState state) : base(state)
        {
            _CombatList = new CombatListView();
            //

            AddSubview(_CombatList);
            _PlayerList = new CharacterListView(CombatState, false);
            _PlayerList.CharacterSelectionChanged += HandlePlayerListCharacterSelectionChanged;
            AddSubview(_PlayerList);
            _MonsterList = new CharacterListView(CombatState, true);
            _MonsterList.CharacterSelectionChanged += HandlePlayerListCharacterSelectionChanged;
            AddSubview(_MonsterList);

            _MonsterView = new UIWebView(new CGRect(0, 0, 100, 100));
            _MonsterView.BackgroundColor = UIColor.Brown;
            _MonsterView.LoadHtmlString("<html></html>", new NSUrl("http://localhost/"));

            AddSubview(_MonsterView);

            _DieView = new DieRollerView();
            _DieView._CollpasedChanged += (object sender, EventArgs e) =>
            {
                LayoutSubviews();
            };
            AddSubview(_DieView);

            _CombatList.CombatState = state;
        }
Esempio n. 2
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);
        }