-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
59b6480
commit f483cc3
Showing
8 changed files
with
218 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,4 @@ sources/Scenes/__history/ | |
/sources/Game/__history | ||
/*.txt | ||
/sources/*.dres | ||
/temp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
unit Elinor.Scene.Inventory; | ||
|
||
interface | ||
|
||
uses | ||
Vcl.Controls, | ||
System.Classes, | ||
Elinor.Scene.Frames, | ||
Elinor.Scene.Base.Party, | ||
Elinor.Button, | ||
Elinor.Resources, | ||
Elinor.Party, | ||
Elinor.Scenes; | ||
|
||
type | ||
TSceneInventory = class(TSceneBaseParty) | ||
private type | ||
TButtonEnum = (btClose); | ||
private const | ||
ButtonText: array [TButtonEnum] of TResEnum = (reTextClose); | ||
private | ||
Button: array [TButtonEnum] of TButton; | ||
ConfirmGold: Integer; | ||
ConfirmParty: TParty; | ||
ConfirmPartyPosition: TPosition; | ||
public | ||
constructor Create; | ||
destructor Destroy; override; | ||
procedure Render; override; | ||
procedure Update(var Key: Word); override; | ||
procedure Timer; override; | ||
procedure MouseDown(AButton: TMouseButton; Shift: TShiftState; | ||
X, Y: Integer); override; | ||
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; | ||
class procedure ShowScene(AParty: TParty; | ||
const ACloseSceneEnum: TSceneEnum); | ||
class procedure HideScene; | ||
end; | ||
|
||
implementation | ||
|
||
uses | ||
System.Math, | ||
System.SysUtils, | ||
Elinor.Scene.Settlement, | ||
Elinor.Scene.Party, | ||
Elinor.Scene.Party2, | ||
Elinor.Saga, | ||
Elinor.Frame, | ||
Elinor.Creatures; | ||
|
||
var | ||
ShowResources: Boolean; | ||
CurrentParty: TParty; | ||
CloseSceneEnum: TSceneEnum; | ||
|
||
{ TSceneInventory } | ||
|
||
class procedure TSceneInventory.ShowScene(AParty: TParty; | ||
const ACloseSceneEnum: TSceneEnum); | ||
begin | ||
CurrentParty := AParty; | ||
CloseSceneEnum := ACloseSceneEnum; | ||
ShowResources := AParty = TLeaderParty.Leader; | ||
if ShowResources then | ||
begin | ||
ActivePartyPosition := TLeaderParty.GetPosition; | ||
end | ||
else | ||
ActivePartyPosition := AParty.GetRandomPosition; | ||
Game.Show(scInventory); | ||
Game.MediaPlayer.PlaySound(mmSettlement); | ||
end; | ||
|
||
class procedure TSceneInventory.HideScene; | ||
begin | ||
Game.MediaPlayer.PlaySound(mmClick); | ||
Game.MediaPlayer.PlaySound(mmSettlement); | ||
Game.Show(CloseSceneEnum); | ||
end; | ||
|
||
constructor TSceneInventory.Create; | ||
var | ||
LButtonEnum: TButtonEnum; | ||
LLeft, LWidth: Integer; | ||
begin | ||
inherited Create(reWallpaperSettlement); | ||
LWidth := ResImage[reButtonDef].Width + 4; | ||
LLeft := ScrWidth - ((LWidth * (Ord(High(TButtonEnum)) + 1)) div 2); | ||
for LButtonEnum := Low(TButtonEnum) to High(TButtonEnum) do | ||
begin | ||
Button[LButtonEnum] := TButton.Create(LLeft, DefaultButtonTop, | ||
ButtonText[LButtonEnum]); | ||
Inc(LLeft, LWidth); | ||
if (LButtonEnum = btClose) then | ||
Button[LButtonEnum].Sellected := True; | ||
end; | ||
end; | ||
|
||
destructor TSceneInventory.Destroy; | ||
var | ||
LButtonEnum: TButtonEnum; | ||
begin | ||
for LButtonEnum := Low(TButtonEnum) to High(TButtonEnum) do | ||
FreeAndNil(Button[LButtonEnum]); | ||
inherited; | ||
end; | ||
|
||
procedure TSceneInventory.MouseDown(AButton: TMouseButton; Shift: TShiftState; | ||
X, Y: Integer); | ||
begin | ||
inherited; | ||
case AButton of | ||
mbLeft: | ||
begin | ||
{ if Button[btHeal].MouseDown then | ||
Heal | ||
else if Button[btRevive].MouseDown then | ||
Revive | ||
else if Button[btParty].MouseDown then | ||
ShowPartyScene | ||
else } if Button[btClose].MouseDown then | ||
HideScene; | ||
end; | ||
end; | ||
end; | ||
|
||
procedure TSceneInventory.MouseMove(Shift: TShiftState; X, Y: Integer); | ||
var | ||
LButtonEnum: TButtonEnum; | ||
begin | ||
inherited; | ||
for LButtonEnum := Low(TButtonEnum) to High(TButtonEnum) do | ||
Button[LButtonEnum].MouseMove(X, Y); | ||
end; | ||
|
||
procedure TSceneInventory.Render; | ||
|
||
procedure RenderParty; | ||
var | ||
LPosition: TPosition; | ||
begin | ||
if (CurrentParty <> nil) then | ||
for LPosition := Low(TPosition) to High(TPosition) do | ||
DrawUnit(LPosition, CurrentParty, TFrame.Col(LPosition, psLeft), | ||
TFrame.Row(LPosition), False, True); | ||
end; | ||
|
||
procedure RenderCharacterInfo; | ||
var | ||
LCreatureEnum: TCreatureEnum; | ||
begin | ||
LCreatureEnum := CurrentParty.Creature[ActivePartyPosition].Enum; | ||
TextTop := TFrame.Row(0) + 6; | ||
TextLeft := TFrame.Col(2) + 12; | ||
if (LCreatureEnum <> crNone) then | ||
DrawCreatureInfo(CurrentParty.Creature[ActivePartyPosition]); | ||
end; | ||
|
||
procedure RenderButtons; | ||
var | ||
LButtonEnum: TButtonEnum; | ||
begin | ||
for LButtonEnum := Low(TButtonEnum) to High(TButtonEnum) do | ||
Button[LButtonEnum].Render; | ||
end; | ||
|
||
begin | ||
inherited; | ||
|
||
DrawTitle(reTitleInventory); | ||
RenderParty; | ||
// RenderCharacterInfo; | ||
|
||
RenderButtons; | ||
end; | ||
|
||
procedure TSceneInventory.Timer; | ||
begin | ||
inherited; | ||
|
||
end; | ||
|
||
procedure TSceneInventory.Update(var Key: Word); | ||
begin | ||
inherited; | ||
case Key of | ||
K_ESCAPE, K_ENTER: | ||
HideScene; | ||
end; | ||
end; | ||
|
||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
unit Elinor.Scene.Skills; | ||
|
||
interface | ||
|
||
implementation | ||
|
||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters