37 static void Register(
int id,
string displayName,
string widgetName,
typename tabClass)
71 protected static const string HINTS_PATH_DEFAULT =
"scripts/data/internal/script_console_hints.json";
92 #ifdef PLATFORM_CONSOLE
93 protected Widget m_HeaderPanelConsole;
94 protected GridSpacerWidget m_ConsoleButtonsMenuGrid;
120 g_Game.GetMission().GetHud().ShowHudPlayer(
false);
121 g_Game.GetMission().GetHud().ShowQuickbarPlayer(
false);
122 g_Game.GetMission().GetHud().HideVehicleInfo();
128 plugin.OnScriptMenuOpened(
true);
138 g_Game.GetMission().GetHud().ShowHudPlayer(
true);
139 g_Game.GetMission().GetHud().ShowQuickbarPlayer(
true);
140 g_Game.GetMission().GetHud().ShowVehicleInfo();
141 g_Game.GetMission().EnableAllInputs(
true);
150 plugin.OnScriptMenuOpened(
false);
177 if (!JsonFileLoader<JsonHintsData>.LoadFile(
path, data, errorMessage))
188 m_JsonData.WidgetHintBindings.Set(hash, text);
203 layoutRoot =
g_Game.GetWorkspace().CreateWidgets(
"gui/layouts/script_console/script_console.layout");
204 m_EditTooltipRoot =
g_Game.GetWorkspace().CreateWidgets(
"gui/layouts/script_console/script_console_tooltip_edit.layout", layoutRoot);
212 m_ButtonsMenu = GridSpacerWidget.Cast(layoutRoot.FindAnyWidget(
"ButtonsContextMenu"));
213 m_ContextMenuGrid = GridSpacerWidget.Cast(layoutRoot.FindAnyWidget(
"ContextMenuGrid"));
217 #ifdef PLATFORM_CONSOLE
221 m_HeaderPanelConsole = layoutRoot.FindAnyWidget(
"HeaderBarConsole");
222 m_ConsoleButtonsMenuGrid = GridSpacerWidget.Cast(layoutRoot.FindAnyWidget(
"TabButtonsGrid"));
224 m_HeaderPanelConsole.Show(
true);
237 #ifdef PLATFORM_CONSOLE
245 #ifdef PLATFORM_CONSOLE
251 switch (pInputDeviceType)
257 m_HeaderPanelConsole.Show(
true);
258 g_Game.GetUIManager().ShowUICursor(
false);
259 g_Game.GetMission().RemoveActiveInputExcludes({
"menu_move"});
264 m_HeaderPanelConsole.Show(
false);
267 g_Game.GetUIManager().ShowUICursor(
true);
268 g_Game.GetMission().AddActiveInputExcludes({
"menu_move"});
285 element.GetRoot().Unlink();
286 delete element.GetRoot();
305 #ifdef PLATFORM_CONSOLE
307 buttonsGrid = m_ConsoleButtonsMenuGrid;
321 if (element.HasSubElements())
335 if (w == element.GetButton())
338 if (element.IsSubElementButton(w))
353 string nameThis = w.GetName();
354 string nameParent =
"";
358 nameParent = w.GetParent().GetName();
361 string namesCombined = nameThis + nameParent;
362 return namesCombined.
Hash();
371 if (
m_JsonData.WidgetHintBindings.Contains(hash))
373 return m_JsonData.WidgetHintBindings.Get(hash);
414 "UAVoiceModifierHelper",
416 "UAVoiceDistanceDown",
418 "UAVoiceOverNetToggle",
419 "UAVoiceOverNetMute",
430 "UABuldSelectToggle",
433 "UABuldSelectAddMod",
434 "UABuldSelectRemoveMod",
435 "UABuldModifySelected",
437 "UABuldRotationXAxisMod",
438 "UABuldRotationZAxisMod",
439 "UABuldCoordModCycle",
440 "UABuldSampleTerrainHeight",
441 "UABuldSetTerrainHeight",
446 "UABuldBrushRatioUp",
447 "UABuldBrushRatioDown",
448 "UABuldBrushOuterUp",
449 "UABuldBrushOuterDown",
450 "UABuldBrushStrengthUp",
451 "UABuldBrushStrengthDown",
452 "UABuldToggleNearestObjectArrow",
453 "UABuldCycleBrushMod",
454 "UABuldSelectionType",
455 "UABuldCreateLastSelectedObject",
456 "UABuldDuplicateSelection",
457 "UABuldDeleteSelection",
477 "UABuldViewerMoveForward",
478 "UABuldViewerMoveBack",
479 "UABuldViewerMoveLeft",
480 "UABuldViewerMoveRight",
481 "UABuldViewerMoveUp",
482 "UABuldViewerMoveDown",
483 "UABuldObjectRotateLeft",
484 "UABuldObjectRotateRight",
485 "UABuldObjectRotateForward",
486 "UABuldObjectRotateBack",
487 "UABuldPreviousAnimation",
488 "UABuldNextAnimation",
489 "UABuldRecedeAnimation",
490 "UABuldAdvanceAnimation",
491 "UABuldLinkCamToTerrain",
492 "UABuldCopyTileCoord",
493 "UABuldMarkUnderground",
494 "UABuldRemoveUnderground"
499 inputExcludes.Remove(0);
502 g_Game.GetMission().AddActiveInputExcludes(inputExcludes);
515 super.OnKeyPress(w,
x,
y, key);
525 super.OnKeyDown(w,
x,
y, key);
535 super.Update(timeslice);
567 if (handler.IsSelected())
569 handler.Update(timeslice);
576 g_Game.GetUIManager().Back();
599 super.OnMouseButtonDown(w,
x,
y,button);
609 super.OnClick(w,
x,
y, button);
628 #ifndef PLATFORM_CONSOLE
632 g_Game.GetMission().EnableAllInputs(
true);
644 super.OnDoubleClick(w,
x,
y, button);
654 super.OnMouseLeave(w, enterW,
x,
y);
679 super.OnMouseEnter(w,
x,
y);
700 #ifdef PLATFORM_CONSOLE
708 super.OnChange(w,
x,
y, finished);
718 super.OnItemSelected(w,
x,
y, row, column, oldRow, oldColumn);
730 if (tabType == handler.Type())
749 if (entry.m_ID == tabId)
760 Widget panel = layoutRoot.FindAnyWidget(foundEntry.m_PanelWidgetName);
761 if (panel && elementButton)
781 if (elementID == tabId)
797 handler.Select(handler == selectedHandler, selectedHandler);
801 ScriptConsoleWeatherTab weatherTab;
802 bool isCameraTab =
Class.
CastTo(cameraTab, selectedHandler);
803 bool isWeatherTab =
Class.
CastTo(weatherTab, selectedHandler);
805 if (isCameraTab || isWeatherTab)
810 g_Game.GetMission().RemoveActiveInputExcludes({
"movement"},
true);
816 g_Game.GetMission().AddActiveInputExcludes({
"movement"});
825 ButtonWidget buttonW;
837 GetLayoutRoot().FindAnyWidget(
"MenuWindow").SetColor(
ARGB(0, 0, 0, 0));
841 GetLayoutRoot().FindAnyWidget(
"MenuWindow").SetColor(
ARGB(128, 0, 0, 0));
847 if (!child || !parent)
850 Widget currentChild = parent.GetChildren();
853 if (currentChild == child)
855 currentChild = currentChild.GetSibling();
864 m_HintWidgetRoot =
g_Game.GetWorkspace().CreateWidgets(
"gui/layouts/script_console/script_console_hint.layout");
874 int screenW, screenH;
880 float relativeX = mouseX / screenW;
881 float relativeY = mouseY / screenH;
886 offsetX = -width - offsetX;
888 offsetY = -height - offsetY;
898 super.OnRPCEx(rpc_type, ctx);
899 #ifdef DIAG_DEVELOPER
903 handler.OnRPCEx(rpc_type,ctx);
937 m_Timer.Run(0.1,
this,
"Tick", NULL,
true);
951 if (!
m_Root.IsVisibleHierarchy())
968 m_HintWidgetRoot =
g_Game.GetWorkspace().CreateWidgets(
"gui/layouts/script_console/script_console_hint.layout");
978 int screenW, screenH;
984 float relativeX = mouseX / screenW;
985 float relativeY = mouseY / screenH;
990 offsetX = -width - offsetX;
992 offsetY = -height - offsetY;
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
EInputDeviceType m_CurrentInputDevice
PluginConfigDebugProfile m_ConfigDebugProfile
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
ButtonWidget GetContextElementButton(int tabID)
class ScriptConsoleTabRegistry HINTS_PATH_DEFAULT
GridSpacerWidget m_ContextMenuGrid
ButtonWidget m_HintCancelButton
EditBoxWidget m_HintInputText
override bool OnKeyDown(Widget w, int x, int y, int key)
void HideContextSubElements()
ImageWidget m_HintWidgetBackground
ScriptConsoleToolTipEventHandler WidgetHintBindings
ButtonWidget m_CloseConsoleButton
ButtonWidget m_HintOkButton
static JsonHintsData GetData()
TextWidget m_ContectMenuButtonLabel
Widget m_CurrentHoverWidget
ButtonWidget m_HintClearButton
override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
ref map< int, ref ScriptConsoleTabBase > m_TabHandlersByID
static const string HINTS_PATH_OPTIONAL
bool IsContextElementButton(Widget w)
GridSpacerWidget m_ButtonsMenu
void ShowMenuBackground(bool state)
RichTextWidget m_HintWidget
ButtonWidget m_ContextMenuButton
bool IsChildOfWidget(Widget child, Widget parent)
ref map< int, ref ScriptConsoleMenuElement > m_ContextMenuElements
void ScriptConsoleTabRegistryEntry(int id, string displayName, string panelWidgetName, typename tabClass)
static ref array< ref MapMarker > m_MarkedEntities
static ref JsonHintsData m_JsonData
int GetWidgetCombinedHash(Widget w)
bool m_HoverSuccessTriggered
void SetHintText(string text, Widget w)
ScriptConsoleTabBase GetTabHandler(typename tabType)
ScriptConsoleTabBase GetSelectedHandler()
void DisplayHint(string message)
void RegisterContextMenuElement(int id, string name)
void RegisterTab(int id, ScriptConsoleTabBase handler)
void SelectTabByID(int tabId)
ScriptConsoleTabBase m_SelectedHandler
const string NO_HINT_TEXT
void SelectTab(ScriptConsoleTabBase selectedHandler)
Super root of all classes in Enforce script.
void InitializeTab(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
static void InitializeRegistry()
static void Register(int id, string displayName, string widgetName, typename tabClass)
static ref array< ref ScriptConsoleTabRegistryEntry > s_Entries
static array< ref ScriptConsoleTabRegistryEntry > GetAll()
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Serializer ParamsReadContext
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
proto bool FileExist(string name)
Check existence of file.
proto native void ClearKey(KeyCode key)
proto native int KeyState(KeyCode key)
static proto float Sqrt(float val)
Returns square root.
static proto float AbsFloat(float f)
Returns absolute value.
proto void GetScreenSize(out int x, out int y)
proto void GetMousePos(out int x, out int y)
proto native int Hash()
Returns hash of string.
int ARGB(int a, int r, int g, int b)