From 38d1bba585d6165a3cb7c000fe0701be23ff37a7 Mon Sep 17 00:00:00 2001 From: devZoGok Date: Sat, 8 Aug 2026 16:46:12 +0300 Subject: [PATCH] Added in-game tooltips More tooltip parameters --- Assets/Scripts/GameObjects/Units/unitData.lua | 419 ++++++++++++++++-- Assets/Scripts/Gui/activeGameState.lua | 9 +- Assets/Scripts/Gui/mainMenu.lua | 36 +- Assets/Scripts/Gui/tradingScreen.lua | 25 +- Assets/Scripts/Gui/unitGui.lua | 89 +++- Assets/Textures/Icons/Resources/time.png | Bin 2883 -> 2991 bytes Assets/Textures/Icons/Resources/time.svg | 23 +- concreteGuiManager.cpp | 28 +- pfButtonBase.h | 2 +- tooltip.cpp | 12 +- tooltip.h | 14 +- tradeButton.cpp | 37 +- tradeButton.h | 7 +- trader.cpp | 15 +- trader.h | 1 + 15 files changed, 626 insertions(+), 91 deletions(-) diff --git a/Assets/Scripts/GameObjects/Units/unitData.lua b/Assets/Scripts/GameObjects/Units/unitData.lua index d9a8972..c3058ea 100644 --- a/Assets/Scripts/GameObjects/Units/unitData.lua +++ b/Assets/Scripts/GameObjects/Units/unitData.lua @@ -186,6 +186,7 @@ units = { hitboxOffset = {x = 0, y = 4.5, z = 0}, lineOfSight = 25, name = 'Mech', + description = '', basePath = PATH .. vehiclePrefix .. 'Mechs/', meshPath = 'acsMech.xml', albedoPath = 'mech.jpg', @@ -261,6 +262,7 @@ units = { hitboxOffset = {x = 0, y = 3.02, z = .16}, lineOfSight = 25, name = 'Mech', + description = '', basePath = PATH .. vehiclePrefix .. 'Mechs/', meshPath = 'aincMech.xml', albedoPath = 'mech.jpg', @@ -336,6 +338,7 @@ units = { hitboxOffset = {x = 0, y = 4.27, z = .13}, lineOfSight = 25, name = 'Mech', + description = '', basePath = PATH .. vehiclePrefix .. 'Mechs/', meshPath = 'erMech.xml', albedoPath = 'mech.jpg', @@ -394,6 +397,7 @@ units = { hitboxOffset = {x = 0, y = 5.46, z = .86}, lineOfSight = 75, name = 'Tank', + description = '', basePath = PATH .. vehiclePrefix .. 'Tanks/', meshPath = 'acsTank.xml', albedoPath = 'tank.jpg', @@ -452,6 +456,7 @@ units = { hitboxOffset = {x = 0, y = 3.31, z = 0}, lineOfSight = 75, name = 'Tank', + description = '', basePath = PATH .. vehiclePrefix .. 'Tanks/', meshPath = 'aincTank.xml', albedoPath = 'tank.jpg', @@ -513,6 +518,7 @@ units = { hitboxOffset = {x = 0, y = 5.27, z = .26}, lineOfSight = 75, name = 'Tank', + description = '', basePath = PATH .. vehiclePrefix .. 'Tanks/', meshPath = 'erTank.xml', albedoPath = 'tank.jpg', @@ -572,6 +578,7 @@ units = { hitboxOffset = {x = 0, y = 7.69, z = .71}, lineOfSight = 90, name = 'Artillery', + description = '', basePath = PATH .. vehiclePrefix .. 'Artillery/', meshPath = 'acsArtillery.xml', albedoPath = 'artillery.jpg', @@ -630,6 +637,7 @@ units = { hitboxOffset = {x = 0, y = 7, z = 1.3}, lineOfSight = 90, name = 'Artillery', + description = '', basePath = PATH .. vehiclePrefix .. 'Artillery/', meshPath = 'aincArtillery.xml', albedoPath = 'artillery.jpg', @@ -689,6 +697,7 @@ units = { hitboxOffset = {x = 0, y = 1, z = 0}, lineOfSight = 30, name = 'Artillery', + description = '', basePath = PATH .. vehiclePrefix .. 'Artillery/', meshPath = 'artillery.xml', albedoPath = 'artillery.jpg', @@ -725,6 +734,7 @@ units = { hitboxOffset = {x = 0, y = 1.21, z = 0}, lineOfSight = 200, name = 'Engineer', + description = '', basePath = PATH .. vehiclePrefix .. 'Engineers/', albedoPath = 'engineer.jpg', colorNodes = {'Cube'}, @@ -755,7 +765,20 @@ units = { {id = UnitId.POINT_DEFENSE, iconPath = 'Icons/Buttons/GameObjects/pointDefense.png', buildable = true, trigger = 80}, {id = UnitId.EXTRACTOR, iconPath = 'Icons/Buttons/GameObjects/extractor.png', buildable = true, trigger = 69}, }, - abilityButtons = {{buttonType = ButtonType.ORDER, name = 'Hack', orderType = OrderType.HACK}}, + abilityButtons = { + { + buttonType = ButtonType.ORDER, + name = 'Hack', + orderType = OrderType.HACK, + tooltip = { + size = {x = 200, y = 40}, + lines = { + {entry = {text = 'Eject'}}, + {entry = {text = 'Eject all garrisoned units'}}, + } + } + } + }, unitClass = UnitClass.CYBORG_ENGINEER, unitType = UnitType.LAND, armor = {ArmorType.MECHANIC}, @@ -770,6 +793,7 @@ units = { hitboxOffset = {x = .178, y = 3.27, z = 0}, lineOfSight = 150, name = 'Engineer', + description = '', basePath = PATH .. vehiclePrefix .. 'Engineers/', albedoPath = 'engineer.jpg', colorNodes = {'Engineer_Asia.001'}, @@ -806,6 +830,7 @@ units = { hitboxOffset = {x = 0, y = 1.02, z = .19}, lineOfSight = 200, name = 'Engineer', + description = '', basePath = PATH .. vehiclePrefix .. 'Engineers/', albedoPath = 'engineer.jpg', colorNodes = {'EngineerAM.001'}, @@ -836,7 +861,20 @@ units = { {id = UnitId.POINT_DEFENSE, iconPath = 'Icons/Buttons/GameObjects/pointDefense.png', buildable = true, trigger = 80}, {id = UnitId.EXTRACTOR, iconPath = 'Icons/Buttons/GameObjects/extractor.png', buildable = true, trigger = 69}, }, - abilityButtons = {{buttonType = ButtonType.ORDER, name = 'Hack', orderType = OrderType.HACK}}, + abilityButtons = { + { + buttonType = ButtonType.ORDER, + name = 'Hack', + orderType = OrderType.HACK, + tooltip = { + size = {x = 200, y = 40}, + lines = { + {entry = {text = 'Eject'}}, + {entry = {text = 'Eject all garrisoned units'}}, + } + } + } + }, unitClass = UnitClass.CYBORG_ENGINEER, unitType = UnitType.LAND, armor = {ArmorType.MECHANIC}, @@ -851,6 +889,7 @@ units = { hitboxOffset = {x = 0, y = 2.83, z = .4}, lineOfSight = 150, name = 'Engineer', + description = '', basePath = PATH .. vehiclePrefix .. 'Engineers/', albedoPath = 'engineer.jpg', colorNodes = {'Cube.001'}, @@ -887,6 +926,7 @@ units = { hitboxOffset = {x = 0, y = 1.41, z = 1}, lineOfSight = 200, name = 'Engineer', + description = '', basePath = PATH .. vehiclePrefix .. 'Engineers/', albedoPath = 'engineer.jpg', colorNodes = {'Cube.001'}, @@ -917,7 +957,20 @@ units = { {id = UnitId.POINT_DEFENSE, iconPath = 'Icons/Buttons/GameObjects/pointDefense.png', buildable = true, trigger = 80}, {id = UnitId.EXTRACTOR, iconPath = 'Icons/Buttons/GameObjects/extractor.png', buildable = true, trigger = 69}, }, - abilityButtons = {{buttonType = ButtonType.ORDER, name = 'Hack', orderType = OrderType.HACK}}, + abilityButtons = { + { + buttonType = ButtonType.ORDER, + name = 'Hack', + orderType = OrderType.HACK, + tooltip = { + size = {x = 200, y = 40}, + lines = { + {entry = {text = 'Eject'}}, + {entry = {text = 'Eject all garrisoned units'}}, + } + } + } + }, unitClass = UnitClass.CYBORG_ENGINEER, unitType = UnitType.LAND, armor = {ArmorType.MECHANIC}, @@ -932,6 +985,7 @@ units = { hitboxOffset = {x = 0, y = 2.9, z = .55}, lineOfSight = 150, name = 'Engineer', + description = '', basePath = PATH .. vehiclePrefix .. 'Engineers/', albedoPath = 'engineer.jpg', colorNodes = {'Rig.001'}, @@ -1024,6 +1078,7 @@ units = { lineOfSight = 5, colorNodes = {'Cube.002'}, name = 'Transport', + description = '', basePath = PATH .. vehiclePrefix .. 'Transports/', meshPath = 'acsTransport.xml', albedoPath = 'transport.jpg', @@ -1103,6 +1158,7 @@ units = { lineOfSight = 5, colorNodes = {'turret'}, name = 'Transport', + description = '', basePath = PATH .. vehiclePrefix .. 'Transports/', meshPath = 'aincTransport.xml', albedoPath = 'transport.jpg', @@ -1196,9 +1252,51 @@ units = { { weapons = {}, abilityButtons = { - {buttonType = ButtonType.ORDER, name = 'Supply', orderType = OrderType.SUPPLY}, - {buttonType = ButtonType.ORDER, name = 'Load', orderType = OrderType.LOAD}, - {buttonType = ButtonType.ORDER, name = 'Unload', orderType = OrderType.UNLOAD}, + { + buttonType = ButtonType.ORDER, + name = 'Supply', + orderType = OrderType.SUPPLY, + tooltip = { + size = {x = 210, y = 60}, + lines = { + {entry = {text = 'Supply'}}, + {entry = {text = 'Begin collecting refineds'}}, + {entry = {text = 'from an extractor'}}, + } + } + }, + { + buttonType = ButtonType.ORDER, + name = 'Load', + orderType = OrderType.LOAD, + tooltip = { + size = {x = 290, y = 120}, + lines = { + {entry = {text = 'Load'}}, + {entry = {text = 'Load the cargo ship with the'}}, + {entry = {text = 'corresponding resource. Can load:'}}, + {entry = {text = 'from refineries'}, icons = {{charId = 0, path = 'Resources/refineds.png'}}}, + {entry = {text = 'from trade centers'}, icons = {{charId = 0, path = 'Resources/wealth.png'}}}, + {entry = {text = 'from labs'}, icons = {{charId = 0, path = 'Resources/research.png'}}}, + } + } + }, + { + buttonType = ButtonType.ORDER, + name = 'Unload', + orderType = OrderType.UNLOAD, + tooltip = { + size = {x = 320, y = 120}, + lines = { + {entry = {text = 'Unload'}}, + {entry = {text = 'Unload the cargo ship with the'}}, + {entry = {text = 'corresponding resource. Can unload:'}}, + {entry = {text = 'to refineries'}, icons = {{charId = 0, path = 'Resources/refineds.png'}}}, + {entry = {text = 'to trade centers'}, icons = {{charId = 0, path = 'Resources/wealth.png'}}}, + {entry = {text = 'to labs'}, icons = {{charId = 0, path = 'Resources/research.png'}}}, + } + } + } }, unitClass = UnitClass.RESOURCE_ROVER, unitType = UnitType.HOVER, @@ -1216,6 +1314,7 @@ units = { hitboxOffset = {x = 0, y = 2.65, z = 0}, lineOfSight = 5, name = 'Cargo ship', + description = '', colorNodes = {'Cargo'}, basePath = PATH .. vehiclePrefix .. 'Cargoships/', meshPath = 'acsCargoShip.xml', @@ -1231,9 +1330,51 @@ units = { { weapons = {}, abilityButtons = { - {buttonType = ButtonType.ORDER, name = 'Supply', orderType = OrderType.SUPPLY}, - {buttonType = ButtonType.ORDER, name = 'Load', orderType = OrderType.LOAD}, - {buttonType = ButtonType.ORDER, name = 'Unload', orderType = OrderType.UNLOAD}, + { + buttonType = ButtonType.ORDER, + name = 'Supply', + orderType = OrderType.SUPPLY, + tooltip = { + size = {x = 210, y = 60}, + lines = { + {entry = {text = 'Supply'}}, + {entry = {text = 'Begin collecting refineds'}}, + {entry = {text = 'from an extractor'}}, + } + } + }, + { + buttonType = ButtonType.ORDER, + name = 'Load', + orderType = OrderType.LOAD, + tooltip = { + size = {x = 290, y = 120}, + lines = { + {entry = {text = 'Load'}}, + {entry = {text = 'Load the cargo ship with the'}}, + {entry = {text = 'corresponding resource. Can load:'}}, + {entry = {text = 'from refineries'}, icons = {{charId = 0, path = 'Resources/refineds.png'}}}, + {entry = {text = 'from trade centers'}, icons = {{charId = 0, path = 'Resources/wealth.png'}}}, + {entry = {text = 'from labs'}, icons = {{charId = 0, path = 'Resources/research.png'}}}, + } + } + }, + { + buttonType = ButtonType.ORDER, + name = 'Unload', + orderType = OrderType.UNLOAD, + tooltip = { + size = {x = 320, y = 120}, + lines = { + {entry = {text = 'Unload'}}, + {entry = {text = 'Unload the cargo ship with the'}}, + {entry = {text = 'corresponding resource. Can unload:'}}, + {entry = {text = 'to refineries'}, icons = {{charId = 0, path = 'Resources/refineds.png'}}}, + {entry = {text = 'to trade centers'}, icons = {{charId = 0, path = 'Resources/wealth.png'}}}, + {entry = {text = 'to labs'}, icons = {{charId = 0, path = 'Resources/research.png'}}}, + } + } + } }, unitClass = UnitClass.RESOURCE_ROVER, unitType = UnitType.HOVER, @@ -1251,6 +1392,7 @@ units = { hitboxOffset = {x = 0, y = 2.65, z = 0}, lineOfSight = 5, name = 'Cargo ship', + description = '', colorNodes = {'Cargo'}, basePath = PATH .. vehiclePrefix .. 'Cargoships/', meshPath = 'aincCargoShip.xml', @@ -1266,9 +1408,51 @@ units = { { weapons = {}, abilityButtons = { - {buttonType = ButtonType.ORDER, name = 'Supply', orderType = OrderType.SUPPLY}, - {buttonType = ButtonType.ORDER, name = 'Load', orderType = OrderType.LOAD}, - {buttonType = ButtonType.ORDER, name = 'Unload', orderType = OrderType.UNLOAD}, + { + buttonType = ButtonType.ORDER, + name = 'Supply', + orderType = OrderType.SUPPLY, + tooltip = { + size = {x = 210, y = 60}, + lines = { + {entry = {text = 'Supply'}}, + {entry = {text = 'Begin collecting refineds'}}, + {entry = {text = 'from an extractor'}}, + } + } + }, + { + buttonType = ButtonType.ORDER, + name = 'Load', + orderType = OrderType.LOAD, + tooltip = { + size = {x = 290, y = 120}, + lines = { + {entry = {text = 'Load'}}, + {entry = {text = 'Load the cargo ship with the'}}, + {entry = {text = 'corresponding resource. Can load:'}}, + {entry = {text = 'from refineries'}, icons = {{charId = 0, path = 'Resources/refineds.png'}}}, + {entry = {text = 'from trade centers'}, icons = {{charId = 0, path = 'Resources/wealth.png'}}}, + {entry = {text = 'from labs'}, icons = {{charId = 0, path = 'Resources/research.png'}}}, + } + } + }, + { + buttonType = ButtonType.ORDER, + name = 'Unload', + orderType = OrderType.UNLOAD, + tooltip = { + size = {x = 320, y = 120}, + lines = { + {entry = {text = 'Unload'}}, + {entry = {text = 'Unload the cargo ship with the'}}, + {entry = {text = 'corresponding resource. Can unload:'}}, + {entry = {text = 'to refineries'}, icons = {{charId = 0, path = 'Resources/refineds.png'}}}, + {entry = {text = 'to trade centers'}, icons = {{charId = 0, path = 'Resources/wealth.png'}}}, + {entry = {text = 'to labs'}, icons = {{charId = 0, path = 'Resources/research.png'}}}, + } + } + } }, unitClass = UnitClass.RESOURCE_ROVER, unitType = UnitType.HOVER, @@ -1286,6 +1470,7 @@ units = { hitboxOffset = {x = 0, y = 2.65, z = 0}, lineOfSight = 5, name = 'Cargo ship', + description = '', colorNodes = {'Cargo'}, basePath = PATH .. vehiclePrefix .. 'Cargoships/', meshPath = 'erCargoShip.xml', @@ -1394,6 +1579,7 @@ units = { lineOfSight = 50, colorNodes = {'AATuret'}, name = 'Assault cruiser', + description = '', basePath = PATH .. vehiclePrefix .. 'Cruisers/', meshPath = 'heavyAssaultCruiser.xml', albedoPath = 'cruiser.jpg', @@ -1506,6 +1692,7 @@ units = { lineOfSight = 5, colorNodes = {'frontAATurret', 'rearAATurret'}, name = 'Assault cruiser', + description = '', basePath = PATH .. vehiclePrefix .. 'Cruisers/', meshPath = 'mediumAssaultCruiser.xml', albedoPath = 'cruiser.jpg', @@ -1616,6 +1803,7 @@ units = { lineOfSight = 5, colorNodes = {'aaTurret'}, name = 'Assault cruiser', + description = '', basePath = PATH .. vehiclePrefix .. 'Cruisers/', meshPath = 'lightAssaultCruiser.xml', albedoPath = 'cruiser.jpg', @@ -1706,6 +1894,7 @@ units = { lineOfSight = 100, colorNodes = {'FrontTurret', 'RearTurret'}, name = 'Anti sub cruiser', + description = '', basePath = PATH .. vehiclePrefix .. 'Cruisers/', meshPath = 'acsAntiSubCruiser.xml', albedoPath = 'cruiser.jpg', @@ -1832,6 +2021,7 @@ units = { lineOfSight = 100, colorNodes = {'sides'}, name = 'Anti sub cruiser', + description = '', basePath = PATH .. vehiclePrefix .. 'Cruisers/', meshPath = 'aincAntiSubCruiser.xml', albedoPath = 'cruiser.jpg', @@ -1987,6 +2177,7 @@ units = { lineOfSight = 100, colorNodes = {'Gunship.001'}, name = 'Anti sub cruiser', + description = '', basePath = PATH .. vehiclePrefix .. 'Cruisers/', meshPath = 'erAntiSubCruiser.xml', albedoPath = 'cruiser.jpg', @@ -2038,6 +2229,7 @@ units = { hitboxOffset = {x = 0, y = 1.8, z = -1.3}, lineOfSight = 50, name = 'Missile submarine', + description = '', basePath = PATH .. vehiclePrefix .. 'Submarines/', meshPath = 'acsMissileSubmarine.xml', albedoPath = 'submarine.jpg', @@ -2142,6 +2334,7 @@ units = { hitboxOffset = {x = 0, y = 2.29, z = -1.09}, lineOfSight = 500, name = 'Missile submarine', + description = '', basePath = PATH .. vehiclePrefix .. 'Submarines/', meshPath = 'erMissileSubmarine.xml', albedoPath = 'submarine.jpg', @@ -2181,6 +2374,7 @@ units = { hitboxOffset = {x = 0, y = 1.8, z = -1.3}, lineOfSight = 0, name = 'Stealth submarine', + description = '', colorNodes = {'Cube.001'}, basePath = PATH .. vehiclePrefix .. 'Submarines/', meshPath = 'acsSubmarine.xml', @@ -2220,6 +2414,7 @@ units = { size = {x = 8.32, y = 12.1, z = 57.4}, lineOfSight = 0, name = 'Stealth submarine', + description = '', colorNodes = {'Cube.001'}, basePath = PATH .. vehiclePrefix .. 'Submarines/', meshPath = 'aincSubmarine.xml', @@ -2259,6 +2454,7 @@ units = { size = {x = 5.37, y = 7.66, z = 43}, lineOfSight = 0, name = 'Stealth submarine', + description = '', colorNodes = {'Sphere.001'}, basePath = PATH .. vehiclePrefix .. 'Submarines/', meshPath = 'erSubmarine.xml', @@ -2282,6 +2478,7 @@ units = { hitboxOffset = {x = 0, y = 6.7, z = 0}, lineOfSight = 25, name = 'Icebreaker', + description = '', colorNodes = {'Cube.001'}, basePath = PATH .. vehiclePrefix .. 'Icebreakers/', meshPath = 'acsIcebreaker.xml', @@ -2305,6 +2502,7 @@ units = { hitboxOffset = {x = 0, y = 7.6, z = 5.88}, lineOfSight = 25, name = 'Icebreaker', + description = '', colorNodes = {'Cube.001'}, basePath = PATH .. vehiclePrefix .. 'Icebreakers/', meshPath = 'aincIcebreaker.xml', @@ -2328,6 +2526,7 @@ units = { hitboxOffset = {x = 0, y = 6.71, z = 5.95}, lineOfSight = 25, name = 'Icebreaker', + description = '', colorNodes = {'Cube.001'}, basePath = PATH .. vehiclePrefix .. 'Icebreakers/', meshPath = 'erIcebreaker.xml', @@ -2375,6 +2574,7 @@ units = { hitboxOffset = {x = 0, y = 4.7, z = 0}, lineOfSight = 25, name = 'Freezer', + description = '', colorNodes = {'CryoGun'}, basePath = PATH .. vehiclePrefix .. 'Freezers/', meshPath = 'freezer.xml', @@ -2416,6 +2616,7 @@ units = { hitboxOffset = {x = 0, y = 1.13, z = 1.83}, lineOfSight = 25, name = 'EMP boat', + description = '', colorNodes = {'turret'}, basePath = PATH .. vehiclePrefix .. 'EMPShips/', meshPath = 'empShip.xml', @@ -2449,6 +2650,7 @@ units = { lineOfSight = 5, colorNodes = {'ring'}, name = 'Land factory', + description = '', albedoPath = 'factory.jpg', basePath = PATH .. structurePrefix .. 'LandFactories/', meshPath = 'acsFactory.xml', @@ -2476,6 +2678,7 @@ units = { lineOfSight = 5, colorNodes = {'Cube.002'}, name = 'Land factory', + description = '', albedoPath = 'factory.jpg', basePath = PATH .. structurePrefix .. 'LandFactories/', meshPath = 'aincFactory.xml', @@ -2503,6 +2706,7 @@ units = { lineOfSight = 5, colorNodes = {'Sphere.001'}, name = 'Land factory', + description = '', albedoPath = 'factory.jpg', basePath = PATH .. structurePrefix .. 'LandFactories/', meshPath = 'erFactory.xml', @@ -2530,6 +2734,7 @@ units = { hitboxOffset = {x = 0, y = 28.4, z = -29}, lineOfSight = 5, name = 'Naval factory', + description = '', basePath = PATH .. structurePrefix .. 'NavalFactories/', meshPath = 'acsFactory.xml', colorNodes = {'stripes'}, @@ -2558,6 +2763,7 @@ units = { hitboxOffset = {x = 0, y = 18, z = 0}, lineOfSight = 5, name = 'Naval factory', + description = '', colorNodes = {'roof'}, basePath = PATH .. structurePrefix .. 'NavalFactories/', meshPath = 'aincFactory.xml', @@ -2588,6 +2794,7 @@ units = { hitboxOffset = {x = 0, y = 10, z = -14}, lineOfSight = 5, name = 'Naval factory', + description = '', colorNodes = {'building'}, basePath = PATH .. structurePrefix .. 'NavalFactories/', meshPath = 'erFactory.xml', @@ -2599,10 +2806,46 @@ units = { unitClass = UnitClass.TRADE_CENTER, unitType = UnitType.LAND, abilityButtons = { - {buttonType = ButtonType.BUY_REFINEDS, name = 'Buy ref', trigger = 73}, - {buttonType = ButtonType.SELL_REFINEDS, name = 'Sell ref', trigger = 79}, - {buttonType = ButtonType.BUY_RESEARCH, name = 'Buy rsch', trigger = 75}, - {buttonType = ButtonType.SELL_RESEARCH, name = 'Sell rsch', trigger = 76} + { + buttonType = ButtonType.BUY_REFINEDS, + name = 'Buy ref', + trigger = 73, + amount = 10, + tooltip = { + size = {x = 200, y = 40}, + lines = {{entry = {text = 'Buy _ refineds for _ wealth'}}} + } + }, + { + buttonType = ButtonType.SELL_REFINEDS, + name = 'Sell ref', + trigger = 79, + amount = 10, + tooltip = { + size = {x = 200, y = 40}, + lines = {{entry = {text = 'Sell _ refineds for _ wealth'}}} + } + }, + { + buttonType = ButtonType.BUY_RESEARCH, + name = 'Buy rsch', + trigger = 75, + amount = 10, + tooltip = { + size = {x = 200, y = 40}, + lines = {{entry = {text = 'Buy _ research for _ wealth'}}} + } + }, + { + buttonType = ButtonType.SELL_RESEARCH, + name = 'Sell rsch', + trigger = 76, + amount = 10, + tooltip = { + size = {x = 200, y = 40}, + lines = {{entry = {text = 'Sell _ research for _ wealth'}}} + } + } }, maxUnevenness = .5, isVehicle = false, @@ -2614,6 +2857,7 @@ units = { lineOfSight = 5, colorNodes = {'wall'}, name = 'Trade center', + description = '', basePath = PATH .. structurePrefix .. 'TradeCenters/', meshPath = 'acsTradeCenter.xml', albedoPath = 'tradeCenter.jpg', @@ -2624,10 +2868,46 @@ units = { unitClass = UnitClass.TRADE_CENTER, unitType = UnitType.LAND, abilityButtons = { - {buttonType = ButtonType.BUY_REFINEDS, name = 'Buy ref', trigger = 73}, - {buttonType = ButtonType.SELL_REFINEDS, name = 'Sell ref', trigger = 79}, - {buttonType = ButtonType.BUY_RESEARCH, name = 'Buy rsch', trigger = 75}, - {buttonType = ButtonType.SELL_RESEARCH, name = 'Sell rsch', trigger = 76} + { + buttonType = ButtonType.BUY_REFINEDS, + name = 'Buy ref', + trigger = 73, + amount = 10, + tooltip = { + size = {x = 200, y = 40}, + lines = {{entry = {text = 'Buy _ refineds for _ wealth'}}} + } + }, + { + buttonType = ButtonType.SELL_REFINEDS, + name = 'Sell ref', + trigger = 79, + amount = 10, + tooltip = { + size = {x = 200, y = 40}, + lines = {{entry = {text = 'Sell _ refineds for _ wealth'}}} + } + }, + { + buttonType = ButtonType.BUY_RESEARCH, + name = 'Buy rsch', + trigger = 75, + amount = 10, + tooltip = { + size = {x = 200, y = 40}, + lines = {{entry = {text = 'Buy _ research for _ wealth'}}} + } + }, + { + buttonType = ButtonType.SELL_RESEARCH, + name = 'Sell rsch', + trigger = 76, + amount = 10, + tooltip = { + size = {x = 200, y = 40}, + lines = {{entry = {text = 'Sell _ research for _ wealth'}}} + } + } }, maxUnevenness = .5, isVehicle = false, @@ -2639,6 +2919,7 @@ units = { lineOfSight = 5, colorNodes = {'Cube.001'}, name = 'Trade center', + description = '', basePath = PATH .. structurePrefix .. 'TradeCenters/', meshPath = 'aincTradeCenter.xml', albedoPath = 'tradeCenter.jpg', @@ -2649,10 +2930,46 @@ units = { unitClass = UnitClass.TRADE_CENTER, unitType = UnitType.LAND, abilityButtons = { - {buttonType = ButtonType.BUY_REFINEDS, name = 'Buy ref', trigger = 73}, - {buttonType = ButtonType.SELL_REFINEDS, name = 'Sell ref', trigger = 79}, - {buttonType = ButtonType.BUY_RESEARCH, name = 'Buy rsch', trigger = 75}, - {buttonType = ButtonType.SELL_RESEARCH, name = 'Sell rsch', trigger = 76} + { + buttonType = ButtonType.BUY_REFINEDS, + name = 'Buy ref', + trigger = 73, + amount = 10, + tooltip = { + size = {x = 200, y = 40}, + lines = {{entry = {text = 'Buy _ refineds for _ wealth'}}} + } + }, + { + buttonType = ButtonType.SELL_REFINEDS, + name = 'Sell ref', + trigger = 79, + amount = 10, + tooltip = { + size = {x = 200, y = 40}, + lines = {{entry = {text = 'Sell _ refineds for _ wealth'}}} + } + }, + { + buttonType = ButtonType.BUY_RESEARCH, + name = 'Buy rsch', + trigger = 75, + amount = 10, + tooltip = { + size = {x = 200, y = 40}, + lines = {{entry = {text = 'Buy _ research for _ wealth'}}} + } + }, + { + buttonType = ButtonType.SELL_RESEARCH, + name = 'Sell rsch', + trigger = 76, + amount = 10, + tooltip = { + size = {x = 200, y = 40}, + lines = {{entry = {text = 'Sell _ research for _ wealth'}}} + } + } }, maxUnevenness = .5, isVehicle = false, @@ -2664,6 +2981,7 @@ units = { lineOfSight = 5, colorNodes = {'sphere'}, name = 'Trade center', + description = '', basePath = PATH .. structurePrefix .. 'TradeCenters/', meshPath = 'erTradeCenter.xml', albedoPath = 'tradeCenter.jpg', @@ -2674,7 +2992,20 @@ units = { unitClass = UnitClass.LAB, unitType = UnitType.LAND, maxUnevenness = .5, - abilityButtons = {{buttonType = ButtonType.ACTIVE_STATE, name = 'Tech tree', guiScreen = 'acsTechTree.lua'}}, + abilityButtons = { + { + buttonType = ButtonType.ACTIVE_STATE, + name = 'Tech tree', + guiScreen = 'acsTechTree.lua', + tooltip = { + size = {x = 200, y = 40}, + lines = { + {entry = {text = 'Tech tree'}}, + {entry = {text = 'Access the Asian technology tree'}}, + } + } + } + }, isVehicle = false, health = 500, buildTime = 1000, @@ -2686,6 +3017,7 @@ units = { generationSpeed = 10, researchCost = 1, name = 'Lab', + description = '', colorNodes = {'stripes'}, basePath = PATH .. structurePrefix .. 'Labs/', meshPath = 'acsLab.xml', @@ -2697,7 +3029,20 @@ units = { unitClass = UnitClass.LAB, unitType = UnitType.LAND, maxUnevenness = .5, - abilityButtons = {{buttonType = ButtonType.ACTIVE_STATE, name = 'Tech tree', guiScreen = 'aincTechTree.lua'}}, + abilityButtons = { + { + buttonType = ButtonType.ACTIVE_STATE, + name = 'Tech tree', + guiScreen = 'aincTechTree.lua', + tooltip = { + size = {x = 200, y = 40}, + lines = { + {entry = {text = 'Tech tree'}}, + {entry = {text = 'Access the American technology tree'}}, + } + } + } + }, isVehicle = false, health = 500, buildTime = 1000, @@ -2709,6 +3054,7 @@ units = { generationSpeed = 10, researchCost = 1, name = 'Lab', + description = '', colorNodes = {'stripe'}, basePath = PATH .. structurePrefix .. 'Labs/', meshPath = 'aincLab.xml', @@ -2720,7 +3066,20 @@ units = { unitClass = UnitClass.LAB, unitType = UnitType.LAND, maxUnevenness = .5, - abilityButtons = {{buttonType = ButtonType.ACTIVE_STATE, name = 'Tech tree', guiScreen = 'erTechTree.lua'}}, + abilityButtons = { + { + buttonType = ButtonType.ACTIVE_STATE, + name = 'Tech tree', + guiScreen = 'erTechTree.lua', + tooltip = { + size = {x = 200, y = 40}, + lines = { + {entry = {text = 'Tech tree'}}, + {entry = {text = 'Access the European technology tree'}}, + } + } + } + }, isVehicle = false, health = 500, buildTime = 1000, @@ -2732,6 +3091,7 @@ units = { generationSpeed = 10, researchCost = 1, name = 'Lab', + description = '', colorNodes = {'stripes'}, basePath = PATH .. structurePrefix .. 'Labs/', meshPath = 'erLab.xml', @@ -2796,6 +3156,7 @@ units = { hitboxOffset = {x = 0, y = 4, z = 0}, lineOfSight = 55, name = 'Point defense', + description = '', colorNodes = {'Hoses', 'Hoses.001'}, turretNode = 'TurretBody', basePath = PATH .. structurePrefix .. 'PointDefenses/', @@ -2819,6 +3180,7 @@ units = { size = {x = 9.72, y = 10.14, z = 9.72}, lineOfSight = 5, name = 'Extractor', + description = 'Collects refineds from resource deposits', basePath = PATH .. structurePrefix .. 'Extractors/', meshPath = 'extractor.xml', albedoPath = 'extractor.jpg', @@ -2857,6 +3219,7 @@ units = { hitboxOffset = {x = 0, y = 15.2, z = 0}, lineOfSight = 5, name = 'Refinery', + description = '', basePath = PATH .. structurePrefix .. 'Refineries/', meshPath = 'aincRefinery.xml', albedoPath = 'refinery.jpg', @@ -2876,6 +3239,7 @@ units = { hitboxOffset = {x = 0, y = 13.95, z = 3.23}, lineOfSight = 5, name = 'Refinery', + description = '', basePath = PATH .. structurePrefix .. 'Refineries/', meshPath = 'erRefinery.xml', albedoPath = 'refinery.jpg', @@ -2891,6 +3255,7 @@ units = { hitboxOffset = {x = 0, y = 0, z = 0}, lineOfSight = 5, name = 'Ice sheet', + description = '', basePath = PATH .. structurePrefix .. 'IceSheets/', meshPath = 'iceSheet.xml', albedoPath = 'iceSheet.jpg', diff --git a/Assets/Scripts/Gui/activeGameState.lua b/Assets/Scripts/Gui/activeGameState.lua index cda4cd6..e7fa7da 100644 --- a/Assets/Scripts/Gui/activeGameState.lua +++ b/Assets/Scripts/Gui/activeGameState.lua @@ -118,7 +118,14 @@ gui = { guiScreen = 'tradingHub.lua', pos = {x = minimapSize.x, y = res.y - minimapSize.y, z = -.2}, size = {x = Size.x, y = minimapSize.y - .75 * sz}, - trigger = 10 + trigger = 10, + tooltip = { + offset = {x = Size.x, y = -(minimapSize.y - .75 * sz), z = .1}, + size = {x = 310, y = 20}, + lines = { + {entry = {text = 'Trade resources with other players'}}, + } + } }, { guiType = GuiType.GUI_RECTANGLE, diff --git a/Assets/Scripts/Gui/mainMenu.lua b/Assets/Scripts/Gui/mainMenu.lua index ba8edbe..78fef46 100644 --- a/Assets/Scripts/Gui/mainMenu.lua +++ b/Assets/Scripts/Gui/mainMenu.lua @@ -34,10 +34,13 @@ gui = { baseColor = {x = .6, y = .6, z = .6, w = 1}, hoveredOnColor = {x = .8, y = .8, z = .8, w = 1}, tooltip = { - offset = {x = 100, y = 100}, - size = {x = 300, y = 200}, + offset = {x = 100, y = -25, z = .1}, + size = {x = 270, y = 20}, lines = { - {entry = {text = 'Play with computer opponents'}}, + { + entry = {text = 'Play with computer opponents'}, + }, + } } }, @@ -46,20 +49,41 @@ gui = { size = Size, guiType = GuiType.BUTTON, name = 'Map editor', - buttonType = ButtonType.MAP_EDITOR + buttonType = ButtonType.MAP_EDITOR, + tooltip = { + offset = {x = 100, y = -25, z = .1}, + size = {x = 340, y = 20}, + lines = { + {entry = {text = 'Create new maps or edit existing ones'}}, + } + } }, { pos = {x = 20, y = 220, z = 0}, size = Size, guiType = GuiType.BUTTON, name = 'Options', - buttonType = ButtonType.OPTIONS + buttonType = ButtonType.OPTIONS, + tooltip = { + offset = {x = 100, y = -25, z = .1}, + size = {x = 200, y = 20}, + lines = { + {entry = {text = 'Configure Planet Fleet'}}, + } + } }, { pos = {x = 20, y = 280, z = 0}, size = Size, guiType = GuiType.BUTTON, name = 'Exit', - buttonType = ButtonType.EXIT + buttonType = ButtonType.EXIT, + tooltip = { + offset = {x = 100, y = -25, z = .1}, + size = {x = 150, y = 20}, + lines = { + {entry = {text = 'Exit Planet Fleet'}}, + } + } } } diff --git a/Assets/Scripts/Gui/tradingScreen.lua b/Assets/Scripts/Gui/tradingScreen.lua index 937e83b..d1da4ec 100644 --- a/Assets/Scripts/Gui/tradingScreen.lua +++ b/Assets/Scripts/Gui/tradingScreen.lua @@ -12,6 +12,9 @@ IconPath = {WEALTH = 'Icons/Resources/wealth.png', RESEARCH = 'Icons/Resources/r function createResourceTrayGui(cpuPlayer, lineId, guiId, imgPath) height = HubMargin.top + lineId * iconSize.y + tooltipOffset = {x = iconSize.x * (cpuPlayer and 1 or -1), y = -iconSize.y, z = .1} + tooltipSize = {x = 190, y = 20} + resourceAmountDelta = 10 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} @@ -36,11 +39,18 @@ function createResourceTrayGui(cpuPlayer, lineId, guiId, imgPath) return { guiType = GuiType.BUTTON, buttonType = ButtonType.RESOURCE_AMMOUNT, - ammount = 10, + ammount = resourceAmountDelta, name = '+', pos = guiElPos, size = iconSize, - trigger = 10 + trigger = 10, + tooltip = { + offset = tooltipOffset, + size = tooltipSize, + lines = { + {entry = {text = 'Increase value by ' .. resourceAmountDelta}}, + } + } } 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} @@ -48,11 +58,18 @@ function createResourceTrayGui(cpuPlayer, lineId, guiId, imgPath) return { guiType = GuiType.BUTTON, buttonType = ButtonType.RESOURCE_AMMOUNT, - ammount = -10, + ammount = -resourceAmountDelta, name = '-', pos = guiElPos, size = iconSize, - trigger = 10 + trigger = 10, + tooltip = { + offset = tooltipOffset, + size = tooltipSize, + lines = { + {entry = {text = 'Decrease value by ' .. resourceAmountDelta}}, + } + } } end end diff --git a/Assets/Scripts/Gui/unitGui.lua b/Assets/Scripts/Gui/unitGui.lua index 8890486..e659db7 100644 --- a/Assets/Scripts/Gui/unitGui.lua +++ b/Assets/Scripts/Gui/unitGui.lua @@ -11,7 +11,7 @@ function generateButton(numGui, buttonData) yOffset = (numGui + 1) % 2 == 0 and (buttonSize.y + buttonSpace.y) or 0 button = { - pos = {x = buttonInitPos.x + xOffset, y = buttonInitPos.y + yOffset, z = .5}, + pos = {x = buttonInitPos.x + xOffset, y = buttonInitPos.y + yOffset, z = buttonInitPos.z}, size = buttonSize, guiType = GuiType.BUTTON, name = buttonData.name, @@ -22,6 +22,8 @@ function generateButton(numGui, buttonData) factoryId = buttonData.factoryId, engineerId = buttonData.engineerId, guiScreen = buttonData.guiScreen, + tooltip = buttonData.tooltip, + amount = buttonData.amount, slotId = buttonData.slotId } @@ -30,15 +32,50 @@ end function generateGui(unitId) local gui = {} + haltOrder = { + buttonType = ButtonType.ORDER, + orderType = OrderType.HALT, + name = 'Halt', + tooltip = { + offset = {x = buttonSize.x, y = -buttonSize.y, z = .1}, + size = {x = 210, y = 20}, + lines = {{entry = {text = "Cancel all unit\'s orders"}}} + } + } vehicleButtonData = { - {buttonType = ButtonType.UNIT_STATE, imagePath = 'Icons/Buttons/chase.png'}, - {buttonType = ButtonType.ORDER, orderType = OrderType.GARRISON, name = 'Garrison'}, - {buttonType = ButtonType.ORDER, orderType = OrderType.PATROL, name = 'Patrol'}, - {buttonType = ButtonType.ORDER, orderType = OrderType.HALT, name = 'Halt'}, - } - structureButtonData = { - {buttonType = ButtonType.ORDER, orderType = OrderType.HALT, name = 'Halt'} + { + buttonType = ButtonType.UNIT_STATE, + imagePath = 'Icons/Buttons/chase.png', + tooltip = { + offset = {x = buttonSize.x, y = -buttonSize.y, z = .1}, + size = {x = 340, y = 120}, + lines = { + {entry = {text = 'Toggle unit state'}}, + {entry = {text = '(C)hase: automatically attacks and'}}, + {entry = {text = 'pursues enemies'}}, + {entry = {text = '(S)tand ground: automatically fires on'}}, + {entry = {text = 'enemies but does not move'}}, + {entry = {text = '(H)old fire: does not react to enemies'}}, + } + } + }, + { + buttonType = ButtonType.ORDER, + orderType = OrderType.GARRISON, + name = 'Garrison', + tooltip = { + offset = {x = buttonSize.x, y = -buttonSize.y, z = .1}, + size = {x = 300, y = 60}, + lines = { + {entry = {text = 'Garrison'}}, + {entry = {text = 'Enter a garrisonable unit, such as a'}}, + {entry = {text = 'transport ship'}}, + } + } + }, + haltOrder } + structureButtonData = {haltOrder} mainUnit = units[unitId + 1] unitButtonData = mainUnit.isVehicle and vehicleButtonData or structureButtonData @@ -47,7 +84,15 @@ function generateGui(unitId) unitButtonData[#unitButtonData + 1] = { buttonType = ButtonType.ORDER, orderType = OrderType.EJECT, - name = 'Eject' + name = 'Eject', + tooltip = { + offset = {x = buttonSize.x, y = -buttonSize.y, z = .1}, + size = {x = 220, y = 40}, + lines = { + {entry = {text = 'Eject'}}, + {entry = {text = 'Eject all garrisoned units'}}, + } + } } end @@ -64,7 +109,13 @@ function generateGui(unitId) name = abilButton.name, buttonType = abilButton.buttonType, guiScreen = abilButton.guiScreen, - orderType = abilButton.orderType + orderType = abilButton.orderType, + amount = abilButton.amount, + tooltip = { + offset = {x = buttonSize.x, y = -buttonSize.y, z = .1}, + size = abilButton.tooltip.size, + lines = abilButton.tooltip.lines + } } gui[#gui + 1] = generateButton(#gui, buttonData) end @@ -86,6 +137,8 @@ function generateGui(unitId) mainUnit.unitClass == UnitClass.ENGINEER or mainUnit.unitClass == UnitClass.FREEZER ) + costStr = '' .. units[buildUnit.id + 1].cost + buildTimeStr = '' .. units[buildUnit.id + 1].buildTime buttonData = { trigger = buildUnit.trigger, @@ -94,7 +147,21 @@ function generateGui(unitId) factoryId = (isFactory and unitId or nil), engineerId = (isEng and unitId or nil), imagePath = buildUnit.iconPath, - slotId = (ButtonType.BUILD and i - 1 or nil) + slotId = (ButtonType.BUILD and i - 1 or nil), + tooltip = { + offset = {x = buttonSize.x, y = -buttonSize.y, z = .1}, + size = {x = 220, y = 60}, + lines = { + {entry = {text = units[buildUnit.id + 1].name}}, + { + entry = {text = 'Cost: ' .. costStr .. ' ' .. buildTimeStr}, + icons = { + {charId = 0, path = 'Resources/refineds.png'}, + {charId = 9 + #costStr, path = 'Resources/time.png'} + } + }, + } + } } gui[#gui + 1] = generateButton(#gui, buttonData) diff --git a/Assets/Textures/Icons/Resources/time.png b/Assets/Textures/Icons/Resources/time.png index ae1ba7c9c6232c602006cacc5b94ef50d4226ba1..a671a83db09f28725ec60db05601c0a98c7de420 100644 GIT binary patch delta 2941 zcmV-@3xf2+7OxkOED9O`00$ZYIPK+$kv1oP3p`0gK~#90?VWqDS5+0qKkI_`iV6w{ zTt#_Yc{bRT)mRpqh)t$wK{HB%X8$xj>@^cI)dbEoJ;boA9IY%vn@D>oKFWg7@kNk5 zsMLE&QxuR?9$vgW%DehwoeRJFT?IECl8Olj~f38}LhDg{nSP=duq&ZiI-)C}2KD z#9MPw;&5yLZUug(sxRlFfvVOu0poyw?*JWu7BqDL*8?Zly?yFPL<{h3U|#_m+?x&n zD}bqeh7jP`h=~6cpn;R7|3-Bf)~g8t<^azZph2@rTY<}nzP-JM5NxWtwg3%StF#&z zUyHWOe3m65bAg+I<1);)gJ@v~v_`2N`|!3@d1eD}AGWBRf-NkM%221Bz!j>0dRK;d zX4gZ2CTyI|;tkx7^{_7k?*fjfP~JR8KBtt(H)0FUCBOqw8EN(G1eODhg&MMeX6%hj zTfs+xj{(CSWq#6;-^?DK9|3$Ecq{|G*8yV+K?pDjcsfO8y5{_o1IxWK4IyQDO#!|O z>`hURO+ZVoga9*uEeR{ojty~tCnhXAGeS!890e=|b|tLSi@=+6Ap|%R*quP>PTWA_9@_;G(^;ckdiWH0vi*Oa$1ry8wiAm zOagvK*tAxGZvZn?bxmlQc|lbl0^R~#i`Bu4VZgm2Qf*4!W1%5$%xG+XEfDgyyac>2 zi(XOh9#U4`1;ERJb$=RYu1OCOktX0C!puW<5;hIb@ZU z-30tRpglT)_h&L>iO58MYzin&j_&~Gsp>wbe6NG5?gu`E9sPPBz|A5uK2ESlLPSIe z+bCQEEL7D_r+lx4s=f{^!1l#F7y0I|`pg;j5%P&&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V!(5Moxxao&L~^_8 z(OIc}oN%GxZr~EF^fg`$4GdgUfd3H=T(1G=HhVyA!T{cl?Q8UX9p>|}=@nalXPKs8JAM5!?Vv_=NK*-M1sI3DlWXK@`Xe?|*7QoQu^f{y zpC5-KWqA-7n@XN37ib2y_rx#EAz%q`PO~e#irnvWFD3^gvcCe%O*QWf3OC%1EeFc9 zm?gkWU~mhNFxbhmv`mZG@5YLXGkyJr5U;>zV1E4eMG71A$F~B1-Ay3kJj~(Qjxut+ z1N;W)$V{FlRKO_AQOw>l6`_0=NxZrCCmfcijJDvaX+4+TJAL zJj=|+{9ScdxpXsTN_8D(pKv`kF7*I=RCRA8-D5CgF2k{xi%v{C-G%9z#!?w8v9-2; zQq?!(m#T3zjgS(1Axtqj2lLP{@d%ek5$KP=+?&S58f<^YAG8I$U$+DyKAb9lDrS0n z8lgHnDQpCmVSD + inkscape:export-xdpi="46.181816" + inkscape:export-ydpi="46.181816" /> + x="21.99954" + y="144.25369" + transform="rotate(-50.109638)" /> getPath() + "Fonts/batang.ttf"; - return new Tooltip(guiPos + offset, size, lines, fontPath); + Tooltip *tooltip = new Tooltip(guiPos + offset, size, lines, fontPath); + + sol::optional bgColorTblOpt = tooltipTbl["backgroundColor"]; + + if(bgColorTblOpt != sol::nullopt){ + sol::table bgColorTbl = tooltipTbl["backgroundColor"]; + Vector4 bgColor = Vector4(bgColorTbl["x"], bgColorTbl["y"], bgColorTbl["z"], bgColorTbl["w"]); + tooltip->getBackground()->getMaterial()->setVec4Uniform("diffuseColor", bgColor); + } + + return tooltip; } //TODO refactor player difficulty and faction listbox selection @@ -242,16 +256,16 @@ namespace battleship{ button = new ResearchButton(pos, size, name, (int)guiTable["trigger"], imagePath, (int)guiTable["techId"]); break; case BUY_REFINEDS: - button = new TradeButton(pos, size, name, (int)guiTable["trigger"], imagePath, TradeButton::Type::BUY_REFINEDS); + button = new TradeButton(pos, size, name, (int)guiTable["trigger"], imagePath, TradeButton::Type::BUY_REFINEDS, (int)guiTable["amount"]); break; case SELL_REFINEDS: - button = new TradeButton(pos, size, name, (int)guiTable["trigger"], imagePath, TradeButton::Type::SELL_REFINEDS); + button = new TradeButton(pos, size, name, (int)guiTable["trigger"], imagePath, TradeButton::Type::SELL_REFINEDS, (int)guiTable["amount"]); break; case BUY_RESEARCH: - button = new TradeButton(pos, size, name, (int)guiTable["trigger"], imagePath, TradeButton::Type::BUY_RESEARCH); + button = new TradeButton(pos, size, name, (int)guiTable["trigger"], imagePath, TradeButton::Type::BUY_RESEARCH, (int)guiTable["amount"]); break; case SELL_RESEARCH: - button = new TradeButton(pos, size, name, (int)guiTable["trigger"], imagePath, TradeButton::Type::SELL_RESEARCH); + button = new TradeButton(pos, size, name, (int)guiTable["trigger"], imagePath, TradeButton::Type::SELL_RESEARCH, (int)guiTable["amount"]); break; case ACTIVE_STATE_BUTTON: button = new ActiveStateButton(pos, size, guiTable["guiScreen"], name, fontBasePath + "batang.ttf", (int)guiTable["trigger"], imagePath); diff --git a/pfButtonBase.h b/pfButtonBase.h index 01a50e9..d0a5353 100644 --- a/pfButtonBase.h +++ b/pfButtonBase.h @@ -15,7 +15,7 @@ namespace battleship{ inline void setEnabledHoverdOn(bool e){this->enabledHoveredOn = e;} inline void setHoveredOnColor(vb01::Vector4 hc){this->hoveredOnColor = hc;} inline void setBaseColor(vb01::Vector4 bc){this->baseColor = bc;} - private: + protected: bool enabledHoveredOn = false; vb01::Vector4 baseColor, hoveredOnColor; Tooltip *tooltip = nullptr; diff --git a/tooltip.cpp b/tooltip.cpp index 838c3bf..b1df009 100644 --- a/tooltip.cpp +++ b/tooltip.cpp @@ -16,7 +16,7 @@ namespace battleship{ Root *root = Root::getSingleton(); Material *bgMat = new Material(root->getLibPath() + "gui"); bgMat->addBoolUniform("texturingEnabled", false); - bgMat->addVec4Uniform("diffuseColor", Vector4(.5, .5, .5, .5)); + bgMat->addVec4Uniform("diffuseColor", Vector4(.5, .5, .5, 1)); background = new Quad(Vector3(s.x, s.y, 0), false); background->setMaterial(bgMat); @@ -35,12 +35,10 @@ namespace battleship{ textMat->addBoolUniform("texturingEnabled", false); textMat->addVec4Uniform("diffuseColor", ld.textColor); - float scale = .2; - - Vector3 offset = Vector3(0, 20 * (i + 1), .01); + Vector3 offset = ld.getLineOffset(i); Text *text = new Text(fontPath, ld.entryText); text->setMaterial(textMat); - Node *textNode = new Node(pos + offset - Vector3(0, 3, 0), Quaternion::QUAT_W, scale * Vector3::VEC_IJK); + Node *textNode = new Node(pos + offset, Quaternion::QUAT_W, ld.scale * Vector3::VEC_IJK); textNode->addText(text); bgNode->attachChild(textNode); @@ -50,7 +48,7 @@ namespace battleship{ for(int j = 0; j < iconData.first; j++){ Text::Glyph *glyph = text->getGlyph(entry[j]); - iconOffset.x += scale * (glyph->advance >> 6); + iconOffset.x += ld.scale * (glyph->advance >> 6); } entry.insert(iconData.first, L" "); @@ -62,7 +60,7 @@ namespace battleship{ Texture *t = new Texture(ip, 1, false); iconMat->addTexUniform("textures[0]", t, false); - Vector2 iconSize = 20 * Vector2::VEC_IJ; + Vector2 iconSize = ld.height * Vector2::VEC_IJ; Quad *rect = new Quad(Vector3(iconSize.x, iconSize.y, 0), false); rect->setMaterial(iconMat); Node *rectNode = new Node(iconOffset - Vector3(0, iconSize.y, 0)); diff --git a/tooltip.h b/tooltip.h index 12316e4..724765c 100644 --- a/tooltip.h +++ b/tooltip.h @@ -16,11 +16,23 @@ namespace battleship{ class Tooltip{ public: struct LineData{ + int height; + float scale; + vb01::Vector3 textOffset; std::wstring entryText; vb01::Vector4 textColor; std::vector> iconsData; - LineData(std::wstring et, vb01::Vector4 tc, std::vector> id) : entryText(et), textColor(tc), iconsData(id){}; + inline vb01::Vector3 getLineOffset(int i){return vb01::Vector3(textOffset.x, height * (i + 1) + textOffset.y, textOffset.z);} + + LineData(std::wstring et, vb01::Vector4 tc, std::vector> id, int h, vb01::Vector3 to, float s) : + entryText(et), + textColor(tc), + iconsData(id), + height(h), + textOffset(to), + scale(s) + {} }; Tooltip(vb01::Vector3, vb01::Vector2, std::vector, std::string); diff --git a/tradeButton.cpp b/tradeButton.cpp index 51b98a5..8a0c28b 100644 --- a/tradeButton.cpp +++ b/tradeButton.cpp @@ -2,6 +2,10 @@ #include "activeGameState.h" #include "player.h" +#include +#include +#include + #include namespace battleship{ @@ -9,15 +13,42 @@ namespace battleship{ using namespace vb01; using namespace gameBase; - TradeButton::TradeButton(Vector3 pos, Vector2 size, string name, int trigger, string imagePath, Type t) : UnitButton(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", trigger, imagePath), type(t){} + TradeButton::TradeButton(Vector3 pos, Vector2 size, string name, int trigger, string imagePath, Type t, int am) : + UnitButton(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", trigger, imagePath), + type(t), + amount(am) + {} void TradeButton::onClick(){ ActiveGameState *activeState = (ActiveGameState*)(GameManager::getSingleton()->getStateManager()->getAppStateByType((int)AppStateType::ACTIVE_STATE)); Player *player = activeState->getPlayer(); - int resType, ammount = 10; + int resType; bool buy; + editResourceTradeData(resType, buy); + player->getTrader()->trade(player, resType, amount, buy); + } + void TradeButton::update(){ + PfButtonBase::update(); + + Text *descText = tooltip->getBackground()->getNode()->getChild(0)->getText(0); + + if(tooltipInitDesc == L"") tooltipInitDesc = descText->getText(); + + wstring entry = tooltipInitDesc; + entry.replace(entry.find_first_of(L"_"), 1, to_wstring(amount)); + + int rt; + bool b; + editResourceTradeData(rt, b); + ActiveGameState *activeState = (ActiveGameState*)(GameManager::getSingleton()->getStateManager()->getAppStateByType((int)AppStateType::ACTIVE_STATE)); + entry.replace(entry.find_last_of(L"_"), 1, to_wstring(activeState->getPlayer()->getTrader()->getResourceRate(rt))); + + descText->setText(entry); + } + + void TradeButton::editResourceTradeData(int &resType, bool &buy){ switch(type){ case Type::BUY_REFINEDS: resType = (int)ResourceType::REFINEDS; @@ -36,7 +67,5 @@ namespace battleship{ buy = false; break; } - - player->getTrader()->trade(player, resType, ammount, buy); } } diff --git a/tradeButton.h b/tradeButton.h index 604858b..fd504fc 100644 --- a/tradeButton.h +++ b/tradeButton.h @@ -8,10 +8,15 @@ namespace battleship{ public: enum class Type{BUY_REFINEDS, SELL_REFINEDS, BUY_RESEARCH, SELL_RESEARCH}; - TradeButton(vb01::Vector3, vb01::Vector2, std::string, int, std::string, Type); + TradeButton(vb01::Vector3, vb01::Vector2, std::string, int, std::string, Type, int); void onClick(); + void update(); private: Type type; + int amount; + std::wstring tooltipInitDesc = L""; + + void editResourceTradeData(int&, bool&); }; } diff --git a/trader.cpp b/trader.cpp index 5e5af2e..49d2baa 100644 --- a/trader.cpp +++ b/trader.cpp @@ -45,17 +45,12 @@ namespace battleship{ } } - void Trader::trade(Player *tradingPlayer, int rt, int ammount, bool buying){ - int tradeResRate; + int Trader::getResourceRate(int rt){ + return (ResourceType)rt == ResourceType::REFINEDS ? refinedsRate : researchRate; + } - switch((ResourceType)rt){ - case ResourceType::REFINEDS: - tradeResRate = refinedsRate; - break; - case ResourceType::RESEARCH: - tradeResRate = researchRate; - break; - } + void Trader::trade(Player *tradingPlayer, int rt, int ammount, bool buying){ + int tradeResRate = getResourceRate(rt); if(buying && ammount * tradeResRate <= tradingPlayer->getResource(ResourceType::WEALTH)){ tradingPlayer->updateResource((ResourceType)rt, ammount, true); diff --git a/trader.h b/trader.h index 1121cf4..acfbfbf 100644 --- a/trader.h +++ b/trader.h @@ -11,6 +11,7 @@ namespace battleship{ Trader(); void update(); void trade(Player*, int, int, bool); + int getResourceRate(int); private: void initProperties();