protected override void BuildFilters() { Button b; b = BuildFilterButton("Type", 180); List <String> types = new List <string>(Rule.Types); types.Insert(0, "All"); PopupUtils.AttachButtonStringPopover("Classes", b, types, 0, (r1, index, val) => { _Type = val; UpdateSubtypeButton(); UpdateFilter(); }); _SubtypeButton = BuildFilterButton("Subtype", 180); _SubtypesList.Add("All"); PopupUtils.AttachButtonStringPopover("Classes", _SubtypeButton, _SubtypesList, 0, (r1, index, val) => { _Subtype = val; UpdateFilter(); }); UpdateSubtypeButton(); }
protected override void BuildFilters() { Button b = BuildFilterButton("group", 100); List <String> groups = new List <string>() { "All Groups" }; groups.AddRange(MagicItem.Groups); int startindex = groups.IndexOf(_Group); if (startindex < 0) { startindex = 0; } PopupUtils.AttachButtonStringPopover("Group", b, groups, startindex, (r1, index, val) => { if (index == 0) { _Group = ""; } else { _Group = val; } UpdateFilter(); }); b = BuildFilterButton("cl", 80); List <string> cls = new List <string>() { "All CLs" }; cls.AddRange(from x in MagicItem.CLs select x.ToString()); startindex = 0; if (_CL != -1) { startindex = cls.IndexOf(_CL.ToString()); } PopupUtils.AttachButtonStringPopover("CL", b, cls, startindex, (r1, index, val) => { if (index == 0) { _CL = -1; } else { int.TryParse(val, out _CL); } UpdateFilter(); }); }
Drawable ItemImage(object item) { if (item is Condition) { return(PopupUtils.NamedImage(Context, ((Condition)item).Image)); } return(null); }
protected override void BuildFilters() { Button b; b = BuildFilterButton("Spells", 180); List <String> classes = new List <string>(Spell.SpellAdjuster.Classes.Values); classes.Insert(0, "All Classes"); PopupUtils.AttachButtonStringPopover("Classes", b, classes, 0, (r1, index, val) => { _Class = val; UpdateFilter(); }); b = BuildFilterButton("Levels", 80); List <String> levels = new List <string>(); for (int i = 0; i < 10; i++) { levels.Add(i.PastTense()); } levels.Insert(0, "All Levels"); PopupUtils.AttachButtonStringPopover("Levels", b, levels, 0, (r1, index, val) => { _Level = index - 1; UpdateFilter(); }); b = BuildFilterButton("Schools", 180); List <String> schools = new List <string>(Spell.Schools); schools.Insert(0, "All Schools"); PopupUtils.AttachButtonStringPopover("Schools", b, schools, 0, (r1, index, val) => { _School = val; UpdateFilter(); }); }
protected override void BuildFilters() { Button b; b = BuildFilterButton("type", 180); List <String> fts = new List <string>(Feat.FeatTypes); fts.Insert(0, "All"); PopupUtils.AttachButtonStringPopover("Type", b, fts, 0, (r1, index, val) => { _Type = val; UpdateFilter(); }); }
protected override void BuildFilters() { Button b; b = BuildFilterButton("type", 180); List <String> fts = new List <string>(Feat.FeatTypes); fts.Insert(0, "All"); PopupUtils.AttachButtonStringPopover("Type", b, fts, 0, (r1, index, val) => { _Type = val; UpdateFilter(); }); b = new Button(_v.Context); b.Text = "New"; b.Click += (sender, e) => { NewItem(); }; FilterLayout.AddView(b); NewButton = b; b = new Button(_v.Context); b.Text = "Customize"; b.Click += (sender, e) => { CustomizeItem(); }; FilterLayout.AddView(b); CustomizeButton = b; b = new Button(_v.Context); b.Text = "Edit"; b.Click += (sender, e) => { EditItem(); }; FilterLayout.AddView(b); EditButton = b; }
protected override void BuildFilters() { Button b = BuildFilterButton("group", 100); PopupUtils.AttachButtonStringPopover("Group", b, new List <string> { "All Monsters", "Monsters", "NPCs" }, _group, (r1, index, val) => { _group = index; UpdateFilter(); }); b = BuildFilterButton("type", 180); List <String> cts = new List <String>(from s in Monster.CreatureTypeNames select s.Capitalize()); cts.Insert(0, "All Types"); PopupUtils.AttachButtonStringPopover("Type", b, cts, 0, (r1, index, val) => { _type = val; UpdateFilter(); }); b = BuildFilterButton("cr", 80); List <string> crs = new List <string>(Monster.CRList.Values); crs.Insert(0, "All CRs"); PopupUtils.AttachButtonStringPopover("CR", b, crs, 0, (r1, index, val) => { _cr = val; UpdateFilter(); }); }
public override View GetView(int position, View convertView, ViewGroup parent) { CharacterActionItem ai = _ActionItems[position]; TextView t = (TextView)convertView; if (t == null) { t = new TextView(_Context); } t.Text = ai.Name; t.SetTextColor(new Color(0xee, 0xee, 0xee)); t.SetTextSize(Android.Util.ComplexUnitType.Dip, 20f); if (ai.Name != null && ai.Name.Length > 0) { t.SetPadding(8, 10, 5, 10); } else { t.SetPadding(0, -2, 0, -2); t.Enabled = false; } t.SetCompoundDrawablesWithIntrinsicBounds(PopupUtils.NamedImage(_Context, ai.Icon), null, null, null); return(t); }
protected override void BuildFilters() { Button b = BuildFilterButton("group", 100); PopupUtils.AttachButtonStringPopover("Group", b, new List <string> { "All Monsters", "Monsters", "NPCs", "Custom" }, _group, (r1, index, val) => { _group = index; UpdateFilter(); }); b = BuildFilterButton("type", 180); List <String> cts = new List <String>(from s in Monster.CreatureTypeNames select s.Capitalize()); cts.Insert(0, "All Types"); PopupUtils.AttachButtonStringPopover("Type", b, cts, 0, (r1, index, val) => { _type = val; UpdateFilter(); }); b = BuildFilterButton("cr", 80); List <string> crs = new List <string>(Monster.CRList.Values); crs.Insert(0, "All CRs"); PopupUtils.AttachButtonStringPopover("CR", b, crs, 0, (r1, index, val) => { _cr = val; UpdateFilter(); }); b = new Button(_v.Context); b.Text = "New"; b.Click += (sender, e) => { NewItem(); }; FilterLayout.AddView(b); NewButton = b; b = new Button(_v.Context); b.Text = "Customize"; b.Click += (sender, e) => { CustomizeItem(); }; FilterLayout.AddView(b); CustomizeButton = b; b = new Button(_v.Context); b.Text = "Edit"; b.Click += (sender, e) => { EditItem(); }; FilterLayout.AddView(b); EditButton = b; }
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(); }
public override View GetView(int position, View convertView, ViewGroup parent) { LinearLayout baseLayout = (LinearLayout)convertView; if (baseLayout == null) { baseLayout = new LinearLayout(Application.Context); baseLayout.LongClickable = true; } baseLayout.RemoveAllViews(); baseLayout.LayoutParameters = new AbsListView.LayoutParams( new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)); baseLayout.Orientation = Orientation.Vertical; baseLayout.Tag = position; LinearLayout layout = new LinearLayout(Application.Context); baseLayout.AddView(layout); layout.SetGravity(GravityFlags.CenterVertical); Character c = _State.CombatList[position]; ImageView rv = new ImageView(_View.Context); rv.SetImageDrawable(_View.Context.Resources.GetDrawable( Resource.Drawable.target16)); layout.AddView(rv); rv.Visibility = c.IsReadying?ViewStates.Visible:ViewStates.Gone; ImageView dv = new ImageView(_View.Context); dv.SetImageDrawable(_View.Context.Resources.GetDrawable( Resource.Drawable.hourglass16)); layout.AddView(dv); dv.Visibility = c.IsDelaying?ViewStates.Visible:ViewStates.Gone; TextView t = new TextView(Application.Context); if (t == null) { t = new TextView(Application.Context); } t.Text = _State.CombatList[position].Name; t.SetTextColor(Android.Graphics.Color.Black); t.Ellipsize = Android.Text.TextUtils.TruncateAt.Middle; t.Gravity = GravityFlags.CenterVertical; t.SetSingleLine(true); SetLayoutBackground(baseLayout, layout, false); if (_State.CurrentCharacter == _State.CombatList[position]) { ImageView iv = new ImageView(Application.Context); iv.SetImageDrawable(Application.Context.Resources.GetDrawable(Resource.Drawable.next16)); layout.AddView(iv); } if (_State.CombatList[position] == _Character) { layout.SetBackgroundColor(new Android.Graphics.Color(0, 0, 0)); t.SetTextColor(Android.Graphics.Color.White); } LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)); lp.Weight = 1.0f; t.LayoutParameters = lp; t.Click += (object sender, EventArgs e) => { if (CharacterClicked != null) { CharacterClicked(this, new CharacterEventArgs() { Character = c }); } }; t.LongClickable = true; t.LongClick += (object sender, View.LongClickEventArgs e) => { ClipData data = ClipData.NewPlainText("", ""); View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(baseLayout); baseLayout.StartDrag(data, shadowBuilder, baseLayout, 0); }; layout.AddView(t); //init button Button bu = new Button(_View.Context); bu.SetHeight(45); bu.SetWidth(45); layout.AddView(bu); bu.SetBackgroundDrawable(_View.Context.Resources.GetDrawable(Resource.Drawable.blue_button)); bu.Text = c.CurrentInitiative.ToString(); bu.SetTextColor(new Android.Graphics.Color(0xff, 0xff, 0xff)); bu.Click += (object sender, EventArgs e) => { new NumberDialog("CurrentInitiative", "Initiative", c, _View.Context).Show(); }; //action button ImageButton b = new ImageButton(_View.Context); b.SetImageDrawable(_View.Context.Resources.GetDrawable(Resource.Drawable.lightning16)); layout.AddView(b); b.SetMaxHeight(45); b.SetMinimumHeight(45); b.SetMaxWidth(45); b.SetMinimumWidth(45); b.SetBackgroundDrawable(_View.Context.Resources.GetDrawable(Resource.Drawable.blue_button)); var options = new List <string>() { "Move Down", "Move Up", "Ready", "Delay", "Act Now" }; PopupUtils.AttachSimpleStringPopover(c.Name, b, options, (v, index, val) => { switch (index) { case 0: _State.MoveDownCharacter(c); break; case 1: _State.MoveUpCharacter(c); break; case 2: c.IsReadying = !c.IsReadying; break; case 3: c.IsDelaying = !c.IsDelaying; break; case 4: _State.CharacterActNow(c); break; } }); new ViewUpdateListener(c, layout, rv, dv, bu); foreach (Character follower in c.InitiativeFollowers) { TextView tv = new TextView(_View.Context); tv.SetPadding(10, 0, 0, 0); tv.Text = follower.Name; baseLayout.AddView(tv); } baseLayout.SetOnDragListener(new ListOnDragListener(this, baseLayout, layout)); return(baseLayout); }
protected override void BuildAdditionalLayouts() { ImageButton ib = new ImageButton(_v.Context); ib.SetImageDrawable(ContextCompat.GetDrawable(_v.Context, Resource.Drawable.wand16)); LeftLayout.AddView(ib); ib.Click += (object sender, EventArgs e) => { ShowLookup(); }; ib.Background = (ContextCompat.GetDrawable(_v.Context, Resource.Drawable.main_tab)); ib.Selected = true; lookupButton = ib; ib = new ImageButton(_v.Context); ib.SetImageDrawable(ContextCompat.GetDrawable(_v.Context, Resource.Drawable.dice16)); LeftLayout.AddView(ib); ib.Click += (object sender, EventArgs e) => { ShowGenerator(); }; ib.Background = (ContextCompat.GetDrawable(_v.Context, Resource.Drawable.main_tab)); generatorButton = ib; LayoutInflater vi = (LayoutInflater)_v.Context.GetSystemService(Context.LayoutInflaterService); _GeneratorLayout = vi.Inflate(Resource.Layout.TreasureGenerator, SearchReplacementLayout, false); SearchReplacementLayout.Visibility = ViewStates.Gone; SearchReplacementLayout.AddView(_GeneratorLayout); Button b; b = _GeneratorLayout.FindViewById <Button>(Resource.Id.byLevelButton); b.Click += (object sender, EventArgs e) => { ShowLevel(true); }; b.Selected = true; b.Background = (ContextCompat.GetDrawable(_v.Context, Resource.Drawable.main_tab)); b = _GeneratorLayout.FindViewById <Button>(Resource.Id.byItemsButton); b.Click += (object sender, EventArgs e) => { ShowLevel(false); }; b.Background = (ContextCompat.GetDrawable(_v.Context, Resource.Drawable.main_tab)); ShowLevel(_LevelVisible); //level generation b = _GeneratorLayout.FindViewById <Button>(Resource.Id.levelButton); List <String> levelList = new List <string>(); for (int i = 1; i <= 20; i++) { levelList.Add(i.ToString()); } PopupUtils.AttachButtonStringPopover("Level", b, levelList, "Level {0}", 0, (r1, index, val) => { _Level = index + 1; }); b = _GeneratorLayout.FindViewById <Button>(Resource.Id.goodsButton); b.SetLeftDrawableResource(Resource.Drawable.emerald16); List <String> goodsList = new List <string>() { "None", "Normal", "Double", "Triple" }; for (int i = 4; i <= 100; i++) { goodsList.Add("x" + i.ToString()); } PopupUtils.AttachButtonStringPopover("Goods", b, goodsList, "Goods {0}", 1, (r1, index, val) => { _Goods = index; }); b = _GeneratorLayout.FindViewById <Button>(Resource.Id.coinButton); b.SetLeftDrawableResource(Resource.Drawable.coins16); PopupUtils.AttachButtonStringPopover("Coin", b, goodsList, "Coin {0}", 1, (r1, index, val) => { _Coin = index; }); b = _GeneratorLayout.FindViewById <Button>(Resource.Id.magicItemsButton); b.SetLeftDrawableResource(Resource.Drawable.wand16); PopupUtils.AttachButtonStringPopover("Items", b, goodsList, "Items {0}", 1, (r1, index, val) => { _MagicItems = index; }); b = _GeneratorLayout.FindViewById <Button>(Resource.Id.generateLevelButton); b.SetLeftDrawableResource(Resource.Drawable.treasure16); b.Click += (object sender, EventArgs e) => { GenerateLevel(); }; //item generation b = _GeneratorLayout.FindViewById <Button>(Resource.Id.countButton); List <String> countList = new List <string>(); for (int i = 1; i <= 100; i++) { countList.Add(i.ToString()); } PopupUtils.AttachButtonStringPopover("Item Count", b, countList, "{0} items(s)", 0, (r1, index, val) => { _ItemCount = index + 1; }); b = _GeneratorLayout.FindViewById <Button>(Resource.Id.itemsLevelButton); List <String> itemLevelList = new List <string>() { "Minor", "Medium", "Major" }; PopupUtils.AttachButtonStringPopover("Item Level", b, itemLevelList, "{0} Level", 0, (r1, index, val) => { _ItemLevel = index; }); b = _GeneratorLayout.FindViewById <Button>(Resource.Id.generateItemsButton); b.Click += (object sender, EventArgs e) => { GenerateItems(); }; b.SetCompoundDrawablesWithIntrinsicBounds(ContextCompat.GetDrawable(_v.Context, Resource.Drawable.treasure16), null, null, null); if (_GeneratorVisible) { ShowGenerator(); } else { ShowLookup(); } }
protected override void BuildFilters() { Button b; b = BuildFilterButton("Spells", 180); List <String> classes = new List <string>(Spell.SpellAdjuster.Classes.Values); classes.Insert(0, "All Classes"); PopupUtils.AttachButtonStringPopover("Classes", b, classes, 0, (r1, index, val) => { _Class = val; UpdateFilter(); }); b = BuildFilterButton("Levels", 80); List <String> levels = new List <string>(); for (int i = 0; i < 10; i++) { levels.Add(i.PastTense()); } levels.Insert(0, "All Levels"); PopupUtils.AttachButtonStringPopover("Levels", b, levels, 0, (r1, index, val) => { _Level = index - 1; UpdateFilter(); }); b = BuildFilterButton("Schools", 180); List <String> schools = new List <string>(Spell.Schools); schools.Insert(0, "All Schools"); PopupUtils.AttachButtonStringPopover("Schools", b, schools, 0, (r1, index, val) => { _School = val; UpdateFilter(); }); b = new Button(_v.Context); b.Text = "New"; b.Click += (sender, e) => { NewItem(); }; FilterLayout.AddView(b); NewButton = b; b = new Button(_v.Context); b.Text = "Customize"; b.Click += (sender, e) => { CustomizeItem(); }; FilterLayout.AddView(b); CustomizeButton = b; b = new Button(_v.Context); b.Text = "Edit"; b.Click += (sender, e) => { EditItem(); }; FilterLayout.AddView(b); EditButton = b; }