Changeset 6623 for 2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel.cs
- Timestamp:
- 2015-06-30 18:34:26 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel.cs
r6621 r6623 45 45 private Label nextItem; 46 46 private Label prevItem; 47 private Label swordFrame; 47 48 48 49 #region Resources … … 52 53 public static Image SmallSwordImage = LoadImage("smallsword"); 53 54 public static Image MonocleImage = LoadImage("monocle"); 55 public static Image BigMonocleImage = LoadImage("bigmonocle"); 56 public static Image BigSwordImage = LoadImage("bigsword"); 54 57 55 58 public static Image FrameImage = LoadImage("frame"); 59 public static Image ActiveItemFrameImageX = LoadImage("activeitemframe"); 60 public static Image ActiveItemFrameImageZ = LoadImage("activeitemframez"); 56 61 57 62 [AssetName("walkright")] … … 96 101 } 97 102 98 void BuildInventoryCycle()103 void BuildInventoryCycle() 99 104 { 100 105 const int spacing = 20; … … 117 122 nextItem.Y = prevItem.Y; 118 123 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); 119 144 } 120 145 … … 223 248 Keyboard.Listen(Key.Z, ButtonState.Down, delegate { UseItem(player.Sword, player.ActiveItem, () => player.Sword.UseKeyDown()); }, null); 224 249 225 Keyboard.Listen(Key.Space, ButtonState.Pressed, delegate { player.CycleItems(); UpdateItemCycleImages(); }, null);250 Keyboard.Listen(Key.Space, ButtonState.Pressed, CycleItems, null); 226 251 227 252 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, null); … … 240 265 action(); 241 266 } 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(); 242 279 } 243 280 … … 247 284 if (player.NextItem != null) nextItem.Image = player.NextItem.InventoryImage; 248 285 if (player.ActiveItem != null) currentItem.Image = player.ActiveItem.InventoryImage; 286 287 if (player.Sword != null) 288 { 289 swordFrame.Image = BigSwordImage; 290 } 249 291 } 250 292
Note: See TracChangeset
for help on using the changeset viewer.