Esempio n. 1
0
        public void StyleButton(GradientButton button, bool selected)
        {
            button.SetTitleColor(UIColor.White, UIControlState.Normal);
            UIColor color1 = CMUIColors.PrimaryColorDarker;
            UIColor color2 = CMUIColors.PrimaryColorLight;

            if (selected)
            {
                button.Gradient = new GradientHelper(color1, color2);
                button.SetTitleColor(UIColor.White, UIControlState.Normal);
            }
            else
            {
                button.Gradient = new GradientHelper(UIExtensions.RGBColor(0xEEEEEE), UIExtensions.RGBColor(0xEEEEEE));
                button.SetTitleColor(UIExtensions.ARGBColor(0xFF999999), UIControlState.Normal);
            }
        }
        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();
        }
Esempio n. 3
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);
        }