forked from 0ad/0ad
Delete obsolete version of GUI files
This was SVN commit r8403.
This commit is contained in:
parent
c486e5cde0
commit
7b7e98ea7b
@ -1,568 +0,0 @@
|
||||
const SDL_BUTTON_LEFT = 1;
|
||||
const SDL_BUTTON_MIDDLE = 2;
|
||||
const SDL_BUTTON_RIGHT = 3;
|
||||
const SDLK_RSHIFT = 303;
|
||||
const SDLK_LSHIFT = 304;
|
||||
// TODO: these constants should be defined somewhere else instead, in
|
||||
// case any other code wants to use them too
|
||||
|
||||
var INPUT_NORMAL = 0;
|
||||
var INPUT_SELECTING = 1;
|
||||
var INPUT_BANDBOXING = 2;
|
||||
var INPUT_BUILDING_PLACEMENT = 3;
|
||||
var INPUT_BUILDING_CLICK = 4;
|
||||
var INPUT_BUILDING_DRAG = 5;
|
||||
var INPUT_BATCHTRAINING = 6;
|
||||
|
||||
var inputState = INPUT_NORMAL;
|
||||
|
||||
var defaultPlacementAngle = Math.PI*3/4;
|
||||
var placementAngle;
|
||||
var placementPosition;
|
||||
var placementEntity;
|
||||
|
||||
var mouseX = 0;
|
||||
var mouseY = 0;
|
||||
var specialKeyStates = {};
|
||||
specialKeyStates[SDLK_RSHIFT] = 0;
|
||||
specialKeyStates[SDLK_LSHIFT] = 0;
|
||||
// (TODO: maybe we should fix the hotkey system to be usable in this situation,
|
||||
// rather than hardcoding Shift into this code?)
|
||||
|
||||
function updateCursor()
|
||||
{
|
||||
if (inputState == INPUT_NORMAL)
|
||||
{
|
||||
var action = determineAction(mouseX, mouseY);
|
||||
if (action)
|
||||
{
|
||||
if (action.cursor)
|
||||
{
|
||||
Engine.SetCursor(action.cursor);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Engine.SetCursor("arrow-default");
|
||||
}
|
||||
|
||||
function findGatherType(gatherer, supply)
|
||||
{
|
||||
if (!gatherer || !supply)
|
||||
return;
|
||||
if (gatherer[supply.type.generic+"."+supply.type.specific])
|
||||
return supply.type.specific;
|
||||
if (gatherer[supply.type.generic])
|
||||
return supply.type.generic;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the context-sensitive action that should be performed when the mouse is at (x,y)
|
||||
*/
|
||||
function determineAction(x, y)
|
||||
{
|
||||
var selection = g_Selection.toList();
|
||||
|
||||
// No action if there's no selection
|
||||
if (!selection.length)
|
||||
return;
|
||||
|
||||
// If the selection doesn't exist, no action
|
||||
var entState = Engine.GuiInterfaceCall("GetEntityState", selection[0]);
|
||||
if (!entState)
|
||||
return;
|
||||
|
||||
// If the selection isn't friendly units, no action
|
||||
var player = Engine.GetPlayerID();
|
||||
if (entState.player != player && !g_DevSettings.controlAll)
|
||||
return;
|
||||
|
||||
var targets = Engine.PickEntitiesAtPoint(x, y);
|
||||
|
||||
// If there's no unit, just walk
|
||||
if (!targets.length)
|
||||
return {"type": "move"};
|
||||
|
||||
// Look at the first targeted entity
|
||||
// (TODO: maybe we eventually want to look at more, and be more context-sensitive?
|
||||
// e.g. prefer to attack an enemy unit, even if some friendly units are closer to the mouse)
|
||||
var targetState = Engine.GuiInterfaceCall("GetEntityState", targets[0]);
|
||||
|
||||
// Resource -> gather
|
||||
var resource = findGatherType(entState.resourceGatherRates, targetState.resourceSupply);
|
||||
if (resource)
|
||||
return {"type": "gather", "cursor": "action-gather-"+resource, "target": targets[0]};
|
||||
|
||||
// Different owner -> attack
|
||||
// (TODO: this should only happen if the target is really targetable, not e.g. a tree that this unit can't gather)
|
||||
if (entState.attack && targetState.player != entState.player)
|
||||
return {"type": "attack", "cursor": "action-attack", "target": targets[0]};
|
||||
|
||||
// If a builder, then: Foundation -> build
|
||||
if (entState.buildEntities && targetState.foundation)
|
||||
return {"type": "build", "cursor": "action-build", "target": targets[0]};
|
||||
|
||||
// TODO: need more actions
|
||||
|
||||
// If we don't do anything more specific, just walk
|
||||
return {"type": "move"};
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Selection methods: (not all currently implemented)
|
||||
|
||||
- Left-click on entity to select (always chooses the 'closest' one if the mouse is over several).
|
||||
Includes non-controllable units (e.g. trees, enemy units).
|
||||
- Double-left-click to select entity plus all of the same type on the screen.
|
||||
- Triple-left-click to select entity plus all of the same type in the world.
|
||||
- Left-click-and-drag to select all in region. Only includes controllable units.
|
||||
- Left-click on empty space to deselect all.
|
||||
- Hotkeys to select various groups.
|
||||
- Shift plus left-click on entity to toggle selection of that unit. Only includes controllable.
|
||||
- Shift plus any other selection method above, to add them to current selection.
|
||||
|
||||
*/
|
||||
|
||||
var dragStart; // used for remembering mouse coordinates at start of drag operations
|
||||
|
||||
function tryPlaceBuilding()
|
||||
{
|
||||
var selection = g_Selection.toList();
|
||||
|
||||
// Use the preview to check it's a valid build location
|
||||
var ok = Engine.GuiInterfaceCall("SetBuildingPlacementPreview", {
|
||||
"template": placementEntity,
|
||||
"x": placementPosition.x,
|
||||
"z": placementPosition.z,
|
||||
"angle": placementAngle
|
||||
});
|
||||
if (!ok)
|
||||
{
|
||||
// invalid location - don't build it
|
||||
return false;
|
||||
}
|
||||
|
||||
// Remove the preview
|
||||
Engine.GuiInterfaceCall("SetBuildingPlacementPreview", {"template": ""});
|
||||
|
||||
// Start the construction
|
||||
Engine.PostNetworkCommand({
|
||||
"type": "construct",
|
||||
"template": placementEntity,
|
||||
"x": placementPosition.x,
|
||||
"z": placementPosition.z,
|
||||
"angle": placementAngle,
|
||||
"entities": selection
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function handleInputBeforeGui(ev)
|
||||
{
|
||||
// Capture mouse position so we can use it for displaying cursors,
|
||||
// and key states
|
||||
switch (ev.type)
|
||||
{
|
||||
case "mousebuttonup":
|
||||
case "mousebuttondown":
|
||||
case "mousemotion":
|
||||
mouseX = ev.x;
|
||||
mouseY = ev.y;
|
||||
break;
|
||||
case "keydown":
|
||||
if (ev.keysym.sym in specialKeyStates)
|
||||
specialKeyStates[ev.keysym.sym] = 1;
|
||||
break;
|
||||
case "keyup":
|
||||
if (ev.keysym.sym in specialKeyStates)
|
||||
specialKeyStates[ev.keysym.sym] = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
// State-machine processing:
|
||||
//
|
||||
// (This is for states which should override the normal GUI processing - events will
|
||||
// be processed here before being passed on, and propagation will stop if this function
|
||||
// returns true)
|
||||
//
|
||||
// TODO: it'd probably be nice to have a better state-machine system, with guaranteed
|
||||
// entry/exit functions, since this is a bit broken now
|
||||
|
||||
switch (inputState)
|
||||
{
|
||||
case INPUT_BANDBOXING:
|
||||
switch (ev.type)
|
||||
{
|
||||
case "mousemotion":
|
||||
var x0 = dragStart[0];
|
||||
var y0 = dragStart[1];
|
||||
var x1 = ev.x;
|
||||
var y1 = ev.y;
|
||||
if (x0 > x1) { var t = x0; x0 = x1; x1 = t; }
|
||||
if (y0 > y1) { var t = y0; y0 = y1; y1 = t; }
|
||||
|
||||
var bandbox = getGUIObjectByName("bandbox");
|
||||
bandbox.size = [x0, y0, x1, y1].join(" ");
|
||||
bandbox.hidden = false;
|
||||
|
||||
var ents = Engine.PickFriendlyEntitiesInRect(x0, y0, x1, y1, Engine.GetPlayerID());
|
||||
g_Selection.setHighlightList(ents);
|
||||
|
||||
return false;
|
||||
|
||||
case "mousebuttonup":
|
||||
if (ev.button == SDL_BUTTON_LEFT)
|
||||
{
|
||||
var x0 = dragStart[0];
|
||||
var y0 = dragStart[1];
|
||||
var x1 = ev.x;
|
||||
var y1 = ev.y;
|
||||
if (x0 > x1) { var t = x0; x0 = x1; x1 = t; }
|
||||
if (y0 > y1) { var t = y0; y0 = y1; y1 = t; }
|
||||
|
||||
var bandbox = getGUIObjectByName("bandbox");
|
||||
bandbox.hidden = true;
|
||||
|
||||
var ents = Engine.PickFriendlyEntitiesInRect(x0, y0, x1, y1, Engine.GetPlayerID());
|
||||
g_Selection.setHighlightList([]);
|
||||
g_Selection.reset();
|
||||
g_Selection.addList(ents);
|
||||
|
||||
inputState = INPUT_NORMAL;
|
||||
return true;
|
||||
}
|
||||
else if (ev.button == SDL_BUTTON_RIGHT)
|
||||
{
|
||||
// Cancel selection
|
||||
|
||||
var bandbox = getGUIObjectByName("bandbox");
|
||||
bandbox.hidden = true;
|
||||
|
||||
g_Selection.setHighlightList([]);
|
||||
|
||||
inputState = INPUT_NORMAL;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case INPUT_BUILDING_CLICK:
|
||||
switch (ev.type)
|
||||
{
|
||||
case "mousemotion":
|
||||
// If the mouse moved far enough from the original click location,
|
||||
// then switch to drag-orientatio mode
|
||||
var dragDeltaX = ev.x - dragStart[0];
|
||||
var dragDeltaY = ev.y - dragStart[1];
|
||||
var maxDragDelta = 16;
|
||||
if (Math.abs(dragDeltaX) >= maxDragDelta || Math.abs(dragDeltaY) >= maxDragDelta)
|
||||
{
|
||||
inputState = INPUT_BUILDING_DRAG;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case "mousebuttonup":
|
||||
if (ev.button == SDL_BUTTON_LEFT)
|
||||
{
|
||||
if (tryPlaceBuilding())
|
||||
{
|
||||
// If shift is down, let the player continue placing another of the same building
|
||||
if (specialKeyStates[SDLK_RSHIFT] || specialKeyStates[SDLK_LSHIFT])
|
||||
inputState = INPUT_BUILDING_PLACEMENT;
|
||||
else
|
||||
inputState = INPUT_NORMAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
inputState = INPUT_BUILDING_PLACEMENT;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case "mousebuttondown":
|
||||
if (ev.button == SDL_BUTTON_RIGHT)
|
||||
{
|
||||
// Cancel building
|
||||
Engine.GuiInterfaceCall("SetBuildingPlacementPreview", {"template": ""});
|
||||
inputState = INPUT_NORMAL;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case INPUT_BUILDING_DRAG:
|
||||
switch (ev.type)
|
||||
{
|
||||
case "mousemotion":
|
||||
var dragDeltaX = ev.x - dragStart[0];
|
||||
var dragDeltaY = ev.y - dragStart[1];
|
||||
var maxDragDelta = 16;
|
||||
if (Math.abs(dragDeltaX) >= maxDragDelta || Math.abs(dragDeltaY) >= maxDragDelta)
|
||||
{
|
||||
// Rotate in the direction of the mouse
|
||||
var target = Engine.GetTerrainAtPoint(ev.x, ev.y);
|
||||
placementAngle = Math.atan2(target.x - placementPosition.x, target.z - placementPosition.z);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the mouse is near the center, snap back to the default orientation
|
||||
placementAngle = defaultPlacementAngle;
|
||||
}
|
||||
|
||||
Engine.GuiInterfaceCall("SetBuildingPlacementPreview", {
|
||||
"template": placementEntity,
|
||||
"x": placementPosition.x,
|
||||
"z": placementPosition.z,
|
||||
"angle": placementAngle
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
case "mousebuttonup":
|
||||
if (ev.button == SDL_BUTTON_LEFT)
|
||||
{
|
||||
if (tryPlaceBuilding())
|
||||
inputState = INPUT_NORMAL;
|
||||
else
|
||||
inputState = INPUT_BUILDING_PLACEMENT;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case "mousebuttondown":
|
||||
if (ev.button == SDL_BUTTON_RIGHT)
|
||||
{
|
||||
// Cancel building
|
||||
Engine.GuiInterfaceCall("SetBuildingPlacementPreview", {"template": ""});
|
||||
inputState = INPUT_NORMAL;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case INPUT_BATCHTRAINING:
|
||||
switch (ev.type)
|
||||
{
|
||||
case "keyup":
|
||||
if (ev.keysym.sym == SDLK_RSHIFT || ev.keysym.sym == SDLK_LSHIFT)
|
||||
{
|
||||
flushTrainingQueueBatch();
|
||||
inputState = INPUT_NORMAL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function handleInputAfterGui(ev)
|
||||
{
|
||||
// State-machine processing:
|
||||
|
||||
switch (inputState)
|
||||
{
|
||||
case INPUT_NORMAL:
|
||||
switch (ev.type)
|
||||
{
|
||||
case "mousemotion":
|
||||
var ents = Engine.PickEntitiesAtPoint(ev.x, ev.y);
|
||||
g_Selection.setHighlightList(ents);
|
||||
return false;
|
||||
|
||||
case "mousebuttondown":
|
||||
if (ev.button == SDL_BUTTON_LEFT)
|
||||
{
|
||||
dragStart = [ ev.x, ev.y ];
|
||||
inputState = INPUT_SELECTING;
|
||||
return true;
|
||||
}
|
||||
else if (ev.button == SDL_BUTTON_RIGHT)
|
||||
{
|
||||
var action = determineAction(ev.x, ev.y);
|
||||
if (!action)
|
||||
break;
|
||||
|
||||
var selection = g_Selection.toList();
|
||||
|
||||
switch (action.type)
|
||||
{
|
||||
case "move":
|
||||
var target = Engine.GetTerrainAtPoint(ev.x, ev.y);
|
||||
Engine.PostNetworkCommand({"type": "walk", "entities": selection, "x": target.x, "z": target.z});
|
||||
return true;
|
||||
|
||||
case "attack":
|
||||
Engine.PostNetworkCommand({"type": "attack", "entities": selection, "target": action.target});
|
||||
return true;
|
||||
|
||||
case "build": // (same command as repair)
|
||||
case "repair":
|
||||
Engine.PostNetworkCommand({"type": "repair", "entities": selection, "target": action.target});
|
||||
return true;
|
||||
|
||||
case "gather":
|
||||
Engine.PostNetworkCommand({"type": "gather", "entities": selection, "target": action.target});
|
||||
return true;
|
||||
|
||||
default:
|
||||
throw new Error("Invalid action.type "+action.type);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case INPUT_SELECTING:
|
||||
switch (ev.type)
|
||||
{
|
||||
case "mousemotion":
|
||||
// If the mouse moved further than a limit, switch to bandbox mode
|
||||
var dragDeltaX = ev.x - dragStart[0];
|
||||
var dragDeltaY = ev.y - dragStart[1];
|
||||
var maxDragDelta = 4;
|
||||
if (Math.abs(dragDeltaX) >= maxDragDelta || Math.abs(dragDeltaY) >= maxDragDelta)
|
||||
{
|
||||
inputState = INPUT_BANDBOXING;
|
||||
return false;
|
||||
}
|
||||
|
||||
var ents = Engine.PickEntitiesAtPoint(ev.x, ev.y);
|
||||
g_Selection.setHighlightList(ents);
|
||||
return false;
|
||||
|
||||
case "mousebuttonup":
|
||||
if (ev.button == SDL_BUTTON_LEFT)
|
||||
{
|
||||
var ents = Engine.PickEntitiesAtPoint(ev.x, ev.y);
|
||||
if (!ents.length)
|
||||
{
|
||||
g_Selection.reset();
|
||||
|
||||
inputState = INPUT_NORMAL;
|
||||
return true;
|
||||
}
|
||||
|
||||
g_Selection.reset();
|
||||
g_Selection.addList([ents[0]]);
|
||||
|
||||
inputState = INPUT_NORMAL;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case INPUT_BUILDING_PLACEMENT:
|
||||
switch (ev.type)
|
||||
{
|
||||
case "mousemotion":
|
||||
var target = Engine.GetTerrainAtPoint(ev.x, ev.y);
|
||||
Engine.GuiInterfaceCall("SetBuildingPlacementPreview", {
|
||||
"template": placementEntity,
|
||||
"x": target.x,
|
||||
"z": target.z,
|
||||
"angle": placementAngle
|
||||
});
|
||||
|
||||
return false; // continue processing mouse motion
|
||||
|
||||
case "mousebuttondown":
|
||||
if (ev.button == SDL_BUTTON_LEFT)
|
||||
{
|
||||
placementPosition = Engine.GetTerrainAtPoint(ev.x, ev.y);
|
||||
dragStart = [ ev.x, ev.y ];
|
||||
inputState = INPUT_BUILDING_CLICK;
|
||||
return true;
|
||||
}
|
||||
else if (ev.button == SDL_BUTTON_RIGHT)
|
||||
{
|
||||
// Cancel building
|
||||
Engine.GuiInterfaceCall("SetBuildingPlacementPreview", {"template": ""});
|
||||
inputState = INPUT_NORMAL;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Called by GUI when user clicks construction button
|
||||
function startBuildingPlacement(buildEntType)
|
||||
{
|
||||
placementEntity = buildEntType;
|
||||
placementAngle = defaultPlacementAngle;
|
||||
inputState = INPUT_BUILDING_PLACEMENT;
|
||||
}
|
||||
|
||||
// Batch training:
|
||||
// When the user shift-clicks, we set these variables and switch to INPUT_BATCHTRAINING
|
||||
// When the user releases shift, or clicks on a different training button, we create the batched units
|
||||
var batchTrainingEntity;
|
||||
var batchTrainingType;
|
||||
var batchTrainingCount;
|
||||
const batchIncrementSize = 5;
|
||||
|
||||
function flushTrainingQueueBatch()
|
||||
{
|
||||
Engine.PostNetworkCommand({"type": "train", "entity": batchTrainingEntity, "template": batchTrainingType, "count": batchTrainingCount});
|
||||
}
|
||||
|
||||
// Called by GUI when user clicks training button
|
||||
function addToTrainingQueue(entity, trainEntType)
|
||||
{
|
||||
if (specialKeyStates[SDLK_RSHIFT] || specialKeyStates[SDLK_LSHIFT])
|
||||
{
|
||||
if (inputState == INPUT_BATCHTRAINING)
|
||||
{
|
||||
// If we're already creating a batch of this unit, then just extend it
|
||||
if (batchTrainingEntity == entity && batchTrainingType == trainEntType)
|
||||
{
|
||||
batchTrainingCount += batchIncrementSize;
|
||||
return;
|
||||
}
|
||||
// Otherwise start a new one
|
||||
else
|
||||
{
|
||||
flushTrainingQueueBatch();
|
||||
// fall through to create the new batch
|
||||
}
|
||||
}
|
||||
inputState = INPUT_BATCHTRAINING;
|
||||
batchTrainingEntity = entity;
|
||||
batchTrainingType = trainEntType;
|
||||
batchTrainingCount = batchIncrementSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Non-batched - just create a single entity
|
||||
Engine.PostNetworkCommand({"type": "train", "entity": entity, "template": trainEntType, "count": 1});
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the number of units that will be present in a batch if the user clicks
|
||||
// the training button with shift down
|
||||
function getTrainingQueueBatchStatus(entity, trainEntType)
|
||||
{
|
||||
if (inputState == INPUT_BATCHTRAINING && batchTrainingEntity == entity && batchTrainingType == trainEntType)
|
||||
return [batchTrainingCount, batchIncrementSize];
|
||||
else
|
||||
return [0, batchIncrementSize];
|
||||
}
|
||||
|
||||
// Called by GUI when user clicks production queue item
|
||||
function removeFromTrainingQueue(entity, id)
|
||||
{
|
||||
Engine.PostNetworkCommand({"type": "stop-train", "entity": entity, "id": id});
|
||||
}
|
||||
|
@ -1,34 +0,0 @@
|
||||
var g_CurrentMusic = null;
|
||||
|
||||
/*
|
||||
* At some point, this ought to be extended to do dynamic music selection and
|
||||
* crossfading - it at least needs to pick the music track based on the player's
|
||||
* civ and peace/battle
|
||||
*/
|
||||
|
||||
function startMusic()
|
||||
{
|
||||
var ambient1 = new Sound("audio/ambient/dayscape/day_temperate_gen_03.ogg");
|
||||
if (ambient1)
|
||||
{
|
||||
ambient1.loop();
|
||||
ambient1.setGain(0.8);
|
||||
}
|
||||
|
||||
var gain = 0.3;
|
||||
g_CurrentMusic = new Sound("audio/music/germanic_peace_1.ogg");
|
||||
if (g_CurrentMusic)
|
||||
{
|
||||
g_CurrentMusic.loop();
|
||||
g_CurrentMusic.fade(0.0, gain, 10.0);
|
||||
}
|
||||
}
|
||||
|
||||
function stopMusic()
|
||||
{
|
||||
if (g_CurrentMusic)
|
||||
{
|
||||
g_CurrentMusic.fade(-1, 0.0, 5.0);
|
||||
g_CurrentMusic = null;
|
||||
}
|
||||
}
|
@ -1,112 +0,0 @@
|
||||
var g_ActiveSelectionColour = { r:1, g:1, b:1, a:1 };
|
||||
var g_HighlightSelectionColour = { r:1, g:1, b:1, a:0.5 };
|
||||
var g_InactiveSelectionColour = { r:1, g:1, b:1, a:0 };
|
||||
|
||||
function _setHighlight(ents, colour)
|
||||
{
|
||||
if (ents.length)
|
||||
Engine.GuiInterfaceCall("SetSelectionHighlight", { "entities":ents, "colour":colour });
|
||||
}
|
||||
|
||||
function _setMotionOverlay(ents, enabled)
|
||||
{
|
||||
if (ents.length)
|
||||
Engine.GuiInterfaceCall("SetMotionDebugOverlay", { "entities":ents, "enabled":enabled });
|
||||
}
|
||||
|
||||
function EntitySelection()
|
||||
{
|
||||
// Private properties:
|
||||
this.selected = {}; // { id:id, id:id, ... } for each selected entity ID 'id'
|
||||
this.highlighted = {}; // { id:id, ... } for mouseover-highlighted entity IDs
|
||||
// (in these, the key is a string and the value is an int; we want to use the
|
||||
// int form wherever possible since it's more efficient to send to the simulation code)
|
||||
this.motionDebugOverlay = false;
|
||||
|
||||
// Public properties:
|
||||
this.dirty = false; // set whenever the selection has changed
|
||||
}
|
||||
|
||||
EntitySelection.prototype.toggle = function(ent)
|
||||
{
|
||||
if (this.selected[ent])
|
||||
{
|
||||
_setHighlight([ent], g_InactiveSelectionColour);
|
||||
_setMotionOverlay([ent], false);
|
||||
delete this.selected[ent];
|
||||
}
|
||||
else
|
||||
{
|
||||
_setHighlight([ent], g_ActiveSelectionColour);
|
||||
_setMotionOverlay([ent], this.motionDebugOverlay);
|
||||
this.selected[ent] = ent;
|
||||
}
|
||||
this.dirty = true;
|
||||
};
|
||||
|
||||
EntitySelection.prototype.addList = function(ents)
|
||||
{
|
||||
var added = [];
|
||||
for each (var ent in ents)
|
||||
{
|
||||
if (!this.selected[ent])
|
||||
{
|
||||
added.push(ent);
|
||||
this.selected[ent] = ent;
|
||||
}
|
||||
}
|
||||
_setHighlight(added, g_ActiveSelectionColour);
|
||||
_setMotionOverlay(added, this.motionDebugOverlay);
|
||||
this.dirty = true;
|
||||
};
|
||||
|
||||
EntitySelection.prototype.reset = function()
|
||||
{
|
||||
_setHighlight(this.toList(), g_InactiveSelectionColour);
|
||||
_setMotionOverlay(this.toList(), false);
|
||||
this.selected = {};
|
||||
this.dirty = true;
|
||||
};
|
||||
|
||||
EntitySelection.prototype.toList = function()
|
||||
{
|
||||
var ents = [];
|
||||
for each (var ent in this.selected)
|
||||
ents.push(ent);
|
||||
return ents;
|
||||
};
|
||||
|
||||
EntitySelection.prototype.setHighlightList = function(ents)
|
||||
{
|
||||
var removed = [];
|
||||
var added = [];
|
||||
|
||||
// Remove highlighting for the old units (excluding ones that are actively selected too)
|
||||
for each (var ent in this.highlighted)
|
||||
if (!this.selected[ent])
|
||||
removed.push(ent);
|
||||
|
||||
// Add new highlighting
|
||||
for each (var ent in ents)
|
||||
if (!this.selected[ent])
|
||||
added.push(ent);
|
||||
|
||||
_setHighlight(removed, g_InactiveSelectionColour);
|
||||
_setHighlight(added, g_HighlightSelectionColour);
|
||||
|
||||
// TODO: this could be a bit more efficient by only changing the ones that
|
||||
// have entered/left the highlight list
|
||||
|
||||
// Store the new list
|
||||
this.highlighted = {};
|
||||
for each (var ent in ents)
|
||||
this.highlighted[ent] = ent;
|
||||
};
|
||||
|
||||
EntitySelection.prototype.SetMotionDebugOverlay = function(enabled)
|
||||
{
|
||||
this.motionDebugOverlay = enabled;
|
||||
_setMotionOverlay(this.toList(), enabled);
|
||||
};
|
||||
|
||||
var g_Selection = new EntitySelection();
|
@ -1,315 +0,0 @@
|
||||
// Cache dev-mode settings that are frequently or widely used
|
||||
var g_DevSettings = {
|
||||
controlAll: false
|
||||
};
|
||||
|
||||
function init(initData, hotloadData)
|
||||
{
|
||||
if (hotloadData)
|
||||
{
|
||||
g_Selection.selected = hotloadData.selection;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Starting for the first time:
|
||||
startMusic();
|
||||
}
|
||||
|
||||
onSimulationUpdate();
|
||||
}
|
||||
|
||||
function leaveGame()
|
||||
{
|
||||
stopMusic();
|
||||
endGame();
|
||||
Engine.SwitchGuiPage("page_pregame.xml");
|
||||
}
|
||||
|
||||
// Return some data that we'll use when hotloading this file after changes
|
||||
function getHotloadData()
|
||||
{
|
||||
return { selection: g_Selection.selected };
|
||||
}
|
||||
|
||||
function onTick()
|
||||
{
|
||||
g_DevSettings.controlAll = getGUIObjectByName("devControlAll").checked;
|
||||
// TODO: at some point this controlAll needs to disable the simulation code's
|
||||
// player checks (once it has some player checks)
|
||||
|
||||
updateCursor();
|
||||
|
||||
// If the selection changed, we need to regenerate the sim display
|
||||
if (g_Selection.dirty)
|
||||
onSimulationUpdate();
|
||||
}
|
||||
|
||||
function onSimulationUpdate()
|
||||
{
|
||||
g_Selection.dirty = false;
|
||||
|
||||
var simState = Engine.GuiInterfaceCall("GetSimulationState");
|
||||
|
||||
// If we're called during init when the game is first loading, there will be
|
||||
// no simulation yet, so do nothing
|
||||
if (!simState)
|
||||
return;
|
||||
|
||||
updateDebug(simState);
|
||||
|
||||
updatePlayerDisplay(simState);
|
||||
|
||||
updateUnitDisplay();
|
||||
}
|
||||
|
||||
function updateDebug(simState)
|
||||
{
|
||||
var debug = getGUIObjectByName("debug");
|
||||
|
||||
if (getGUIObjectByName("devDisplayState").checked)
|
||||
{
|
||||
debug.hidden = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
debug.hidden = true;
|
||||
return;
|
||||
}
|
||||
|
||||
var text = uneval(simState);
|
||||
|
||||
var selection = g_Selection.toList();
|
||||
if (selection.length)
|
||||
{
|
||||
var entState = Engine.GuiInterfaceCall("GetEntityState", selection[0]);
|
||||
if (entState)
|
||||
{
|
||||
var template = Engine.GuiInterfaceCall("GetTemplateData", entState.template);
|
||||
text += "\n\n" + uneval(entState) + "\n\n" + uneval(template);
|
||||
}
|
||||
}
|
||||
|
||||
debug.caption = text;
|
||||
}
|
||||
|
||||
function updatePlayerDisplay(simState)
|
||||
{
|
||||
var playerState = simState.players[Engine.GetPlayerID()];
|
||||
|
||||
getGUIObjectByName("resourceFood").caption = playerState.resourceCounts.food;
|
||||
getGUIObjectByName("resourceWood").caption = playerState.resourceCounts.wood;
|
||||
getGUIObjectByName("resourceStone").caption = playerState.resourceCounts.stone;
|
||||
getGUIObjectByName("resourceMetal").caption = playerState.resourceCounts.metal;
|
||||
getGUIObjectByName("resourcePop").caption = playerState.popCount + "/" + playerState.popLimit;
|
||||
}
|
||||
|
||||
function damageTypesToText(dmg)
|
||||
{
|
||||
if (!dmg)
|
||||
return "(None)";
|
||||
return dmg.hack + " Hack\n" + dmg.pierce + " Pierce\n" + dmg.crush + " Crush";
|
||||
}
|
||||
|
||||
// The number of currently visible buttons (used to optimise showing/hiding)
|
||||
var g_unitPanelButtons = { "Construction": 0, "Training": 0, "Queue": 0 };
|
||||
|
||||
// The unitSomethingPanel objects, which are displayed in a stack at the bottom of the screen,
|
||||
// ordered with *lowest* first
|
||||
var g_unitPanels = ["Stance", "Formation", "Construction", "Research", "Training", "Queue"];
|
||||
|
||||
// Helper function for updateUnitDisplay
|
||||
function setupUnitPanel(guiName, usedPanels, unitEntState, items, callback)
|
||||
{
|
||||
usedPanels[guiName] = 1;
|
||||
var i = 0;
|
||||
for each (var item in items)
|
||||
{
|
||||
var entType;
|
||||
if (guiName == "Queue")
|
||||
entType = item.template;
|
||||
else
|
||||
entType = item;
|
||||
|
||||
var button = getGUIObjectByName("unit"+guiName+"Button["+i+"]");
|
||||
var icon = getGUIObjectByName("unit"+guiName+"Icon["+i+"]");
|
||||
|
||||
var template = Engine.GuiInterfaceCall("GetTemplateData", entType);
|
||||
if (!template)
|
||||
continue; // ignore attempts to use invalid templates (an error should have been reported already)
|
||||
|
||||
var name;
|
||||
if (template.name.specific && template.name.generic)
|
||||
name = template.name.specific + " (" + template.name.generic + ")";
|
||||
else
|
||||
name = template.name.specific || template.name.generic || "???";
|
||||
|
||||
var tooltip;
|
||||
if (guiName == "Queue")
|
||||
{
|
||||
var progress = Math.round(item.progress*100) + "%";
|
||||
tooltip = name + " - " + progress;
|
||||
|
||||
getGUIObjectByName("unit"+guiName+"Count["+i+"]").caption = (item.count > 1 ? item.count : "");
|
||||
getGUIObjectByName("unit"+guiName+"Progress["+i+"]").caption = (item.progress ? progress : "");
|
||||
}
|
||||
else
|
||||
{
|
||||
tooltip = "[font=\"serif-bold-16\"]" + name + "[/font]";
|
||||
|
||||
if (template.cost)
|
||||
{
|
||||
var font1 = "[font=\"serif-bold-13\"]";
|
||||
var costs = [];
|
||||
if (template.cost.food) costs.push(font1 + "Food:[/font] " + template.cost.food);
|
||||
if (template.cost.wood) costs.push(font1 + "Wood:[/font] " + template.cost.wood);
|
||||
if (template.cost.metal) costs.push(font1 + "Metal:[/font] " + template.cost.metal);
|
||||
if (template.cost.stone) costs.push(font1 + "Stone:[/font] " + template.cost.stone);
|
||||
if (costs.length)
|
||||
tooltip += "\n" + costs.join(", ");
|
||||
}
|
||||
|
||||
if (guiName == "Training")
|
||||
{
|
||||
var font1 = "[font=\"serif-13\"]";
|
||||
var font2 = "[font=\"serif-bold-13\"]";
|
||||
var [batchSize, batchIncrement] = getTrainingQueueBatchStatus(unitEntState.id, entType);
|
||||
tooltip += "\n" + font1;
|
||||
if (batchSize) tooltip += "Training " + font2 + batchSize + font1 + " units; ";
|
||||
tooltip += "Shift-click to train " + font2 + (batchSize+batchIncrement) + font1 + " units[/font]";
|
||||
}
|
||||
}
|
||||
|
||||
button.hidden = false;
|
||||
button.tooltip = tooltip;
|
||||
button.onpress = (function(e) { return function() { callback(e) } })(item);
|
||||
// (need nested functions to get the closure right)
|
||||
|
||||
icon.sprite = "snPortraitSheetHele"; // TODO
|
||||
if (typeof template.icon_cell == "undefined")
|
||||
icon.cell_id = 0;
|
||||
else
|
||||
icon.cell_id = template.icon_cell;
|
||||
++i;
|
||||
}
|
||||
var numButtons = i;
|
||||
// Position the visible buttons
|
||||
// (TODO: if there's lots, maybe they should be squeezed together to fit)
|
||||
for (i = 0; i < numButtons; ++i)
|
||||
{
|
||||
var button = getGUIObjectByName("unit"+guiName+"Button["+i+"]");
|
||||
var size = button.size;
|
||||
size.left = 40*i;
|
||||
size.right = 40*i + size.bottom;
|
||||
button.size = size;
|
||||
}
|
||||
|
||||
// Hide any buttons we're no longer using
|
||||
for (i = numButtons; i < g_unitPanelButtons[guiName]; ++i)
|
||||
getGUIObjectByName("unit"+guiName+"Button["+i+"]").hidden = true;
|
||||
g_unitPanelButtons[guiName] = numButtons;
|
||||
}
|
||||
|
||||
function updateUnitDisplay()
|
||||
{
|
||||
var detailsPanel = getGUIObjectByName("selectionDetails");
|
||||
var commandsPanel = getGUIObjectByName("unitCommands");
|
||||
|
||||
var selection = g_Selection.toList();
|
||||
if (selection.length == 0)
|
||||
{
|
||||
detailsPanel.hidden = true;
|
||||
commandsPanel.hidden = true;
|
||||
return;
|
||||
}
|
||||
|
||||
var entState = Engine.GuiInterfaceCall("GetEntityState", selection[0]);
|
||||
|
||||
// If the unit has no data (e.g. it was killed), don't try displaying any
|
||||
// data for it. (TODO: it should probably be removed from the selection too;
|
||||
// also need to handle multi-unit selections)
|
||||
if (!entState)
|
||||
{
|
||||
detailsPanel.hidden = true;
|
||||
commandsPanel.hidden = true;
|
||||
return;
|
||||
}
|
||||
|
||||
var template = Engine.GuiInterfaceCall("GetTemplateData", entState.template);
|
||||
|
||||
detailsPanel.hidden = false;
|
||||
commandsPanel.hidden = false;
|
||||
|
||||
getGUIObjectByName("selectionDetailsIcon").sprite = "snPortraitSheetHele";
|
||||
getGUIObjectByName("selectionDetailsIcon").cell_id = template.icon_cell;
|
||||
|
||||
var healthSize = getGUIObjectByName("selectionDetailsHealthBar").size;
|
||||
healthSize.rright = 100*Math.max(0, Math.min(1, entState.hitpoints / entState.maxHitpoints));
|
||||
getGUIObjectByName("selectionDetailsHealthBar").size = healthSize;
|
||||
getGUIObjectByName("selectionDetailsHealth").tooltip = "Hitpoints " + entState.hitpoints + " / " + entState.maxHitpoints;
|
||||
|
||||
getGUIObjectByName("selectionDetailsSpecific").caption = template.name.specific;
|
||||
if (template.name.generic == template.name.specific)
|
||||
{
|
||||
getGUIObjectByName("selectionDetailsGeneric").hidden = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
getGUIObjectByName("selectionDetailsGeneric").hidden = false;
|
||||
getGUIObjectByName("selectionDetailsGeneric").caption = template.name.generic;
|
||||
}
|
||||
|
||||
getGUIObjectByName("selectionDetailsPlayer").caption = "Player " + entState.player; // TODO: get player name
|
||||
|
||||
getGUIObjectByName("selectionDetailsAttack").caption = damageTypesToText(entState.attack);
|
||||
getGUIObjectByName("selectionDetailsArmour").caption = damageTypesToText(entState.armour);
|
||||
|
||||
var usedPanels = {};
|
||||
|
||||
// If the selection is friendly units, add the command panels
|
||||
var player = Engine.GetPlayerID();
|
||||
if (entState.player == player || g_DevSettings.controlAll)
|
||||
{
|
||||
if (entState.attack) // TODO - this should be based on some AI properties
|
||||
{
|
||||
//usedPanels["Stance"] = 1;
|
||||
//usedPanels["Formation"] = 1;
|
||||
// (These are disabled since they're not implemented yet)
|
||||
}
|
||||
else // TODO - this should be based on various other things
|
||||
{
|
||||
//usedPanels["Research"] = 1;
|
||||
}
|
||||
|
||||
if (entState.buildEntities && entState.buildEntities.length)
|
||||
setupUnitPanel("Construction", usedPanels, entState, entState.buildEntities, startBuildingPlacement);
|
||||
|
||||
if (entState.training && entState.training.entities.length)
|
||||
setupUnitPanel("Training", usedPanels, entState, entState.training.entities,
|
||||
function (trainEntType) { addToTrainingQueue(entState.id, trainEntType); } );
|
||||
|
||||
if (entState.training && entState.training.queue.length)
|
||||
setupUnitPanel("Queue", usedPanels, entState, entState.training.queue,
|
||||
function (item) { removeFromTrainingQueue(entState.id, item.id); } );
|
||||
}
|
||||
|
||||
// Lay out all the used panels in a stack at the bottom of the screen
|
||||
var offset = 0;
|
||||
for each (var panelName in g_unitPanels)
|
||||
{
|
||||
var panel = getGUIObjectByName("unit"+panelName+"Panel");
|
||||
if (usedPanels[panelName])
|
||||
{
|
||||
var size = panel.size;
|
||||
var h = size.bottom - size.top;
|
||||
size.bottom = offset;
|
||||
size.top = offset - h;
|
||||
panel.size = size;
|
||||
panel.hidden = false;
|
||||
offset -= (h + 12);
|
||||
}
|
||||
else
|
||||
{
|
||||
panel.hidden = true;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,275 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<objects>
|
||||
|
||||
<script file="gui/common/functions_global_object.js" />
|
||||
<script file="gui/session_new/session.js"/>
|
||||
<script file="gui/session_new/selection.js"/>
|
||||
<script file="gui/session_new/input.js"/>
|
||||
<script file="gui/session_new/music.js"/>
|
||||
|
||||
<object name="sn" hotkey="session.gui.toggle">
|
||||
<action on="Tick">
|
||||
onTick();
|
||||
</action>
|
||||
|
||||
<action on="SimulationUpdate">
|
||||
onSimulationUpdate();
|
||||
</action>
|
||||
|
||||
<action on="Press">
|
||||
this.hidden = !this.hidden;
|
||||
</action>
|
||||
|
||||
<!-- Exit button -->
|
||||
<object type="button" style="wheatExit"
|
||||
size="100%-16 0 100% 16"
|
||||
tooltip_style="snToolTip"
|
||||
tooltip="Exit game"
|
||||
hotkey="leave"
|
||||
>
|
||||
<action on="Press"><![CDATA[
|
||||
messageBox(400, 200, "Do you really want to quit?", "Confirmation", 0,
|
||||
["Yes", "No!"], [leaveGame, null]);
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<!-- Dev/cheat commands -->
|
||||
<object size="100%-170 32 100%-16 144" type="image" sprite="devCommandsBackground">
|
||||
<object size="0 0 100%-18 16" type="text" style="devCommandsText">Control all units</object>
|
||||
<object size="100%-16 0 100% 16" type="checkbox" name="devControlAll" style="wheatCrossBox"/>
|
||||
|
||||
<object size="0 16 100%-18 32" type="text" style="devCommandsText">Display selection state</object>
|
||||
<object size="100%-16 16 100% 32" type="checkbox" name="devDisplayState" style="wheatCrossBox"/>
|
||||
|
||||
<object size="0 32 100%-18 48" type="text" style="devCommandsText">Pathfinder overlay</object>
|
||||
<object size="100%-16 32 100% 48" type="checkbox" style="wheatCrossBox">
|
||||
<action on="Press">Engine.GuiInterfaceCall("SetPathfinderDebugOverlay", this.checked);</action>
|
||||
</object>
|
||||
|
||||
<object size="0 48 100%-18 64" type="text" style="devCommandsText">Obstruction overlay</object>
|
||||
<object size="100%-16 48 100% 64" type="checkbox" style="wheatCrossBox">
|
||||
<action on="Press">Engine.GuiInterfaceCall("SetObstructionDebugOverlay", this.checked);</action>
|
||||
</object>
|
||||
|
||||
<object size="0 64 100%-18 80" type="text" style="devCommandsText">Unit motion overlay</object>
|
||||
<object size="100%-16 64 100% 80" type="checkbox" style="wheatCrossBox">
|
||||
<action on="Press">g_Selection.SetMotionDebugOverlay(this.checked);</action>
|
||||
</object>
|
||||
|
||||
<object size="0 80 100%-18 96" type="text" style="devCommandsText">Toggle music</object>
|
||||
<object size="100%-16 80 100% 96" type="checkbox" style="wheatCrossBox" checked="true" hotkey="music.toggle">
|
||||
<action on="Press">if (this.checked) startMusic(); else stopMusic();</action>
|
||||
</object>
|
||||
|
||||
<object size="0 96 100%-18 112" type="text" style="devCommandsText">Pause game</object>
|
||||
<object size="100%-16 96 100% 112" type="checkbox" style="wheatCrossBox" hotkey="pause">
|
||||
<action on="Press">setPaused(this.checked);</action>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<!-- Debug text -->
|
||||
<object name="debug"
|
||||
type="text"
|
||||
size="0 50 50% 100%"
|
||||
ghost="true"
|
||||
textcolor="yellow"
|
||||
font="mono-stroke-10"
|
||||
/>
|
||||
|
||||
<!-- Player resource bar -->
|
||||
<object
|
||||
size="50%-200 0 50%+200 30"
|
||||
type="image"
|
||||
style="goldPanelFrilly"
|
||||
>
|
||||
|
||||
<!-- Food -->
|
||||
<object size="0 0 18% 100%" type="image" style="resourceCounter" tooltip="Food">
|
||||
<object size="0 0 28 28" type="image" style="resourceIcon" cell_id="0"/>
|
||||
<object size="24 4 100% 32" type="text" style="resourceText" name="resourceFood"/>
|
||||
</object>
|
||||
|
||||
<!-- Wood -->
|
||||
<object size="18% 0 36% 100%" type="image" style="resourceCounter" tooltip="Wood">
|
||||
<object size="0 0 28 28" type="image" style="resourceIcon" cell_id="1"/>
|
||||
<object size="24 4 100% 32" type="text" style="resourceText" name="resourceWood"/>
|
||||
</object>
|
||||
|
||||
<!-- Stone -->
|
||||
<object size="36% 0 54% 100%" type="image" style="resourceCounter" tooltip="Stone">
|
||||
<object size="0 0 28 28" type="image" style="resourceIcon" cell_id="2"/>
|
||||
<object size="24 4 100% 32" type="text" style="resourceText" name="resourceStone"/>
|
||||
</object>
|
||||
|
||||
<!-- Metal -->
|
||||
<object size="54% 0 72% 100%" type="image" style="resourceCounter" tooltip="Metal">
|
||||
<object size="0 0 28 28" type="image" style="resourceIcon" cell_id="3"/>
|
||||
<object size="24 4 100% 32" type="text" style="resourceText" name="resourceMetal"/>
|
||||
</object>
|
||||
|
||||
<!-- Population -->
|
||||
<object size="72% 0 100% 100%" type="image" style="resourceCounter" tooltip="Population (current / maximum)">
|
||||
<object size="0 0 28 28" type="image" style="resourceIcon" cell_id="4"/>
|
||||
<object size="24 4 100% 32" type="text" style="resourceText" name="resourcePop"/>
|
||||
</object>
|
||||
|
||||
</object>
|
||||
|
||||
<!-- Bottom-left selected-unit details panel -->
|
||||
<object name="selectionDetails"
|
||||
type="image"
|
||||
style="goldPanel"
|
||||
size="0 100%-250 300 100%"
|
||||
>
|
||||
|
||||
<!-- Big unit icon -->
|
||||
<object size="8 8 136 136">
|
||||
<object type="image" style="selectionDetailsIconOutline"/>
|
||||
<object type="image" name="selectionDetailsIcon" ghost="true"/>
|
||||
</object>
|
||||
|
||||
<!-- Health bar -->
|
||||
<object size="8 138 136 144" type="image" name="selectionDetailsHealth" tooltip="Hitpoints" tooltip_style="snToolTip">
|
||||
<object type="image" sprite="selectionDetailsHealthBackground" ghost="true"/>
|
||||
<object type="image" sprite="selectionDetailsHealthForeground" ghost="true" name="selectionDetailsHealthBar"/>
|
||||
</object>
|
||||
|
||||
<!-- Stamina bar -->
|
||||
<object size="8 146 136 152" type="image" name="selectionDetailsStamina" tooltip="Stamina" tooltip_style="snToolTip">
|
||||
<object type="image" sprite="selectionDetailsStaminaBackground" ghost="true"/>
|
||||
<object type="image" sprite="selectionDetailsStaminaForeground" ghost="true" name="selectionDetailsStaminaBar"/>
|
||||
</object>
|
||||
|
||||
<!-- Details text -->
|
||||
<object size="136 6 100% 100%">
|
||||
<object size="0 0 100% 30" name="selectionDetailsSpecific" type="text" font="serif-bold-18"/>
|
||||
<object size="0 20 100% 40" name="selectionDetailsGeneric" type="text" font="serif-14"/>
|
||||
<object size="0 40 100% 60" name="selectionDetailsPlayer" type="text" font="serif-14" textcolor="blue"/>
|
||||
</object>
|
||||
|
||||
<!-- Attack stats -->
|
||||
<object size="146 72 100% 130" type="image" tooltip="Attack strengths" tooltip_style="snToolTip">
|
||||
<object size="-4 -8 48 48" type="image" ghost="true" sprite="snIconSheetStance" cell_id="1"/>
|
||||
<object size="40 0 100% 100%" type="text" ghost="true" name="selectionDetailsAttack" font="serif-bold-12"/>
|
||||
</object>
|
||||
|
||||
<!-- Armour stats -->
|
||||
<object size="146 130 100% 188" type="image" tooltip="Armour strengths" tooltip_style="snToolTip">
|
||||
<object size="-4 -4 48 48" type="image" ghost="true" sprite="snIconSheetStance" cell_id="3"/>
|
||||
<object size="40 0 100% 100%" type="text" ghost="true" name="selectionDetailsArmour" font="serif-bold-12"/>
|
||||
</object>
|
||||
|
||||
</object>
|
||||
|
||||
<!-- Bottom-middle selected-unit commands panel -->
|
||||
<object name="unitCommands"
|
||||
size="350 0 100%-300 100%-8"
|
||||
>
|
||||
|
||||
<object name="unitConstructionPanel"
|
||||
style="goldPanelFrilly"
|
||||
size="0 100%-56 100% 100%"
|
||||
type="image"
|
||||
>
|
||||
<object size="-5 -2 59 62" type="image" sprite="snIconSheetTab" tooltip_style="snToolTip"
|
||||
cell_id="0" tooltip="Construction"/>
|
||||
|
||||
<object size="59 10 100% 47">
|
||||
<repeat count="16">
|
||||
<object name="unitConstructionButton[n]" hidden="true" style="iconButton" type="button" size="0 0 37 37">
|
||||
<object name="unitConstructionIcon[n]" type="image" ghost="true" size="3 3 35 35"/>
|
||||
</object>
|
||||
</repeat>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<object name="unitStancePanel"
|
||||
style="goldPanelFrilly"
|
||||
size="0 100%-56 100% 100%"
|
||||
type="text"
|
||||
>
|
||||
<object size="-5 -2 59 62" type="image" sprite="snIconSheetTab" tooltip_style="snToolTip"
|
||||
cell_id="4" tooltip="Stances"/>
|
||||
|
||||
[stance commands]
|
||||
</object>
|
||||
|
||||
<object name="unitFormationPanel"
|
||||
style="goldPanelFrilly"
|
||||
size="0 100%-56 100% 100%"
|
||||
type="text"
|
||||
>
|
||||
<object size="-5 -2 59 62" type="image" sprite="snIconSheetTab" tooltip_style="snToolTip"
|
||||
cell_id="5" tooltip="Formations"/>
|
||||
|
||||
[formation commands]
|
||||
</object>
|
||||
|
||||
<object name="unitResearchPanel"
|
||||
style="goldPanelFrilly"
|
||||
size="0 100%-56 100% 100%"
|
||||
type="text"
|
||||
>
|
||||
<object size="-5 -2 59 62" type="image" sprite="snIconSheetTab" tooltip_style="snToolTip"
|
||||
cell_id="1" tooltip="Research"/>
|
||||
|
||||
[research commands]
|
||||
</object>
|
||||
|
||||
<object name="unitTrainingPanel"
|
||||
style="goldPanelFrilly"
|
||||
size="0 100%-56 100% 100%"
|
||||
type="image"
|
||||
>
|
||||
<object size="-5 -2 59 62" type="image" sprite="snIconSheetTab" tooltip_style="snToolTip"
|
||||
cell_id="2" tooltip="Training"/>
|
||||
|
||||
<object size="59 10 100% 47">
|
||||
<repeat count="16">
|
||||
<object name="unitTrainingButton[n]" hidden="true" style="iconButton" type="button" size="0 0 37 37">
|
||||
<object name="unitTrainingIcon[n]" type="image" ghost="true" size="3 3 35 35"/>
|
||||
</object>
|
||||
</repeat>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<object name="unitQueuePanel"
|
||||
style="goldPanelFrilly"
|
||||
size="0 100%-56 100% 100%"
|
||||
type="text"
|
||||
>
|
||||
<object size="-5 -2 59 62" type="image" sprite="snIconSheetTab" tooltip_style="snToolTip"
|
||||
cell_id="3" tooltip="Production queue"/>
|
||||
|
||||
<object size="59 10 100% 47">
|
||||
<repeat count="16">
|
||||
<object name="unitQueueButton[n]" hidden="true" style="iconButton" type="button" size="0 0 37 37">
|
||||
<object name="unitQueueIcon[n]" ghost="true" type="image" size="3 3 35 35"/>
|
||||
<object name="unitQueueCount[n]" ghost="true" style="iconButtonCount" type="text"/>
|
||||
<object name="unitQueueProgress[n]" ghost="true" style="iconButtonProgress" type="text"/>
|
||||
</object>
|
||||
</repeat>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
</object>
|
||||
|
||||
<!-- Minimap -->
|
||||
<object name="minimap">
|
||||
<object style="goldPanel"
|
||||
size="100%-246 100%-246 100% 100%"
|
||||
type="image"
|
||||
/>
|
||||
<object name="minimapDisplay"
|
||||
type="minimap"
|
||||
size="100%-206 100%-206 100%-6 100%-6"
|
||||
/>
|
||||
</object>
|
||||
|
||||
</object>
|
||||
|
||||
<!-- Selection bandbox -->
|
||||
<object name="bandbox" type="image" sprite="bandbox" ghost="true" hidden="true"/>
|
||||
|
||||
</objects>
|
@ -1,106 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<sprites>
|
||||
<sprite name="goldPanel">
|
||||
<!-- (currently this is all a hack - need proper textures) -->
|
||||
<image
|
||||
texture="global/titlebar/middle_gold_fern.dds"
|
||||
texture_size="0 0 64 32"
|
||||
size="0 -6 100% 0"
|
||||
/>
|
||||
<image
|
||||
texture="global/titlebar/middle_gold_fern.dds"
|
||||
texture_size="0 0 64 32"
|
||||
size="0 100%+5 100% 100%"
|
||||
/>
|
||||
<image
|
||||
texture="global/border/corner_bronze.dds"
|
||||
texture_size="0 0 16 100%"
|
||||
size="100% 0 100%+4 100%"
|
||||
/>
|
||||
<image
|
||||
texture="global/border/corner_bronze.dds"
|
||||
texture_size="0 0 16 100%"
|
||||
size="-4 0 0 100%"
|
||||
/>
|
||||
<image
|
||||
texture="global/tile/sandstone.dds"
|
||||
texture_size="0 0 128 128"
|
||||
/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="goldPanelFrilly">
|
||||
<!-- (currently this is all a hack - need proper textures) -->
|
||||
<image
|
||||
texture="global/titlebar/middle_gold_fern.dds"
|
||||
texture_size="0 0 64 32"
|
||||
size="0 -6 100% 0"
|
||||
/>
|
||||
<image
|
||||
texture="global/titlebar/middle_gold_fern.dds"
|
||||
texture_size="0 0 64 32"
|
||||
size="0 100%+5 100% 100%"
|
||||
/>
|
||||
<image
|
||||
texture="global/border/corner_bronze.dds"
|
||||
texture_size="0 0 16 100%"
|
||||
size="100% 0 100%+4 100%"
|
||||
/>
|
||||
<image
|
||||
texture="global/border/corner_bronze.dds"
|
||||
texture_size="0 0 16 100%"
|
||||
size="-4 0 0 100%"
|
||||
/>
|
||||
<image
|
||||
texture="global/titlebar/left_gold_fern.dds"
|
||||
texture_size="0 0 64 32"
|
||||
size="-48 50%-16 0 50%+16"
|
||||
/>
|
||||
<image
|
||||
texture="global/titlebar/right_gold_fern.dds"
|
||||
texture_size="-16 0 48 32"
|
||||
size="100% 50%-16 100%+48 50%+16"
|
||||
/>
|
||||
<image
|
||||
texture="global/tile/sandstone.dds"
|
||||
texture_size="0 0 128 128"
|
||||
/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="selectionDetailsIconOutline">
|
||||
<image backcolor="blue"/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="selectionDetailsHealthBackground">
|
||||
<image backcolor="red"/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="selectionDetailsHealthForeground">
|
||||
<image backcolor="green"/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="selectionDetailsStaminaBackground">
|
||||
<image backcolor="black"/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="selectionDetailsStaminaForeground">
|
||||
<image backcolor="blue"/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="bandbox">
|
||||
<image backcolor="black" size="0 0 100% 1"/>
|
||||
<image backcolor="black" size="100%-1 0 100% 100%"/>
|
||||
<image backcolor="black" size="0 100%-1 100% 100%"/>
|
||||
<image backcolor="black" size="0 0 1 100%"/>
|
||||
<image backcolor="white" size="1 1 100%-1 2"/>
|
||||
<image backcolor="white" size="100%-2 1 100%-1 100%-1"/>
|
||||
<image backcolor="white" size="1 100%-2 100%-1 100%-1"/>
|
||||
<image backcolor="white" size="1 1 2 100%-1"/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="devCommandsBackground">
|
||||
<image backcolor="0 0 0 85"/>
|
||||
</sprite>
|
||||
|
||||
</sprites>
|
||||
|
@ -1,65 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<styles>
|
||||
<style name="goldPanel"
|
||||
sprite="goldPanel"
|
||||
buffer_zone="4"
|
||||
text_align="left"
|
||||
text_valign="top"
|
||||
/>
|
||||
|
||||
<style name="goldPanelFrilly"
|
||||
sprite="goldPanelFrilly"
|
||||
buffer_zone="4"
|
||||
text_align="center"
|
||||
text_valign="center"
|
||||
/>
|
||||
|
||||
<style name="resourceIcon"
|
||||
sprite="snIconSheetResource"
|
||||
ghost="true"
|
||||
/>
|
||||
|
||||
<style name="resourceText"
|
||||
textcolor="black"
|
||||
font="serif-bold-14"
|
||||
ghost="true"
|
||||
/>
|
||||
|
||||
<style name="resourceCounter"
|
||||
tooltip_style="snToolTip"
|
||||
/>
|
||||
|
||||
<style name="selectionDetailsIconOutline"
|
||||
sprite="selectionDetailsIconOutline"
|
||||
/>
|
||||
|
||||
<style name="iconButton"
|
||||
sprite="snIconPortrait"
|
||||
sprite_over="snIconPortraitOver"
|
||||
sprite_disabled="snIconPortraitDisabled"
|
||||
tooltip_style="snToolTipBottom"
|
||||
/>
|
||||
|
||||
<style name="iconButtonCount"
|
||||
textcolor="255 255 255"
|
||||
font="serif-9"
|
||||
text_align="right"
|
||||
text_valign="top"
|
||||
buffer_zone="4"
|
||||
/>
|
||||
|
||||
<style name="iconButtonProgress"
|
||||
textcolor="255 255 255"
|
||||
font="serif-stroke-14"
|
||||
text_align="center"
|
||||
text_valign="center"
|
||||
/>
|
||||
|
||||
<style name="devCommandsText"
|
||||
font="sans-10"
|
||||
textcolor="255 255 255"
|
||||
text_align="right"
|
||||
/>
|
||||
|
||||
</styles>
|
Loading…
Reference in New Issue
Block a user