Ejemplo n.º 1
0
        /// <summary>
        /// Creates a subgrid containing user's equipment
        /// </summary>
        /// <param name="previous">supergrid</param>
        /// <param name="owner">Owner of the equipment</param>
        /// <param name="handlePlayable">Playable handler</param>
        /// <param name="isInCombat">If in combat, text is "Equipment", otherwise it's the owner's name</param>
        /// <returns></returns>
        public static Grid GenerateEquipmentGrid(Page current, IButtonable previous, Character owner, Action <IPlayable> handlePlayable, bool isInCombat)
        {
            Grid grid = GenerateBackableGrid(
                previous,
                isInCombat ? EQUIPMENT : owner.Look.Sprite,
                isInCombat ? "Equipment" : owner.Look.DisplayName,
                string.Format("Manage {0}'s equipment.", owner.Look.DisplayName));

            foreach (EquipType myET in EquipType.AllTypes)
            {
                EquipType   et = myET;
                IButtonable ib = null;
                Equipment   eq = owner.Equipment;
                if (owner.Equipment.Contains(et))
                {
                    CastUnequipItem unequip = new CastUnequipItem(owner.Inventory, owner.Equipment, eq.PeekItem(et));
                    ib = GetUnequipProcess(current, unequip, owner, grid, handlePlayable);
                }
                else
                {
                    ib = GetEquipGrid(current, owner, et, owner.Inventory, grid, handlePlayable);
                }
                grid.List.Add(ib);
            }
            return(grid);
        }
Ejemplo n.º 2
0
 private static Process GetUnequipProcess(Page current, CastUnequipItem unequipSpell, Character owner, IButtonable previous, Action <IPlayable> handlePlayable)
 {
     return(new Process(unequipSpell.Name, unequipSpell.Icon, unequipSpell.CreateDescription(owner),
                        () => {
         handlePlayable(owner.Spells.CreateSpell(current, unequipSpell, owner, owner));
         previous.Invoke();
     },
                        () => unequipSpell.IsCastable(owner, owner)
                        ));
 }