26 ButtonWidget m_CloseConsoleButton;
29 protected static const string HINTS_PATH_DEFAULT =
"scripts/data/internal/script_console_hints.json";
30 protected static const string HINTS_PATH_OPTIONAL =
"$mission:script_console_hints.json";
34 const string NO_HINT_TEXT =
"No hint";
42 GetGame().GetMission().GetHud().ShowHudPlayer(
false);
43 GetGame().GetMission().GetHud().ShowQuickbarPlayer(
false);
48 plugin.OnScriptMenuOpened(
true);
56 GetGame().GetMission().GetHud().ShowHudPlayer(
true);
57 GetGame().GetMission().GetHud().ShowQuickbarPlayer(
true);
64 plugin.OnScriptMenuOpened(
false);
68 GetGame().GetMission().EnableAllInputs(
true);
80 if (!JsonFileLoader<JsonHintsData>.SaveFile(HINTS_PATH_OPTIONAL, m_JsonData, errorMessage))
95 if (!JsonFileLoader<JsonHintsData>.LoadFile(
path, data, errorMessage))
103 if (m_JsonData && m_JsonData.WidgetHintBindings && w)
106 m_JsonData.WidgetHintBindings.Set(hash, text);
107 Print(
"setting: " + text);
114 m_TabHandlers.Insert(handler.
GetButton(), handler);
115 m_TabHandlersByID.Insert(
m_Id, handler);
124 layoutRoot =
GetGame().GetWorkspace().CreateWidgets(
"gui/layouts/script_console/script_console.layout");
125 m_EditTooltipRoot =
GetGame().GetWorkspace().CreateWidgets(
"gui/layouts/script_console/script_console_tooltip_edit.layout", layoutRoot);
126 m_EditTooltipRoot.Show(
false);
127 m_HintOkButton = ButtonWidget.Cast(m_EditTooltipRoot.FindAnyWidget(
"ButtonOk"));
128 m_HintCancelButton = ButtonWidget.Cast(m_EditTooltipRoot.FindAnyWidget(
"ButtonCancel"));
129 m_HintClearButton = ButtonWidget.Cast(m_EditTooltipRoot.FindAnyWidget(
"ButtonClear"));
130 m_HintInputText = EditBoxWidget.Cast(m_EditTooltipRoot.FindAnyWidget(
"InputText"));
132 m_ButtonsWindowWidget = layoutRoot.FindAnyWidget(
"TabButtons");
133 m_ButtonsWindowWidget.Show(
true);
138 RegisterTab(
new ScriptConsoleEnfScriptServerTab(layoutRoot.FindAnyWidget(
"EnScriptPanel"),
this,ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"EnScriptButtonWidgetServer"))));
146 m_CloseConsoleButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"CloseConsoleButtonWidget"));
165 string nameThis = w.GetName();
166 string nameParent =
"";
170 nameParent = w.GetParent().GetName();
173 string namesCombined = nameThis + nameParent;
174 return namesCombined.Hash();
181 if (m_JsonData && m_JsonData.WidgetHintBindings)
183 if (m_JsonData.WidgetHintBindings.Contains(hash))
185 return m_JsonData.WidgetHintBindings.Get(hash);
204 m_HintEditMode =
false;
210 super.OnKeyPress(w,
x,
y, key);
220 super.OnKeyDown(w,
x,
y, key);
230 super.Update(timeslice);
234 float dist =
Math.Sqrt(
Math.AbsFloat(mouseX - m_PrevMouseX) +
Math.AbsFloat(mouseY - m_PrevMouseY));
235 m_PrevMouseX = mouseX;
236 m_PrevMouseY = mouseY;
252 GetGame().GetUIManager().Back();
259 m_EditTooltipRoot.Show(
true);
261 if (text == NO_HINT_TEXT)
263 m_HintInputText.SetText(text);
269 if (handler.IsSelected())
271 handler.Update(timeslice);
278 super.OnMouseButtonDown(w,
x,
y,button);
287 override bool OnClick(Widget w,
int x,
int y,
int button)
289 super.OnClick(w,
x,
y, button);
291 if (w == m_CloseConsoleButton)
294 GetGame().GetMission().EnableAllInputs(
true);
297 else if (w == m_HintOkButton)
301 m_EditTooltipRoot.Show(
false);
304 else if (w == m_HintCancelButton)
307 m_EditTooltipRoot.Show(
false);
310 else if (w == m_HintClearButton)
312 m_HintInputText.SetText(
"");
318 if (m_SelectedHandler.
OnClick(w,
x,
y,button))
325 super.OnDoubleClick(w,
x,
y, button);
335 super.OnMouseLeave(w, enterW,
x,
y);
337 if (!m_EditTooltipRoot.IsVisible())
348 super.OnMouseEnter(w,
x,
y);
349 if (!m_EditTooltipRoot.IsVisible())
355 #ifdef PLATFORM_CONSOLE
361 override bool OnChange(Widget w,
int x,
int y,
bool finished)
363 super.OnChange(w,
x,
y, finished);
365 if (m_SelectedHandler.
OnChange(w,
x,
y,finished))
371 override bool OnItemSelected(Widget w,
int x,
int y,
int row,
int column,
int oldRow,
int oldColumn)
373 super.OnItemSelected(w,
x,
y, row, column, oldRow, oldColumn);
375 if (m_SelectedHandler.
OnItemSelected(w,
x,
y, row, column,oldRow, oldColumn))
385 if (tabType == handler.Type())
411 handler.Select(handler == selectedHandler, selectedHandler);
418 GetGame().GetMission().RemoveActiveInputExcludes({
"movement"},
true);
424 GetGame().GetMission().AddActiveInputExcludes({
"movement"});
427 m_SelectedHandler = selectedHandler;
435 GetLayoutRoot().FindAnyWidget(
"MenuWindow").SetColor(
ARGB(0, 0, 0, 0));
439 GetLayoutRoot().FindAnyWidget(
"MenuWindow").SetColor(
ARGB(128, 0, 0, 0));
447 m_HintWidgetRoot =
GetGame().GetWorkspace().CreateWidgets(
"gui/layouts/script_console/script_console_hint.layout");
457 int screenW, screenH;
463 float relativeX = mouseX / screenW;
464 float relativeY = mouseY / screenH;
469 offsetX = -width - offsetX;
471 offsetY = -height - offsetY;
481 super.OnRPCEx(rpc_type, ctx);
482 #ifdef DIAG_DEVELOPER
486 handler.OnRPCEx(rpc_type,ctx);
508 "UAVoiceModifierHelper",
510 "UAVoiceDistanceDown",
512 "UAVoiceOverNetToggle",
513 "UAVoiceOverNetMute",
524 "UABuldSelectToggle",
527 "UABuldSelectAddMod",
528 "UABuldSelectRemoveMod",
529 "UABuldModifySelected",
531 "UABuldRotationXAxisMod",
532 "UABuldRotationZAxisMod",
533 "UABuldCoordModCycle",
534 "UABuldSampleTerrainHeight",
535 "UABuldSetTerrainHeight",
540 "UABuldBrushRatioUp",
541 "UABuldBrushRatioDown",
542 "UABuldBrushOuterUp",
543 "UABuldBrushOuterDown",
544 "UABuldBrushStrengthUp",
545 "UABuldBrushStrengthDown",
546 "UABuldToggleNearestObjectArrow",
547 "UABuldCycleBrushMod",
548 "UABuldSelectionType",
549 "UABuldCreateLastSelectedObject",
550 "UABuldDuplicateSelection",
551 "UABuldDeleteSelection",
571 "UABuldViewerMoveForward",
572 "UABuldViewerMoveBack",
573 "UABuldViewerMoveLeft",
574 "UABuldViewerMoveRight",
575 "UABuldViewerMoveUp",
576 "UABuldViewerMoveDown",
577 "UABuldObjectRotateLeft",
578 "UABuldObjectRotateRight",
579 "UABuldObjectRotateForward",
580 "UABuldObjectRotateBack",
581 "UABuldPreviousAnimation",
582 "UABuldNextAnimation",
583 "UABuldRecedeAnimation",
584 "UABuldAdvanceAnimation"
589 inputExcludes.Remove(0);
592 GetGame().GetMission().AddActiveInputExcludes(inputExcludes);
599class ScriptConsoleToolTipEventHandler : ScriptedWidgetEventHandler
624 m_Timer.Run(0.1,
this,
"Tick", NULL,
true);
638 if (!
m_Root.IsVisibleHierarchy())
655 m_HintWidgetRoot =
GetGame().GetWorkspace().CreateWidgets(
"gui/layouts/script_console/script_console_hint.layout");
665 int screenW, screenH;
671 float relativeX = mouseX / screenW;
672 float relativeY = mouseY / screenH;
677 offsetX = -width - offsetX;
679 offsetY = -height - offsetY;
override bool OnMouseEnter(Widget w, int x, int y)
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
class ServerBrowserHelperFunctions m_Id
bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
bool OnItemSelected(Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
bool OnKeyDown(Widget w, int x, int y, int key)
bool OnDoubleClick(Widget w, int x, int y, int button)
bool OnMouseButtonDown(Widget w, int x, int y, int button)
bool OnMouseEnter(Widget w, int x, int y)
bool OnKeyPress(Widget w, int x, int y, int key)
bool OnChange(Widget w, int x, int y, bool finished)
bool OnClick(Widget w, int x, int y, int button)
Serialization general interface. Serializer API works with:
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.
proto bool FileExist(string name)
Check existence of file.
proto native void ClearKey(KeyCode key)
proto native int KeyState(KeyCode key)
proto void GetScreenSize(out int x, out int y)
proto void GetMousePos(out int x, out int y)
PluginConfigDebugProfile m_ConfigDebugProfile
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
int ARGB(int a, int r, int g, int b)
ImageWidget m_HintWidgetBackground
Widget m_CurrentHoverWidget
RichTextWidget m_HintWidget
class ScriptConsole extends UIScriptedMenu HintMessage
bool m_HoverSuccessTriggered
void DisplayHint(string message)
void ScriptConsoleEnfScriptTab(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
void ScriptConsoleWeatherTab(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
void OnWidgetScriptInit(Widget w)