예제 #1
0
        public EditInitiative()
        {
            InitializeComponent();
            var sheet = CharacterSheetStorage.Instance.selectedCharacter;

            modifiers = sheet.initiative.miscModifiers.Clone as CharacterSheet.ValueWithIntModifiers;
            UpdateView();
        }
        public void InitEditor()
        {
            var sheet = CharacterSheetStorage.Instance.selectedCharacter;

            if (sheet == null)
            {
                return;
            }
            skillRanks = sheet.skillRanks.Clone as CharacterSheet.ValueWithIntModifiers;
            UpdateView();
        }
        private void Init()
        {
            var sheet = CharacterSheetStorage.Instance.selectedCharacter;

            if (sheet == null)
            {
                return;
            }
            sizeModifiers = sheet.attackSizeModifier.Clone as CharacterSheet.ValueWithIntModifiers;
            attackBonus   = sheet.attackBonusModifiers.Clone as CharacterSheet.ValueWithIntModifiers;
            currentAttack = sheet.currentAttack;
            UpdateCurrentAttackPicker();
            UpdateView();
        }
예제 #4
0
 public void Init(CharacterSheet sheet, CharacterSheet.ValueWithIntModifiers source, string title, string valueName, bool saveCharacter, bool allowUseAbilities = true)
 {
     Title                  = title;
     ValueName.Text         = valueName;
     this.allowUseAbilities = allowUseAbilities;
     if (source == null)
     {
         return;
     }
     this.sheet         = sheet;
     this.source        = source;
     this.saveCharacter = saveCharacter;
     modifiers          = source.modifiers.Clone as CharacterSheet.ModifiersList <CharacterSheet.IntModifier, int, CharacterSheet.IntSum>;
     Value.Text         = source.baseValue.ToString();
     UpdateView();
 }
        private void InitControls()
        {
            var sheet = CharacterSheetStorage.Instance.selectedCharacter;

            if (sheet == null)
            {
                return;
            }
            levelOfClass = CharacterSheet.LevelOfClass.CreateClone(sheet.levelOfClass);
            var alignments    = new List <AlignmentPickerItem>();
            var values        = Enum.GetValues(typeof(CharacterSheet.Alignments));
            var selectedIndex = -1;
            var index         = -1;

            foreach (var v in values)
            {
                index += 1;
                var alignment = new AlignmentPickerItem()
                {
                    Name  = v.ToString(),
                    Value = (CharacterSheet.Alignments)v,
                };
                alignments.Add(alignment);
                if (sheet.Alignment == alignment.Value)
                {
                    selectedIndex = index;
                }
            }
            Alignment.ItemsSource        = alignments;
            Alignment.ItemDisplayBinding = new Binding("Name");
            Alignment.SelectedIndex      = selectedIndex;
            CharacterName.Text           = sheet.name;
            experience           = sheet.experience.Clone as CharacterSheet.ValueWithIntModifiers;
            nextLevelExperience  = sheet.nextLevelExperience.Clone as CharacterSheet.ValueWithIntModifiers;
            Deity.Text           = sheet.deity;
            Homeland.Text        = sheet.homeland;
            Race.Text            = sheet.Race;
            Size.Text            = sheet.size;
            Gender.Text          = sheet.gender;
            Age.Text             = sheet.age;
            CharacterHeight.Text = sheet.height;
            Weight.Text          = sheet.weight;
            Hair.Text            = sheet.hair;
            Eyes.Text            = sheet.eyes;
            Biography.Text       = sheet.biography;
        }
        private void EditBonus(CharacterSheet.ValueWithIntModifiers bab)
        {
            if (pushedPage != null)
            {
                return;
            }
            var sheet = CharacterSheetStorage.Instance.selectedCharacter;

            if (sheet == null)
            {
                return;
            }
            var eivwm = new EditIntValueWithModifiers();

            eivwm.Init(sheet, bab, "Edit Base Attack Bonus", "Base Attack Bonus", false);
            pushedPage = eivwm;
            Navigation.PushAsync(eivwm);
        }
예제 #7
0
        private void InitEditor()
        {
            var sheet = CharacterSheetStorage.Instance.selectedCharacter;

            if (sheet == null)
            {
                return;
            }
            cmdSizeModifier = sheet.cmdSizeModifier.Clone as CharacterSheet.ValueWithIntModifiers;
            cmbSizeModifier = sheet.cmbSizeModifier.Clone as CharacterSheet.ValueWithIntModifiers;
#if SELECT_CURRENT_ATTACK
            currentAttack = sheet.currentAttack;
            UpdateCurrentAttackPicker();
#else
            BaseAttackBonus.Text = sheet.GetBaseAttackBonus(0).ToString();
#endif
            StrengthModifier.Text     = sheet.GetAbilityModifier(CharacterSheet.Ability.Strength).ToString();
            CMDDexterityModifier.Text = sheet.GetAbilityModifier(CharacterSheet.Ability.Dexterity).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);
        }
        public void InitEditor()
        {
            var sheet = CharacterSheetStorage.Instance.selectedCharacter;

            baseAttackBonus = new List <CharacterSheet.ValueWithIntModifiers>();
            if (sheet.baseAttackBonus != null)
            {
                foreach (var bab in sheet.baseAttackBonus)
                {
                    if (bab != null)
                    {
                        baseAttackBonus.Add(bab.Clone as CharacterSheet.ValueWithIntModifiers);
                    }
                }
            }
            if (baseAttackBonus.Count <= 0)
            {
                baseAttackBonus.Add(new CharacterSheet.ValueWithIntModifiers());
            }
            attacksCount        = baseAttackBonus.Count;
            currentAttack       = sheet.currentAttack;
            currentAttacksCount = sheet.currentAttacksCount.Clone as CharacterSheet.ValueWithIntModifiers;
            UpdateView();
        }