Save endgame progress, team presets, technique support and camera controls

This commit is contained in:
CAtlas0784 committed 2026-10-17 23:44:36 +07:00
1 parent a681affdb3
commit 639cef7d19
52 files changed
+11940 -766

No files matched your search

+34 -12
View File
@@ -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