Ignore:
Timestamp:
2015-06-30 18:34:26 (6 years ago)
Author:
sieerinn
Message:

Inventoryjuttua päivitetty.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel.cs

    r6621 r6623  
    4545    private Label nextItem; 
    4646    private Label prevItem; 
     47    private Label swordFrame; 
    4748 
    4849    #region Resources 
     
    5253    public static Image SmallSwordImage = LoadImage("smallsword"); 
    5354    public static Image MonocleImage = LoadImage("monocle"); 
     55    public static Image BigMonocleImage = LoadImage("bigmonocle"); 
     56    public static Image BigSwordImage = LoadImage("bigsword"); 
    5457 
    5558    public static Image FrameImage = LoadImage("frame"); 
     59    public static Image ActiveItemFrameImageX = LoadImage("activeitemframe"); 
     60    public static Image ActiveItemFrameImageZ = LoadImage("activeitemframez"); 
    5661 
    5762    [AssetName("walkright")] 
     
    96101    } 
    97102 
    98 void BuildInventoryCycle() 
     103    void BuildInventoryCycle() 
    99104    { 
    100105        const int spacing = 20; 
     
    117122        nextItem.Y = prevItem.Y; 
    118123        Add(nextItem); 
     124 
     125        var frame = new Label(); 
     126        frame.Size = new Vector(60, 60); 
     127        frame.Image = ActiveItemFrameImageX; 
     128        frame.X = currentItem.X; 
     129        frame.Top = currentItem.Top; 
     130        Add(frame); 
     131 
     132        swordFrame = new Label(); 
     133        swordFrame.Size = prevItem.Size; 
     134        swordFrame.Left = nextItem.Right + spacing * 2; 
     135        swordFrame.Top = currentItem.Top; 
     136        Add(swordFrame); 
     137 
     138        var frame2 = new Label(); 
     139        frame2.Size = new Vector(60, 60); 
     140        frame2.Image = ActiveItemFrameImageZ; 
     141        frame2.X = swordFrame.X; 
     142        frame2.Top = swordFrame.Top; 
     143        Add(frame2); 
    119144    } 
    120145 
     
    223248        Keyboard.Listen(Key.Z, ButtonState.Down, delegate { UseItem(player.Sword, player.ActiveItem, () => player.Sword.UseKeyDown()); }, null); 
    224249 
    225         Keyboard.Listen(Key.Space, ButtonState.Pressed, delegate { player.CycleItems(); UpdateItemCycleImages(); }, null); 
     250        Keyboard.Listen(Key.Space, ButtonState.Pressed, CycleItems, null); 
    226251 
    227252        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, null); 
     
    240265            action(); 
    241266        } 
     267    } 
     268 
     269    void CycleItems() 
     270    { 
     271        // Kaman vaihtossa simuloidaan että oltaisiin laskettu irti käyttönäppäimestä. 
     272        if (player.ActiveItem != null) 
     273        { 
     274            player.ActiveItem.UseKeyReleased(); 
     275        } 
     276 
     277        player.CycleItems(); 
     278        UpdateItemCycleImages(); 
    242279    } 
    243280 
     
    247284        if (player.NextItem != null) nextItem.Image = player.NextItem.InventoryImage; 
    248285        if (player.ActiveItem != null) currentItem.Image = player.ActiveItem.InventoryImage; 
     286 
     287        if (player.Sword != null) 
     288        { 
     289            swordFrame.Image = BigSwordImage; 
     290        } 
    249291    } 
    250292 
Note: See TracChangeset for help on using the changeset viewer.