public override void Activate()
        {
            Initialize();

            _attack = Factories.RFactory.CreateMenuItem(_battleModel.CurrentAttacker.Spells[0].Name, SetAttack);
            _defend = Factories.RFactory.CreateMenuItem(_battleModel.CurrentAttacker.Spells[1].Name, SetDefend);

            ClearStates();
            AddState(_attack);
            AddState(_defend);
            AddState(_spell);
            AddState(_switch);
            AddState(_formation);
            AddState(_convince);
            SetCurrentState(0);
            _attack.Activate();
            _convince.IsDisabled  = Model.BattleModel.Enemies.Count != 1;
            _spell.IsDisabled     = Model.BattleModel.CurrentAttacker.IsSilenced;
            _formation.IsDisabled = Model.BattleModel.FrontRow.Count == 1;
            _switch.IsDisabled    = Model.Party.BackSeat.Count == 0;
            Model.CommitChanges();
        }
Example #2
0
        public override void Activate()
        {
            Initialize();

            var races           = Model.RaceFactory.Templates;
            var archeTypes      = Model.ArcheTypeFactory.ArcheTypes;
            var skillSets       = Model.SkillsetFactory.SkillSets;
            var signatureSpells = Model.SignatureSpellFactory.SignatureSpells;
            var normalAttacks   = Model.NormalAttackFactory.NormalAttacks;

            _inputBuffer.Reset();
            _name.Label           = Name;
            _race.Label           = string.Format("{0}<{1}>", Race, races.First().Name);
            _archeType.Label      = string.Format("{0}<{1}>", ArcheType, archeTypes.First().Name);
            _skillSet.Label       = string.Format("{0}<{1}>", SkillSet, skillSets.First().Name);
            _signatureSpell.Label = string.Format("{0}<{1}>", SignatureSpell, signatureSpells.First().Name);
            _normalAttack.Label   = string.Format("{0}<{1}>", NormalAttack, normalAttacks.First().Name);
            _FIR.Label            = string.Format("{0}<50>", FIR);
            _WAT.Label            = string.Format("{0}<50>", WAT);
            _ICE.Label            = string.Format("{0}<50>", ICE);
            _ARC.Label            = string.Format("{0}<50>", ARC);
            _WND.Label            = string.Format("{0}<50>", WND);
            _HOL.Label            = string.Format("{0}<50>", HOL);
            _DRK.Label            = string.Format("{0}<50>", DRK);
            _GRN.Label            = string.Format("{0}<50>", GRN);
            _LGT.Label            = string.Format("{0}<50>", LGT);

            _raceIndex              = 0;
            _archeTypeIndex         = 0;
            _skillSetIndex          = 0;
            _signatureSpellIndex    = 0;
            _normalAttackIndex      = 0;
            _FIRValue               = 50;
            _WATValue               = 50;
            _ICEValue               = 50;
            _ARCValue               = 50;
            _WNDValue               = 50;
            _HOLValue               = 50;
            _DRKValue               = 50;
            _GRNValue               = 50;
            _LGTValue               = 50;
            _availableMasteryPoints = 550;
            Model.PreGameModel.AvailableMasteryPoints = _availableMasteryPoints;

            _race.SetLeftAction(() => SwitchRace(-1));
            _race.SetRightAction(() => SwitchRace(1));

            SetLeftAndRightActions(_archeType, () => _archeTypeIndex, x => _archeTypeIndex = x, archeTypes, ArcheType,
                                   x => Model.PreGameModel.ArcheType = x);

            SetLeftAndRightActions(_skillSet, () => _skillSetIndex, x => _skillSetIndex = x, skillSets, SkillSet,
                                   x => Model.PreGameModel.Skillset = x);

            SetLeftAndRightActions(_signatureSpell, () => _signatureSpellIndex, x => _signatureSpellIndex = x,
                                   signatureSpells, SignatureSpell,
                                   x => Model.PreGameModel.SignatureSpell = x);

            SetLeftAndRightActions(_normalAttack, () => _normalAttackIndex, x => _normalAttackIndex = x, normalAttacks,
                                   NormalAttack,
                                   x => Model.PreGameModel.NormalAttack = x);

            Model.PreGameModel.RaceTemplate   = races[_raceIndex];
            Model.PreGameModel.ArcheType      = archeTypes[_archeTypeIndex];
            Model.PreGameModel.Skillset       = skillSets[_skillSetIndex];
            Model.PreGameModel.SignatureSpell = signatureSpells[_signatureSpellIndex];
            Model.PreGameModel.NormalAttack   = normalAttacks[_normalAttackIndex];

            SwitchList(() => _archeTypeIndex, x => _archeTypeIndex           = x, 0, archeTypes, _archeType, ArcheType);
            SwitchList(() => _skillSetIndex, x => _skillSetIndex             = x, 0, skillSets, _skillSet, SkillSet);
            SwitchList(() => _signatureSpellIndex, x => _signatureSpellIndex = x, 0, signatureSpells, _signatureSpell,
                       SignatureSpell);
            SwitchList(() => _normalAttackIndex, x => _normalAttackIndex = x, 0, normalAttacks, _normalAttack,
                       NormalAttack);

            SwitchRace(0);

            _FIR.SetLeftAction(() => ChangePoints(_FIR, ref _FIRValue, -1, FIR, EleMastery.FIR));
            _FIR.SetRightAction(() => ChangePoints(_FIR, ref _FIRValue, 1, FIR, EleMastery.FIR));
            _WAT.SetLeftAction(() => ChangePoints(_WAT, ref _WATValue, -1, WAT, EleMastery.WAT));
            _WAT.SetRightAction(() => ChangePoints(_WAT, ref _WATValue, 1, WAT, EleMastery.WAT));
            _ICE.SetLeftAction(() => ChangePoints(_ICE, ref _ICEValue, -1, ICE, EleMastery.ICE));
            _ICE.SetRightAction(() => ChangePoints(_ICE, ref _ICEValue, 1, ICE, EleMastery.ICE));
            _ARC.SetLeftAction(() => ChangePoints(_ARC, ref _ARCValue, -1, ARC, EleMastery.ARC));
            _ARC.SetRightAction(() => ChangePoints(_ARC, ref _ARCValue, 1, ARC, EleMastery.ARC));
            _WND.SetLeftAction(() => ChangePoints(_WND, ref _WNDValue, -1, WND, EleMastery.WND));
            _WND.SetRightAction(() => ChangePoints(_WND, ref _WNDValue, 1, WND, EleMastery.WND));
            _HOL.SetLeftAction(() => ChangePoints(_HOL, ref _HOLValue, -1, HOL, EleMastery.HOL));
            _HOL.SetRightAction(() => ChangePoints(_HOL, ref _HOLValue, 1, HOL, EleMastery.HOL));
            _DRK.SetLeftAction(() => ChangePoints(_DRK, ref _DRKValue, -1, DRK, EleMastery.DRK));
            _DRK.SetRightAction(() => ChangePoints(_DRK, ref _DRKValue, 1, DRK, EleMastery.DRK));
            _GRN.SetLeftAction(() => ChangePoints(_GRN, ref _GRNValue, -1, GRN, EleMastery.GRN));
            _GRN.SetRightAction(() => ChangePoints(_GRN, ref _GRNValue, 1, GRN, EleMastery.GRN));
            _LGT.SetLeftAction(() => ChangePoints(_LGT, ref _LGTValue, -1, LGT, EleMastery.LGT));
            _LGT.SetRightAction(() => ChangePoints(_LGT, ref _LGTValue, 1, LGT, EleMastery.LGT));

            _switchViews = false;

            ClearStates();
            AddState(_name);
            AddState(_race);
            AddState(_archeType);
            AddState(_normalAttack);
            AddState(_skillSet);
            AddState(_signatureSpell);
            AddState(_FIR);
            AddState(_WAT);
            AddState(_ICE);
            AddState(_ARC);
            AddState(_WND);
            AddState(_HOL);
            AddState(_DRK);
            AddState(_GRN);
            AddState(_LGT);
            AddState(_createChar);
            SetCurrentState(0);
            _name.Activate();

            for (var stat = EleMastery.FIR; stat <= EleMastery.LGT; ++stat)
            {
                Model.PreGameModel.SetMastery(stat, 50);
            }

            Model.MenuModel.ActiveMenu = this;
        }