Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/session/input.js
Show All 23 Lines | |||||
const INPUT_BANDBOXING = 2; | const INPUT_BANDBOXING = 2; | ||||
const INPUT_BUILDING_PLACEMENT = 3; | const INPUT_BUILDING_PLACEMENT = 3; | ||||
const INPUT_BUILDING_CLICK = 4; | const INPUT_BUILDING_CLICK = 4; | ||||
const INPUT_BUILDING_DRAG = 5; | const INPUT_BUILDING_DRAG = 5; | ||||
const INPUT_BATCHTRAINING = 6; | const INPUT_BATCHTRAINING = 6; | ||||
const INPUT_PRESELECTEDACTION = 7; | const INPUT_PRESELECTEDACTION = 7; | ||||
const INPUT_BUILDING_WALL_CLICK = 8; | const INPUT_BUILDING_WALL_CLICK = 8; | ||||
const INPUT_BUILDING_WALL_PATHING = 9; | const INPUT_BUILDING_WALL_PATHING = 9; | ||||
const INPUT_MASSTRIBUTING = 10; | const INPUT_UNIT_POSITION_START = 10; | ||||
const INPUT_UNIT_POSITION_START = 11; | const INPUT_UNIT_POSITION = 11; | ||||
const INPUT_UNIT_POSITION = 12; | |||||
var inputState = INPUT_NORMAL; | var inputState = INPUT_NORMAL; | ||||
const INVALID_ENTITY = 0; | const INVALID_ENTITY = 0; | ||||
var mouseX = 0; | var mouseX = 0; | ||||
var mouseY = 0; | var mouseY = 0; | ||||
var mouseIsOverObject = false; | var mouseIsOverObject = false; | ||||
▲ Show 20 Lines • Show All 719 Lines • ▼ Show 20 Lines | case "mousebuttondown": | ||||
placementSupport.Reset(); | placementSupport.Reset(); | ||||
inputState = INPUT_NORMAL; | inputState = INPUT_NORMAL; | ||||
return true; | return true; | ||||
} | } | ||||
break; | break; | ||||
} | } | ||||
break; | break; | ||||
case INPUT_MASSTRIBUTING: | |||||
if (ev.type == "hotkeyup" && ev.hotkey == "session.masstribute") | |||||
{ | |||||
g_FlushTributing(); | |||||
inputState = INPUT_NORMAL; | |||||
} | |||||
break; | |||||
case INPUT_BATCHTRAINING: | case INPUT_BATCHTRAINING: | ||||
if (ev.type == "hotkeyup" && ev.hotkey == "session.batchtrain") | if (ev.type == "hotkeyup" && ev.hotkey == "session.batchtrain") | ||||
{ | { | ||||
flushTrainingBatch(); | flushTrainingBatch(); | ||||
inputState = INPUT_NORMAL; | inputState = INPUT_NORMAL; | ||||
} | } | ||||
break; | break; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 428 Lines • ▼ Show 20 Lines | function positionUnitsFreehandSelectionMouseUp(ev) | ||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": "order_walk", | "name": "order_walk", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
return true; | return true; | ||||
} | } | ||||
function handleMinimapEvent(target) | |||||
{ | |||||
// Partly duplicated from handleInputAfterGui(), but with the input being | |||||
// world coordinates instead of screen coordinates. | |||||
if (inputState != INPUT_NORMAL) | |||||
return false; | |||||
let action = determineAction(undefined, undefined, true); | |||||
if (!action) | |||||
return false; | |||||
return handleUnitAction(target, action); | |||||
} | |||||
function handleUnitAction(target, action) | function handleUnitAction(target, action) | ||||
{ | { | ||||
if (!g_UnitActions[action.type] || !g_UnitActions[action.type].execute) | if (!g_UnitActions[action.type] || !g_UnitActions[action.type].execute) | ||||
{ | { | ||||
error("Invalid action.type " + action.type); | error("Invalid action.type " + action.type); | ||||
return false; | return false; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 407 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator