103 PlayerController controller =
GetGame().GetPlayerController();
107 SCR_RadialMenuGameModeComponent rm = SCR_RadialMenuGameModeComponent.Cast(controller.FindComponent(SCR_RadialMenuGameModeComponent));
112 Print(
"[SCR_RadialMenuController] - Can't setup radial menu due to missing RM game mode!");
164 super.OnClose(owner);
183 if (
System.IsConsoleApp())
223 super.SetMenuDisplay(display);
275 super.InvokeOnUpdateEntries(entries);
281 super.SetController(owner, controls);
292 DebugFillWithEntries();
301 super.OnPerformInput();
317 super.AddActionListeners();
340 super.RemoveActionListeners();
396 if (elementCount == 0)
405 angleDeg =
Math.Repeat(angleDeg, 360);
411 DebugPrint(
"GetSelectedElementIndex",
"No distance between entries!");
443 GetGame().GetWorkspace().GetScreenSize(curW, curH);
445 if (curW == 0 || curH == 0)
452 float ratioX = curW / refW;
453 float ratioY = curH / refH;
455 float ratioDist =
vector.Distance(
457 Vector(curW / refW, curH / refH,
479 dir =
Vector(mouseX, mouseY, 0);
515 float angle =
Math.Atan2(dir[0], dir[1]);
538 for (
int i = 1; i < 9; i++)
633 override protected void DebugPrint(
string method,
string msg)
635 Print(
string.Format(
"[SCR_RadialMenu] - %1() - '%2'", method, msg));
639 protected void DebugSetupDiagMenu()
641 string rmDiagName =
"Radial menu (refactored)";
643 DiagMenu.RegisterMenu(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_MENU, rmDiagName,
"UI");
645 DiagMenu.RegisterBool(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_CONFIG_DEBUG,
"",
"Override config", rmDiagName);
646 DiagMenu.RegisterBool(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_CLOSE_ON_RELEASE_OPEN,
"",
"Close on open", rmDiagName);
647 DiagMenu.RegisterBool(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_PERFORM_ON_CLOSE,
"",
"Perform on close", rmDiagName);
648 DiagMenu.RegisterBool(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_CLOSE_ON_PERFORM,
"",
"Close on perform", rmDiagName);
649 DiagMenu.RegisterBool(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_DESELECT_IN_CENTER,
"",
"Delect in center", rmDiagName);
650 DiagMenu.RegisterBool(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_USE_LARGE_SIZE,
"",
"Large size", rmDiagName);
652 DiagMenu.RegisterBool(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_CUSTOM_SIZE_ENABLE,
"",
"Override size", rmDiagName);
653 DiagMenu.RegisterRange(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_CUSTOM_SIZE,
"",
"Sustom size", rmDiagName,
"100, 1000, 100, 1");
655 DiagMenu.RegisterBool(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_ENTRY_COUNT_ENABLE,
"",
"Entries setup", rmDiagName);
656 DiagMenu.RegisterRange(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_ENTRY_COUNT,
"",
"Entries", rmDiagName,
"2, 32, 2, 1");
660 protected void DebugCleanup()
663 DiagMenu.Unregister(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_CLOSE_ON_RELEASE_OPEN);
664 DiagMenu.Unregister(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_PERFORM_ON_CLOSE);
665 DiagMenu.Unregister(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_CLOSE_ON_PERFORM);
666 DiagMenu.Unregister(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_DESELECT_IN_CENTER);
667 DiagMenu.Unregister(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_USE_LARGE_SIZE);
668 DiagMenu.Unregister(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_CUSTOM_SIZE_ENABLE);
670 DiagMenu.Unregister(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_ENTRY_COUNT_ENABLE);
676 protected void DebugSetupControllerInputs(out notnull SCR_RadialMenuControllerInputs inputs)
679 if (!DiagMenu.GetBool(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_CONFIG_DEBUG))
682 inputs.m_bCloseOnReleaseOpen = DiagMenu.GetBool(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_CLOSE_ON_RELEASE_OPEN);
683 inputs.m_bPerformOnClose = DiagMenu.GetBool(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_PERFORM_ON_CLOSE);
684 inputs.m_bCloseOnPerform = DiagMenu.GetBool(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_CLOSE_ON_PERFORM);
685 inputs.m_bDeselectInCenter = DiagMenu.GetBool(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_DESELECT_IN_CENTER);
686 inputs.m_bUseLargeSize = DiagMenu.GetBool(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_USE_LARGE_SIZE);
688 if (DiagMenu.GetBool(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_CUSTOM_SIZE_ENABLE))
689 inputs.m_fCustomSize = DiagMenu.GetRangeValue(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_CUSTOM_SIZE);
691 inputs.m_fCustomSize = -1;
695 protected void DebugFillWithEntries()
697 if (!DiagMenu.GetBool(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_ENTRY_COUNT_ENABLE))
702 int count = DiagMenu.GetRangeValue(
SCR_DebugMenuID.DEBUGUI_RADIALMENU_ENTRY_COUNT);
703 for (
int i = 0; i < count; i++)
705 SCR_SelectionMenuEntry entry =
new SCR_SelectionMenuEntry();
706 entry.
SetName(
"Debug entry " + i);
719 DebugSetupDiagMenu();
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.