public void UpdateView()
        {
            pushedPage = null;
            var sheet = CharacterSheetStorage.Instance.selectedCharacter;

            if (sheet == null)
            {
                return;
            }
            //BaseAttackBonus.Text = sheet.GetBaseAttackBonus().ToString();
            SizeModifier.Text = sizeModifiers.GetTotal(sheet).ToString();
            Value.Text        = attackBonus.baseValue.ToString();
            UpdateModifiersSum();
            MainPage.FillIntMLGrid(Modifiers, sheet, attackBonus.modifiers, "Modifiers", EditModifier, EditModifier, ReorderModifiers, (modifiers, modifier) => UpdateModifiersSum());
        }
示例#2
0
        public void UpdateView()
        {
            pushedPage = null;
            var sheet  = CharacterSheetStorage.Instance.selectedCharacter;
            var dexMod = sheet.GetAbilityModifier(CharacterSheet.Ability.Dexterity);

            DexModifier.Text = dexMod.ToString();
            var miscMod = modifiers.GetTotal(sheet);

            MiscModifiers.Text = miscMod.ToString();
            Total.Text         = (dexMod + miscMod).ToString();
        }
示例#3
0
        public void UpdateView()
        {
            pushedPage = null;
            var sheet = CharacterSheetStorage.Instance.selectedCharacter;

            if (sheet == null)
            {
                return;
            }
            CMDSizeModifier.Text = cmdSizeModifier.GetTotal(sheet).ToString();
            CMBSizeModifier.Text = cmbSizeModifier.GetTotal(sheet).ToString();
            UpdateTotal();
        }
        public void UpdateView()
        {
            pushedPage = null;
            var sheet = CharacterSheetStorage.Instance.selectedCharacter;

            if (sheet == null)
            {
                return;
            }
            Level.Text      = CharacterSheet.LevelOfClass.AsString(sheet, levelOfClass);
            Experience.Text = experience.GetTotal(sheet).ToString();
            NextLevel.Text  = nextLevelExperience.GetTotal(sheet).ToString();
        }
        private void UpdateCurrentAttackPicker()
        {
            var sheet = CharacterSheetStorage.Instance.selectedCharacter;

            if (sheet == null)
            {
                return;
            }
            if (baseAttackBonus == null)
            {
                return;
            }
            if (baseAttackBonus.Count <= 0)
            {
                return;
            }
            var items         = new List <CharacterSheet.IntPickerItem>();
            var selectedIndex = -1;
            var cac           = currentAttacksCount.GetTotal(sheet);
            var ac            = Math.Min(attacksCount, cac);

            if (ac <= 0)
            {
                ac = attacksCount;
            }
            for (var i = 0; i < ac; i++)
            {
                if (i == currentAttack)
                {
                    selectedIndex = i;
                }
                var item = new CharacterSheet.IntPickerItem()
                {
                    Name  = sheet.GetBaseAttackBonusForPicker(baseAttackBonus, i, true),
                    Value = i,
                };
                items.Add(item);
            }
            CurrentAttacksCount.Text    = cac > 0 ? ac.ToString() : "(equals to attacks count)";
            CurrentAttack.ItemsSource   = items;
            CurrentAttack.SelectedIndex = selectedIndex;
            var oneAttack = ac < 2;

            CurrentAttack.InputTransparent     = oneAttack;
            CurrentAttackFrame.BackgroundColor = oneAttack ? Color.LightGray : Color.White;
        }
        public void UpdateView()
        {
            pushedPage = null;
            var sheet      = CharacterSheetStorage.Instance.selectedCharacter;
            var ranksSpent = 0;

            foreach (var skill in sheet.skills)
            {
                ranksSpent += skill.rank.GetTotal(sheet);
            }
            var ranks     = skillRanks.GetTotal(sheet);
            var ranksLeft = ranks - ranksSpent;

            Left.Text  = ranksLeft.ToString();
            Ranks.Text = ranks.ToString();
            Spent.Text = ranksSpent.ToString();
        }
        private void UpdateRow(AttackRow row, CharacterSheet.ValueWithIntModifiers bab)
        {
            if (row == null)
            {
                return;
            }
            if (bab == null)
            {
                return;
            }
            var sheet = CharacterSheetStorage.Instance.selectedCharacter;

            if (sheet == null)
            {
                return;
            }
            var value = bab.GetTotal(sheet);

            UpdateValue(row.value, value >= 0 ? "+" + value : value.ToString());
            MainPage.SetTapHandler(row.frame, (s, e) => EditBonus(bab), 1);
        }
        private void CreateRow(CharacterSheet.ValueWithIntModifiers bab)
        {
            var sheet = CharacterSheetStorage.Instance.selectedCharacter;

            if (sheet == null)
            {
                return;
            }
            if (rowsPool.Count > 0)
            {
                var row = rowsPool[0];
                rowsPool.RemoveAt(0);
                var rowIndex = rows.Count;
                rows.Add(row);
                UpdateRow(row, bab);
                Attacks.Children.Add(row.title, 0, rowIndex);
                Attacks.Children.Add(row.frame, 1, rowIndex);
                return;
            }
            var title = CreateLabel("Attack " + (rows.Count + 1) + " Bonus:");
            var bonus = bab.GetTotal(sheet);
            var frame = CreateFrame(bonus >= 0 ? "+" + bonus : bonus.ToString());
            var value = frame.Content as Label;

            value.TextDecorations = TextDecorations.Underline;
            var newRow = new AttackRow()
            {
                title = title,
                frame = frame,
                value = value,
            };
            var newRowIndex = rows.Count;

            rows.Add(newRow);
            MainPage.SetTapHandler(frame, (s, e) => EditBonus(bab), 1);
            Attacks.Children.Add(newRow.title, 0, newRowIndex);
            Attacks.Children.Add(newRow.frame, 1, newRowIndex);
        }
        private void UpdateTotal()
        {
            var sheet = CharacterSheetStorage.Instance.selectedCharacter;

            if (sheet == null)
            {
                return;
            }
            var total = 0;

            MainPage.StrToInt(Value.Text, ref attackBonus.baseValue);
            total += sizeModifiers.GetTotal(sheet);
            total += attackBonus.GetTotal(sheet);
            var values = string.Empty;
            var count  = sheet.attacksCount;

            if (count <= 0)
            {
                values = "+0";
            }
            else
            {
                for (var i = 0; i < count; i++)
                {
                    var bab = sheet.GetBaseAttackBonus(i);
                    bab += total;
                    if (values.Length > 0)
                    {
                        values += ", ";
                    }
                    var sbab = bab >= 0 ? "+" + bab : bab.ToString();
                    values += ((count > 1) && (i == currentAttack)) ? "[" + sbab + "]" : sbab;
                }
            }
            Total.Text = values;
        }