Esempio n. 1
0
 /// <summary>
 /// Windows initialization
 /// </summary>
 void InitializeWindows()
 {
     helpWindow      = new WindowHelp();
     leftWindow      = new WindowEquipLeft(actor);
     rightWindow     = new WindowEquipRight(actor);
     weaponWindow    = new WindowEquipItem(actor, 0);
     shieldWindow    = new WindowEquipItem(actor, 1);
     headWindow      = new WindowEquipItem(actor, 2);
     bodyWindow      = new WindowEquipItem(actor, 3);
     accessoryWindow = new WindowEquipItem(actor, 4);
     // Associate help window
     rightWindow.HelpWindow     = helpWindow;
     weaponWindow.HelpWindow    = helpWindow;
     shieldWindow.HelpWindow    = helpWindow;
     headWindow.HelpWindow      = helpWindow;
     bodyWindow.HelpWindow      = helpWindow;
     accessoryWindow.HelpWindow = helpWindow;
     // Set cursor position
     rightWindow.Index = equipIndex;
     Refresh();
 }
Esempio n. 2
0
        /// <summary>
        /// Refresh
        /// </summary>
        public void Refresh()
        {
            // Set item window to visible
            weaponWindow.IsVisible    = (rightWindow.Index == 0);
            shieldWindow.IsVisible    = (rightWindow.Index == 1);
            headWindow.IsVisible      = (rightWindow.Index == 2);
            bodyWindow.IsVisible      = (rightWindow.Index == 3);
            accessoryWindow.IsVisible = (rightWindow.Index == 4);
            // Get currently equipped item
            Carriable _item1 = rightWindow.Item;

            // Set current item window to item_window
            switch (rightWindow.Index)
            {
            case 0:
                itemWindow = weaponWindow;
                break;

            case 1:
                itemWindow = shieldWindow;
                break;

            case 2:
                itemWindow = headWindow;
                break;

            case 3:
                itemWindow = bodyWindow;
                break;

            case 4:
                itemWindow = accessoryWindow;
                break;
            }
            // If right window is active
            if (rightWindow.IsActive)
            {
                // Erase parameters for after equipment change
                leftWindow.SetNewParameters(null, null, null);
            }
            // If item window is active
            if (itemWindow.IsActive)
            {
                // Get currently selected item
                Carriable _item2 = itemWindow.Item;
                // Change equipment
                int last_hp = actor.Hp;
                int last_sp = actor.Sp;
                actor.Equip(rightWindow.Index, _item2 == null ? 0 : _item2.Id);
                // Get parameters for after equipment change
                int _new_atk  = actor.Atk;
                int _new_pdef = actor.Pdef;
                int _new_mdef = actor.Mdef;
                // Return equipment
                actor.Equip(rightWindow.Index, _item1 == null ? 0 : _item1.Id);
                actor.Hp = last_hp;
                actor.Sp = last_sp;
                // Draw in left window
                leftWindow.SetNewParameters(_new_atk, _new_pdef, _new_mdef);
            }
        }