diff --git a/Assets/Scripts/Gui/activeGameState.lua b/Assets/Scripts/Gui/activeGameState.lua
index f863dd5..07aa28c 100644
--- a/Assets/Scripts/Gui/activeGameState.lua
+++ b/Assets/Scripts/Gui/activeGameState.lua
@@ -1,11 +1,20 @@
+res = graphics.resolution
+Size = {x = 70, y = 70}
+sz = 210
+s = 40
+resTextScale = {x = .5, y = .5}
+resIconBasePath = 'Icons/Resources/'
+pointerTex = 'pointer.png'
+attackTex = 'attack.png'
+garrisonTex = 'garrison.png'
+
gui = {
{
guiType = GuiType.TEXT,
name = 'refineds',
text = '',
- pos = {x = 0, y = 100},
- zIndex = 0,
- scale = 1,
+ pos = {x = s, y = s, z = 0},
+ scale = resTextScale,
font = 'batang.ttf',
fontFirstChar = 0,
fontLastChar = 256,
@@ -15,9 +24,8 @@ gui = {
guiType = GuiType.TEXT,
name = 'wealth',
text = '',
- pos = {x = 0, y = 200},
- zIndex = 0,
- scale = 1,
+ pos = {x = 200 + s, y = s, z = 0},
+ scale = resTextScale,
font = 'batang.ttf',
fontFirstChar = 0,
fontLastChar = 256,
@@ -27,24 +35,70 @@ gui = {
guiType = GuiType.TEXT,
name = 'research',
text = '',
- pos = {x = 0, y = 300},
- zIndex = 0,
- scale = 1,
+ pos = {x = 400 + s, y = s, z = 0},
+ scale = resTextScale,
font = 'batang.ttf',
fontFirstChar = 0,
fontLastChar = 256,
color = {x = 1, y = 1, z = 1, w = 1}
},
+ {
+ guiType = GuiType.GUI_RECTANGLE,
+ name = 'refineds',
+ pos = {x = 0, y = 0, z = 0},
+ size = {x = s, y = s},
+ imagePath = resIconBasePath .. 'refineds.png',
+ },
+ {
+ guiType = GuiType.GUI_RECTANGLE,
+ name = 'wealth',
+ pos = {x = 200, y = 0, z = 0},
+ size = {x = s, y = s},
+ imagePath = resIconBasePath .. 'wealth.png',
+ },
+ {
+ guiType = GuiType.GUI_RECTANGLE,
+ name = 'research',
+ pos = {x = 400, y = 0, z = 0},
+ size = {x = s, y = s},
+ imagePath = resIconBasePath .. 'research.png',
+ },
{
guiType = GuiType.TEXT,
name = 'depth',
text = '',
- pos = {x = 0, y = 400},
- zIndex = 0,
- scale = 1,
+ pos = {x = 0, y = 400, z = 0},
+ scale = {x = 0, y = 1},
font = 'batang.ttf',
fontFirstChar = 0,
fontLastChar = 256,
color = {x = 1, y = 1, z = 1, w = 1}
- }
+ },
+ {
+ guiType = GuiType.BUTTON,
+ buttonType = ButtonType.PLAYER_TRADE,
+ name = 'Trade',
+ guiScreen = 'tradingHub.lua',
+ pos = {x = res.x - Size.x, y = 200, z = 0},
+ size = Size,
+ trigger = 10
+ },
+ {
+ guiType = GuiType.GUI_RECTANGLE,
+ pos = {x = res.x - sz, y = res.y - sz, z = 0},
+ size = {x = sz, y = sz},
+ color = {x = .6, y = .6, z = .6, w = .4}
+ },
+ {
+ guiType = GuiType.GUI_RECTANGLE,
+ pos = {x = 0, y = res.y - sz, z = 0},
+ size = {x = sz, y = sz},
+ color = {x = .6, y = .6, z = .6, w = .4}
+ },
+ {
+ guiType = GuiType.GUI_RECTANGLE,
+ pos = {x = sz, y = res.y - .75 * sz, z = 0},
+ size = {x = res.x - 2 * sz, y = sz * .75},
+ color = {x = .6, y = .6, z = .6, w = .4}
+ },
}
diff --git a/Assets/Scripts/Gui/audioTab.lua b/Assets/Scripts/Gui/audioTab.lua
index a8b5676..0419e1b 100644
--- a/Assets/Scripts/Gui/audioTab.lua
+++ b/Assets/Scripts/Gui/audioTab.lua
@@ -1,12 +1,12 @@
numGui = 5
gui = {
{
- pos = {x = 110, y = 90},
+ pos = {x = 110, y = 90, z = 0},
size = {x = 100, y = 10},
guiType = GuiType.TEXTBOX,
},
{
- pos = {x = 110, y = 40},
+ pos = {x = 110, y = 40, z = 0},
size = {x = 100, y = 10},
guiType = GuiType.SLIDER,
minValue = 0,
@@ -17,21 +17,21 @@ gui = {
}
},
{
- pos = {x = 100, y = 400},
+ pos = {x = 100, y = 400, z = 0},
size = {x = 150, y = 20},
guiType = GuiType.BUTTON,
name = 'Ok',
buttonType = ButtonType.OK
},
{
- pos = {x = 260, y = 400},
+ pos = {x = 260, y = 400, z = 0},
size = {x = 150, y = 20},
guiType = GuiType.BUTTON,
name = 'Restore defaults',
buttonType = ButtonType.DEFAULTS
},
{
- pos = {x = 420, y = 400},
+ pos = {x = 420, y = 400, z = 0},
size = {x = 150, y = 20},
guiType = GuiType.BUTTON,
name = 'Back',
diff --git a/Assets/Scripts/Gui/console.lua b/Assets/Scripts/Gui/console.lua
index 0bf39e5..61e3e64 100644
--- a/Assets/Scripts/Gui/console.lua
+++ b/Assets/Scripts/Gui/console.lua
@@ -1,7 +1,7 @@
numGui = 3
gui = {
{
- pos = {x = 100, y = 100},
+ pos = {x = 100, y = 100, z = 0},
size = {x = 300, y = 20},
guiType = GuiType.LISTBOX,
listboxType = ListboxType.CONSOLE,
@@ -9,12 +9,12 @@ gui = {
closable = false
},
{
- pos = {x = 100, y = 510},
+ pos = {x = 100, y = 510, z = 0},
size = {x = 270, y = 20},
guiType = GuiType.TEXTBOX
},
{
- pos = {x = 380, y = 510},
+ pos = {x = 380, y = 510, z = 0},
size = {x = 20, y = 20},
guiType = GuiType.BUTTON,
buttonType = ButtonType.CONSOLE_COMMAND_OK,
diff --git a/Assets/Scripts/Gui/controlsTab.lua b/Assets/Scripts/Gui/controlsTab.lua
index 9b11a14..8518863 100644
--- a/Assets/Scripts/Gui/controlsTab.lua
+++ b/Assets/Scripts/Gui/controlsTab.lua
@@ -1,28 +1,28 @@
numGui = 4
gui = {
{
- pos = {x = 110, y = 190},
+ pos = {x = 110, y = 190, z = 0},
size = {x = 360, y = 20},
guiType = GuiType.LISTBOX,
listboxType = ListboxType.CONTROLS,
numMaxDisplay = 5
},
{
- pos = {x = 100, y = 400},
+ pos = {x = 100, y = 400, z = 0},
size = {x = 150, y = 20},
guiType = GuiType.BUTTON,
name = 'Ok',
buttonType = ButtonType.OK
},
{
- pos = {x = 260, y = 400},
+ pos = {x = 260, y = 400, z = 0},
size = {x = 150, y = 20},
guiType = GuiType.BUTTON,
name = 'Restore defaults',
buttonType = ButtonType.DEFAULTS
},
{
- pos = {x = 420, y = 400},
+ pos = {x = 420, y = 400, z = 0},
size = {x = 150, y = 20},
guiType = GuiType.BUTTON,
name = 'Back',
diff --git a/Assets/Scripts/Gui/defeat.lua b/Assets/Scripts/Gui/defeat.lua
index 78e89b4..97b18b9 100644
--- a/Assets/Scripts/Gui/defeat.lua
+++ b/Assets/Scripts/Gui/defeat.lua
@@ -5,8 +5,7 @@ gui = {
guiType = GuiType.TEXT,
text = 'Defeat',
name = 'D',
- pos = {x = 100, y = 100},
- zIndex = 0,
+ pos = {x = 100, y = 100, z = 0},
scale = 1,
font = 'batang.ttf',
fontFirstChar = 0,
@@ -15,13 +14,12 @@ gui = {
},
{
guiType = GuiType.GUI_RECTANGLE,
- pos = {x = 100, y = 200},
- zIndex = 1,
+ pos = {x = 100, y = 200, z = .1},
size = {x = 600, y = 600},
color = {x = 0, y = 0, z = 0, w = 0.1}
},
{
- pos = {x = 110, y = 350},
+ pos = {x = 110, y = 350, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Leave',
diff --git a/Assets/Scripts/Gui/engineerCommands.lua b/Assets/Scripts/Gui/engineerCommands.lua
index d9cd565..c8093f2 100644
--- a/Assets/Scripts/Gui/engineerCommands.lua
+++ b/Assets/Scripts/Gui/engineerCommands.lua
@@ -1,51 +1,47 @@
res = graphics.resolution
-Size = {x = 100, y = 100}
+Size = {x = 70, y = 70}
+margin = 10
+sz = {x = Size.x - margin, y = Size.y - margin}
gui = {
{
- pos = {x = res.x - 200, y = res.y - 200},
- size = Size,
- imagePath = '',
+ pos = {x = res.x - 3 * Size.x, y = res.y - 3 * Size.y, z = 0},
+ size = sz,
guiType = GuiType.BUTTON,
buttonType = ButtonType.BUILD,
trigger = 76,
},
{
- pos = {x = res.x - Size.x - 200, y = res.y - 200},
- size = Size,
- imagePath = '',
+ pos = {x = res.x - 2 * Size.x, y = res.y - 3 * Size.y, z = 0},
+ size = sz,
guiType = GuiType.BUTTON,
buttonType = ButtonType.BUILD,
trigger = 78,
},
{
- pos = {x = res.x - 2 * Size.x - 200, y = res.y - 200},
- size = {x = 100, y = 100},
- imagePath = '',
+ pos = {x = res.x - 1 * Size.x, y = res.y - 3 * Size.y, z = 0},
+ size = sz,
guiType = GuiType.BUTTON,
buttonType = ButtonType.BUILD,
trigger = 77,
},
{
- pos = {x = res.x - 3 * Size.x - 200, y = res.y - 200},
- size = Size,
- imagePath = '',
+ pos = {x = res.x - 3 * Size.x, y = res.y - 2 * Size.y, z = 0},
+ size = sz,
guiType = GuiType.BUTTON,
buttonType = ButtonType.BUILD,
trigger = 84,
},
{
- pos = {x = res.x - 4 * Size.x - 200, y = res.y - 200},
- size = Size,
- imagePath = '',
+ pos = {x = res.x - 2 * Size.x, y = res.y - 2 * Size.y, z = 0},
+ size = sz,
guiType = GuiType.BUTTON,
buttonType = ButtonType.BUILD,
trigger = 68,
},
{
- pos = {x = res.x - 5 * Size.x - 200, y = res.y - 200},
- size = Size,
- imagePath = '',
+ pos = {x = res.x - 1 * Size.x, y = res.y - 2 * Size.y, z = 0},
+ size = sz,
guiType = GuiType.BUTTON,
buttonType = ButtonType.BUILD,
trigger = 70,
diff --git a/Assets/Scripts/Gui/fortCommands.lua b/Assets/Scripts/Gui/fortCommands.lua
index 2600775..e2d1732 100644
--- a/Assets/Scripts/Gui/fortCommands.lua
+++ b/Assets/Scripts/Gui/fortCommands.lua
@@ -1,11 +1,12 @@
res = graphics.resolution
-Size = {x = 100, y = 100}
+Size = {x = 70, y = 70}
+margin = 10
+sz = {x = Size.x - margin, y = Size.y - margin}
gui = {
{
- pos = {x = res.x - 200, y = res.y - 200},
- size = Size,
- imagePath = '',
+ pos = {x = res.x - Size.x + .5 * margin, y = res.y - Size.y + .5 * margin, z = 0},
+ size = sz,
guiType = GuiType.BUTTON,
buttonType = ButtonType.FORT_TRAIN,
trigger = 82
diff --git a/Assets/Scripts/Gui/gamePaused.lua b/Assets/Scripts/Gui/gamePaused.lua
index 2fdfbe8..f9a4be1 100644
--- a/Assets/Scripts/Gui/gamePaused.lua
+++ b/Assets/Scripts/Gui/gamePaused.lua
@@ -2,35 +2,35 @@ Size = {x = 150, y = 50}
numGui = 5
gui = {
{
- pos = {x = 100, y = 100},
+ pos = {x = 100, y = 100, z = 0},
size = Size,
guiType = GuiType.BUTTON,
buttonType = ButtonType.RESUME,
name = 'Resume'
},
{
- pos = {x = 100, y = 100 + 1 * (Size.y + 10)},
+ pos = {x = 100, y = 100 + 1 * (Size.y + 10), z = 0},
size = Size,
guiType = GuiType.BUTTON,
buttonType = ButtonType.CONSOLE,
name = 'Console'
},
{
- pos = {x = 100, y = 100 + 2 * (Size.y + 10)},
+ pos = {x = 100, y = 100 + 2 * (Size.y + 10), z = 0},
size = Size,
guiType = GuiType.BUTTON,
buttonType = ButtonType.OPTIONS,
name = 'Options'
},
{
- pos = {x = 100, y = 100 + 3 * (Size.y + 10)},
+ pos = {x = 100, y = 100 + 3 * (Size.y + 10), z = 0},
size = Size,
guiType = GuiType.BUTTON,
buttonType = ButtonType.MAIN_MENU,
name = 'Main menu'
},
{
- pos = {x = 100, y = 100 + 4 * (Size.y + 10)},
+ pos = {x = 100, y = 100 + 4 * (Size.y + 10), z = 0},
size = Size,
guiType = GuiType.BUTTON,
buttonType = ButtonType.EXIT,
diff --git a/Assets/Scripts/Gui/inGameOptions.lua b/Assets/Scripts/Gui/inGameOptions.lua
index 650d260..4f4e27d 100644
--- a/Assets/Scripts/Gui/inGameOptions.lua
+++ b/Assets/Scripts/Gui/inGameOptions.lua
@@ -3,42 +3,42 @@ Size = {x = 150, y = 40}
numGui = 6
gui = {
{
- pos = {x = 110, y = 40},
+ pos = {x = 110, y = 40}, z = 0,
size = Size,
guiType = GuiType.BUTTON,
name = 'Controls',
buttonType = ButtonType.CONTROLS_TAB
},
{
- pos = {x = 270, y = 40},
+ pos = {x = 270, y = 40}, z = 0,
size = Size,
guiType = GuiType.BUTTON,
name = 'Mouse',
buttonType = ButtonType.MOUSE_TAB
},
{
- pos = {x = 430, y = 40},
+ pos = {x = 430, y = 40, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Video',
buttonType = ButtonType.VIDEO_TAB
},
{
- pos = {x = 590, y = 40},
+ pos = {x = 590, y = 40, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Audio',
buttonType = ButtonType.AUDIO_TAB
},
{
- pos = {x = 750, y = 40},
+ pos = {x = 750, y = 40, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Multiplayer',
buttonType = ButtonType.MULTIPLAYER_TAB
},
{
- pos = {x = 910, y = 100},
+ pos = {x = 910, y = 100, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Back',
diff --git a/Assets/Scripts/Gui/landFactoryCommands.lua b/Assets/Scripts/Gui/landFactoryCommands.lua
index 8ad889f..15c4e3e 100644
--- a/Assets/Scripts/Gui/landFactoryCommands.lua
+++ b/Assets/Scripts/Gui/landFactoryCommands.lua
@@ -1,27 +1,26 @@
res = graphics.resolution
-Size = {x = 100, y = 100}
+Size = {x = 70, y = 70}
+margin = 10
+sz = {x = Size.x - margin, y = Size.y - margin}
gui = {
{
- pos = {x = res.x - 200, y = res.y - 200},
- size = Size,
- imagePath = '',
+ pos = {x = res.x + .5 * margin - Size.x, y = res.y - 3 * Size.y, z = 0},
+ size = sz,
guiType = GuiType.BUTTON,
buttonType = ButtonType.LAND_FACTORY_TRAIN,
trigger = 87
},
{
- pos = {x = res.x - Size.x - 200, y = res.y - 200},
- size = Size,
- imagePath = '',
+ pos = {x = res.x + .5 * margin - 2 * Size.x, y = res.y - 3 * Size.y, z = 0},
+ size = sz,
guiType = GuiType.BUTTON,
buttonType = ButtonType.LAND_FACTORY_TRAIN,
trigger = 84
},
{
- pos = {x = res.x - 2 * Size.x - 200, y = res.y - 200},
- size = Size,
- imagePath = '',
+ pos = {x = res.x + .5 * margin - 3 * Size.x, y = res.y - 3 * Size.y, z = 0},
+ size = sz,
guiType = GuiType.BUTTON,
buttonType = ButtonType.LAND_FACTORY_TRAIN,
trigger = 65
diff --git a/Assets/Scripts/Gui/loadMap.lua b/Assets/Scripts/Gui/loadMap.lua
index 45d120f..f77ec44 100644
--- a/Assets/Scripts/Gui/loadMap.lua
+++ b/Assets/Scripts/Gui/loadMap.lua
@@ -1,14 +1,14 @@
numGui = 3
gui = {
{
- pos = {x = 110, y = 190},
+ pos = {x = 110, y = 190, z = 0},
size = {x = 360, y = 20},
guiType = GuiType.LISTBOX,
listboxType = ListboxType.MAPS,
numMaxDisplay = 5
},
{
- pos = {x = 110, y = 250},
+ pos = {x = 110, y = 250, z = 0},
size = {x = 140, y = 40},
guiType = GuiType.BUTTON,
name = 'Ok',
@@ -19,7 +19,7 @@ gui = {
}
},
{
- pos = {x = 420, y = 400},
+ pos = {x = 420, y = 400, z = 0},
size = {x = 150, y = 50},
guiType = GuiType.BUTTON,
name = 'Back',
diff --git a/Assets/Scripts/Gui/main.lua b/Assets/Scripts/Gui/main.lua
index ee35787..bf9ba09 100644
--- a/Assets/Scripts/Gui/main.lua
+++ b/Assets/Scripts/Gui/main.lua
@@ -33,6 +33,11 @@ ButtonType = {
SELL_REFINEDS = 29,
BUY_RESEARCH = 30,
SELL_RESEARCH = 31,
+ ACTIVE_GAME_STATE = 32,
+ PLAYER_TRADE = 33,
+ TRADING_SCREEN = 34,
+ TRADE_OFFER = 35,
+ RESOURCE_AMMOUNT = 36
}
ListboxType = {
@@ -46,5 +51,6 @@ ListboxType = {
LAND_TEXTURES = 7,
CPU_DIFFICULTIES = 8,
FACTIONS = 9,
- CONSOLE = 10
+ CONSOLE = 10,
+ TRADE_OFFERS = 11
}
diff --git a/Assets/Scripts/Gui/mainMenu.lua b/Assets/Scripts/Gui/mainMenu.lua
index 6195049..85edd47 100644
--- a/Assets/Scripts/Gui/mainMenu.lua
+++ b/Assets/Scripts/Gui/mainMenu.lua
@@ -3,28 +3,28 @@ Size = {x = 150, y = 40}
numGui = 4
gui = {
{
- pos = {x = 110, y = 40},
+ pos = {x = 110, y = 40, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Single player',
buttonType = ButtonType.SINGLE_PLAYER
},
{
- pos = {x = 110, y = 90},
+ pos = {x = 110, y = 90, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Map editor',
buttonType = ButtonType.MAP_EDITOR
},
{
- pos = {x = 110, y = 140},
+ pos = {x = 110, y = 140, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Options',
buttonType = ButtonType.OPTIONS
},
{
- pos = {x = 110, y = 190},
+ pos = {x = 110, y = 190, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Exit',
diff --git a/Assets/Scripts/Gui/mainMenuOptions.lua b/Assets/Scripts/Gui/mainMenuOptions.lua
index df7159c..d5be514 100644
--- a/Assets/Scripts/Gui/mainMenuOptions.lua
+++ b/Assets/Scripts/Gui/mainMenuOptions.lua
@@ -3,42 +3,42 @@ Size = {x = 150, y = 40}
numGui = 6
gui = {
{
- pos = {x = 110, y = 40},
+ pos = {x = 110, y = 40, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Controls',
buttonType = ButtonType.CONTROLS_TAB
},
{
- pos = {x = 270, y = 40},
+ pos = {x = 270, y = 40, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Mouse',
buttonType = ButtonType.MOUSE_TAB
},
{
- pos = {x = 430, y = 40},
+ pos = {x = 430, y = 40, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Video',
buttonType = ButtonType.VIDEO_TAB
},
{
- pos = {x = 590, y = 40},
+ pos = {x = 590, y = 40, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Audio',
buttonType = ButtonType.AUDIO_TAB
},
{
- pos = {x = 750, y = 40},
+ pos = {x = 750, y = 40, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Multiplayer',
buttonType = ButtonType.MULTIPLAYER_TAB
},
{
- pos = {x = 910, y = 100},
+ pos = {x = 910, y = 100, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Back',
diff --git a/Assets/Scripts/Gui/mapEditor.lua b/Assets/Scripts/Gui/mapEditor.lua
index a462588..b17dda4 100644
--- a/Assets/Scripts/Gui/mapEditor.lua
+++ b/Assets/Scripts/Gui/mapEditor.lua
@@ -4,42 +4,42 @@ Size = {x = 140, y = 20}
startX = 100
gui = {
{
- pos = {x = startX, y = 400},
+ pos = {x = startX, y = 400, z = 0},
size = Size,
guiType = GuiType.BUTTON,
buttonType = ButtonType.EXPORT,
name = 'Export'
},
{
- pos = {x = startX + Size.x + 10, y = 400},
+ pos = {x = startX + Size.x + 10, y = 400, z = 0},
size = Size,
guiType = GuiType.LISTBOX,
listboxType = ListboxType.VEHICLES,
numMaxDisplay = 5
},
{
- pos = {x = startX + 2 * (Size.x + 10), y = 400},
+ pos = {x = startX + 2 * (Size.x + 10), y = 400, z = 0},
size = Size,
guiType = GuiType.LISTBOX,
listboxType = ListboxType.STRUCTURES,
numMaxDisplay = 5
},
{
- pos = {x = startX + 3 * (Size.x + 10), y = 400},
+ pos = {x = startX + 3 * (Size.x + 10), y = 400, z = 0},
size = Size,
guiType = GuiType.LISTBOX,
listboxType = ListboxType.RESOURCE_DEPOSITS,
numMaxDisplay = 5
},
{
- pos = {x = startX + 4 * (Size.x + 10), y = 400},
+ pos = {x = startX + 4 * (Size.x + 10), y = 400, z = 0},
size = Size,
guiType = GuiType.LISTBOX,
listboxType = ListboxType.SKYBOX_TEXTURES,
numMaxDisplay = 5
},
{
- pos = {x = startX + 5 * (Size.x + 10), y = 400},
+ pos = {x = startX + 5 * (Size.x + 10), y = 400, z = 0},
size = Size,
guiType = GuiType.LISTBOX,
listboxType = ListboxType.LAND_TEXTURES,
diff --git a/Assets/Scripts/Gui/mapEditorMenu.lua b/Assets/Scripts/Gui/mapEditorMenu.lua
index c053a39..5bae37a 100644
--- a/Assets/Scripts/Gui/mapEditorMenu.lua
+++ b/Assets/Scripts/Gui/mapEditorMenu.lua
@@ -3,21 +3,21 @@ Size = {x = 150, y = 40}
numGui = 3
gui = {
{
- pos = {x = 110, y = 40},
+ pos = {x = 110, y = 40, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'New map',
buttonType = ButtonType.NEW_MAP
},
{
- pos = {x = 110, y = 90},
+ pos = {x = 110, y = 90, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Load map',
buttonType = ButtonType.LOAD_MAP
},
{
- pos = {x = 110, y = 140},
+ pos = {x = 110, y = 140, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Back',
diff --git a/Assets/Scripts/Gui/mouseTab.lua b/Assets/Scripts/Gui/mouseTab.lua
index 1d39c27..e9c34f4 100644
--- a/Assets/Scripts/Gui/mouseTab.lua
+++ b/Assets/Scripts/Gui/mouseTab.lua
@@ -1,12 +1,12 @@
numGui = 6
gui = {
{
- pos = {x = 110, y = 80},
+ pos = {x = 110, y = 80, z = 0},
size = {x = 300, y = 10},
guiType = GuiType.TEXTBOX
},
{
- pos = {x = 110, y = 40},
+ pos = {x = 110, y = 40, z = 0},
size = {x = 300, y = 10},
minValue = 0,
maxValue = 2,
@@ -17,25 +17,25 @@ gui = {
}
},
{
- pos = {x = 110, y = 110},
+ pos = {x = 110, y = 110, z = 0},
guiType = GuiType.CHECKBOX
},
{
- pos = {x = 100, y = 400},
+ pos = {x = 100, y = 400, z = 0},
size = {x = 150, y = 20},
guiType = GuiType.BUTTON,
name = 'Ok',
buttonType = ButtonType.OK
},
{
- pos = {x = 260, y = 400},
+ pos = {x = 260, y = 400, z = 0},
size = {x = 150, y = 20},
guiType = GuiType.BUTTON,
name = 'Restore defaults',
buttonType = ButtonType.DEFAULTS
},
{
- pos = {x = 420, y = 400},
+ pos = {x = 420, y = 400, z = 0},
size = {x = 150, y = 20},
guiType = GuiType.BUTTON,
name = 'Back',
diff --git a/Assets/Scripts/Gui/multiplayerTab.lua b/Assets/Scripts/Gui/multiplayerTab.lua
index bec5ea2..1fb7bff 100644
--- a/Assets/Scripts/Gui/multiplayerTab.lua
+++ b/Assets/Scripts/Gui/multiplayerTab.lua
@@ -1,36 +1,36 @@
numGui = 6
gui = {
{
- pos = {x = 110, y = 40},
+ pos = {x = 110, y = 40, z = 0},
size = {x = 100, y = 20},
guiType = GuiType.TEXTBOX
},
{
- pos = {x = 110, y = 70},
+ pos = {x = 110, y = 70, z = 0},
size = {x = 100, y = 20},
guiType = GuiType.TEXTBOX
},
{
- pos = {x = 110, y = 100},
+ pos = {x = 110, y = 100, z = 0},
size = {x = 100, y = 20},
guiType = GuiType.TEXTBOX
},
{
- pos = {x = 100, y = 400},
+ pos = {x = 100, y = 400, z = 0},
size = {x = 150, y = 20},
guiType = GuiType.BUTTON,
name = 'Ok',
buttonType = ButtonType.OK
},
{
- pos = {x = 260, y = 400},
+ pos = {x = 260, y = 400, z = 0},
size = {x = 150, y = 20},
guiType = GuiType.BUTTON,
name = 'Restore defaults',
buttonType = ButtonType.DEFAULTS
},
{
- pos = {x = 420, y = 400},
+ pos = {x = 420, y = 400, z = 0},
size = {x = 150, y = 20},
guiType = GuiType.BUTTON,
name = 'Back',
diff --git a/Assets/Scripts/Gui/navalFactoryCommands.lua b/Assets/Scripts/Gui/navalFactoryCommands.lua
index 652031d..719313b 100644
--- a/Assets/Scripts/Gui/navalFactoryCommands.lua
+++ b/Assets/Scripts/Gui/navalFactoryCommands.lua
@@ -1,10 +1,10 @@
res = graphics.resolution
+Size = {x = 70, y = 70}
gui = {
{
- pos = {x = res.x - 200, y = res.y - 200},
- size = {x = 100, y = 100},
- imagePath = '',
+ pos = {x = res.x - Size.x, y = res.y - Size.y, z = 0},
+ size = Size,
guiType = GuiType.BUTTON,
buttonType = ButtonType.NAVAL_FACTORY_TRAIN,
trigger = 66
diff --git a/Assets/Scripts/Gui/newMap.lua b/Assets/Scripts/Gui/newMap.lua
index 1b1a4d4..2f0fc99 100644
--- a/Assets/Scripts/Gui/newMap.lua
+++ b/Assets/Scripts/Gui/newMap.lua
@@ -3,22 +3,22 @@ Size = {x = 140, y = 40}
numGui = 5
gui = {
{
- pos = {x = 110, y = 150},
+ pos = {x = 110, y = 150, z = 0},
size = Size,
guiType = GuiType.TEXTBOX
},
{
- pos = {x = 110, y = 190},
+ pos = {x = 110, y = 190, z = 0},
size = Size,
guiType = GuiType.TEXTBOX
},
{
- pos = {x = 110, y = 220},
+ pos = {x = 110, y = 220, z = 0},
size = Size,
guiType = GuiType.TEXTBOX
},
{
- pos = {x = 420, y = 400},
+ pos = {x = 420, y = 400, z = 0},
size = {x = 150, y = 50},
guiType = GuiType.BUTTON,
name = 'Ok',
@@ -31,7 +31,7 @@ gui = {
}
},
{
- pos = {x = 250, y = 400},
+ pos = {x = 250, y = 400, z = 0},
size = {x = 150, y = 50},
guiType = GuiType.BUTTON,
name = 'Back',
diff --git a/Assets/Scripts/Gui/options.lua b/Assets/Scripts/Gui/options.lua
index df7159c..d5be514 100644
--- a/Assets/Scripts/Gui/options.lua
+++ b/Assets/Scripts/Gui/options.lua
@@ -3,42 +3,42 @@ Size = {x = 150, y = 40}
numGui = 6
gui = {
{
- pos = {x = 110, y = 40},
+ pos = {x = 110, y = 40, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Controls',
buttonType = ButtonType.CONTROLS_TAB
},
{
- pos = {x = 270, y = 40},
+ pos = {x = 270, y = 40, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Mouse',
buttonType = ButtonType.MOUSE_TAB
},
{
- pos = {x = 430, y = 40},
+ pos = {x = 430, y = 40, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Video',
buttonType = ButtonType.VIDEO_TAB
},
{
- pos = {x = 590, y = 40},
+ pos = {x = 590, y = 40, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Audio',
buttonType = ButtonType.AUDIO_TAB
},
{
- pos = {x = 750, y = 40},
+ pos = {x = 750, y = 40, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Multiplayer',
buttonType = ButtonType.MULTIPLAYER_TAB
},
{
- pos = {x = 910, y = 100},
+ pos = {x = 910, y = 100, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Back',
diff --git a/Assets/Scripts/Gui/playerSelection.lua b/Assets/Scripts/Gui/playerSelection.lua
index 3857ed9..f6f09d2 100644
--- a/Assets/Scripts/Gui/playerSelection.lua
+++ b/Assets/Scripts/Gui/playerSelection.lua
@@ -1,4 +1,4 @@
-Pos = {x = 110, y = 150}
+Pos = {x = 110, y = 150, z = 0}
Size = {x = 100, y = 20}
space = 60
diff --git a/Assets/Scripts/Gui/researchStructCommands.lua b/Assets/Scripts/Gui/researchStructCommands.lua
index 166afe1..8c17b96 100644
--- a/Assets/Scripts/Gui/researchStructCommands.lua
+++ b/Assets/Scripts/Gui/researchStructCommands.lua
@@ -1,15 +1,27 @@
res = graphics.resolution
-Size = {x = 100, y = 100}
+Size = {x = 70, y = 70}
+margin = 10
+sz = {x = Size.x - margin, y = Size.y - margin}
gui = {
+ --[[
{
- pos = {x = res.x - 200, y = res.y - 200},
- size = Size,
+ pos = {x = res.x - Size.x, y = res.y - Size.y},
+ size = sz,
name = "Research",
- imagePath = '',
guiType = GuiType.BUTTON,
buttonType = ButtonType.RESEARCH,
techId = TechId.APT,
trigger = 82,
- }
+ },
+ ]]--
+ {
+ guiType = GuiType.BUTTON,
+ buttonType = ButtonType.ACTIVE_GAME_STATE,
+ name = 'Tech',
+ guiScreen = 'techTree.lua',
+ pos = {x = res.x - 2 * Size.x, y = res.y - Size.y, z = 0},
+ size = sz,
+ trigger = 85
+ },
}
diff --git a/Assets/Scripts/Gui/singlePlayerMenu.lua b/Assets/Scripts/Gui/singlePlayerMenu.lua
index d9b633d..d43e620 100644
--- a/Assets/Scripts/Gui/singlePlayerMenu.lua
+++ b/Assets/Scripts/Gui/singlePlayerMenu.lua
@@ -3,35 +3,35 @@ Size = {x = 100, y = 20}
numGui = 6
gui = {
{
- pos = {x = 100, y = 100},
+ pos = {x = 100, y = 100, z = 0},
size = Size,
guiType = GuiType.LISTBOX,
numMaxDisplay = 3,
listboxType = ListboxType.CPU_DIFFICULTIES
},
{
- pos = {x = 210, y = 100},
+ pos = {x = 210, y = 100, z = 0},
size = Size,
guiType = GuiType.LISTBOX,
numMaxDisplay = 3,
listboxType = ListboxType.FACTIONS
},
{
- pos = {x = 100, y = 230},
+ pos = {x = 100, y = 230, z = 0},
size = Size,
guiType = GuiType.LISTBOX,
numMaxDisplay = 3,
listboxType = ListboxType.FACTIONS
},
{
- pos = {x = 110, y = 310},
+ pos = {x = 110, y = 310, z = 0},
size = Size,
guiType = GuiType.LISTBOX,
listboxType = ListboxType.MAPS,
numMaxDisplay = 5
},
{
- pos = {x = 110, y = 460},
+ pos = {x = 110, y = 460, z = 0},
size = Size,
guiType = GuiType.BUTTON,
buttonType = ButtonType.PLAY,
@@ -45,7 +45,7 @@ gui = {
}
},
{
- pos = {x = 110 + Size.x + 10, y = 460},
+ pos = {x = 110 + Size.x + 10, y = 460, z = 0},
size = Size,
guiType = GuiType.BUTTON,
buttonType = ButtonType.BACK,
diff --git a/Assets/Scripts/Gui/statistics.lua b/Assets/Scripts/Gui/statistics.lua
index cc22a67..6beac18 100644
--- a/Assets/Scripts/Gui/statistics.lua
+++ b/Assets/Scripts/Gui/statistics.lua
@@ -3,7 +3,7 @@ gui = {
guiType = GuiType.TEXT,
text = 'Statistics',
name = 'stat',
- pos = {x = 850, y = 100},
+ pos = {x = 850, y = 100, z = 0},
zIndex = 0,
scale = 0.5,
font = 'batang.ttf',
@@ -15,7 +15,7 @@ gui = {
guiType = GuiType.TEXT,
text = 'Player',
name = 'pl',
- pos = {x = 50, y = 200},
+ pos = {x = 50, y = 200, z = 0},
zIndex = 0,
scale = 0.3,
font = 'batang.ttf',
@@ -27,7 +27,7 @@ gui = {
guiType = GuiType.TEXT,
text = 'Vehicles built',
name = 'vb',
- pos = {x = 150, y = 200},
+ pos = {x = 150, y = 200, z = 0},
zIndex = 0,
scale = 0.3,
font = 'batang.ttf',
@@ -39,7 +39,7 @@ gui = {
guiType = GuiType.TEXT,
text = 'Vehicles destroyed',
name = 'vd',
- pos = {x = 450, y = 200},
+ pos = {x = 450, y = 200, z = 0},
zIndex = 0,
scale = 0.3,
font = 'batang.ttf',
@@ -51,7 +51,7 @@ gui = {
guiType = GuiType.TEXT,
text = 'Vehicles lost',
name = 'vl',
- pos = {x = 850, y = 200},
+ pos = {x = 850, y = 200, z = 0},
zIndex = 0,
scale = 0.3,
font = 'batang.ttf',
@@ -63,7 +63,7 @@ gui = {
guiType = GuiType.TEXT,
text = 'Structures built',
name = 'sb',
- pos = {x = 1050, y = 200},
+ pos = {x = 1050, y = 200, z = 0},
zIndex = 0,
scale = 0.3,
font = 'batang.ttf',
@@ -75,7 +75,7 @@ gui = {
guiType = GuiType.TEXT,
text = 'Structures destroyed',
name = 'sd',
- pos = {x = 1350, y = 200},
+ pos = {x = 1350, y = 200, z = 0},
zIndex = 0,
scale = 0.3,
font = 'batang.ttf',
@@ -87,7 +87,7 @@ gui = {
guiType = GuiType.TEXT,
text = 'Structures lost',
name = 'sl',
- pos = {x = 1720, y = 200},
+ pos = {x = 1720, y = 200, z = 0},
zIndex = 0,
scale = 0.3,
font = 'batang.ttf',
@@ -97,13 +97,13 @@ gui = {
},
{
guiType = GuiType.GUI_RECTANGLE,
- pos = {x = 100, y = 200},
+ pos = {x = 100, y = 200, z = 0},
zIndex = 1,
size = {x = 600, y = 600},
color = {x = 0, y = 0, z = 1, w = 1}
},
{
- pos = {x = 1700, y = 1000},
+ pos = {x = 1700, y = 1000, z = 0},
size = Size,
guiType = GuiType.BUTTON,
name = 'Back',
diff --git a/Assets/Scripts/Gui/techTree.lua b/Assets/Scripts/Gui/techTree.lua
new file mode 100644
index 0000000..953403c
--- /dev/null
+++ b/Assets/Scripts/Gui/techTree.lua
@@ -0,0 +1,106 @@
+res = graphics.resolution
+Size = {x = res.x * .5, y = res.y * .5}
+techButtonSize = {x = 50, y = 50}
+Pos = {x = res.x * .3, y = res.y * .1, z = .1}
+margin = {top = 10, left = 10, right = 10, bottom = 10}
+baseTechPath = 'Icons/Technologies/'
+heightOffset = techButtonSize.y + 10
+
+gui = {
+ {
+ guiType = GuiType.GUI_RECTANGLE,
+ pos = Pos,
+ size = Size,
+ color = {x = 0, y = 0, z = 0, w = .6}
+ },
+ {
+ pos = {x = Pos.x + .5 * (Size.x - techButtonSize.x), y = Pos.y + margin.top, z = .11},
+ size = techButtonSize,
+ name = "APT",
+ imagePath = baseTechPath .. 'apt.jpg',
+ guiType = GuiType.BUTTON,
+ buttonType = ButtonType.RESEARCH,
+ techId = TechId.APT,
+ trigger = 82,
+ },
+ {
+ pos = {x = Pos.x + margin.left, y = Pos.y + margin.top + heightOffset, z = .11},
+ size = techButtonSize,
+ name = "FPT",
+ imagePath = baseTechPath .. 'fpt.jpg',
+ guiType = GuiType.BUTTON,
+ buttonType = ButtonType.RESEARCH,
+ techId = TechId.FPT,
+ trigger = 82,
+ },
+ {
+ pos = {x = Pos.x + margin.left, y = Pos.y + margin.top + 2 * heightOffset, z = .11},
+ size = techButtonSize,
+ name = "Cruisers",
+ imagePath = baseTechPath .. 'cruisers.jpg',
+ guiType = GuiType.BUTTON,
+ buttonType = ButtonType.RESEARCH,
+ techId = TechId.CRUISERS,
+ trigger = 82,
+ },
+ {
+ pos = {x = Pos.x + .5 * (Size.x - techButtonSize.x), y = Pos.y + margin.top + heightOffset, z = .11},
+ size = techButtonSize,
+ name = "EFT",
+ imagePath = baseTechPath .. 'ept.jpg',
+ guiType = GuiType.BUTTON,
+ buttonType = ButtonType.RESEARCH,
+ techId = TechId.EFT,
+ trigger = 82,
+ },
+ {
+ pos = {x = Pos.x + .5 * (Size.x - 3 * techButtonSize.x), y = Pos.y + margin.top + 2 * heightOffset, z = .11},
+ size = techButtonSize,
+ name = "Stealth",
+ imagePath = baseTechPath .. 'stealth.jpg',
+ guiType = GuiType.BUTTON,
+ buttonType = ButtonType.RESEARCH,
+ techId = TechId.ST_SUB,
+ trigger = 82,
+ },
+ {
+ pos = {x = Pos.x + .5 * (Size.x + 3 * techButtonSize.x), y = Pos.y + margin.top + 2 * heightOffset, z = .11},
+ size = techButtonSize,
+ name = "Robotics",
+ imagePath = baseTechPath .. 'robo.jpg',
+ guiType = GuiType.BUTTON,
+ buttonType = ButtonType.RESEARCH,
+ techId = TechId.ROBO,
+ trigger = 82,
+ },
+ {
+ pos = {x = Pos.x + Size.x - (margin.right + techButtonSize.x), y = Pos.y + margin.top + heightOffset, z = .11},
+ size = techButtonSize,
+ name = "PCT",
+ imagePath = baseTechPath .. 'pct.jpg',
+ guiType = GuiType.BUTTON,
+ buttonType = ButtonType.RESEARCH,
+ techId = TechId.PCT,
+ trigger = 82,
+ },
+ {
+ pos = {x = Pos.x + Size.x - (margin.right + 3 * techButtonSize.x), y = Pos.y + margin.top + 2 * heightOffset, z = .11},
+ size = techButtonSize,
+ name = "Carriers",
+ imagePath = baseTechPath .. 'carriers.jpg',
+ guiType = GuiType.BUTTON,
+ buttonType = ButtonType.RESEARCH,
+ techId = TechId.CARRIERS,
+ trigger = 82,
+ },
+ {
+ pos = {x = Pos.x + Size.x - (margin.right + techButtonSize.x), y = Pos.y + margin.top + 2 * heightOffset, z = .11},
+ size = techButtonSize,
+ name = "Tanks",
+ imagePath = baseTechPath .. 'tanks.jpg',
+ guiType = GuiType.BUTTON,
+ buttonType = ButtonType.RESEARCH,
+ techId = TechId.TANKS,
+ trigger = 82,
+ },
+}
diff --git a/Assets/Scripts/Gui/tradingCenterCommands.lua b/Assets/Scripts/Gui/tradingCenterCommands.lua
index 1c0dcb9..4a4dbda 100644
--- a/Assets/Scripts/Gui/tradingCenterCommands.lua
+++ b/Assets/Scripts/Gui/tradingCenterCommands.lua
@@ -1,38 +1,36 @@
res = graphics.resolution
-Size = {x = 100, y = 100}
+Size = {x = 70, y = 70}
+margin = 10
+sz = {x = Size.x - margin, y = Size.y - margin}
gui = {
{
- pos = {x = res.x - 200, y = res.y - 200},
- size = Size,
+ pos = {x = res.x - Size.x, y = res.y - Size.y, z = 0},
+ size = sz,
name = 'Buy ref',
- imagePath = '',
guiType = GuiType.BUTTON,
buttonType = ButtonType.BUY_REFINEDS,
trigger = 73,
},
{
- pos = {x = res.x - Size.x - 200, y = res.y - 200},
- size = Size,
- imagePath = '',
+ pos = {x = res.x - 2 * Size.x, y = res.y - Size.y, z = 0},
+ size = sz,
name = 'Sell ref',
guiType = GuiType.BUTTON,
buttonType = ButtonType.SELL_REFINEDS,
trigger = 79,
},
{
- pos = {x = res.x - 200, y = res.y - 400},
- size = Size,
- imagePath = '',
+ pos = {x = res.x - Size.x, y = res.y - 2 * Size.y, z = 0},
+ size = sz,
name = 'Buy rsch',
guiType = GuiType.BUTTON,
buttonType = ButtonType.BUY_RESEARCH,
trigger = 75,
},
{
- pos = {x = res.x - Size.x - 200, y = res.y - 400},
- size = Size,
- imagePath = '',
+ pos = {x = res.x - 2 * Size.x, y = res.y - 2 * Size.y, z = 0},
+ size = sz,
name = 'Sell rsch',
guiType = GuiType.BUTTON,
buttonType = ButtonType.SELL_RESEARCH,
diff --git a/Assets/Scripts/Gui/tradingHub.lua b/Assets/Scripts/Gui/tradingHub.lua
new file mode 100644
index 0000000..065387a
--- /dev/null
+++ b/Assets/Scripts/Gui/tradingHub.lua
@@ -0,0 +1,26 @@
+res = graphics.resolution
+
+HubSize = {x = res.x * .3, y = res.y * .8}
+HubPos = {x = .5 * (res.x - HubSize.x), y = 10, z = .1}
+HubMargin = {top = 10, left = 10, right = 10, bottom = 10}
+
+buttonSize = {x = 100, y = 20}
+textboxSize = {x = 200, y = 25}
+
+gui = {
+ {
+ guiType = GuiType.GUI_RECTANGLE,
+ pos = HubPos,
+ size = HubSize,
+ color = {x = 0, y = 0, z = 0, w = .6}
+ },
+ {
+ guiType = GuiType.BUTTON,
+ buttonType = ButtonType.ACTIVE_GAME_STATE,
+ name = 'Back',
+ guiScreen = 'activeGameState.lua',
+ pos = {x = HubPos.x + HubSize.x - buttonSize.x - HubMargin.right, y = HubPos.y + HubSize.y - buttonSize.y - HubMargin.bottom, z = .11},
+ size = buttonSize,
+ trigger = 10
+ },
+}
diff --git a/Assets/Scripts/Gui/tradingPlayerGuiTray.lua b/Assets/Scripts/Gui/tradingPlayerGuiTray.lua
new file mode 100644
index 0000000..dccc609
--- /dev/null
+++ b/Assets/Scripts/Gui/tradingPlayerGuiTray.lua
@@ -0,0 +1,45 @@
+res = graphics.resolution
+
+buttonSize = {x = 100, y = 20}
+textboxSize = {x = 200, y = 20}
+
+height = HubPos.y + HubMargin.top + lineId * 30
+warIcon = 'Icons/PlayerStates/war.png'
+allianceIcon = 'Icons/PlayerStates/alliance.png'
+
+gui = {
+ {
+ guiType = GuiType.TEXT,
+ name = 'playerName',
+ text = '',
+ pos = {x = HubPos.x + HubMargin.left, y = height + 35, z = .11},
+ scale = {x = .2, y = .2},
+ font = 'batang.ttf',
+ fontFirstChar = 0,
+ fontLastChar = 256,
+ color = {x = 1, y = 1, z = 1, w = 1}
+ },
+ {
+ guiType = GuiType.GUI_RECTANGLE,
+ pos = {x = HubPos.x + HubMargin.left + 100, y = height, z = .11},
+ size = {x = 50, y = 50},
+ imagePath = warIcon
+ },
+ {
+ pos = {x = HubPos.x + HubMargin.left + 200, y = height + 25, z = .11},
+ size = textboxSize,
+ guiType = GuiType.LISTBOX,
+ listboxType = ListboxType.TRADE_OFFERS,
+ numMaxDisplay = 3
+ },
+ {
+ guiType = GuiType.BUTTON,
+ buttonType = ButtonType.TRADING_SCREEN,
+ name = 'Trade',
+ guiScreen = 'tradingScreen.lua',
+ pos = {x = HubPos.x + HubSize.x - buttonSize.x - HubMargin.right, y = height + 25, z = .11},
+ size = buttonSize,
+ trigger = 10,
+ dependencies = {{id = 2}}
+ }
+}
diff --git a/Assets/Scripts/Gui/tradingScreen.lua b/Assets/Scripts/Gui/tradingScreen.lua
new file mode 100644
index 0000000..90aa351
--- /dev/null
+++ b/Assets/Scripts/Gui/tradingScreen.lua
@@ -0,0 +1,145 @@
+res = graphics.resolution
+HubMargin.top = 100
+
+resTrayPos = {x = HubPos.x + HubMargin.left, y = HubPos.y + HubMargin.top}
+iconSize = {x = 25, y = 25}
+textboxSize = {x = 200, y = 25}
+
+buttonSize = {x = 100, y = 20}
+
+ResourceTrayGuiId = {ICON = 0, TEXTBOX = 1, INCREMENT = 2, DECREMENT = 3}
+IconPath = {WEALTH = 'Icons/Resources/wealth.png', RESEARCH = 'Icons/Resources/research.png', REFINEDS = 'Icons/Resources/refineds.png', TIME = 'Icons/Resources/time.png'}
+
+function createResourceTrayGui(cpuPlayer, lineId, guiId, imgPath)
+ height = HubMargin.top + lineId * iconSize.y
+
+ if guiId == ResourceTrayGuiId.ICON then
+ guiElPos = {x = HubPos.x + (cpuPlayer and HubMargin.left or HubSize.x -(HubMargin.right + 3 * iconSize.x + textboxSize.x)), y = height, z = .2}
+
+ return {
+ guiType = GuiType.GUI_RECTANGLE,
+ pos = guiElPos,
+ size = iconSize,
+ imagePath = imgPath
+ }
+ elseif guiId == ResourceTrayGuiId.TEXTBOX then
+ guiElPos = {x = HubPos.x + (cpuPlayer and HubMargin.left + iconSize.x or HubSize.x -(HubMargin.right + 2 * iconSize.x + textboxSize.x)), y = height, z = .2}
+
+ return {
+ pos = guiElPos,
+ size = textboxSize,
+ guiType = GuiType.TEXTBOX,
+ }
+ elseif guiId == ResourceTrayGuiId.INCREMENT then
+ guiElPos = {x = HubPos.x + (cpuPlayer and HubMargin.left + iconSize.x + textboxSize.x or HubSize.x -(HubMargin.right + 2 * iconSize.x)), y = height, z = .2}
+
+ return {
+ guiType = GuiType.BUTTON,
+ buttonType = ButtonType.RESOURCE_AMMOUNT,
+ ammount = 10,
+ name = '+',
+ pos = guiElPos,
+ size = iconSize,
+ trigger = 10
+ }
+ elseif guiId == ResourceTrayGuiId.DECREMENT then
+ guiElPos = {x = HubPos.x + (cpuPlayer and HubMargin.left + 2 * iconSize.x + textboxSize.x or HubSize.x -(HubMargin.right + iconSize.x)), y = height, z = .2}
+
+ return {
+ guiType = GuiType.BUTTON,
+ buttonType = ButtonType.RESOURCE_AMMOUNT,
+ ammount = -10,
+ name = '-',
+ pos = guiElPos,
+ size = iconSize,
+ trigger = 10
+ }
+ end
+end
+
+gui = {
+ {
+ guiType = GuiType.GUI_RECTANGLE,
+ pos = HubPos,
+ size = HubSize,
+ color = {x = 0, y = 0, z = 0, w = .6}
+ },
+ {
+ guiType = GuiType.TEXT,
+ name = 'P0',
+ text = 'P0',
+ pos = {x = HubPos.x + HubMargin.left, y = HubPos.y + HubMargin.top - 20, z = .2},
+ scale = {x = .5, y = .5},
+ font = 'batang.ttf',
+ fontFirstChar = 0,
+ fontLastChar = 256,
+ color = {x = 1, y = 1, z = 1, w = 1}
+ },
+ {
+ guiType = GuiType.TEXT,
+ name = 'You',
+ text = 'You',
+ pos = {x = HubPos.x + HubSize.x -(HubMargin.right + textboxSize.x + iconSize.x + 50), y = HubPos.y + HubMargin.top - 20, z = .2},
+ scale = {x = .5, y = .5},
+ font = 'batang.ttf',
+ fontFirstChar = 0,
+ fontLastChar = 256,
+ color = {x = 1, y = 1, z = 1, w = 1}
+ },
+
+ createResourceTrayGui(true, 0, ResourceTrayGuiId.ICON, IconPath.REFINEDS),
+ createResourceTrayGui(true, 0, ResourceTrayGuiId.TEXTBOX),
+ createResourceTrayGui(true, 0, ResourceTrayGuiId.INCREMENT),
+ createResourceTrayGui(true, 0, ResourceTrayGuiId.DECREMENT),
+ createResourceTrayGui(false, 0, ResourceTrayGuiId.ICON, IconPath.REFINEDS),
+ createResourceTrayGui(false, 0, ResourceTrayGuiId.TEXTBOX),
+ createResourceTrayGui(false, 0, ResourceTrayGuiId.INCREMENT),
+ createResourceTrayGui(false, 0, ResourceTrayGuiId.DECREMENT),
+ createResourceTrayGui(true, 1, ResourceTrayGuiId.ICON, IconPath.WEALTH),
+ createResourceTrayGui(true, 1, ResourceTrayGuiId.TEXTBOX),
+ createResourceTrayGui(true, 1, ResourceTrayGuiId.INCREMENT),
+ createResourceTrayGui(true, 1, ResourceTrayGuiId.DECREMENT),
+ createResourceTrayGui(false, 1, ResourceTrayGuiId.ICON, IconPath.WEALTH),
+ createResourceTrayGui(false, 1, ResourceTrayGuiId.TEXTBOX),
+ createResourceTrayGui(false, 1, ResourceTrayGuiId.INCREMENT),
+ createResourceTrayGui(false, 1, ResourceTrayGuiId.DECREMENT),
+ createResourceTrayGui(true, 2, ResourceTrayGuiId.ICON, IconPath.RESEARCH),
+ createResourceTrayGui(true, 2, ResourceTrayGuiId.TEXTBOX),
+ createResourceTrayGui(true, 2, ResourceTrayGuiId.INCREMENT),
+ createResourceTrayGui(true, 2, ResourceTrayGuiId.DECREMENT),
+ createResourceTrayGui(false, 2, ResourceTrayGuiId.ICON, IconPath.RESEARCH),
+ createResourceTrayGui(false, 2, ResourceTrayGuiId.TEXTBOX),
+ createResourceTrayGui(false, 2, ResourceTrayGuiId.INCREMENT),
+ createResourceTrayGui(false, 2, ResourceTrayGuiId.DECREMENT),
+ createResourceTrayGui(true, 3, ResourceTrayGuiId.ICON, IconPath.TIME),
+ createResourceTrayGui(true, 3, ResourceTrayGuiId.TEXTBOX),
+ createResourceTrayGui(true, 3, ResourceTrayGuiId.INCREMENT),
+ createResourceTrayGui(true, 3, ResourceTrayGuiId.DECREMENT),
+ createResourceTrayGui(false, 3, ResourceTrayGuiId.ICON, IconPath.TIME),
+ createResourceTrayGui(false, 3, ResourceTrayGuiId.TEXTBOX),
+ createResourceTrayGui(false, 3, ResourceTrayGuiId.INCREMENT),
+ createResourceTrayGui(false, 3, ResourceTrayGuiId.DECREMENT),
+
+ {
+ guiType = GuiType.BUTTON,
+ buttonType = ButtonType.PLAYER_TRADE,
+ name = 'Back',
+ guiScreen = 'tradingHub.lua',
+ pos = {x = HubPos.x + HubSize.x - 2 * buttonSize.x - HubMargin.right, y = HubPos.y + HubSize.y - buttonSize.y - HubMargin.bottom, z = .2},
+ size = buttonSize,
+ trigger = 10
+ },
+ {
+ guiType = GuiType.BUTTON,
+ buttonType = ButtonType.TRADE_OFFER,
+ name = 'Offer',
+ pos = {x = HubPos.x + HubSize.x - buttonSize.x - HubMargin.right, y = HubPos.y + HubSize.y - buttonSize.y - HubMargin.bottom, z = .2},
+ size = buttonSize,
+ trigger = 10
+ },
+ {
+ pos = {x = HubPos.x + HubMargin.left, y = HubPos.y + HubSize.y - textboxSize.y - HubMargin.bottom, z = .2},
+ size = textboxSize,
+ guiType = GuiType.TEXTBOX,
+ }
+}
diff --git a/Assets/Scripts/Gui/videoTab.lua b/Assets/Scripts/Gui/videoTab.lua
index 4277f15..3ee280e 100644
--- a/Assets/Scripts/Gui/videoTab.lua
+++ b/Assets/Scripts/Gui/videoTab.lua
@@ -1,7 +1,7 @@
numGui = 9
gui = {
{
- pos = {x = 210, y = 190},
+ pos = {x = 210, y = 190, z = 0},
size = {x = 360, y = 20},
guiType = GuiType.LISTBOX,
listboxType = ListboxType.RESOLUTION,
@@ -14,41 +14,41 @@ gui = {
}
},
{
- pos = {x = 110, y = 40},
+ pos = {x = 110, y = 40, z = 0},
guiType = GuiType.CHECKBOX
},
{
- pos = {x = 110, y = 70},
+ pos = {x = 110, y = 70, z = 0},
guiType = GuiType.CHECKBOX
},
{
- pos = {x = 110, y = 100},
+ pos = {x = 110, y = 100, z = 0},
guiType = GuiType.CHECKBOX
},
{
- pos = {x = 110, y = 130},
+ pos = {x = 110, y = 130, z = 0},
guiType = GuiType.CHECKBOX
},
{
- pos = {x = 110, y = 160},
+ pos = {x = 110, y = 160, z = 0},
guiType = GuiType.CHECKBOX
},
{
- pos = {x = 100, y = 400},
+ pos = {x = 100, y = 400, z = 0},
size = {x = 150, y = 20},
guiType = GuiType.BUTTON,
name = 'Ok',
buttonType = ButtonType.OK
},
{
- pos = {x = 260, y = 400},
+ pos = {x = 260, y = 400, z = 0},
size = {x = 150, y = 20},
guiType = GuiType.BUTTON,
name = 'Restore defaults',
buttonType = ButtonType.DEFAULTS
},
{
- pos = {x = 420, y = 400},
+ pos = {x = 420, y = 400, z = 0},
size = {x = 150, y = 20},
guiType = GuiType.BUTTON,
name = 'Back',
diff --git a/Assets/Scripts/Technologies/technologyData.lua b/Assets/Scripts/Technologies/technologyData.lua
index 74b412f..9407f3b 100644
--- a/Assets/Scripts/Technologies/technologyData.lua
+++ b/Assets/Scripts/Technologies/technologyData.lua
@@ -1,49 +1,86 @@
TechId = {
APT = 0,
- EFT = 1,
- PCT = 2,
- FPT = 3,
+ FPT = 1,
+ CRUISERS = 2,
+ EFT = 3,
+ ST_SUB = 4,
+ ROBO = 5,
+ PCT = 6,
+ CARRIERS = 7,
+ TANKS = 8
}
technologies = {
{
- id = TechId.APT,
name = 'Advanced power technology',
cost = 1000,
icon = '',
description = '',
parents = {},
- children = {},
abilities = {0},
},
{
- id = TechId.EFT,
- name = 'Energy field technology',
- cost = 1000,
- icon = '',
- description = '',
- parents = {},
- children = {},
- abilities = {},
- },
- {
- id = TechId.PCT,
- name = 'Plasma casting technology',
- cost = 1000,
- icon = '',
- description = '',
- parents = {},
- children = {},
- abilities = {},
- },
- {
- id = TechId.FPT,
name = 'Fusion power technology',
cost = 1000,
icon = '',
description = '',
- parents = {},
- children = {},
+ parents = {TechId.APT},
+ abilities = {},
+ },
+ {
+ name = 'Cruiser technology',
+ cost = 1000,
+ icon = '',
+ description = '',
+ parents = {TechId.FPT},
+ abilities = {},
+ },
+ {
+ name = 'Energy field technology',
+ cost = 1000,
+ icon = '',
+ description = '',
+ parents = {TechId.APT},
+ abilities = {},
+ },
+ {
+ name = 'Stealth technology',
+ cost = 1000,
+ icon = '',
+ description = '',
+ parents = {TechId.EFT},
+ abilities = {},
+ },
+ {
+ name = 'Robotics',
+ cost = 1000,
+ icon = '',
+ description = '',
+ parents = {TechId.EFT},
+ abilities = {},
+ },
+ {
+ name = 'Plasma casting technology',
+ cost = 1000,
+ icon = '',
+ description = '',
+ parents = {TechId.APT},
+ abilities = {},
+ },
+ {
+ name = 'Carrier technology',
+ cost = 1000,
+ icon = '',
+ description = '',
+ parents = {TechId.PCT},
+ abilities = {},
+ },
+ {
+ name = 'Tank technology',
+ cost = 1000,
+ icon = '',
+ description = '',
+ parents = {TechId.PCT},
abilities = {},
},
}
diff --git a/Assets/Textures/Icons/Cursors/attack.png b/Assets/Textures/Icons/Cursors/attack.png
new file mode 100644
index 0000000..3707cc9
Binary files /dev/null and b/Assets/Textures/Icons/Cursors/attack.png differ
diff --git a/Assets/Textures/Icons/Cursors/garrison.png b/Assets/Textures/Icons/Cursors/garrison.png
new file mode 100644
index 0000000..f11ba83
Binary files /dev/null and b/Assets/Textures/Icons/Cursors/garrison.png differ
diff --git a/Assets/Textures/Icons/Cursors/garrison.svg b/Assets/Textures/Icons/Cursors/garrison.svg
new file mode 100644
index 0000000..e051593
--- /dev/null
+++ b/Assets/Textures/Icons/Cursors/garrison.svg
@@ -0,0 +1,51 @@
+
+
+
+
diff --git a/Assets/Textures/Icons/Cursors/pointer.png b/Assets/Textures/Icons/Cursors/pointer.png
new file mode 100755
index 0000000..746a54c
Binary files /dev/null and b/Assets/Textures/Icons/Cursors/pointer.png differ
diff --git a/Assets/Textures/Icons/aam.png b/Assets/Textures/Icons/GameObjects/aam.png
similarity index 100%
rename from Assets/Textures/Icons/aam.png
rename to Assets/Textures/Icons/GameObjects/aam.png
diff --git a/Assets/Textures/Icons/aircraftCarrier00.png b/Assets/Textures/Icons/GameObjects/aircraftCarrier00.png
similarity index 100%
rename from Assets/Textures/Icons/aircraftCarrier00.png
rename to Assets/Textures/Icons/GameObjects/aircraftCarrier00.png
diff --git a/Assets/Textures/Icons/aircraftCarrier01.png b/Assets/Textures/Icons/GameObjects/aircraftCarrier01.png
similarity index 100%
rename from Assets/Textures/Icons/aircraftCarrier01.png
rename to Assets/Textures/Icons/GameObjects/aircraftCarrier01.png
diff --git a/Assets/Textures/Icons/awm.png b/Assets/Textures/Icons/GameObjects/awm.png
similarity index 100%
rename from Assets/Textures/Icons/awm.png
rename to Assets/Textures/Icons/GameObjects/awm.png
diff --git a/Assets/Textures/Icons/battleship00.png b/Assets/Textures/Icons/GameObjects/battleship00.png
similarity index 100%
rename from Assets/Textures/Icons/battleship00.png
rename to Assets/Textures/Icons/GameObjects/battleship00.png
diff --git a/Assets/Textures/Icons/battleship01.png b/Assets/Textures/Icons/GameObjects/battleship01.png
similarity index 100%
rename from Assets/Textures/Icons/battleship01.png
rename to Assets/Textures/Icons/GameObjects/battleship01.png
diff --git a/Assets/Textures/Icons/cruiser00.png b/Assets/Textures/Icons/GameObjects/cruiser00.png
similarity index 100%
rename from Assets/Textures/Icons/cruiser00.png
rename to Assets/Textures/Icons/GameObjects/cruiser00.png
diff --git a/Assets/Textures/Icons/cruiser01.png b/Assets/Textures/Icons/GameObjects/cruiser01.png
similarity index 100%
rename from Assets/Textures/Icons/cruiser01.png
rename to Assets/Textures/Icons/GameObjects/cruiser01.png
diff --git a/Assets/Textures/Icons/destroyer00.png b/Assets/Textures/Icons/GameObjects/destroyer00.png
similarity index 100%
rename from Assets/Textures/Icons/destroyer00.png
rename to Assets/Textures/Icons/GameObjects/destroyer00.png
diff --git a/Assets/Textures/Icons/destroyer01.png b/Assets/Textures/Icons/GameObjects/destroyer01.png
similarity index 100%
rename from Assets/Textures/Icons/destroyer01.png
rename to Assets/Textures/Icons/GameObjects/destroyer01.png
diff --git a/Assets/Textures/Icons/guidedMissile00.png b/Assets/Textures/Icons/GameObjects/guidedMissile00.png
similarity index 100%
rename from Assets/Textures/Icons/guidedMissile00.png
rename to Assets/Textures/Icons/GameObjects/guidedMissile00.png
diff --git a/Assets/Textures/Icons/guidedMissile01.png b/Assets/Textures/Icons/GameObjects/guidedMissile01.png
similarity index 100%
rename from Assets/Textures/Icons/guidedMissile01.png
rename to Assets/Textures/Icons/GameObjects/guidedMissile01.png
diff --git a/Assets/Textures/Icons/jet00.png b/Assets/Textures/Icons/GameObjects/jet00.png
similarity index 100%
rename from Assets/Textures/Icons/jet00.png
rename to Assets/Textures/Icons/GameObjects/jet00.png
diff --git a/Assets/Textures/Icons/jet01.png b/Assets/Textures/Icons/GameObjects/jet01.png
similarity index 100%
rename from Assets/Textures/Icons/jet01.png
rename to Assets/Textures/Icons/GameObjects/jet01.png
diff --git a/Assets/Textures/Icons/submarine00.png b/Assets/Textures/Icons/GameObjects/submarine00.png
similarity index 100%
rename from Assets/Textures/Icons/submarine00.png
rename to Assets/Textures/Icons/GameObjects/submarine00.png
diff --git a/Assets/Textures/Icons/submarine01.png b/Assets/Textures/Icons/GameObjects/submarine01.png
similarity index 100%
rename from Assets/Textures/Icons/submarine01.png
rename to Assets/Textures/Icons/GameObjects/submarine01.png
diff --git a/Assets/Textures/Icons/PlayerStates/alliance.png b/Assets/Textures/Icons/PlayerStates/alliance.png
new file mode 100644
index 0000000..aaf75eb
Binary files /dev/null and b/Assets/Textures/Icons/PlayerStates/alliance.png differ
diff --git a/Assets/Textures/Icons/PlayerStates/alliance.svg b/Assets/Textures/Icons/PlayerStates/alliance.svg
new file mode 100644
index 0000000..288989d
--- /dev/null
+++ b/Assets/Textures/Icons/PlayerStates/alliance.svg
@@ -0,0 +1,235 @@
+
+
diff --git a/Assets/Textures/Icons/PlayerStates/war.png b/Assets/Textures/Icons/PlayerStates/war.png
new file mode 100644
index 0000000..3707cc9
Binary files /dev/null and b/Assets/Textures/Icons/PlayerStates/war.png differ
diff --git a/Assets/Textures/Icons/PlayerStates/war.svg b/Assets/Textures/Icons/PlayerStates/war.svg
new file mode 100644
index 0000000..b60f216
--- /dev/null
+++ b/Assets/Textures/Icons/PlayerStates/war.svg
@@ -0,0 +1,73 @@
+
+
+
+
diff --git a/Assets/Textures/Icons/Resources/refineds.png b/Assets/Textures/Icons/Resources/refineds.png
new file mode 100644
index 0000000..80bf7bd
Binary files /dev/null and b/Assets/Textures/Icons/Resources/refineds.png differ
diff --git a/Assets/Textures/Icons/Resources/refineds.svg b/Assets/Textures/Icons/Resources/refineds.svg
new file mode 100644
index 0000000..ad7be71
--- /dev/null
+++ b/Assets/Textures/Icons/Resources/refineds.svg
@@ -0,0 +1,98 @@
+
+
+
+
diff --git a/Assets/Textures/Icons/Resources/refines.svg b/Assets/Textures/Icons/Resources/refines.svg
new file mode 100644
index 0000000..b224c12
--- /dev/null
+++ b/Assets/Textures/Icons/Resources/refines.svg
@@ -0,0 +1,95 @@
+
+
+
+
diff --git a/Assets/Textures/Icons/Resources/research.png b/Assets/Textures/Icons/Resources/research.png
new file mode 100644
index 0000000..4c3551e
Binary files /dev/null and b/Assets/Textures/Icons/Resources/research.png differ
diff --git a/Assets/Textures/Icons/Resources/research.svg b/Assets/Textures/Icons/Resources/research.svg
new file mode 100644
index 0000000..9564211
--- /dev/null
+++ b/Assets/Textures/Icons/Resources/research.svg
@@ -0,0 +1,55 @@
+
+
+
+
diff --git a/Assets/Textures/Icons/Resources/time.png b/Assets/Textures/Icons/Resources/time.png
new file mode 100644
index 0000000..ae1ba7c
Binary files /dev/null and b/Assets/Textures/Icons/Resources/time.png differ
diff --git a/Assets/Textures/Icons/Resources/time.svg b/Assets/Textures/Icons/Resources/time.svg
new file mode 100644
index 0000000..8462ec8
--- /dev/null
+++ b/Assets/Textures/Icons/Resources/time.svg
@@ -0,0 +1,66 @@
+
+
+
+
diff --git a/Assets/Textures/Icons/Resources/wealth.png b/Assets/Textures/Icons/Resources/wealth.png
new file mode 100644
index 0000000..e7104b5
Binary files /dev/null and b/Assets/Textures/Icons/Resources/wealth.png differ
diff --git a/Assets/Textures/Icons/Resources/wealth.svg b/Assets/Textures/Icons/Resources/wealth.svg
new file mode 100644
index 0000000..f4834cd
--- /dev/null
+++ b/Assets/Textures/Icons/Resources/wealth.svg
@@ -0,0 +1,62 @@
+
+
+
+
diff --git a/Assets/Textures/Icons/Technologies/apt.jpg b/Assets/Textures/Icons/Technologies/apt.jpg
new file mode 100755
index 0000000..a1451cc
Binary files /dev/null and b/Assets/Textures/Icons/Technologies/apt.jpg differ
diff --git a/Assets/Textures/Icons/Technologies/carriers.jpg b/Assets/Textures/Icons/Technologies/carriers.jpg
new file mode 100755
index 0000000..a1451cc
Binary files /dev/null and b/Assets/Textures/Icons/Technologies/carriers.jpg differ
diff --git a/Assets/Textures/Icons/Technologies/cruisers.jpg b/Assets/Textures/Icons/Technologies/cruisers.jpg
new file mode 100755
index 0000000..a1451cc
Binary files /dev/null and b/Assets/Textures/Icons/Technologies/cruisers.jpg differ
diff --git a/Assets/Textures/Icons/Technologies/ept.jpg b/Assets/Textures/Icons/Technologies/ept.jpg
new file mode 100755
index 0000000..a1451cc
Binary files /dev/null and b/Assets/Textures/Icons/Technologies/ept.jpg differ
diff --git a/Assets/Textures/Icons/Technologies/fpt.jpg b/Assets/Textures/Icons/Technologies/fpt.jpg
new file mode 100755
index 0000000..a1451cc
Binary files /dev/null and b/Assets/Textures/Icons/Technologies/fpt.jpg differ
diff --git a/Assets/Textures/Icons/Technologies/pct.jpg b/Assets/Textures/Icons/Technologies/pct.jpg
new file mode 100755
index 0000000..a1451cc
Binary files /dev/null and b/Assets/Textures/Icons/Technologies/pct.jpg differ
diff --git a/Assets/Textures/Icons/Technologies/robo.jpg b/Assets/Textures/Icons/Technologies/robo.jpg
new file mode 100755
index 0000000..a1451cc
Binary files /dev/null and b/Assets/Textures/Icons/Technologies/robo.jpg differ
diff --git a/Assets/Textures/Icons/Technologies/stealth.jpg b/Assets/Textures/Icons/Technologies/stealth.jpg
new file mode 100755
index 0000000..a1451cc
Binary files /dev/null and b/Assets/Textures/Icons/Technologies/stealth.jpg differ
diff --git a/Assets/Textures/Icons/Technologies/tanks.jpg b/Assets/Textures/Icons/Technologies/tanks.jpg
new file mode 100755
index 0000000..a1451cc
Binary files /dev/null and b/Assets/Textures/Icons/Technologies/tanks.jpg differ
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0836f53..dae23e7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,9 +10,11 @@ cmake_policy(SET CMP0015 NEW)
set(UNIT_BUTTONS unitButton.cpp tradeButton.cpp buildButton.cpp trainButton.cpp researchButton.cpp)
set(OPTIONS_BUTTONS optionsButton.cpp tabButton.cpp okButton.cpp defaultsButton.cpp)
-set(IN_GAME_APP_STATE_BUTTONS mainMenuButton.cpp)
+set(TRADING_BUTTONS playerTradeButton.cpp tradingScreenButton.cpp offerButton.cpp resourceAmmountButton.cpp)
+set(MENU_BUTTONS mainMenuButton.cpp singlePlayerButton.cpp exitButton.cpp backButton.cpp playButton.cpp)
set(MAP_EDITOR_BUTTONS mapEditorButton.cpp newMapButton.cpp loadMapButton.cpp exportButton.cpp)
-set(BUTTONS singlePlayerButton.cpp exitButton.cpp backButton.cpp playButton.cpp statsButton.cpp ${OPTIONS_BUTTONS} ${IN_GAME_APP_STATE_BUTTONS} ${MAP_EDITOR_BUTTONS} ${UNIT_BUTTONS})
+set(BUTTONS statsButton.cpp activeStateButton.cpp ${TRADING_BUTTONS} ${OPTIONS_BUTTONS} ${MENU_BUTTONS} ${MAP_EDITOR_BUTTONS} ${UNIT_BUTTONS})
+
set(LISTBOXES skyboxTextureListbox.cpp landTextureListbox.cpp gameObjectListbox.cpp)
set(GUI tooltip.cpp concreteGuiManager.cpp ${BUTTONS} ${LISTBOXES})
diff --git a/activeGameState.cpp b/activeGameState.cpp
index 097707c..d386d50 100755
--- a/activeGameState.cpp
+++ b/activeGameState.cpp
@@ -2,6 +2,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -34,17 +35,14 @@ namespace battleship{
using namespace configData;
using namespace gameBase;
- ActiveGameState::ActiveGameState(GuiAppState *guiState, int playerId) : AbstractAppState(
+ ActiveGameState::ActiveGameState(GuiAppState *gs, int plId) : AbstractAppState(
AppStateType::ACTIVE_STATE,
configData::calcSumBinds(AppStateType::ACTIVE_STATE, true),
configData::calcSumBinds(AppStateType::ACTIVE_STATE, false),
- GameManager::getSingleton()->getPath() + scripts[(int)ScriptFiles::OPTIONS]){
- this->guiState = guiState;
- this->playerId = playerId;
- mainPlayer = Game::getSingleton()->getPlayer(playerId);
- depth = 1;
-
+ GameManager::getSingleton()->getPath() + scripts[(int)ScriptFiles::OPTIONS]), guiState(gs), playerId(plId), depth(1){
initDragbox();
+
+ mainPlayer = Game::getSingleton()->getPlayer(playerId);
}
ActiveGameState::~ActiveGameState() {
@@ -67,6 +65,28 @@ namespace battleship{
root->getGuiNode()->attachChild(dragboxNode);
}
+ void ActiveGameState::initCursor(){
+ string basePath = GameManager::getSingleton()->getPath() + "Textures/Icons/Cursors/";
+ sol::state_view SOL_LUA_VIEW = generateView();
+
+ string p1[]{basePath + (string)SOL_LUA_VIEW["pointerTex"]}, p2[]{basePath + (string)SOL_LUA_VIEW["attackTex"]}, p3[]{basePath + (string)SOL_LUA_VIEW["garrisonTex"]};
+ pointerTex = new Texture(p1, 1, false);
+ attackTex = new Texture(p2, 1, false);
+ garrisonTex = new Texture(p3, 1, false);
+
+ Root *root = Root::getSingleton();
+ Material *mat = new Material(root->getLibPath() + "gui");
+ mat->addBoolUniform("texturingEnabled", true);
+ mat->addTexUniform("diffuseMap", pointerTex, false);
+
+ Quad *quad = new Quad(Vector3(20, 20, 0), false);
+ quad->setMaterial(mat);
+
+ cursorNode = new Node();
+ cursorNode->attachMesh(quad);
+ root->getGuiNode()->attachChild(cursorNode);
+ }
+
void ActiveGameState::removeDragbox(){
Root::getSingleton()->getRootNode()->dettachChild(dragboxNode);
delete dragboxNode;
@@ -75,18 +95,49 @@ namespace battleship{
void ActiveGameState::onAttached() {
AbstractAppState::onAttached();
ConcreteGuiManager::getSingleton()->readLuaScreenScript("activeGameState.lua");
+
+ if(!cursorNode) initCursor();
}
void ActiveGameState::onDettached() {
AbstractAppState::onDettached();
}
+ void ActiveGameState::updateCursor(){
+ Vector2 cursorPos = getCursorPos();
+ cursorNode->setPosition(Vector3(cursorPos.x, cursorPos.y, .8));
+
+ bool canSelect = canSelectHoveredOnGameObj();
+ bool ownGameObj = (gameObjHoveredOn && gameObjHoveredOn->getPlayer()->getTeam() == mainPlayer->getTeam());
+
+ if(controlPressed || (gameObjHoveredOn && !ownGameObj && gameObjHoveredOn->getType() == GameObject::Type::UNIT))
+ cursorState = CursorState::ATTACK;
+ else
+ cursorState = CursorState::NORMAL;
+
+ cursorNode->setVisible(cursorState != CursorState::NORMAL);
+ Texture *tex = nullptr;
+
+ switch(cursorState){
+ case CursorState::ATTACK:
+ tex = attackTex;
+ break;
+ case CursorState::GARRISON:
+ tex = garrisonTex;
+ break;
+ }
+
+ cursorNode->getMesh(0)->getMaterial()->setTexUniform("diffuseMap", tex, false);
+ }
+
void ActiveGameState::update() {
ConcreteGuiManager *guiManager = ConcreteGuiManager::getSingleton();
guiManager->getText("depth")->setText(L"Depth: " + to_wstring(depth));
- guiManager->getText("refineds")->setText(L"Refineds: " + to_wstring(mainPlayer->getResource(ResourceType::REFINEDS)));
- guiManager->getText("wealth")->setText(L"Wealth: " + to_wstring(mainPlayer->getResource(ResourceType::WEALTH)));
- guiManager->getText("research")->setText(L"Research: " + to_wstring(mainPlayer->getResource(ResourceType::RESEARCH)));
+ guiManager->getText("refineds")->setText(to_wstring(mainPlayer->getResource(ResourceType::REFINEDS)));
+ guiManager->getText("wealth")->setText(to_wstring(mainPlayer->getResource(ResourceType::WEALTH)));
+ guiManager->getText("research")->setText(to_wstring(mainPlayer->getResource(ResourceType::RESEARCH)));
+
+ updateCursor();
if(!isSelectionBox && leftMouseClicked && getTime() - lastLeftMouseClicked > 10)
isSelectionBox = true;
@@ -159,9 +210,8 @@ namespace battleship{
ufCtr->removeGameObjectFrames();
ufCtr->setPlacingFrames(false);
- ConcreteGuiManager::getSingleton()->removeAllButtons();
- buttons.clear();
unitGuiScreen = "";
+ ConcreteGuiManager::getSingleton()->readLuaScreenScript("activeGameState.lua");
}
bool ActiveGameState::selectedUnitsAmongst(vector units){
@@ -187,7 +237,7 @@ namespace battleship{
vector checkboxes{};
vector sliders{};
vector textboxes{};
- vector guiRects{};
+ vector guiRects = guiManager->getGuiRectangles();
vector texts{
guiManager->getText("depth"),
guiManager->getText("refineds"),
@@ -331,6 +381,9 @@ namespace battleship{
void ActiveGameState::onAction(int bind, bool isPressed) {
GameObjectFrameController *ufCtr = GameObjectFrameController::getSingleton();
+ if(!ConcreteGuiManager::getSingleton()->findClickedButtons().empty())
+ return;
+
switch((Bind)bind){
case Bind::DRAG_BOX:
leftMouseClicked = isPressed;
diff --git a/activeGameState.h b/activeGameState.h
index 6de8d1b..0cf60ef 100755
--- a/activeGameState.h
+++ b/activeGameState.h
@@ -8,6 +8,7 @@
namespace vb01{
class Node;
+ class Texture;
}
namespace vb01Gui{
@@ -31,8 +32,17 @@ namespace battleship{
inline Player* getPlayer(){return mainPlayer;}
inline std::vector& getUnitGroup(int i){return unitGroups[i];}
private:
+ enum CursorState{
+ NORMAL,
+ ATTACK,
+ GARRISON,
+ SUPPLY
+ };
+
bool selectedUnitsAmongst(std::vector);
void updateGameObjHoveredOn();
+ void initCursor();
+ void updateCursor();
void initDragbox();
void removeDragbox();
void deselectUnits();
@@ -45,8 +55,9 @@ namespace battleship{
void enableUnitState(Unit::State);
inline bool canSelectHoveredOnGameObj(){return gameObjHoveredOn && gameObjHoveredOn->isSelectable() && gameObjHoveredOn->getPlayer() == mainPlayer;}
- GuiAppState *guiState;
+ CursorState cursorState = CursorState::NORMAL;
Player *mainPlayer;
+ GuiAppState *guiState;
std::string unitGuiScreen = "";
GameObject *gameObjHoveredOn = nullptr;
vb01::Node *dragboxNode = nullptr;
@@ -59,6 +70,8 @@ namespace battleship{
const int NUM_MAX_ZOOMS = 10;
float depth = 1;
vb01::s64 lastLeftMouseClicked = 0;
+ vb01::Node *cursorNode = nullptr;
+ vb01::Texture *pointerTex = nullptr, *attackTex = nullptr, *garrisonTex = nullptr;
};
}
diff --git a/activeStateButton.cpp b/activeStateButton.cpp
new file mode 100644
index 0000000..2a25bbb
--- /dev/null
+++ b/activeStateButton.cpp
@@ -0,0 +1,50 @@
+#include "activeStateButton.h"
+#include "gameManager.h"
+#include "activeGameState.h"
+#include "concreteGuiManager.h"
+
+#include
+#include
+#include
+#include
+
+#include
+
+#include
+
+namespace battleship{
+ using namespace std;
+ using namespace vb01;
+ using namespace vb01Gui;
+ using namespace gameBase;
+
+ ActiveStateButton::ActiveStateButton(Vector3 pos, Vector2 size, string gs, string name, int trigger, string imagePath) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", trigger, true, imagePath), guiScreen(gs){
+ StateManager *stateManager = GameManager::getSingleton()->getStateManager();
+ ActiveGameState *activeState = (ActiveGameState*)stateManager->getAppStateByType((int)AppStateType::ACTIVE_STATE);
+
+ if(activeState)
+ activeState->addButton(this);
+ }
+
+ void ActiveStateButton::onClick(){
+ ConcreteGuiManager *guiManager = ConcreteGuiManager::getSingleton();
+
+ vector listboxes{};
+ vector checkboxes{};
+ vector sliders{};
+ vector textboxes{};
+ vector guiRects{
+ guiManager->getGuiRectangle("refineds"),
+ guiManager->getGuiRectangle("wealth"),
+ guiManager->getGuiRectangle("research"),
+ };
+ vector texts{
+ guiManager->getText("depth"),
+ guiManager->getText("refineds"),
+ guiManager->getText("wealth"),
+ guiManager->getText("research")
+ };
+
+ guiManager->readLuaScreenScript(guiScreen, buttons, listboxes, checkboxes, sliders, textboxes, guiRects, texts);
+ }
+}
diff --git a/activeStateButton.h b/activeStateButton.h
new file mode 100644
index 0000000..2def462
--- /dev/null
+++ b/activeStateButton.h
@@ -0,0 +1,18 @@
+#ifndef ACTIVE_STATE_BUTTON_H
+#define ACTIVE_STATE_BUTTON_H
+
+#include
+
+namespace battleship{
+ class ActiveStateButton : public vb01Gui::Button{
+ public:
+ ActiveStateButton(vb01::Vector3, vb01::Vector2, std::string, std::string, int = -1, std::string = "");
+ void onClick();
+ private:
+ std::string guiScreen = "";
+ protected:
+ std::vector buttons;
+ };
+}
+
+#endif
diff --git a/backButton.cpp b/backButton.cpp
index a0d7d55..eb40f90 100644
--- a/backButton.cpp
+++ b/backButton.cpp
@@ -7,7 +7,7 @@ namespace battleship{
using namespace vb01;
using namespace vb01Gui;
- BackButton::BackButton(Vector2 pos, Vector2 size, string name, string screen) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) {
+ BackButton::BackButton(Vector3 pos, Vector2 size, string name, string screen) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) {
this->screen = screen;
}
diff --git a/backButton.h b/backButton.h
index b0f7fc3..504eef7 100644
--- a/backButton.h
+++ b/backButton.h
@@ -6,7 +6,7 @@
namespace battleship{
class BackButton : public vb01Gui::Button{
public:
- BackButton(vb01::Vector2, vb01::Vector2, std::string, std::string);
+ BackButton(vb01::Vector3, vb01::Vector2, std::string, std::string);
void onClick();
private:
std::string screen;
diff --git a/buildButton.cpp b/buildButton.cpp
index 29f57e0..32790ec 100644
--- a/buildButton.cpp
+++ b/buildButton.cpp
@@ -16,7 +16,7 @@ namespace battleship{
using namespace vb01Gui;
using namespace gameBase;
- BuildButton::BuildButton(Vector2 pos, Vector2 size, string name, int trigger, string imagePath, int uid, int slId) :
+ BuildButton::BuildButton(Vector3 pos, Vector2 size, string name, int trigger, string imagePath, int uid, int slId) :
UnitButton(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", trigger, imagePath, uid), slotId(slId){}
void BuildButton::onClick(){
diff --git a/buildButton.h b/buildButton.h
index b4cd97b..a87af94 100644
--- a/buildButton.h
+++ b/buildButton.h
@@ -6,7 +6,7 @@
namespace battleship{
class BuildButton : public UnitButton{
public:
- BuildButton(vb01::Vector2, vb01::Vector2, std::string, int, std::string, int, int);
+ BuildButton(vb01::Vector3, vb01::Vector2, std::string, int, std::string, int, int);
void onClick();
private:
int slotId;
diff --git a/concreteGuiManager.cpp b/concreteGuiManager.cpp
index 51f0f35..7356c01 100644
--- a/concreteGuiManager.cpp
+++ b/concreteGuiManager.cpp
@@ -26,6 +26,11 @@
#include "statsButton.h"
#include "researchButton.h"
#include "tradeButton.h"
+#include "activeStateButton.h"
+#include "playerTradeButton.h"
+#include "tradingScreenButton.h"
+#include "offerButton.h"
+#include "resourceAmmountButton.h"
namespace battleship{
using namespace std;
@@ -35,6 +40,12 @@ namespace battleship{
static ConcreteGuiManager *concreteGuiManager = nullptr;
+ ConcreteGuiManager::ConcreteGuiManager(){
+ string assetPath = GameManager::getSingleton()->getPath();
+ texBasePath = assetPath + "Textures/";
+ fontBasePath = assetPath + "Fonts/";
+ }
+
ConcreteGuiManager* ConcreteGuiManager::getSingleton(){
if(!concreteGuiManager)
concreteGuiManager = new ConcreteGuiManager();
@@ -43,21 +54,28 @@ namespace battleship{
}
//TODO refactor player difficulty and faction listbox selection
+ //TODO remove hardcoded font path values
Button* ConcreteGuiManager::parseButton(int guiId){
sol::state_view SOL_LUA_STATE = generateView();
sol::table guiTable = SOL_LUA_STATE["gui"][guiId + 1];
sol::table posTable = guiTable["pos"];
- Vector2 pos = Vector2(posTable["x"], posTable["y"]);
+ Vector3 pos = Vector3(posTable["x"], posTable["y"], posTable["z"]);
sol::table sizeTable = guiTable["size"];
Vector2 size = Vector2(sizeTable["x"], sizeTable["y"]);
+ //TODO factor out repetetive optional lua key checks
string nk = "name";
sol::optional nameOpt = guiTable[nk];
string name = (nameOpt != sol::nullopt ? (string)guiTable[nk] : "");
ButtonType type = (ButtonType)guiTable["buttonType"];
+ string ipk = "imagePath";
+ sol::optional pathOpt = guiTable[ipk];
+ string imagePath = (pathOpt != sol::nullopt ? texBasePath + (string)guiTable[ipk] : "");
+ bool texturingEnabled = (imagePath != "");
+
Button *button = nullptr;
switch(type){
@@ -168,7 +186,7 @@ namespace battleship{
int unitId = SOL_LUA_STATE["UnitId"]["ENGINEER"];
int strId = SOL_LUA_STATE["units"][unitId + 1]["buildableUnits"][guiId + 1]["id"];
string buttonName = SOL_LUA_STATE["units"][strId + 1]["name"];
- button = new BuildButton(pos, size, buttonName, (int)guiTable["trigger"], (string)guiTable["imagePath"], unitId, guiId);
+ button = new BuildButton(pos, size, buttonName, (int)guiTable["trigger"], imagePath, unitId, guiId);
break;
}
case LAND_FACTORY_TRAIN:
@@ -176,7 +194,7 @@ namespace battleship{
int facId = SOL_LUA_STATE["UnitId"]["LAND_FACTORY"];
int unitId = SOL_LUA_STATE["units"][facId + 1]["buildableUnits"][guiId + 1]["id"];
string buttonName = SOL_LUA_STATE["units"][unitId + 1]["name"];
- button = new TrainButton(pos, size, buttonName, (int)guiTable["trigger"], (string)guiTable["imagePath"], facId, guiId);
+ button = new TrainButton(pos, size, buttonName, (int)guiTable["trigger"], imagePath, facId, guiId);
break;
}
case NAVAL_FACTORY_TRAIN:
@@ -184,7 +202,7 @@ namespace battleship{
int facId = SOL_LUA_STATE["UnitId"]["NAVAL_FACTORY"];
int unitId = SOL_LUA_STATE["units"][facId + 1]["buildableUnits"][guiId + 1]["id"];
string buttonName = SOL_LUA_STATE["units"][unitId + 1]["name"];
- button = new TrainButton(pos, size, buttonName, (int)guiTable["trigger"], (string)guiTable["imagePath"], facId, guiId);
+ button = new TrainButton(pos, size, buttonName, (int)guiTable["trigger"], imagePath, facId, guiId);
break;
}
case FORT_TRAIN:
@@ -192,26 +210,45 @@ namespace battleship{
int facId = SOL_LUA_STATE["UnitId"]["FORT"];
int unitId = SOL_LUA_STATE["units"][facId + 1]["buildableUnits"][guiId + 1]["id"];
string buttonName = SOL_LUA_STATE["units"][unitId + 1]["name"];
- button = new TrainButton(pos, size, buttonName, (int)guiTable["trigger"], (string)guiTable["imagePath"], facId, guiId);
+ button = new TrainButton(pos, size, buttonName, (int)guiTable["trigger"], imagePath, facId, guiId);
break;
}
case STATISTICS:
- button = new StatsButton(pos, size, name, (int)guiTable["trigger"], (string)guiTable["imagePath"]);
+ button = new StatsButton(pos, size, name, (int)guiTable["trigger"], imagePath);
break;
case RESEARCH:
- button = new ResearchButton(pos, size, name, (int)guiTable["trigger"], (string)guiTable["imagePath"], (int)SOL_LUA_STATE["UnitId"]["LAB"], (int)guiTable["techId"]);
+ button = new ResearchButton(pos, size, name, (int)guiTable["trigger"], imagePath, (int)SOL_LUA_STATE["UnitId"]["LAB"], (int)guiTable["techId"]);
break;
case BUY_REFINEDS:
- button = new TradeButton(pos, size, name, (int)guiTable["trigger"], (string)guiTable["imagePath"], (int)SOL_LUA_STATE["UnitId"]["TRADE_CENTER"], TradeButton::Type::BUY_REFINEDS);
+ button = new TradeButton(pos, size, name, (int)guiTable["trigger"], imagePath, (int)SOL_LUA_STATE["UnitId"]["TRADE_CENTER"], TradeButton::Type::BUY_REFINEDS);
break;
case SELL_REFINEDS:
- button = new TradeButton(pos, size, name, (int)guiTable["trigger"], (string)guiTable["imagePath"], (int)SOL_LUA_STATE["UnitId"]["TRADE_CENTER"], TradeButton::Type::SELL_REFINEDS);
+ button = new TradeButton(pos, size, name, (int)guiTable["trigger"], imagePath, (int)SOL_LUA_STATE["UnitId"]["TRADE_CENTER"], TradeButton::Type::SELL_REFINEDS);
break;
case BUY_RESEARCH:
- button = new TradeButton(pos, size, name, (int)guiTable["trigger"], (string)guiTable["imagePath"], (int)SOL_LUA_STATE["UnitId"]["TRADE_CENTER"], TradeButton::Type::BUY_RESEARCH);
+ button = new TradeButton(pos, size, name, (int)guiTable["trigger"], imagePath, (int)SOL_LUA_STATE["UnitId"]["TRADE_CENTER"], TradeButton::Type::BUY_RESEARCH);
break;
case SELL_RESEARCH:
- button = new TradeButton(pos, size, name, (int)guiTable["trigger"], (string)guiTable["imagePath"], (int)SOL_LUA_STATE["UnitId"]["TRADE_CENTER"], TradeButton::Type::SELL_RESEARCH);
+ button = new TradeButton(pos, size, name, (int)guiTable["trigger"], imagePath, (int)SOL_LUA_STATE["UnitId"]["TRADE_CENTER"], TradeButton::Type::SELL_RESEARCH);
+ break;
+ case ACTIVE_GAME_STATE:
+ button = new ActiveStateButton(pos, size, (string)guiTable["guiScreen"], name, (int)guiTable["trigger"], imagePath);
+ break;
+ case PLAYER_TRADE:
+ button = new PlayerTradeButton(pos, size, (string)guiTable["guiScreen"], name, (int)guiTable["trigger"], imagePath);
+ break;
+ case TRADING_SCREEN:{
+ int lid = guiTable["dependencies"][1]["id"];
+ Listbox *listbox = (Listbox*)guiElements[lid].second;
+
+ button = new TradingScreenButton(pos, size, listbox, (int)SOL_LUA_STATE["playerId"], (string)guiTable["guiScreen"], name, (int)guiTable["trigger"], imagePath);
+ break;
+ }
+ case TRADE_OFFER:
+ button = new OfferButton(pos, size, (int)SOL_LUA_STATE["playerId"], name, (int)guiTable["trigger"], imagePath);
+ break;
+ case RESOURCE_AMMOUNT:
+ button = new ResourceAmmountButton(pos, size, name, (int)guiTable["ammount"], (int)guiTable["trigger"], imagePath);
break;
}
@@ -229,7 +266,7 @@ namespace battleship{
sol::table guiTable = SOL_LUA_STATE["gui"][guiId + 1];
string posTable = "pos";
- Vector2 pos = Vector2(guiTable[posTable]["x"], guiTable[posTable]["y"]);
+ Vector3 pos = Vector3(guiTable[posTable]["x"], guiTable[posTable]["y"], guiTable[posTable]["z"]);
string sizeTable = "size";
Vector2 size = Vector2(guiTable[sizeTable]["x"], guiTable[sizeTable]["y"]);
@@ -242,7 +279,7 @@ namespace battleship{
bool closable;
Listbox *listbox = nullptr;
- string fontPath = GameManager::getSingleton()->getPath() + "Fonts/batang.ttf";
+ string fontPath = fontBasePath + "batang.ttf";
switch(listboxType){
case CONTROLS:{
@@ -306,7 +343,7 @@ namespace battleship{
break;
}
case SKYBOX_TEXTURES:
- lines = readDir(GameManager::getSingleton()->getPath() + "Textures/Skyboxes", true);
+ lines = readDir(texBasePath + "Skyboxes", true);
numLines = lines.size();
closable = true;
maxDisplay = (numLines > numMaxDisplay ? numMaxDisplay : numLines);
@@ -314,7 +351,7 @@ namespace battleship{
listbox = new SkyboxTextureListbox(pos, size, lines, maxDisplay, fontPath);
break;
case LAND_TEXTURES:
- lines = readDir(GameManager::getSingleton()->getPath() + "Textures/Landmass", false);
+ lines = readDir(texBasePath + "Landmass", false);
numLines = lines.size();
closable = true;
maxDisplay = (numLines > numMaxDisplay ? numMaxDisplay : numLines);
@@ -347,6 +384,10 @@ namespace battleship{
listbox = new Listbox(pos, size, lines, maxDisplay, fontPath, closable);
}
break;
+ case TRADE_OFFERS:
+ closable = true;
+ listbox = new Listbox(pos, size, lines, numMaxDisplay, fontPath, closable);
+ break;
}
int typeArr[2]{(int)GuiElementType::LISTBOX, (int)listboxType};
@@ -360,10 +401,8 @@ namespace battleship{
sol::table guiTable = SOL_LUA_STATE["gui"][guiId + 1];
string posTable = "pos";
- Vector2 pos = Vector2(guiTable[posTable]["x"], guiTable[posTable]["y"]);
-
- string fontPath = GameManager::getSingleton()->getPath() + "Fonts/batang.ttf";
- Checkbox *checkbox = new Checkbox(pos, fontPath);
+ Vector3 pos = Vector3(guiTable[posTable]["x"], guiTable[posTable]["y"], guiTable[posTable]["z"]);
+ Checkbox *checkbox = new Checkbox(pos, fontBasePath + "batang.ttf");
int typeArr[2]{(int)GuiElementType::CHECKBOX, -1};
guiElements.push_back(make_pair(typeArr, (void*)checkbox));
@@ -376,7 +415,7 @@ namespace battleship{
sol::table guiTable = SOL_LUA_STATE["gui"][guiId + 1];
string posTable = "pos", sizeTable = "size";
- Vector2 pos = Vector2(guiTable[posTable]["x"], guiTable[posTable]["y"]);
+ Vector3 pos = Vector3(guiTable[posTable]["x"], guiTable[posTable]["y"], guiTable[posTable]["z"]);
Vector2 size = Vector2(guiTable[sizeTable]["x"], guiTable[sizeTable]["y"]);
Slider *slider = new Slider(pos, size, guiTable["minValue"], guiTable["maxValue"]);
@@ -392,11 +431,9 @@ namespace battleship{
sol::table guiTable = SOL_LUA_STATE["gui"][guiId + 1];
string posTable = "pos", sizeTable = "size";
- Vector2 pos = Vector2(guiTable[posTable]["x"], guiTable[posTable]["y"]);
+ Vector3 pos = Vector3(guiTable[posTable]["x"], guiTable[posTable]["y"], guiTable[posTable]["z"]);
Vector2 size = Vector2(guiTable[sizeTable]["x"], guiTable[sizeTable]["y"]);
-
- string fontPath = GameManager::getSingleton()->getPath() + "Fonts/batang.ttf";
- Textbox *textbox = new Textbox(pos, size, fontPath);
+ Textbox *textbox = new Textbox(pos, size, fontBasePath + "batang.ttf");
int typeArr[2]{(int)GuiElementType::TEXTBOX, -1};
guiElements.push_back(make_pair(typeArr, (void*)textbox));
@@ -404,22 +441,42 @@ namespace battleship{
return textbox;
}
+ //TODO factor out checking for optional lua values
Node* ConcreteGuiManager::parseGuiRectangle(int guiId){
sol::state_view SOL_LUA_STATE = generateView();
sol::table guiTable = SOL_LUA_STATE["gui"][guiId + 1];
Root *root = Root::getSingleton();
Material *mat = new Material(root->getLibPath() + "gui");
- mat->addBoolUniform("texturingEnabled", false);
- sol::table colorTable = guiTable["color"];
- mat->addVec4Uniform("diffuseColor", Vector4(colorTable["x"], colorTable["y"], colorTable["z"], colorTable["w"]));
+ mat->setTransparent(true);
+
+ string ipk = "imagePath";
+ sol::optional pathOpt = guiTable[ipk];
+ string imagePath = (pathOpt != sol::nullopt ? (string)guiTable[ipk] : "");
+ bool texturingEnabled = (imagePath != "");
+
+ string nk = "name";
+ sol::optional nameOpt = guiTable[nk];
+ string name = (nameOpt != sol::nullopt ? (string)guiTable[nk] : "");
+
+ mat->addBoolUniform("texturingEnabled", texturingEnabled);
+
+ if(texturingEnabled){
+ string p[]{texBasePath + (string)guiTable[ipk]};
+ Texture *tex = new Texture(p, 1, false);
+ mat->addTexUniform("diffuseMap", tex, false);
+ }
+ else{
+ sol::table colorTable = guiTable["color"];
+ mat->addVec4Uniform("diffuseColor", Vector4(colorTable["x"], colorTable["y"], colorTable["z"], colorTable["w"]));
+ }
sol::table sizeTable = guiTable["size"];
Quad *quad = new Quad(Vector3(sizeTable["x"], sizeTable["y"], 1), false);
quad->setMaterial(mat);
sol::table posTable = guiTable["pos"];
- Node *guiRectangle = new Node(Vector3(posTable["x"], posTable["y"], guiTable["zIndex"]));
+ Node *guiRectangle = new Node(Vector3(posTable["x"], posTable["y"], posTable["z"]), Quaternion::QUAT_W, Vector3::VEC_IJK, name);
guiRectangle->attachMesh(quad);
root->getGuiNode()->attachChild(guiRectangle);
@@ -433,6 +490,7 @@ namespace battleship{
sol::state_view SOL_LUA_STATE = generateView();
sol::table guiTable = SOL_LUA_STATE["gui"][guiId + 1];
sol::table posTable = guiTable["pos"];
+ sol::table scaleTable = guiTable["scale"];
Root *root = Root::getSingleton();
@@ -441,12 +499,12 @@ namespace battleship{
sol::table colorTable = guiTable["color"];
mat->addVec4Uniform("diffuseColor", Vector4(colorTable["x"], colorTable["y"], colorTable["z"], colorTable["w"]));
- Text *text = new Text(GameManager::getSingleton()->getPath() + "Fonts/" + (string)guiTable["font"], (wstring)guiTable["text"], guiTable["fontFirstChar"], guiTable["fontLastChar"]);
- text->setScale((float)guiTable["scale"]);
+ Text *text = new Text(fontBasePath + (string)guiTable["font"], (wstring)guiTable["text"], guiTable["fontFirstChar"], guiTable["fontLastChar"]);
text->setMaterial(mat);
- Vector3 pos = Vector3(posTable["x"], posTable["y"], guiTable["zIndex"]);
- Node *node = new Node(pos, Quaternion::QUAT_W, Vector3::VEC_IJK, guiTable["name"]);
+ Vector3 pos = Vector3(posTable["x"], posTable["y"], posTable["z"]);
+ Vector3 scale = Vector3(scaleTable["x"], scaleTable["y"], 1);
+ Node *node = new Node(pos, Quaternion::QUAT_W, scale, guiTable["name"]);
node->addText(text);
root->getGuiNode()->attachChild(node);
diff --git a/concreteGuiManager.h b/concreteGuiManager.h
index 3a9a57c..bc6c8e4 100644
--- a/concreteGuiManager.h
+++ b/concreteGuiManager.h
@@ -46,7 +46,12 @@ namespace battleship{
BUY_REFINEDS,
SELL_REFINEDS,
BUY_RESEARCH,
- SELL_RESEARCH
+ SELL_RESEARCH,
+ ACTIVE_GAME_STATE,
+ PLAYER_TRADE,
+ TRADING_SCREEN,
+ TRADE_OFFER,
+ RESOURCE_AMMOUNT
};
enum ListboxType {
CONTROLS,
@@ -59,7 +64,8 @@ namespace battleship{
LAND_TEXTURES,
CPU_DIFFICULTIES,
FACTIONS,
- CONSOLE
+ CONSOLE,
+ TRADE_OFFERS
};
class ConcreteGuiManager : public vb01Gui::AbstractGuiManager{
@@ -76,7 +82,7 @@ namespace battleship{
std::vector = std::vector{}
);
private:
- ConcreteGuiManager(){}
+ ConcreteGuiManager();
vb01Gui::Button* parseButton(int);
vb01Gui::Listbox* parseGameObjectListbox();
vb01Gui::Listbox* parseListbox(int);
@@ -87,6 +93,7 @@ namespace battleship{
vb01::Text* parseText(int);
std::vector> guiElements;
+ std::string texBasePath, fontBasePath;
};
}
diff --git a/defaultsButton.cpp b/defaultsButton.cpp
index 78d4cdc..8658e2c 100644
--- a/defaultsButton.cpp
+++ b/defaultsButton.cpp
@@ -6,7 +6,7 @@ namespace battleship{
using namespace vb01;
using namespace vb01Gui;
- DefaultsButton::DefaultsButton(Vector2 pos, Vector2 size, string name) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) {}
+ DefaultsButton::DefaultsButton(Vector3 pos, Vector2 size, string name) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) {}
void DefaultsButton::onClick() {}
}
diff --git a/defaultsButton.h b/defaultsButton.h
index ede19dd..f7ac6dd 100644
--- a/defaultsButton.h
+++ b/defaultsButton.h
@@ -6,7 +6,7 @@
namespace battleship{
class DefaultsButton : public vb01Gui::Button{
public:
- DefaultsButton(vb01::Vector2, vb01::Vector2, std::string);
+ DefaultsButton(vb01::Vector3, vb01::Vector2, std::string);
void onClick();
private:
};
diff --git a/exitButton.cpp b/exitButton.cpp
index f180df2..884f3fa 100755
--- a/exitButton.cpp
+++ b/exitButton.cpp
@@ -7,7 +7,7 @@ using namespace std;
using namespace vb01;
namespace battleship{
- ExitButton::ExitButton(Vector2 pos, Vector2 size) : Button(pos, size, "Exit", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) {}
+ ExitButton::ExitButton(Vector3 pos, Vector2 size) : Button(pos, size, "Exit", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) {}
void ExitButton::onClick() {
//Root::getSingleton()->set
diff --git a/exitButton.h b/exitButton.h
index cdfaf0b..d43e9e3 100755
--- a/exitButton.h
+++ b/exitButton.h
@@ -8,7 +8,7 @@
namespace battleship {
class ExitButton : public vb01Gui::Button {
public:
- ExitButton(vb01::Vector2, vb01::Vector2);
+ ExitButton(vb01::Vector3, vb01::Vector2);
void onClick();
};
}
diff --git a/exportButton.cpp b/exportButton.cpp
index e8c4640..f38eea6 100644
--- a/exportButton.cpp
+++ b/exportButton.cpp
@@ -10,7 +10,7 @@ namespace battleship{
using namespace vb01Gui;
using namespace gameBase;
- ExportButton::ExportButton(Vector2 pos, Vector2 size) : Button(pos, size, "Export", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf"){}
+ ExportButton::ExportButton(Vector3 pos, Vector2 size) : Button(pos, size, "Export", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf"){}
void ExportButton::onClick(){
StateManager *sm = GameManager::getSingleton()->getStateManager();
diff --git a/exportButton.h b/exportButton.h
index 698f9d0..6066051 100644
--- a/exportButton.h
+++ b/exportButton.h
@@ -6,7 +6,7 @@
namespace battleship{
class ExportButton : public vb01Gui::Button{
public:
- ExportButton(vb01::Vector2 pos, vb01::Vector2 size);
+ ExportButton(vb01::Vector3 pos, vb01::Vector2 size);
void onClick();
};
}
diff --git a/game.cpp b/game.cpp
index 5fd9e7a..365d4d3 100644
--- a/game.cpp
+++ b/game.cpp
@@ -244,13 +244,11 @@ namespace battleship{
sol::table techTable = SOL_LUA_VIEW[techKey][i + 1];
Technology t;
- t.id = techTable["id"];
t.cost = techTable["cost"];
t.name = techTable["name"];
t.icon = techTable["icon"];
t.description = techTable["description"];
t.parents = parseTechTable(i, techKey, "numParents", "parents");
- t.children = parseTechTable(i, techKey, "numChildren", "children");
t.abilities = parseTechTable(i, techKey, "numAbilities", "abilities");
technologies.push_back(t);
@@ -300,4 +298,14 @@ namespace battleship{
return false;
}
+
+ vector Game::findTradeOffers(Player *pl1, Player *pl2){
+ vector offers;
+
+ for(TradeOffer *to : tradeOffers)
+ if((to->initPlayer == pl1 || to->recPlayer == pl1) && (to->initPlayer == pl2 || to->recPlayer == pl2))
+ offers.push_back(to);
+
+ return offers;
+ }
}
diff --git a/game.h b/game.h
index ae42ab8..52bc729 100644
--- a/game.h
+++ b/game.h
@@ -4,6 +4,7 @@
#include "fx.h"
#include "technology.h"
#include "ability.h"
+#include "tradeOffer.h"
#include
@@ -28,6 +29,8 @@ namespace battleship{
void initTechnologies();
float calcAbilFromTech(Ability::Type, std::vector, int, int);
bool isUnitUnlocked(std::vector, int);
+ std::vector findTradeOffers(Player*, Player*);
+ inline void addTradeOffer(TradeOffer *to){tradeOffers.push_back(to);}
inline void addFx(Fx f){fx.push_back(f);}
inline void addPlayer(Player *pl){players.push_back(pl);}
inline std::vector& getPlayers(){return players;}
@@ -46,6 +49,7 @@ namespace battleship{
std::vector technologies;
std::vector abilities;
std::vector players;
+ std::vector tradeOffers;
};
}
diff --git a/gameObjectListbox.cpp b/gameObjectListbox.cpp
index 7c9fca8..bb65af0 100644
--- a/gameObjectListbox.cpp
+++ b/gameObjectListbox.cpp
@@ -10,7 +10,7 @@ namespace battleship{
using namespace vb01Gui;
using namespace gameBase;
- GameObjectListbox::GameObjectListbox(bool ul, Vector2 pos, Vector2 size, vector lines, int maxDisplay, string fontPath) : Listbox(pos, size, lines, maxDisplay, fontPath), unitListbox(ul) {}
+ GameObjectListbox::GameObjectListbox(bool ul, Vector3 pos, Vector2 size, vector lines, int maxDisplay, string fontPath) : Listbox(pos, size, lines, maxDisplay, fontPath), unitListbox(ul) {}
void GameObjectListbox::onClose(){
GameObjectFrameController *ufCtr = GameObjectFrameController::getSingleton();
diff --git a/gameObjectListbox.h b/gameObjectListbox.h
index 0d7967f..de919f9 100644
--- a/gameObjectListbox.h
+++ b/gameObjectListbox.h
@@ -6,7 +6,7 @@
namespace battleship{
class GameObjectListbox : public vb01Gui::Listbox{
public:
- GameObjectListbox(bool, vb01::Vector2, vb01::Vector2, std::vector, int, std::string);
+ GameObjectListbox(bool, vb01::Vector3, vb01::Vector2, std::vector, int, std::string);
void onClose();
private:
bool unitListbox;
diff --git a/guiAppState.cpp b/guiAppState.cpp
index 375d546..feaccf6 100755
--- a/guiAppState.cpp
+++ b/guiAppState.cpp
@@ -47,7 +47,7 @@ namespace battleship{
leftMousePressed = isPressed;
if(isPressed)
- guiManager->findClickedButton();
+ guiManager->updateGui();
break;
case Bind::SCROLLING_UP:{
diff --git a/inGameAppState.cpp b/inGameAppState.cpp
index 82b51c8..dbd16da 100755
--- a/inGameAppState.cpp
+++ b/inGameAppState.cpp
@@ -24,19 +24,19 @@ using namespace std;
namespace battleship{
using namespace configData;
- InGameAppState::ResumeButton::ResumeButton(Vector2 pos, Vector2 size) : Button(pos, size, "Resume", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) {}
+ InGameAppState::ResumeButton::ResumeButton(Vector3 pos, Vector2 size) : Button(pos, size, "Resume", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) {}
void InGameAppState::ResumeButton::onClick() {
Game::getSingleton()->togglePause();
}
- InGameAppState::ConsoleButton::ConsoleButton(Vector2 pos, Vector2 size) : Button(pos, size, "Console", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) { }
+ InGameAppState::ConsoleButton::ConsoleButton(Vector3 pos, Vector2 size) : Button(pos, size, "Console", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) { }
void InGameAppState::ConsoleButton::onClick() {
ConcreteGuiManager::getSingleton()->readLuaScreenScript("console.lua");
}
- InGameAppState::ConsoleButton::ConsoleButton::ConsoleCommandEntryButton::ConsoleCommandEntryButton(Textbox *t, Listbox *l, Vector2 pos, Vector2 size, string name) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", 257, true) {
+ InGameAppState::ConsoleButton::ConsoleButton::ConsoleCommandEntryButton::ConsoleCommandEntryButton(Textbox *t, Listbox *l, Vector3 pos, Vector2 size, string name) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", 257, true) {
textbox = t;
listbox = l;
}
diff --git a/inGameAppState.h b/inGameAppState.h
index 46d11aa..0bb77e4 100755
--- a/inGameAppState.h
+++ b/inGameAppState.h
@@ -18,7 +18,7 @@ namespace battleship{
public:
class ResumeButton : public vb01Gui::Button {
public:
- ResumeButton(vb01::Vector2, vb01::Vector2);
+ ResumeButton(vb01::Vector3, vb01::Vector2);
void onClick();
private:
};
@@ -27,14 +27,14 @@ namespace battleship{
public:
class ConsoleCommandEntryButton : public Button {
public:
- ConsoleCommandEntryButton(vb01Gui::Textbox*, vb01Gui::Listbox*, vb01::Vector2, vb01::Vector2, std::string);
+ ConsoleCommandEntryButton(vb01Gui::Textbox*, vb01Gui::Listbox*, vb01::Vector3, vb01::Vector2, std::string);
void onClick();
private:
vb01Gui::Textbox *textbox;
vb01Gui::Listbox *listbox;
};
- ConsoleButton(vb01::Vector2, vb01::Vector2);
+ ConsoleButton(vb01::Vector3, vb01::Vector2);
void onClick();
private:
};
diff --git a/landTextureListbox.cpp b/landTextureListbox.cpp
index 64a1dba..13891eb 100644
--- a/landTextureListbox.cpp
+++ b/landTextureListbox.cpp
@@ -15,7 +15,7 @@ namespace battleship{
using namespace vb01Gui;
using namespace gameBase;
- LandTextureListbox::LandTextureListbox(Vector2 pos, Vector2 size, vector lines, int maxDisplay, std::string fontPath) : Listbox(pos, size, lines, maxDisplay, fontPath){}
+ LandTextureListbox::LandTextureListbox(Vector3 pos, Vector2 size, vector lines, int maxDisplay, std::string fontPath) : Listbox(pos, size, lines, maxDisplay, fontPath){}
void LandTextureListbox::onClose(){
StateManager *sm = GameManager::getSingleton()->getStateManager();
diff --git a/landTextureListbox.h b/landTextureListbox.h
index ac5ce5b..867824b 100644
--- a/landTextureListbox.h
+++ b/landTextureListbox.h
@@ -6,7 +6,7 @@
namespace battleship{
class LandTextureListbox : public vb01Gui::Listbox{
public:
- LandTextureListbox(vb01::Vector2, vb01::Vector2, std::vector, int, std::string);
+ LandTextureListbox(vb01::Vector3, vb01::Vector2, std::vector, int, std::string);
void onClose();
private:
};
diff --git a/loadMapButton.cpp b/loadMapButton.cpp
index 3456f44..0a0ef9c 100644
--- a/loadMapButton.cpp
+++ b/loadMapButton.cpp
@@ -11,7 +11,7 @@ namespace battleship{
using namespace vb01Gui;
using namespace gameBase;
- LoadMapButton::OkButton::OkButton(vb01::Vector2 pos, vb01::Vector2 size, vb01Gui::Listbox *listbox) : Button(pos, size, "Ok", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf"){ this->listbox = listbox; }
+ LoadMapButton::OkButton::OkButton(vb01::Vector3 pos, vb01::Vector2 size, vb01Gui::Listbox *listbox) : Button(pos, size, "Ok", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf"){ this->listbox = listbox; }
void LoadMapButton::OkButton::onClick(){
StateManager *sm = GameManager::getSingleton()->getStateManager();
@@ -20,7 +20,7 @@ namespace battleship{
ConcreteGuiManager::getSingleton()->readLuaScreenScript("mapEditor.lua");
}
- LoadMapButton::LoadMapButton(Vector2 pos, Vector2 size) : Button(pos, size, "Load map", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf"){}
+ LoadMapButton::LoadMapButton(Vector3 pos, Vector2 size) : Button(pos, size, "Load map", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf"){}
void LoadMapButton::onClick(){
ConcreteGuiManager::getSingleton()->readLuaScreenScript("loadMap.lua");
diff --git a/loadMapButton.h b/loadMapButton.h
index afe733f..997fea3 100644
--- a/loadMapButton.h
+++ b/loadMapButton.h
@@ -12,13 +12,13 @@ namespace battleship{
public:
class OkButton : public vb01Gui::Button{
public:
- OkButton(vb01::Vector2, vb01::Vector2, vb01Gui::Listbox*);
+ OkButton(vb01::Vector3, vb01::Vector2, vb01Gui::Listbox*);
void onClick();
private:
vb01Gui::Listbox *listbox;
};
- LoadMapButton(vb01::Vector2, vb01::Vector2);
+ LoadMapButton(vb01::Vector3, vb01::Vector2);
void onClick();
private:
};
diff --git a/mainMenuButton.cpp b/mainMenuButton.cpp
index 1888907..f7516c9 100644
--- a/mainMenuButton.cpp
+++ b/mainMenuButton.cpp
@@ -7,7 +7,7 @@ namespace battleship{
using namespace vb01;
using namespace vb01Gui;
- MainMenuButton::MainMenuButton(Vector2 pos, Vector2 size, string name) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true){}
+ MainMenuButton::MainMenuButton(Vector3 pos, Vector2 size, string name) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true){}
void MainMenuButton::onClick(){
}
diff --git a/mainMenuButton.h b/mainMenuButton.h
index 17f8d66..dff8db3 100644
--- a/mainMenuButton.h
+++ b/mainMenuButton.h
@@ -6,7 +6,7 @@
namespace battleship{
class MainMenuButton : public vb01Gui::Button{
public:
- MainMenuButton(vb01::Vector2, vb01::Vector2, std::string);
+ MainMenuButton(vb01::Vector3, vb01::Vector2, std::string);
void onClick();
private:
};
diff --git a/mapEditorButton.h b/mapEditorButton.h
index 5f34227..5c3be9d 100644
--- a/mapEditorButton.h
+++ b/mapEditorButton.h
@@ -8,7 +8,7 @@
namespace battleship{
class MapEditorButton : public vb01Gui::Button{
public:
- MapEditorButton(vb01::Vector2 pos, vb01::Vector2 size) : vb01Gui::Button(pos, size, "Map editor", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf"){}
+ MapEditorButton(vb01::Vector3 pos, vb01::Vector2 size) : vb01Gui::Button(pos, size, "Map editor", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf"){}
void onClick();
private:
};
diff --git a/newMapButton.cpp b/newMapButton.cpp
index 602a21e..ecc621a 100644
--- a/newMapButton.cpp
+++ b/newMapButton.cpp
@@ -14,7 +14,7 @@ namespace battleship{
using namespace vb01Gui;
using namespace gameBase;
- NewMapButton::OkButton::OkButton(vb01::Vector2 pos, vb01::Vector2 size, vb01Gui::Textbox *name, vb01Gui::Textbox *sx, vb01Gui::Textbox *sy) : Button(pos, size, "Ok", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true){
+ NewMapButton::OkButton::OkButton(vb01::Vector3 pos, vb01::Vector2 size, vb01Gui::Textbox *name, vb01Gui::Textbox *sx, vb01Gui::Textbox *sy) : Button(pos, size, "Ok", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true){
this->name = name;
this->sizeX = sx;
this->sizeY = sy;
@@ -31,7 +31,7 @@ namespace battleship{
ConcreteGuiManager::getSingleton()->readLuaScreenScript("mapEditor.lua");
}
- NewMapButton::NewMapButton(Vector2 pos, Vector2 size) : Button(pos, size, "New map", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf"){}
+ NewMapButton::NewMapButton(Vector3 pos, Vector2 size) : Button(pos, size, "New map", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf"){}
void NewMapButton::onClick(){
ConcreteGuiManager::getSingleton()->readLuaScreenScript("newMap.lua");
diff --git a/newMapButton.h b/newMapButton.h
index 371e394..fd48fb0 100644
--- a/newMapButton.h
+++ b/newMapButton.h
@@ -12,13 +12,13 @@ namespace battleship{
public:
class OkButton : public vb01Gui::Button{
public:
- OkButton(vb01::Vector2, vb01::Vector2, vb01Gui::Textbox*, vb01Gui::Textbox*, vb01Gui::Textbox*);
+ OkButton(vb01::Vector3, vb01::Vector2, vb01Gui::Textbox*, vb01Gui::Textbox*, vb01Gui::Textbox*);
void onClick();
private:
vb01Gui::Textbox *name, *sizeX, *sizeY;
};
- NewMapButton(vb01::Vector2, vb01::Vector2);
+ NewMapButton(vb01::Vector3, vb01::Vector2);
void onClick();
private:
};
diff --git a/offerButton.cpp b/offerButton.cpp
new file mode 100644
index 0000000..7fae80f
--- /dev/null
+++ b/offerButton.cpp
@@ -0,0 +1,39 @@
+#include "offerButton.h"
+#include "concreteGuiManager.h"
+#include "activeGameState.h"
+#include "gameManager.h"
+#include "tradeOffer.h"
+#include "player.h"
+#include "game.h"
+
+#include
+
+#include
+
+namespace battleship{
+ using namespace std;
+ using namespace vb01;
+ using namespace vb01Gui;
+ using namespace gameBase;
+
+ OfferButton::OfferButton(Vector3 pos, Vector2 size, int plId, string name, int trigger, string imagePath) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", trigger, true, imagePath), playerId(plId){}
+
+ void OfferButton::onClick(){
+ ConcreteGuiManager *guiManager = ConcreteGuiManager::getSingleton();
+ vector textboxes = guiManager->getTextboxes();
+
+ int recRef = (textboxes[0]->getText() == L"" ? 0 : stoi(textboxes[0]->getText()));
+ int initRef = (textboxes[1]->getText() == L"" ? 0 : stoi(textboxes[1]->getText()));
+ int recWealth = (textboxes[2]->getText() == L"" ? 0 : stoi(textboxes[2]->getText()));
+ int initWealth = (textboxes[3]->getText() == L"" ? 0 : stoi(textboxes[3]->getText()));
+ int recRes = (textboxes[4]->getText() == L"" ? 0 : stoi(textboxes[4]->getText()));
+ int initRes = (textboxes[5]->getText() == L"" ? 0 : stoi(textboxes[5]->getText()));
+
+ StateManager *stateManager = GameManager::getSingleton()->getStateManager();
+ ActiveGameState *activeState = (ActiveGameState*)stateManager->getAppStateByType((int)AppStateType::ACTIVE_STATE);
+ Player *mainPlayer = activeState->getPlayer();
+
+ Game *game = Game::getSingleton();
+ game->addTradeOffer(new TradeOffer(mainPlayer, game->getPlayer(playerId), initRef, recRef, initWealth, recWealth, initRes, recRes));
+ }
+}
diff --git a/offerButton.h b/offerButton.h
new file mode 100644
index 0000000..6de5592
--- /dev/null
+++ b/offerButton.h
@@ -0,0 +1,17 @@
+#ifndef OFFER_BUTTON_H
+#define OFFER_BUTTON_H
+
+#include
+
+namespace battleship{
+ class OfferButton : public vb01Gui::Button{
+ public:
+ OfferButton(vb01::Vector3, vb01::Vector2, int, std::string, int, std::string);
+ void onClick();
+ inline void setPlayerId(int plId){playerId = plId;}
+ private:
+ int playerId;
+ };
+}
+
+#endif
diff --git a/okButton.cpp b/okButton.cpp
index 16b382b..91aa580 100644
--- a/okButton.cpp
+++ b/okButton.cpp
@@ -6,7 +6,7 @@ namespace battleship{
using namespace vb01;
using namespace vb01Gui;
- OkButton::OkButton(Vector2 pos, Vector2 size, string name) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) {}
+ OkButton::OkButton(Vector3 pos, Vector2 size, string name) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) {}
void OkButton::onClick() {}
}
diff --git a/okButton.h b/okButton.h
index 07a0007..9aedbd7 100644
--- a/okButton.h
+++ b/okButton.h
@@ -6,7 +6,7 @@
namespace battleship{
class OkButton : public vb01Gui::Button{
public:
- OkButton(vb01::Vector2, vb01::Vector2, std::string);
+ OkButton(vb01::Vector3, vb01::Vector2, std::string);
void onClick();
private:
};
diff --git a/optionsButton.cpp b/optionsButton.cpp
index 50a2264..d7297c7 100755
--- a/optionsButton.cpp
+++ b/optionsButton.cpp
@@ -7,7 +7,7 @@ using namespace vb01;
using namespace std;
namespace battleship{
- OptionsButton::OptionsButton(Vector2 pos, Vector2 size, string name, bool separate) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, separate) {}
+ OptionsButton::OptionsButton(Vector3 pos, Vector2 size, string name, bool separate) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, separate) {}
void OptionsButton::onClick() {
ConcreteGuiManager::getSingleton()->readLuaScreenScript("options.lua");
diff --git a/optionsButton.h b/optionsButton.h
index 7a68c5f..98a5681 100755
--- a/optionsButton.h
+++ b/optionsButton.h
@@ -7,7 +7,7 @@
namespace battleship {
class OptionsButton : public vb01Gui::Button {
public:
- OptionsButton(vb01::Vector2, vb01::Vector2, std::string, bool);
+ OptionsButton(vb01::Vector3, vb01::Vector2, std::string, bool);
virtual void onClick();
};
}
diff --git a/playButton.cpp b/playButton.cpp
index 1d4b369..4bdeeed 100644
--- a/playButton.cpp
+++ b/playButton.cpp
@@ -14,7 +14,7 @@ namespace battleship{
using namespace vb01Gui;
using namespace gameBase;
- PlayButton::PlayButton(vector difficulties, vector factions, Listbox *mapListbox, Vector2 pos, Vector2 size, string name, bool separate) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", GLFW_KEY_P, separate) {
+ PlayButton::PlayButton(vector difficulties, vector factions, Listbox *mapListbox, Vector3 pos, Vector2 size, string name, bool separate) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", GLFW_KEY_P, separate) {
difficultiesListboxes = difficulties;
factionsListboxes = factions;
this->mapListbox = mapListbox;
diff --git a/playButton.h b/playButton.h
index f2da5ae..2c2565a 100644
--- a/playButton.h
+++ b/playButton.h
@@ -10,7 +10,7 @@ namespace vb01Gui{
namespace battleship{
class PlayButton : public vb01Gui::Button {
public:
- PlayButton(std::vector, std::vector, vb01Gui::Listbox*, vb01::Vector2, vb01::Vector2, std::string, bool);
+ PlayButton(std::vector, std::vector, vb01Gui::Listbox*, vb01::Vector3, vb01::Vector2, std::string, bool);
void onClick();
private:
std::vector difficultiesListboxes, factionsListboxes;
diff --git a/player.cpp b/player.cpp
index cdc1ebc..5d4c947 100755
--- a/player.cpp
+++ b/player.cpp
@@ -12,7 +12,7 @@ namespace battleship{
using namespace gameBase;
using namespace std;
- Player::Player(int diff, int fac, int t, Vector3 col, bool cpuPl, Vector3 sp, string n) : difficulty(diff), faction(fac), team(t), color(col), cpuPlayer(cpuPl), spawnPoint(sp), name(n), refineds(30000), trader(new Trader()) {}
+ Player::Player(int diff, int fac, int t, Vector3 col, bool cpuPl, Vector3 sp, string n) : difficulty(diff), faction(fac), team(t), color(col), cpuPlayer(cpuPl), spawnPoint(sp), name("pl"), refineds(30000), trader(new Trader()) {}
Player::~Player() {}
diff --git a/playerTradeButton.cpp b/playerTradeButton.cpp
new file mode 100644
index 0000000..b04e05a
--- /dev/null
+++ b/playerTradeButton.cpp
@@ -0,0 +1,67 @@
+#include "playerTradeButton.h"
+#include "concreteGuiManager.h"
+#include "activeGameState.h"
+#include "offerButton.h"
+#include "game.h"
+
+#include
+#include
+
+namespace battleship{
+ using namespace std;
+ using namespace vb01;
+ using namespace vb01Gui;
+ using namespace gameBase;
+
+ PlayerTradeButton::PlayerTradeButton(Vector3 pos, Vector2 size, string gs, string name, int trigger, string imagePath) : ActiveStateButton(pos, size, gs, name, trigger, imagePath){}
+
+ void PlayerTradeButton::onClick(){
+ ActiveStateButton::onClick();
+
+ StateManager *stateManager = GameManager::getSingleton()->getStateManager();
+ ActiveGameState *activeState = (ActiveGameState*)stateManager->getAppStateByType((int)AppStateType::ACTIVE_STATE);
+ Player *mainPlayer = activeState->getPlayer();
+ Game *game = Game::getSingleton();
+
+ vector players = game->getPlayers();
+ ConcreteGuiManager *guiManager = ConcreteGuiManager::getSingleton();
+ sol::state_view SOL_LUA_VIEW = generateView();
+
+ for(int i = 0, lineId = 0; i < players.size(); i++){
+ if(players[i] != mainPlayer){
+ vector