Пример #1
0
        protected override void BuildAdditionalLayouts()
        {
            LinearLayout barLayout = new LinearLayout(_v.Context);

            BottomLayout.AddView(barLayout);
            barLayout.Orientation = Orientation.Horizontal;

            _AdvancerButton      = new Button(_v.Context);
            _AdvancerButton.Text = "Monster Advancer";
            _AdvancerButton.SetCompoundDrawablesWithIntrinsicBounds(ContextCompat.GetDrawable(_v.Context, Resource.Drawable.monster16), null, null, null);
            barLayout.AddView(_AdvancerButton);

            _AdvancerButton.Click += (object sender, EventArgs e) =>
            {
                _AdvancerVisible = !_AdvancerVisible;
                _AdvancerContainer.Visibility = _AdvancerVisible?ViewStates.Visible:ViewStates.Gone;
                RefreshItem();
            };

            _AddButton      = new Button(_v.Context);
            _AddButton.Text = "Add to Combat";
            _AddButton.SetCompoundDrawablesWithIntrinsicBounds(ContextCompat.GetDrawable(_v.Context, Resource.Drawable.sword16), null, null, null);
            barLayout.AddView(_AddButton);
            _AddButton.Click += (object sender, EventArgs e) =>
            {
                Monster m = CurrentMonster;
                if (m != null)
                {
                    CombatFragment.CombatState.AddMonster(m, Activity.GetCMPrefs().GetRollHP(), true);
                }
            };

            _AdvancerContainer = new LinearLayout(_v.Context);
            BottomLayout.AddView(_AdvancerContainer);

            LayoutInflater vi = (LayoutInflater)_v.Context.GetSystemService(Context.LayoutInflaterService);

            _AdvancerLayout = vi.Inflate(Resource.Layout.MonsterAdvancer, _AdvancerContainer, false);
            _AdvancerContainer.Visibility = ViewStates.Gone;
            _AdvancerContainer.AddView(_AdvancerLayout);


            CheckBox cb = _AdvancerLayout.FindViewById <CheckBox>(Resource.Id.advancedBox);

            cb.Click += (object sender, EventArgs e) => { RefreshItem(); };


            Button b;

            b = _AdvancerLayout.FindViewById <Button>(Resource.Id.advancedMultiplierButton);
            List <String> advMult = new List <string>()
            {
                "x1", "x2", "x3"
            };

            PopupUtils.AttachButtonStringPopover("Multiplier", b,
                                                 advMult,
                                                 0, (r1, index, val) =>
            {
                _advMuliplier = index + 1;
                RefreshItem();
            });

            b = _AdvancerLayout.FindViewById <Button>(Resource.Id.sizeButton);
            List <String> sizeOpt = new List <string>()
            {
                "Young", "Normal", "Giant"
            };

            PopupUtils.AttachButtonStringPopover("Size", b,
                                                 sizeOpt,
                                                 0, (r1, index, val) =>
            {
                _sizeChange = index - 1;
                RefreshItem();
            });

            b = _AdvancerLayout.FindViewById <Button>(Resource.Id.sizeMultiplierButton);
            List <String> sizeMult = new List <string>()
            {
                "x1", "x2"
            };

            PopupUtils.AttachButtonStringPopover("Multiplier", b,
                                                 sizeMult,
                                                 1, (r1, index, val) =>
            {
                _sizeMultiplier = index + 1;
                RefreshItem();
            });

            b = _AdvancerLayout.FindViewById <Button>(Resource.Id.outsiderButton);
            List <String> outsiderList = new List <string>()
            {
                "None", "Celestial", "Entropic", "Fiendish", "Resoloute"
            };

            PopupUtils.AttachButtonStringPopover("Multiplier", b,
                                                 outsiderList,
                                                 0, (r1, index, val) =>
            {
                _outsiderChange = index;
                RefreshItem();
            });


            b = _AdvancerLayout.FindViewById <Button>(Resource.Id.hdButton);
            List <String> hdList = new List <string>()
            {
                "Remove HD", "No HD", "Add HD"
            };

            PopupUtils.AttachButtonStringPopover("Change HD", b,
                                                 hdList,
                                                 1, (r1, index, val) =>
            {
                _hdChange = index;
                RefreshItem();
            });

            b = _AdvancerLayout.FindViewById <Button>(Resource.Id.hdCountButton);
            List <String> hdCountList = new List <string>();

            for (int i = 1; i <= 20; i++)
            {
                hdCountList.Add(i.ToString());
            }
            PopupUtils.AttachButtonStringPopover("HD Count", b,
                                                 hdCountList,
                                                 0, (r1, index, val) =>
            {
                _hdCount = index + 1;
                RefreshItem();
            });

            b = _AdvancerLayout.FindViewById <Button>(Resource.Id.bonusStatButton);
            List <String> statList = new List <string>();

            for (int i = 0; i < 6; i++)
            {
                statList.Add(Monster.StatText((Stat)i));
            }
            PopupUtils.AttachButtonStringPopover("Bonus Stat", b,
                                                 statList, "Bonus Stat {0}",
                                                 0, (r1, index, val) =>
            {
                _bonusStat = index;
                RefreshItem();
            });
            b = _AdvancerLayout.FindViewById <Button>(Resource.Id.statChangeButton);
            List <String> sizeChange50List = new List <string>()
            {
                "No Size Change", "Size Change 50% HD"
            };

            PopupUtils.AttachButtonStringPopover("Change Size", b,
                                                 sizeChange50List,
                                                 0, (r1, index, val) =>
            {
                _sizeChange50HD = index == 1;
                RefreshItem();
            });


            b = _AdvancerLayout.FindViewById <Button>(Resource.Id.templateButton);
            List <String> templateList = new List <string>()
            {
                "No Template",
                "Half-Dragon", "Half-Celestial", "Half-Fiend", "Skeleton",
                "Vampire", "Zombie"
            };

            PopupUtils.AttachButtonStringPopover("Template", b,
                                                 templateList,
                                                 0, (r1, index, val) =>
            {
                _selectedTemplate = index;
                UpdateTemplateView();
                RefreshItem();
            });


            b = _AdvancerLayout.FindViewById <Button>(Resource.Id.dragonColorButton);
            List <String> colorList = new List <string>(Monster.DragonColors);

            PopupUtils.AttachButtonStringPopover("Color", b,
                                                 colorList,
                                                 0, (r1, index, val) =>
            {
                _dragonColor = val;
                RefreshItem();
            });


            b = _AdvancerLayout.FindViewById <Button>(Resource.Id.zombieButton);
            List <String> zombieList = new List <string>()
            {
                "Regular", "Fast", "Plague"
            };

            PopupUtils.AttachButtonStringPopover("Template", b,
                                                 zombieList,
                                                 0, (r1, index, val) =>
            {
                _zombieType = index;
                RefreshItem();
            });


            cb        = _AdvancerLayout.FindViewById <CheckBox>(Resource.Id.augmentSummoningBox);
            cb.Click += (object sender, EventArgs e) => { RefreshItem(); };

            foreach (int id in new List <int>()
            {
                Resource.Id.strBox,
                Resource.Id.dexBox,
                Resource.Id.conBox,
                Resource.Id.intBox,
                Resource.Id.wisBox,
                Resource.Id.chaBox,
                Resource.Id.bloodyBox,
                Resource.Id.burningBox,
                Resource.Id.championBox,
            })
            {
                cb        = _AdvancerLayout.FindViewById <CheckBox>(id);
                cb.Click += (object sender, EventArgs e) => { RefreshItem(); };
            }

            UpdateTemplateView();
        }
Пример #2
0
 private void SetDataToView()
 {
     BottomLayout.SetOnTouchListener(this);
 }