Save endgame progress, team presets, technique support and camera controls
This commit is contained in:
1 parent
a681affdb3
commit
639cef7d19
52 files changed
+11940
-766
No files matched your search
+34
-12
@@ -5,10 +5,13 @@ local Time = CS.UnityEngine.Time
|
||||
local Camera = CS.UnityEngine.Camera
|
||||
local GameObject = CS.UnityEngine.GameObject
|
||||
|
||||
-- Camera control tuning, in degrees per second (independent of frame rate).
|
||||
local KEYBOARD_TURN_SPEED = 90.0
|
||||
|
||||
_G.__FREECAM_ENABLED = _G.__FREECAM_ENABLED or false
|
||||
_G.__FREECAM_SPEED = _G.__FREECAM_SPEED or 15.0
|
||||
|
||||
local RAINBOW_TEXT = "<color=#bb00ff>นี่คือเวอร์ชั่นทดสอบของเกย์ C is gay and i love to play </color> <color=#FF0000>Ho</color><color=#FF7F00>nk</color><color=#FFFF00>ai</color> <color=#00FF00>St</color><color=#0000FF>ar</color> <color=#4B0082>Gay</color>"
|
||||
local RAINBOW_TEXT = "<color=#bb00ff>นี่คือเวอร์ชั่นทดสอบของเกย์ </color> <color=#FF0000>Ho</color><color=#FF7F00>nk</color><color=#FFFF00>ai</color> <color=#00FF00>St</color><color=#0000FF>ar</color> <color=#4B0082>Gay</color>"
|
||||
|
||||
local function show_ui(msg)
|
||||
pcall(function()
|
||||
@@ -71,8 +74,23 @@ end
|
||||
|
||||
function _G.__FREECAM_TICK()
|
||||
pcall(function()
|
||||
-- Render callbacks run for several cameras/passes in one frame. Consume
|
||||
-- key-down events and integrate movement only once per Unity frame.
|
||||
local frame = Time.frameCount
|
||||
if _G.__FC_INPUT_FRAME == frame then
|
||||
if _G.__FREECAM_ENABLED then
|
||||
local cam = get_active_cam()
|
||||
if cam and _G.__FC_POS then
|
||||
cam.transform.position = _G.__FC_POS
|
||||
cam.transform.eulerAngles = _G.__FC_EULER
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
_G.__FC_INPUT_FRAME = frame
|
||||
if Input.GetKeyDown(KeyCode.Tab) then
|
||||
_G.__FREECAM_ENABLED = not _G.__FREECAM_ENABLED
|
||||
_G.__FC_LAST_TIME = nil
|
||||
local cam = get_active_cam()
|
||||
if _G.__FREECAM_ENABLED then
|
||||
if cam then
|
||||
@@ -80,7 +98,7 @@ function _G.__FREECAM_TICK()
|
||||
_G.__FC_EULER = cam.transform.eulerAngles
|
||||
set_cinemachine_enabled(cam, false)
|
||||
end
|
||||
show_ui("<color=#00FF88><b>[FreeCam: ON]</b> Speed: " .. string.format("%.1f", _G.__FREECAM_SPEED) .. " | Arrow Keys: Fly | Right-Click: Look | WASD: Walk</color>")
|
||||
show_ui("<color=#00FF88><b>[FreeCam: ON]</b> Speed: " .. string.format("%.1f", _G.__FREECAM_SPEED) .. " | Arrows: Fly | PgUp/PgDn: Up/Down | I/J/K/L: Look</color>")
|
||||
else
|
||||
if cam then
|
||||
set_cinemachine_enabled(cam, true)
|
||||
@@ -107,19 +125,23 @@ function _G.__FREECAM_TICK()
|
||||
-- Speed adjustment (+ / -)
|
||||
if Input.GetKeyDown(KeyCode.Equals) or Input.GetKeyDown(KeyCode.KeypadPlus) then
|
||||
_G.__FREECAM_SPEED = math.min(300.0, _G.__FREECAM_SPEED * 1.5)
|
||||
show_ui("<color=#00FF88><b>[FreeCam: ON]</b> Speed: " .. string.format("%.1f", _G.__FREECAM_SPEED) .. " | Arrow Keys: Fly</color>")
|
||||
show_ui("<color=#00FF88><b>[FreeCam: ON]</b> Speed: " .. string.format("%.1f", _G.__FREECAM_SPEED) .. " | Arrows: Fly | PgUp/PgDn: Up/Down | I/J/K/L: Look</color>")
|
||||
end
|
||||
if Input.GetKeyDown(KeyCode.Minus) or Input.GetKeyDown(KeyCode.KeypadMinus) then
|
||||
_G.__FREECAM_SPEED = math.max(0.5, _G.__FREECAM_SPEED / 1.5)
|
||||
show_ui("<color=#00FF88><b>[FreeCam: ON]</b> Speed: " .. string.format("%.1f", _G.__FREECAM_SPEED) .. " | Arrow Keys: Fly</color>")
|
||||
show_ui("<color=#00FF88><b>[FreeCam: ON]</b> Speed: " .. string.format("%.1f", _G.__FREECAM_SPEED) .. " | Arrows: Fly | PgUp/PgDn: Up/Down | I/J/K/L: Look</color>")
|
||||
end
|
||||
|
||||
-- Mouse Look (Hold Right Mouse Button)
|
||||
if Input.GetMouseButton(1) then
|
||||
local rotX = Input.GetAxis("Mouse X") or 0
|
||||
local rotY = Input.GetAxis("Mouse Y") or 0
|
||||
_G.__FC_EULER = Vector3(_G.__FC_EULER.x - rotY * 2.5, _G.__FC_EULER.y + rotX * 2.5, 0)
|
||||
end
|
||||
-- Keyboard-only look: no mouse click is needed, so turning
|
||||
-- the camera does not require pressing a battle action button.
|
||||
local pitch, yaw = 0, 0
|
||||
if Input.GetKey(KeyCode.I) then pitch = pitch - 1 end
|
||||
if Input.GetKey(KeyCode.K) then pitch = pitch + 1 end
|
||||
if Input.GetKey(KeyCode.J) then yaw = yaw - 1 end
|
||||
if Input.GetKey(KeyCode.L) then yaw = yaw + 1 end
|
||||
_G.__FC_EULER = Vector3(
|
||||
_G.__FC_EULER.x + pitch * KEYBOARD_TURN_SPEED * dt,
|
||||
_G.__FC_EULER.y + yaw * KEYBOARD_TURN_SPEED * dt, 0)
|
||||
|
||||
-- Compute 3D direction vectors from camera Euler angles
|
||||
local radY = _G.__FC_EULER.y * (math.pi / 180.0)
|
||||
@@ -144,10 +166,10 @@ function _G.__FREECAM_TICK()
|
||||
if Input.GetKey(KeyCode.LeftArrow) then
|
||||
move = move - right
|
||||
end
|
||||
if Input.GetKey(KeyCode.PageUp) or Input.GetKey(KeyCode.E) or Input.GetKey(KeyCode.RightShift) then
|
||||
if Input.GetKey(KeyCode.PageUp) then
|
||||
move = move + Vector3(0, 1, 0)
|
||||
end
|
||||
if Input.GetKey(KeyCode.PageDown) or Input.GetKey(KeyCode.Q) or Input.GetKey(KeyCode.RightControl) then
|
||||
if Input.GetKey(KeyCode.PageDown) then
|
||||
move = move - Vector3(0, 1, 0)
|
||||
end
|
||||
|
||||
|
||||
+88
-135
@@ -1,158 +1,111 @@
|
||||
-- ==============================================================================
|
||||
-- Hide UI Lua Script for Honkai: Star Rail
|
||||
-- Press "ฃ" (Backslash '\' on keyboard) to toggle UI visibility
|
||||
-- Completely hides 100% of UI elements (HUD, Minimap, UID, Texts, Battle UI, WorldUI)
|
||||
-- Matches the clean visual result of 3Dmigoto/SRMI shader-override mod!
|
||||
-- ==============================================================================
|
||||
|
||||
-- Backslash toggles HUD only. Keep pages, dialogs and UI cameras visible.
|
||||
local Input = CS.UnityEngine.Input
|
||||
local KeyCode = CS.UnityEngine.KeyCode
|
||||
local Time = CS.UnityEngine.Time
|
||||
local GameObject = CS.UnityEngine.GameObject
|
||||
local CanvasGroup = CS.UnityEngine.CanvasGroup
|
||||
local Canvas = CS.UnityEngine.Canvas
|
||||
local Camera = CS.UnityEngine.Camera
|
||||
|
||||
-- Names observed under UIRoot in this Client, plus the existing battle HUD.
|
||||
-- Never target an ancestor shared by HUD and character/reward dialogs.
|
||||
local HUD_PATHS = {
|
||||
"UIRoot/Page/MazeMainPage(Clone)",
|
||||
"UIRoot/Page/BattleGamePhaseUI(Clone)",
|
||||
"UIRoot/BelowPage/AdventureWaypointsPage(Clone)",
|
||||
"UIRoot/BelowPage/MazeJumpingText(Clone)",
|
||||
"UIRoot/BelowPage/MazeMonsterWarningPage(Clone)",
|
||||
"UIRoot/AboveDialog/BetaHintDialog(Clone)",
|
||||
"VersionText"
|
||||
}
|
||||
|
||||
-- The old script did not record CanvasGroup state. Undo its blanket hide once
|
||||
-- on live upgrade; a fresh Client session avoids any lost legacy fade state.
|
||||
if _G.__HIDE_UI_REGISTERED and _G.__HIDE_UI_SCHEMA ~= 2 and _G.__HIDE_UI_ENABLED then
|
||||
pcall(function()
|
||||
local cams = Camera.allCameras
|
||||
for i = 0, cams.Length - 1 do
|
||||
local mask = (_G.__ORIG_CAM_MASKS or {})[cams[i]:GetInstanceID()]
|
||||
if mask ~= nil then cams[i].cullingMask = mask end
|
||||
end
|
||||
local function restore(obj)
|
||||
if obj then
|
||||
local cg = obj:GetComponent(typeof(CanvasGroup))
|
||||
if cg then cg.alpha = 1; cg.blocksRaycasts = true; cg.interactable = true end
|
||||
end
|
||||
end
|
||||
local root = GameObject.Find("UIRoot")
|
||||
if root then
|
||||
restore(root)
|
||||
local t = root.transform
|
||||
for i = 0, t.childCount - 1 do
|
||||
local c = t:GetChild(i); restore(c.gameObject)
|
||||
for j = 0, c.childCount - 1 do restore(c:GetChild(j).gameObject) end
|
||||
end
|
||||
end
|
||||
local canvases = GameObject.FindObjectsOfType(typeof(CS.UnityEngine.Canvas))
|
||||
for i = 0, canvases.Length - 1 do restore(canvases[i].gameObject) end
|
||||
end)
|
||||
end
|
||||
_G.__HIDE_UI_SCHEMA = 2
|
||||
_G.__HIDE_UI_ENABLED = _G.__HIDE_UI_ENABLED or false
|
||||
_G.__HIDE_UI_LAST_FRAME = _G.__HIDE_UI_LAST_FRAME or 0
|
||||
_G.__ORIG_CAM_MASKS = _G.__ORIG_CAM_MASKS or {}
|
||||
_G.__HIDE_UI_PERIODIC = _G.__HIDE_UI_PERIODIC or 0
|
||||
_G.__HIDE_UI_TARGETS = _G.__HIDE_UI_TARGETS or {}
|
||||
|
||||
local function set_canvas_group_state(obj, visible)
|
||||
if not obj then return end
|
||||
pcall(function()
|
||||
local cg = obj:GetComponent(typeof(CanvasGroup))
|
||||
if not cg then
|
||||
cg = obj:AddComponent(typeof(CanvasGroup))
|
||||
end
|
||||
if cg then
|
||||
cg.alpha = visible and 1.0 or 0.0
|
||||
cg.blocksRaycasts = visible
|
||||
cg.interactable = visible
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
local function apply_camera_culling(visible)
|
||||
pcall(function()
|
||||
local allCams = Camera.allCameras
|
||||
if allCams and allCams.Length > 0 then
|
||||
for i = 0, allCams.Length - 1 do
|
||||
local c = allCams[i]
|
||||
if c and c.name then
|
||||
local lower = string.lower(c.name)
|
||||
-- Target UICamera and UI overlay cameras, never touch Main Camera
|
||||
if (string.find(lower, "ui") ~= nil) and (string.find(lower, "main") == nil) then
|
||||
local camId = c:GetInstanceID()
|
||||
if not visible then
|
||||
if not _G.__ORIG_CAM_MASKS[camId] and c.cullingMask ~= 0 then
|
||||
_G.__ORIG_CAM_MASKS[camId] = c.cullingMask
|
||||
end
|
||||
c.cullingMask = 0
|
||||
else
|
||||
if _G.__ORIG_CAM_MASKS[camId] ~= nil and _G.__ORIG_CAM_MASKS[camId] ~= 0 then
|
||||
c.cullingMask = _G.__ORIG_CAM_MASKS[camId]
|
||||
else
|
||||
c.cullingMask = 32 -- Default layer 5 (UI)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
local function apply_ui_root(visible)
|
||||
pcall(function()
|
||||
local uiRoot = GameObject.Find("/UIRoot") or GameObject.Find("UIRoot")
|
||||
if uiRoot then
|
||||
set_canvas_group_state(uiRoot, visible)
|
||||
local tr = uiRoot.transform
|
||||
for i = 0, tr.childCount - 1 do
|
||||
local child = tr:GetChild(i).gameObject
|
||||
set_canvas_group_state(child, visible)
|
||||
local ctr = child.transform
|
||||
for j = 0, ctr.childCount - 1 do
|
||||
set_canvas_group_state(ctr:GetChild(j).gameObject, visible)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
local function apply_all_canvases(visible)
|
||||
pcall(function()
|
||||
local canvases = GameObject.FindObjectsOfType(typeof(Canvas))
|
||||
if canvases and canvases.Length > 0 then
|
||||
for i = 0, canvases.Length - 1 do
|
||||
local cv = canvases[i]
|
||||
if cv and cv.gameObject then
|
||||
set_canvas_group_state(cv.gameObject, visible)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
local function set_ui_visible(visible)
|
||||
pcall(function()
|
||||
-- 1. UI Camera Culling Mask
|
||||
apply_camera_culling(visible)
|
||||
|
||||
-- 2. Entire /UIRoot tree (Page, HUD, Dialog, AboveDialog, Top, Popup, Guide, etc.)
|
||||
apply_ui_root(visible)
|
||||
|
||||
-- 3. Specific known clones / watermarks
|
||||
local function restore_hud()
|
||||
for id, state in pairs(_G.__HIDE_UI_TARGETS) do
|
||||
pcall(function()
|
||||
local specific = {
|
||||
"UIRoot/Page/BattleGamePhaseUI(Clone)",
|
||||
"UIRoot/AboveDialog/BetaHintDialog(Clone)",
|
||||
"VersionText"
|
||||
}
|
||||
for _, path in ipairs(specific) do
|
||||
local obj = GameObject.Find(path)
|
||||
if obj then
|
||||
set_canvas_group_state(obj, visible)
|
||||
if state.group then
|
||||
if state.added then
|
||||
CS.UnityEngine.Object.Destroy(state.group)
|
||||
else
|
||||
state.group.alpha = state.alpha
|
||||
state.group.blocksRaycasts = state.raycast
|
||||
state.group.interactable = state.interactable
|
||||
end
|
||||
end
|
||||
end)
|
||||
_G.__HIDE_UI_TARGETS[id] = nil
|
||||
end
|
||||
end
|
||||
|
||||
-- 4. All active Canvases in scene (ScreenSpace & WorldSpace billboards/nameplates)
|
||||
apply_all_canvases(visible)
|
||||
end)
|
||||
local function hide_hud()
|
||||
for _, path in ipairs(HUD_PATHS) do
|
||||
pcall(function()
|
||||
local obj = GameObject.Find(path)
|
||||
if not obj then return end
|
||||
local id = obj:GetInstanceID()
|
||||
local state = _G.__HIDE_UI_TARGETS[id]
|
||||
if not state then
|
||||
local group = obj:GetComponent(typeof(CanvasGroup))
|
||||
local added = not group
|
||||
if added then group = obj:AddComponent(typeof(CanvasGroup)) end
|
||||
state = {group=group, added=added, alpha=group.alpha,
|
||||
raycast=group.blocksRaycasts, interactable=group.interactable}
|
||||
_G.__HIDE_UI_TARGETS[id] = state
|
||||
end
|
||||
state.group.alpha = 0
|
||||
state.group.blocksRaycasts = false
|
||||
state.group.interactable = false
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function _G.__HIDE_UI_TICK()
|
||||
pcall(function()
|
||||
local curFrame = Time.frameCount
|
||||
if _G.__HIDE_UI_LAST_FRAME == curFrame then
|
||||
return
|
||||
end
|
||||
_G.__HIDE_UI_LAST_FRAME = curFrame
|
||||
|
||||
-- Physical key '\' / 'ฃ' (KeyCode.Backslash)
|
||||
if Input.GetKeyDown(KeyCode.Backslash) then
|
||||
local frame = Time.frameCount
|
||||
if _G.__HIDE_UI_LAST_FRAME == frame then return end
|
||||
_G.__HIDE_UI_LAST_FRAME = frame
|
||||
local toggled = Input.GetKeyDown(KeyCode.Backslash)
|
||||
if toggled then
|
||||
_G.__HIDE_UI_ENABLED = not _G.__HIDE_UI_ENABLED
|
||||
|
||||
set_ui_visible(not _G.__HIDE_UI_ENABLED)
|
||||
|
||||
if _G.__HIDE_UI_ENABLED then
|
||||
CS.UnityEngine.Debug.Log("<color=#FF00FF>[UI Toggle]</color> <color=#FF5555>UI Hidden (ซ่อน UI ทั้งหมด 100% เรียบร้อย)</color>")
|
||||
else
|
||||
CS.UnityEngine.Debug.Log("<color=#FF00FF>[UI Toggle]</color> <color=#55FF55>UI Restored (แสดง UI ตามปกติแล้ว)</color>")
|
||||
end
|
||||
if not _G.__HIDE_UI_ENABLED then restore_hud() end
|
||||
end
|
||||
|
||||
-- While hidden, keep enforcing to prevent newly spawned UI from appearing
|
||||
-- Only the small named HUD list is checked, four times a second.
|
||||
-- New pages/dialogs never inherit a hidden UIRoot or UI camera.
|
||||
if _G.__HIDE_UI_ENABLED then
|
||||
apply_camera_culling(false)
|
||||
apply_ui_root(false)
|
||||
|
||||
_G.__HIDE_UI_PERIODIC = (_G.__HIDE_UI_PERIODIC or 0) + 1
|
||||
if _G.__HIDE_UI_PERIODIC >= 30 then
|
||||
_G.__HIDE_UI_PERIODIC = 0
|
||||
apply_all_canvases(false)
|
||||
local now = Time.unscaledTime
|
||||
if toggled or now >= (_G.__HIDE_UI_NEXT_SCAN or 0) then
|
||||
_G.__HIDE_UI_NEXT_SCAN = now + 0.25
|
||||
hide_hud()
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -173,5 +126,5 @@ if not _G.__HIDE_UI_REGISTERED then
|
||||
pcall(function() CS.UnityEngine.Application.onBeforeRender('+', function() _G.__HIDE_UI_TICK() end) end)
|
||||
pcall(function() CS.UnityEngine.Application.onBeforeRender = CS.UnityEngine.Application.onBeforeRender + function() _G.__HIDE_UI_TICK() end end)
|
||||
|
||||
CS.UnityEngine.Debug.Log("<color=#FF00FF>[UI Toggle Script]</color> 100% Clean HideUI loaded! Press 'ฃ' to toggle UI.")
|
||||
CS.UnityEngine.Debug.Log("<color=#FF00FF>[UI Toggle Script]</color> HUD-only HideUI loaded! Press 'ฃ' to toggle UI.")
|
||||
end
|
||||
Reference in new issue
Block a user