Merge pull request #293 from devZoGok/ft-284-tooltips

Ft 284 tooltips
This commit is contained in:
devZoGok
2026-08-12 17:26:20 +00:00
committed by GitHub
59 changed files with 921 additions and 177 deletions
+392 -27
View File
@@ -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',
+8 -1
View File
@@ -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,
+37 -4
View File
@@ -30,27 +30,60 @@ gui = {
size = Size,
guiType = GuiType.BUTTON,
name = 'Single player',
buttonType = ButtonType.SINGLE_PLAYER
buttonType = ButtonType.SINGLE_PLAYER,
baseColor = {x = .6, y = .6, z = .6, w = 1},
hoveredOnColor = {x = .8, y = .8, z = .8, w = 1},
tooltip = {
offset = {x = 100, y = -25, z = .1},
size = {x = 270, y = 20},
lines = {
{
entry = {text = 'Play with computer opponents'},
},
}
}
},
{
pos = {x = 20, y = 160, z = 0},
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'}},
}
}
}
}
+21 -4
View File
@@ -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
+78 -11
View File
@@ -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)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

+12 -11
View File
@@ -7,7 +7,7 @@
viewBox="0 0 210 297"
version="1.1"
id="svg1"
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)"
inkscape:version="1.4.4 (dcaf3e7d9e, 2026-05-05)"
sodipodi:docname="time.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
@@ -23,9 +23,9 @@
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
inkscape:zoom="1.0733976"
inkscape:cx="429.47738"
inkscape:cy="417.36631"
inkscape:zoom="0.75900672"
inkscape:cx="334.64789"
inkscape:cy="388.0071"
inkscape:window-width="1918"
inkscape:window-height="1058"
inkscape:window-x="0"
@@ -39,23 +39,24 @@
inkscape:groupmode="layer"
id="layer1">
<circle
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.5;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:5;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
id="path1"
cy="75.38356"
cx="125.38356"
r="25"
inkscape:export-filename="time.png"
inkscape:export-xdpi="49.320389"
inkscape:export-ydpi="49.320389" />
inkscape:export-xdpi="46.181816"
inkscape:export-ydpi="46.181816" />
<rect
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
id="rect1"
width="15"
height="1.7659841"
x="125"
y="75" />
x="21.99954"
y="144.25369"
transform="rotate(-50.109638)" />
<rect
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:square;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
id="rect1-5"
width="22.780312"
height="1.7659841"

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

+1 -1
View File
@@ -23,7 +23,7 @@ set(OPTIONS_BUTTONS optionsButton.cpp tabButton.cpp okButton.cpp defaultsButton.
set(TRADING_BUTTONS activeStateBackButton.cpp 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 statsButton.cpp activeStateButton.cpp minimapButton.cpp ${TRADING_BUTTONS} ${OPTIONS_BUTTONS} ${MENU_BUTTONS} ${MAP_EDITOR_BUTTONS} ${UNIT_BUTTONS})
set(BUTTONS pfButtonBase.cpp statsButton.cpp activeStateButton.cpp minimapButton.cpp ${TRADING_BUTTONS} ${OPTIONS_BUTTONS} ${MENU_BUTTONS} ${MAP_EDITOR_BUTTONS} ${UNIT_BUTTONS})
set(LISTBOXES skyboxTextureListbox.cpp landTextureListbox.cpp gameObjectListbox.cpp mapListbox.cpp)
set(GUI tooltip.cpp concreteGuiManager.cpp ${BUTTONS} ${LISTBOXES})
+1 -1
View File
@@ -19,7 +19,7 @@ namespace battleship{
using namespace gameBase;
ActiveStateButton::ActiveStateButton(Vector3 pos, Vector2 size, string gs, string name, string fontPath, int trigger, string imagePath) :
Button(pos, size, name, fontPath, trigger, true, imagePath), guiScreen(gs){}
PfButtonBase(pos, size, name, fontPath, trigger, true, imagePath), guiScreen(gs){}
void ActiveStateButton::onClick(){
StateManager *stateManager = GameManager::getSingleton()->getStateManager();
+2 -2
View File
@@ -1,10 +1,10 @@
#ifndef ACTIVE_STATE_BUTTON_H
#define ACTIVE_STATE_BUTTON_H
#include <button.h>
#include "pfButtonBase.h"
namespace battleship{
class ActiveStateButton : public vb01Gui::Button{
class ActiveStateButton : public PfButtonBase{
public:
ActiveStateButton(vb01::Vector3, vb01::Vector2, std::string, std::string, std::string, int = -1, std::string = "");
void onClick();
+1 -1
View File
@@ -8,7 +8,7 @@ namespace battleship{
using namespace vb01Gui;
BackButton::BackButton(Vector3 pos, Vector2 size, string name, string scr) :
Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true),
PfButtonBase(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true),
screen(scr){}
void BackButton::onClick() {
+2 -2
View File
@@ -1,10 +1,10 @@
#ifndef BACK_BUTTON_H
#define BACK_BUTTON_H
#include <button.h>
#include "pfButtonBase.h"
namespace battleship{
class BackButton : public vb01Gui::Button{
class BackButton : public PfButtonBase{
public:
BackButton(vb01::Vector3, vb01::Vector2, std::string, std::string);
void onClick();
+81 -6
View File
@@ -1,4 +1,3 @@
#include <solUtil.h>
#include <soundManager.h>
#include <quad.h>
@@ -6,6 +5,7 @@
#include "concreteGuiManager.h"
#include "unit.h"
#include "gameManager.h"
#include "pfButtonBase.h"
#include "singlePlayerButton.h"
#include "mapEditorButton.h"
#include "optionsButton.h"
@@ -60,6 +60,56 @@ namespace battleship{
return concreteGuiManager;
}
Tooltip* ConcreteGuiManager::parseTooltip(sol::table &tooltipTbl, Vector3 guiPos){
sol::table offsetTbl = tooltipTbl["offset"], sizeTbl = tooltipTbl["size"];
Vector3 offset = Vector3(offsetTbl["x"], offsetTbl["y"], offsetTbl["z"]);
Vector2 size = Vector2(sizeTbl["x"], sizeTbl["y"]);
sol::table lineDataTbl = tooltipTbl["lines"];
int numLines = lineDataTbl.size();
vector<Tooltip::LineData> lines;
for(int i = 0; i < numLines; i++){
vector<pair<int, string>> iconsData;
sol::optional<sol::table> iconsTblOpt = lineDataTbl[i + 1]["icons"];
if(iconsTblOpt != sol::nullopt){
sol::table iconsTbl = lineDataTbl[i + 1]["icons"];
int numIcons = iconsTbl.size();
for(int j = 0; j < numIcons; j++)
iconsData.push_back(make_pair(iconsTbl[j + 1]["charId"], iconsTbl[j + 1]["path"]));
}
sol::table entryTbl = lineDataTbl[i + 1]["entry"];
wstring entry = (wstring)entryTbl["text"];
Vector4 color = Vector4::VEC_IJKL;
sol::optional<sol::table> colorTblOpt = entryTbl["color"];
if(colorTblOpt != sol::nullopt)
color = Vector4(entryTbl["color"]["r"], entryTbl["color"]["g"], entryTbl["color"]["b"], entryTbl["color"]["a"]);
int height = 20;
float scale = .2;
Vector3 textOffset = Vector3(0, -3, .21);
lines.push_back(Tooltip::LineData(entry, color, iconsData, height, textOffset, scale));
}
string fontPath = GameManager::getSingleton()->getPath() + "Fonts/batang.ttf";
Tooltip *tooltip = new Tooltip(guiPos + offset, size, lines, fontPath);
sol::optional<sol::table> 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
//TODO remove hardcoded font path values
//TODO use configurable map path values
@@ -91,7 +141,15 @@ namespace battleship{
bool texturingEnabled = true;
}
Button *button = nullptr;
Tooltip *tooltip = nullptr;
sol::optional<sol::table> tooltipTblOpt = guiTable["tooltip"];
if(tooltipTblOpt != sol::nullopt){
sol::table tbl = guiTable["tooltip"];
tooltip = parseTooltip(tbl, pos);
}
PfButtonBase *button = nullptr;
string guiScreen = "";
switch(type){
@@ -198,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);
@@ -246,6 +304,23 @@ namespace battleship{
}
}
sol::optional<sol::table> baseColorTblOpt = guiTable["baseColor"], hoveredColorTblOpt = guiTable["hoveredOnColor"];
if(baseColorTblOpt != sol::nullopt){
sol::table baseColorTbl = guiTable["baseColor"];
Vector4 color = Vector4(baseColorTbl["x"], baseColorTbl["y"], baseColorTbl["z"], baseColorTbl["w"]);
button->setBaseColor(color);
button->setColor(color);
}
if(hoveredColorTblOpt != sol::nullopt){
sol::table hoveredColorTbl = guiTable["hoveredOnColor"];
button->setHoveredOnColor(Vector4(hoveredColorTbl["x"], hoveredColorTbl["y"], hoveredColorTbl["z"], hoveredColorTbl["w"]));
button->setEnabledHoverdOn(true);
}
button->setTooltip(tooltip);
int typeArr[2]{(int)GuiElementType::BUTTON, (int)type};
guiElements.push_back(make_pair(typeArr, (void*)button));
+3
View File
@@ -2,6 +2,7 @@
#define CONCRETE_GUI_MANAGER_H
#include <abstractGuiManager.h>
#include <solUtil.h>
#include <string>
#include <utility>
@@ -71,6 +72,7 @@ namespace battleship{
CONSOLE,
TRADE_OFFERS
};
class Tooltip;
class ConcreteGuiManager : public vb01Gui::AbstractGuiManager{
public:
@@ -99,6 +101,7 @@ namespace battleship{
void parseLuaScript(std::string, std::string = "");
private:
ConcreteGuiManager();
Tooltip* parseTooltip(sol::table&, vb01::Vector3);
vb01Gui::Button* parseButton(int);
vb01Gui::Listbox* parseGameObjectListbox();
vb01Gui::Listbox* parseListbox(int);
+1 -1
View File
@@ -6,7 +6,7 @@ namespace battleship{
using namespace vb01;
using namespace vb01Gui;
DefaultsButton::DefaultsButton(Vector3 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) : PfButtonBase(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) {}
void DefaultsButton::onClick() {}
}
+2 -2
View File
@@ -1,10 +1,10 @@
#ifndef DEFAULTS_BUTTON_H
#define DEFAULTS_BUTTON_H
#include <button.h>
#include "pfButtonBase.h"
namespace battleship{
class DefaultsButton : public vb01Gui::Button{
class DefaultsButton : public PfButtonBase{
public:
DefaultsButton(vb01::Vector3, vb01::Vector2, std::string);
void onClick();
+1 -1
View File
@@ -5,7 +5,7 @@ using namespace std;
using namespace vb01;
namespace battleship{
ExitButton::ExitButton(Vector3 pos, Vector2 size) : Button(pos, size, "Exit", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) {}
ExitButton::ExitButton(Vector3 pos, Vector2 size) : PfButtonBase(pos, size, "Exit", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) {}
void ExitButton::onClick() {
GameManager::getSingleton()->setRunning(false);
+3 -2
View File
@@ -1,11 +1,12 @@
#ifndef EXIT_BUTTON_H
#define EXIT_BUTTON_H
#include <button.h>
#include "pfButtonBase.h"
#include <vector.h>
namespace battleship {
class ExitButton : public vb01Gui::Button {
class ExitButton : public PfButtonBase {
public:
ExitButton(vb01::Vector3, vb01::Vector2);
void onClick();
+1 -1
View File
@@ -10,7 +10,7 @@ namespace battleship{
using namespace vb01Gui;
using namespace gameBase;
ExportButton::ExportButton(Vector3 pos, Vector2 size) : Button(pos, size, "Export", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf"){}
ExportButton::ExportButton(Vector3 pos, Vector2 size) : PfButtonBase(pos, size, "Export", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true){}
void ExportButton::onClick(){
StateManager *sm = GameManager::getSingleton()->getStateManager();
+2 -2
View File
@@ -1,10 +1,10 @@
#ifndef EXPORT_BUTTON_H
#define EXPORT_BUTTON_H
#include <button.h>
#include "pfButtonBase.h"
namespace battleship{
class ExportButton : public vb01Gui::Button{
class ExportButton : public PfButtonBase{
public:
ExportButton(vb01::Vector3 pos, vb01::Vector2 size);
void onClick();
+8 -7
View File
@@ -1,6 +1,5 @@
#include <algorithm>
#include <button.h>
#include <util.h>
#include <root.h>
@@ -11,6 +10,7 @@
#include "defConfigs.h"
#include "inGameAppState.h"
#include "pfButtonBase.h"
#include "game.h"
#include "console.h"
#include "gameObjectFrameController.h"
@@ -27,22 +27,23 @@ namespace battleship{
using namespace configData;
using namespace gameBase;
InGameAppState::ResumeButton::ResumeButton(Vector3 pos, Vector2 size) : Button(pos, size, "Resume", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) {}
InGameAppState::ResumeButton::ResumeButton(Vector3 pos, Vector2 size) : PfButtonBase(pos, size, "Resume", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) {}
void InGameAppState::ResumeButton::onClick() {
Game::getSingleton()->togglePause();
}
InGameAppState::ConsoleButton::ConsoleButton(Vector3 pos, Vector2 size) : Button(pos, size, "Console", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) { }
InGameAppState::ConsoleButton::ConsoleButton(Vector3 pos, Vector2 size) : PfButtonBase(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, Vector3 pos, Vector2 size, string name) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", 257, true) {
textbox = t;
listbox = l;
}
InGameAppState::ConsoleButton::ConsoleButton::ConsoleCommandEntryButton::ConsoleCommandEntryButton(Textbox *t, Listbox *l, Vector3 pos, Vector2 size, string name) :
PfButtonBase(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", 257, true),
textbox(t),
listbox(l)
{}
void InGameAppState::ConsoleButton::ConsoleButton::ConsoleCommandEntryButton::onClick() {
Console::execute(wstringToString(textbox->getText()));
+3 -3
View File
@@ -16,16 +16,16 @@
namespace battleship{
class InGameAppState : public gameBase::AbstractAppState {
public:
class ResumeButton : public vb01Gui::Button {
class ResumeButton : public PfButtonBase {
public:
ResumeButton(vb01::Vector3, vb01::Vector2);
void onClick();
private:
};
class ConsoleButton : public vb01Gui::Button {
class ConsoleButton : public PfButtonBase {
public:
class ConsoleCommandEntryButton : public Button {
class ConsoleCommandEntryButton : public PfButtonBase {
public:
ConsoleCommandEntryButton(vb01Gui::Textbox*, vb01Gui::Listbox*, vb01::Vector3, vb01::Vector2, std::string);
void onClick();
+5 -2
View File
@@ -12,7 +12,10 @@ namespace battleship{
using namespace vb01Gui;
using namespace gameBase;
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; }
LoadMapButton::OkButton::OkButton(Vector3 pos, Vector2 size, Listbox *lb) :
PfButtonBase(pos, size, "Ok", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true),
listbox(lb)
{}
void LoadMapButton::OkButton::onClick(){
StateManager *sm = GameManager::getSingleton()->getStateManager();
@@ -20,7 +23,7 @@ namespace battleship{
handleLoadingGui(new LoadingAppState(new MapEditorAppState(name, Vector2::VEC_ZERO, false), "mapEditor.lua"));
}
LoadMapButton::LoadMapButton(Vector3 pos, Vector2 size) : Button(pos, size, "Load map", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf"){}
LoadMapButton::LoadMapButton(Vector3 pos, Vector2 size) : PfButtonBase(pos, size, "Load map", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true){}
void LoadMapButton::onClick(){
ConcreteGuiManager::getSingleton()->readLuaScreenScript("loadMap.lua");
+3 -3
View File
@@ -1,16 +1,16 @@
#ifndef LOAD_MAP_BUTTON_H
#define LOAD_MAP_BUTTON_H
#include <button.h>
#include "pfButtonBase.h"
namespace vb01Gui{
class Listbox;
}
namespace battleship{
class LoadMapButton : public vb01Gui::Button{
class LoadMapButton : public PfButtonBase{
public:
class OkButton : public vb01Gui::Button{
class OkButton : public PfButtonBase{
public:
OkButton(vb01::Vector3, vb01::Vector2, vb01Gui::Listbox*);
void onClick();
+1 -1
View File
@@ -7,7 +7,7 @@ namespace battleship{
using namespace vb01;
using namespace vb01Gui;
MainMenuButton::MainMenuButton(Vector3 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) : PfButtonBase(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true){}
void MainMenuButton::onClick(){
}
+2 -2
View File
@@ -1,10 +1,10 @@
#ifndef MAIN_MENU_BUTTON_H
#define MAIN_MENU_BUTTON_H
#include <button.h>
#include "pfButtonBase.h"
namespace battleship{
class MainMenuButton : public vb01Gui::Button{
class MainMenuButton : public PfButtonBase{
public:
MainMenuButton(vb01::Vector3, vb01::Vector2, std::string);
void onClick();
+3 -4
View File
@@ -1,14 +1,13 @@
#ifndef MAP_EDITOR_BUTTON_H
#define MAP_EDITOR_BUTTON_H
#include <button.h>
#include "pfButtonBase.h"
#include "gameManager.h"
namespace battleship{
class MapEditorButton : public vb01Gui::Button{
class MapEditorButton : public PfButtonBase{
public:
MapEditorButton(vb01::Vector3 pos, vb01::Vector2 size) : vb01Gui::Button(pos, size, "Map editor", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf"){}
MapEditorButton(vb01::Vector3 pos, vb01::Vector2 size) : PfButtonBase(pos, size, "Map editor", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true){}
void onClick();
private:
};
+7 -6
View File
@@ -15,11 +15,12 @@ namespace battleship{
using namespace vb01Gui;
using namespace gameBase;
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;
}
NewMapButton::OkButton::OkButton(Vector3 pos, Vector2 size, Textbox *nm, Textbox *sx, Textbox *sy) :
PfButtonBase(pos, size, "Ok", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true),
name(nm),
sizeX(sx),
sizeY(sy)
{}
void NewMapButton::OkButton::onClick(){
Vector2 size = Vector2(
@@ -29,7 +30,7 @@ namespace battleship{
handleLoadingGui(new LoadingAppState(new MapEditorAppState(wstringToString(name->getText()), size, true), "mapEditor.lua"));
}
NewMapButton::NewMapButton(Vector3 pos, Vector2 size) : Button(pos, size, "New map", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf"){}
NewMapButton::NewMapButton(Vector3 pos, Vector2 size) : PfButtonBase(pos, size, "New map", GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true){}
void NewMapButton::onClick(){
ConcreteGuiManager::getSingleton()->readLuaScreenScript("newMap.lua");
+3 -3
View File
@@ -1,16 +1,16 @@
#ifndef NEW_MAP_BUTTON_H
#define NEW_MAP_BUTTON_H
#include <button.h>
#include "pfButtonBase.h"
namespace vb01Gui{
class Textbox;
}
namespace battleship{
class NewMapButton : public vb01Gui::Button{
class NewMapButton : public PfButtonBase{
public:
class OkButton : public vb01Gui::Button{
class OkButton : public PfButtonBase{
public:
OkButton(vb01::Vector3, vb01::Vector2, vb01Gui::Textbox*, vb01Gui::Textbox*, vb01Gui::Textbox*);
void onClick();
+1 -1
View File
@@ -17,7 +17,7 @@ namespace battleship{
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),
PfButtonBase(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", trigger, true, imagePath),
playerId(plId){}
void OfferButton::onClick(){
+2 -2
View File
@@ -1,10 +1,10 @@
#ifndef OFFER_BUTTON_H
#define OFFER_BUTTON_H
#include <button.h>
#include "pfButtonBase.h"
namespace battleship{
class OfferButton : public vb01Gui::Button{
class OfferButton : public PfButtonBase{
public:
OfferButton(vb01::Vector3, vb01::Vector2, int, std::string, int, std::string);
void onClick();
+1 -1
View File
@@ -6,7 +6,7 @@ namespace battleship{
using namespace vb01;
using namespace vb01Gui;
OkButton::OkButton(Vector3 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) : PfButtonBase(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) {}
void OkButton::onClick() {}
}
+2 -2
View File
@@ -1,10 +1,10 @@
#ifndef OK_BUTTON_H
#define OK_BUTTON_H
#include <button.h>
#include "pfButtonBase.h"
namespace battleship{
class OkButton : public vb01Gui::Button{
class OkButton : public PfButtonBase{
public:
OkButton(vb01::Vector3, vb01::Vector2, std::string);
void onClick();
+1 -1
View File
@@ -7,7 +7,7 @@ using namespace vb01;
using namespace std;
namespace battleship{
OptionsButton::OptionsButton(Vector3 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) : PfButtonBase(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, separate) {}
void OptionsButton::onClick() {
ConcreteGuiManager::getSingleton()->readLuaScreenScript("options.lua");
+2 -3
View File
@@ -1,11 +1,10 @@
#pragma once
#ifndef OPTIONS_BUTTON_H
#define OPTIONS_BUTTON_H
#include <button.h>
#include "pfButtonBase.h"
namespace battleship {
class OptionsButton : public vb01Gui::Button {
class OptionsButton : public PfButtonBase {
public:
OptionsButton(vb01::Vector3, vb01::Vector2, std::string, bool);
virtual void onClick();
+1 -1
View File
@@ -13,7 +13,7 @@ namespace battleship{
using namespace gameBase;
OrderButton::OrderButton(Vector3 pos, Vector2 size, string name, int trigger, string imagePath, int oid) :
Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", trigger, true, imagePath),
PfButtonBase(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", trigger, true, imagePath),
orderId(oid)
{}
+2 -2
View File
@@ -1,10 +1,10 @@
#ifndef ORDER_BUTTON_H
#define ORDER_BUTTON_H
#include <button.h>
#include "pfButtonBase.h"
namespace battleship{
class OrderButton : public vb01Gui::Button{
class OrderButton : public PfButtonBase{
public:
OrderButton(vb01::Vector3, vb01::Vector2, std::string, int, std::string, int);
void onClick();
+23
View File
@@ -0,0 +1,23 @@
#include "pfButtonBase.h"
#include "tooltip.h"
#include <quad.h>
#include <node.h>
namespace battleship{
using namespace std;
using namespace vb01;
PfButtonBase::PfButtonBase(Vector3 pos, Vector2 size, string name, string fontPath, int trigger, bool separate, string imagePath) : Button(pos, size, name, fontPath, trigger, separate, imagePath){}
PfButtonBase::~PfButtonBase(){
if(tooltip) delete tooltip;
}
void PfButtonBase::update() {
if(enabledHoveredOn)
setColor(mouseOver ? hoveredOnColor : baseColor);
if(tooltip) tooltip->getBackground()->getNode()->setVisible(mouseOver);
}
}
+25
View File
@@ -0,0 +1,25 @@
#ifndef PF_BUTTON_BASE_H
#define PF_BUTTON_BASE_H
#include <button.h>
namespace battleship{
class Tooltip;
class PfButtonBase : public vb01Gui::Button{
public:
PfButtonBase(vb01::Vector3, vb01::Vector2, std::string, std::string, int, bool, std::string = "");
~PfButtonBase();
virtual void update();
inline void setTooltip(Tooltip *t){this->tooltip = t;}
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;}
protected:
bool enabledHoveredOn = false;
vb01::Vector4 baseColor, hoveredOnColor;
Tooltip *tooltip = nullptr;
};
}
#endif
+1 -1
View File
@@ -15,7 +15,7 @@ namespace battleship{
using namespace vb01Gui;
using namespace gameBase;
PlayButton::PlayButton(Listbox *ml, Vector3 pos, Vector2 size, string name, bool separate) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", GLFW_KEY_P, separate), mapListbox(ml) {}
PlayButton::PlayButton(Listbox *ml, Vector3 pos, Vector2 size, string name, bool separate) : PfButtonBase(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", GLFW_KEY_P, separate), mapListbox(ml) {}
void PlayButton::onClick() {
ConcreteGuiManager *guiManager = ConcreteGuiManager::getSingleton();
+2 -2
View File
@@ -1,14 +1,14 @@
#ifndef PLAY_BUTTON_H
#define PLAY_BUTTON_H
#include <button.h>
#include "pfButtonBase.h"
namespace vb01Gui{
class Listbox;
}
namespace battleship{
class PlayButton : public vb01Gui::Button {
class PlayButton : public PfButtonBase {
public:
PlayButton(vb01Gui::Listbox*, vb01::Vector3, vb01::Vector2, std::string, bool);
void onClick();
+3 -1
View File
@@ -9,7 +9,9 @@ namespace battleship{
using namespace vb01;
using namespace vb01Gui;
ResourceAmmountButton::ResourceAmmountButton(Vector3 pos, Vector2 size, string name, int amm, int trigger, string imagePath) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", trigger, true, imagePath), ammount(amm) {
ResourceAmmountButton::ResourceAmmountButton(Vector3 pos, Vector2 size, string name, int amm, int trigger, string imagePath) :
PfButtonBase(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", trigger, true, imagePath), ammount(amm)
{
ConcreteGuiManager *guiManager = ConcreteGuiManager::getSingleton();
int numTextboxes = guiManager->getTextboxes().size();
textbox = guiManager->getTextboxes()[numTextboxes - 1];
+2 -2
View File
@@ -1,14 +1,14 @@
#ifndef RESOURCE_AMMOUNT_BUTTON_H
#define RESOURCE_AMMOUNT_BUTTON_H
#include <button.h>
#include "pfButtonBase.h"
namespace vb01Gui{
class Textbox;
}
namespace battleship{
class ResourceAmmountButton : public vb01Gui::Button{
class ResourceAmmountButton : public PfButtonBase{
public:
ResourceAmmountButton(vb01::Vector3, vb01::Vector2, std::string, int, int, std::string);
void onClick();
+5 -10
View File
@@ -1,8 +1,11 @@
#include "singlePlayerButton.h"
#include "gameManager.h"
#include "concreteGuiManager.h"
#include "gameManager.h"
#include "tooltip.h"
#include <listbox.h>
#include <quad.h>
#include <node.h>
#include <text.h>
#include <glfw3.h>
@@ -12,15 +15,7 @@ namespace battleship{
using namespace vb01;
using namespace vb01Gui;
SinglePlayerButton::SinglePlayerButton(Vector3 pos, Vector2 size, string name) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", GLFW_KEY_S, true) {}
void SinglePlayerButton::onMouseOver(){
setColor(Vector4(.8, .8, .8, 1));
}
void SinglePlayerButton::onMouseOff(){
setColor(Vector4(.6, .6, .6, 1));
}
SinglePlayerButton::SinglePlayerButton(Vector3 pos, Vector2 size, string name) : PfButtonBase(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", GLFW_KEY_S, true) {}
void SinglePlayerButton::onClick() {
ConcreteGuiManager *guiManager = ConcreteGuiManager::getSingleton();
+5 -5
View File
@@ -3,16 +3,16 @@
#include <vector>
#include <button.h>
#include "pfButtonBase.h"
namespace battleship{
class SinglePlayerButton : public vb01Gui::Button {
class Tooltip;
class SinglePlayerButton : public PfButtonBase {
public:
SinglePlayerButton(vb01::Vector3, vb01::Vector2, std::string);
~SinglePlayerButton(){}
void onClick();
void onMouseOver();
void onMouseOff();
private:
};
}
+1 -1
View File
@@ -12,7 +12,7 @@ namespace battleship{
using namespace vb01Gui;
using namespace gameBase;
StateToggleButton::StateToggleButton(Vector3 pos, Vector2 size, string name, int trigger, string imagePath) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", trigger, true, imagePath) {
StateToggleButton::StateToggleButton(Vector3 pos, Vector2 size, string name, int trigger, string imagePath) : PfButtonBase(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", trigger, true, imagePath) {
updateStateId();
toggleImage();
}
+2 -2
View File
@@ -1,10 +1,10 @@
#ifndef STATE_TOGGLE_BUTTON_H
#define STATE_TOGGLE_BUTTON_H
#include <button.h>
#include "pfButtonBase.h"
namespace battleship{
class StateToggleButton : public vb01Gui::Button{
class StateToggleButton : public PfButtonBase{
public:
StateToggleButton(vb01::Vector3, vb01::Vector2, std::string, int, std::string);
void onClick();
+1 -1
View File
@@ -13,7 +13,7 @@ namespace battleship{
using namespace vb01;
using namespace gameBase;
StatsButton::StatsButton(Vector3 pos, Vector2 size, string name, int trigger, string imagePath) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", trigger, true, imagePath){}
StatsButton::StatsButton(Vector3 pos, Vector2 size, string name, int trigger, string imagePath) : PfButtonBase(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", trigger, true, imagePath){}
void StatsButton::addPlayerDataGuiElements(int playerId){
const int numPairs = 7;
+2 -2
View File
@@ -1,10 +1,10 @@
#ifndef STATS_BUTTON_H
#define STATS_BUTTON_H
#include <button.h>
#include "pfButtonBase.h"
namespace battleship {
class StatsButton : public vb01Gui::Button{
class StatsButton : public PfButtonBase{
public:
StatsButton(vb01::Vector3, vb01::Vector2, std::string, int, std::string);
void onClick();
+1 -1
View File
@@ -7,7 +7,7 @@ namespace battleship{
using namespace vb01;
using namespace vb01Gui;
TabButton::TabButton(Vector3 pos, Vector2 size, string name, string screenScript) : Button(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) {
TabButton::TabButton(Vector3 pos, Vector2 size, string name, string screenScript) : PfButtonBase(pos, size, name, GameManager::getSingleton()->getPath() + "Fonts/batang.ttf", -1, true) {
this->screenScript = screenScript;
}
+2 -2
View File
@@ -1,10 +1,10 @@
#ifndef TAB_BUTTON_H
#define TAB_BUTTON_H
#include <button.h>
#include "pfButtonBase.h"
namespace battleship{
class TabButton : public vb01Gui::Button{
class TabButton : public PfButtonBase{
public:
TabButton(vb01::Vector3, vb01::Vector2, std::string, std::string);
void onClick();
+67 -2
View File
@@ -1,14 +1,79 @@
#include "tooltip.h"
#include "gameManager.h"
#include <root.h>
#include <text.h>
#include <quad.h>
#include <node.h>
#include <material.h>
#include <texture.h>
using namespace std;
using namespace vb01;
namespace battleship{
Tooltip::Tooltip(Vector2 pos, string entry){
this->pos = pos;
Tooltip::Tooltip(Vector3 p, Vector2 s, vector<Tooltip::LineData> lineData, string fontPath) : pos(p), size(s){
Root *root = Root::getSingleton();
Material *bgMat = new Material(root->getLibPath() + "gui");
bgMat->addBoolUniform("texturingEnabled", false);
bgMat->addVec4Uniform("diffuseColor", Vector4(.5, .5, .5, 1));
background = new Quad(Vector3(s.x, s.y, 0), false);
background->setMaterial(bgMat);
Node *bgNode = new Node(p);
bgNode->attachMesh(background);
root->getGuiNode()->attachChild(bgNode);
string basePath = GameManager::getSingleton()->getPath();
string iconBasePath = basePath + "Textures/Icons/";
for(int i = 0; i < lineData.size(); i++){
LineData &ld = lineData[i];
Material *textMat = new Material(root->getLibPath() + "text");
textMat->addBoolUniform("texturingEnabled", false);
textMat->addVec4Uniform("diffuseColor", ld.textColor);
Vector3 offset = ld.getLineOffset(i);
Text *text = new Text(fontPath, ld.entryText);
text->setMaterial(textMat);
Node *textNode = new Node(pos + offset, Quaternion::QUAT_W, ld.scale * Vector3::VEC_IJK);
textNode->addText(text);
bgNode->attachChild(textNode);
for(pair<int, string> &iconData: ld.iconsData){
Vector3 iconOffset = offset;
wstring entry = text->getText();
for(int j = 0; j < iconData.first; j++){
Text::Glyph *glyph = text->getGlyph(entry[j]);
iconOffset.x += ld.scale * (glyph->advance >> 6);
}
entry.insert(iconData.first, L" ");
text->setText(entry);
Material *iconMat = new Material(root->getLibPath() + "gui");
iconMat->addBoolUniform("texturingEnabled", true);
string ip[]{iconBasePath + iconData.second};
Texture *t = new Texture(ip, 1, false);
iconMat->addTexUniform("textures[0]", t, false);
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));
rectNode->attachMesh(rect);
bgNode->attachChild(rectNode);
}
}
}
Tooltip::~Tooltip(){
Node *node = background->getNode();
Root::getSingleton()->getGuiNode()->dettachChild(node);
delete node;
}
void Tooltip::update(){
+35 -3
View File
@@ -1,16 +1,48 @@
#ifndef TOOLTIP_H
#define TOOLTIP_H
#include <text.h>
#include <vector.h>
#include <vector>
#include <utility>
#include <string>
namespace vb01{
class Quad;
class Text;
}
namespace battleship{
class Tooltip{
public:
Tooltip(vb01::Vector2, std::string);
struct LineData{
int height;
float scale;
vb01::Vector3 textOffset;
std::wstring entryText;
vb01::Vector4 textColor;
std::vector<std::pair<int, std::string>> iconsData;
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<std::pair<int, std::string>> 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<LineData>, std::string);
~Tooltip();
void update();
inline vb01::Quad* getBackground(){return background;}
private:
vb01::Vector2 pos;
vb01::Vector3 pos;
vb01::Vector2 size;
vb01::Quad *background = nullptr;
};
}
+33 -4
View File
@@ -2,6 +2,10 @@
#include "activeGameState.h"
#include "player.h"
#include <quad.h>
#include <node.h>
#include <text.h>
#include <stateManager.h>
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);
}
}
+6 -1
View File
@@ -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&);
};
}
+5 -10
View File
@@ -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);
+1
View File
@@ -11,6 +11,7 @@ namespace battleship{
Trader();
void update();
void trade(Player*, int, int, bool);
int getResourceRate(int);
private:
void initProperties();
+1 -1
View File
@@ -12,7 +12,7 @@ namespace battleship{
using namespace vb01Gui;
using namespace gameBase;
UnitButton::UnitButton(Vector3 pos, Vector2 size, string name, string fontPath, int trigger, string imagePath) : Button(pos, size, name, fontPath, trigger, true, imagePath){
UnitButton::UnitButton(Vector3 pos, Vector2 size, string name, string fontPath, int trigger, string imagePath) : PfButtonBase(pos, size, name, fontPath, trigger, true, imagePath){
StateManager *stateManager = GameManager::getSingleton()->getStateManager();
ActiveGameState *activeState = (ActiveGameState*)stateManager->getAppStateByType((int)AppStateType::ACTIVE_STATE);
+2 -2
View File
@@ -1,12 +1,12 @@
#ifndef UNIT_BUTTON_H
#define UNIT_BUTTON_H
#include <button.h>
#include "pfButtonBase.h"
namespace battleship{
class Unit;
class UnitButton : public vb01Gui::Button{
class UnitButton : public PfButtonBase{
public:
UnitButton(vb01::Vector3, vb01::Vector2, std::string, std::string, int, std::string);
protected: