Compare commits
2 Commits
0be7ccceba
...
a86107b79d
Author | SHA1 | Date | |
---|---|---|---|
a86107b79d | |||
da7ba72698 |
47
Assets/Prefab/Core/TimePauseManager.prefab
Normal file
47
Assets/Prefab/Core/TimePauseManager.prefab
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &5532734616494925005
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 6144181697203329678}
|
||||||
|
- component: {fileID: 4918332973144301582}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: TimePauseManager
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &6144181697203329678
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5532734616494925005}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0.29564962, y: 4.269477, z: -1.7842796}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &4918332973144301582
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5532734616494925005}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: e0328f8bde4442bd8b7e093b40c1306e, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
_pauseToggle: 0
|
7
Assets/Prefab/Core/TimePauseManager.prefab.meta
Normal file
7
Assets/Prefab/Core/TimePauseManager.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 781c629235eee4f4eb34f1e763aa7f67
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@@ -258,9 +258,78 @@ PrefabInstance:
|
|||||||
m_AddedGameObjects: []
|
m_AddedGameObjects: []
|
||||||
m_AddedComponents: []
|
m_AddedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 03010dd3d718e374098805a9faf408ba, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: 03010dd3d718e374098805a9faf408ba, type: 3}
|
||||||
|
--- !u!1001 &9054644576683853387
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 5532734616494925005, guid: 781c629235eee4f4eb34f1e763aa7f67,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: TimePauseManager
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6144181697203329678, guid: 781c629235eee4f4eb34f1e763aa7f67,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0.29564962
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6144181697203329678, guid: 781c629235eee4f4eb34f1e763aa7f67,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 4.269477
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6144181697203329678, guid: 781c629235eee4f4eb34f1e763aa7f67,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: -1.7842796
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6144181697203329678, guid: 781c629235eee4f4eb34f1e763aa7f67,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6144181697203329678, guid: 781c629235eee4f4eb34f1e763aa7f67,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6144181697203329678, guid: 781c629235eee4f4eb34f1e763aa7f67,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6144181697203329678, guid: 781c629235eee4f4eb34f1e763aa7f67,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6144181697203329678, guid: 781c629235eee4f4eb34f1e763aa7f67,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6144181697203329678, guid: 781c629235eee4f4eb34f1e763aa7f67,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6144181697203329678, guid: 781c629235eee4f4eb34f1e763aa7f67,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_RemovedGameObjects: []
|
||||||
|
m_AddedGameObjects: []
|
||||||
|
m_AddedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 781c629235eee4f4eb34f1e763aa7f67, type: 3}
|
||||||
--- !u!1660057539 &9223372036854775807
|
--- !u!1660057539 &9223372036854775807
|
||||||
SceneRoots:
|
SceneRoots:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_Roots:
|
m_Roots:
|
||||||
- {fileID: 6429745761262824323}
|
- {fileID: 6429745761262824323}
|
||||||
- {fileID: 6277645971226662819}
|
- {fileID: 6277645971226662819}
|
||||||
|
- {fileID: 9054644576683853387}
|
||||||
|
3
Assets/Script/Gameplay/Global.meta
Normal file
3
Assets/Script/Gameplay/Global.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e9bc159ddf0a48aba6e9338d92c5e724
|
||||||
|
timeCreated: 1760749356
|
53
Assets/Script/Gameplay/Global/TimePauseManager.cs
Normal file
53
Assets/Script/Gameplay/Global/TimePauseManager.cs
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using System;
|
||||||
|
using Core;
|
||||||
|
|
||||||
|
namespace Script.Gameplay.Global
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 全局时间暂停管理器。
|
||||||
|
/// 单例,挂载到场景里任意常驻 GameObject(如 Managers)。
|
||||||
|
/// </summary>
|
||||||
|
public class TimePauseManager : MonoSingleton<TimePauseManager>
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary> 当前是否处于暂停状态 </summary>
|
||||||
|
public bool IsPaused { get; private set; }
|
||||||
|
|
||||||
|
/// <summary> 暂停/恢复时触发,参数 true=暂停,false=恢复 </summary>
|
||||||
|
public event Action<bool> OnPauseStateChanged;
|
||||||
|
|
||||||
|
[Header("调试按钮")]
|
||||||
|
[SerializeField] private bool _pauseToggle;
|
||||||
|
|
||||||
|
private void OnValidate()
|
||||||
|
{
|
||||||
|
// Inspector 里打钩立即生效(仅 Editor)
|
||||||
|
if (Application.isPlaying && Instance == this)
|
||||||
|
SetPaused(_pauseToggle);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 外部调用:设置暂停状态
|
||||||
|
/// </summary>
|
||||||
|
public void SetPaused(bool pause)
|
||||||
|
{
|
||||||
|
if (IsPaused == pause) return;
|
||||||
|
|
||||||
|
IsPaused = pause;
|
||||||
|
Time.timeScale = pause ? 0f : 1f;
|
||||||
|
OnPauseStateChanged?.Invoke(pause);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 快捷暂停
|
||||||
|
/// </summary>
|
||||||
|
public static void Pause() => Instance.SetPaused(true);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 快捷恢复
|
||||||
|
/// </summary>
|
||||||
|
public static void Resume() => Instance.SetPaused(false);
|
||||||
|
}
|
||||||
|
}
|
3
Assets/Script/Gameplay/Global/TimePauseManager.cs.meta
Normal file
3
Assets/Script/Gameplay/Global/TimePauseManager.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e0328f8bde4442bd8b7e093b40c1306e
|
||||||
|
timeCreated: 1760749366
|
@@ -57,12 +57,21 @@ namespace Gameplay.Player
|
|||||||
{
|
{
|
||||||
case WatchMode.Normal:
|
case WatchMode.Normal:
|
||||||
SetSeeLines(false);
|
SetSeeLines(false);
|
||||||
|
inputManager.SetCursorState(false, CursorLockMode.Locked);
|
||||||
|
inputManager.SetInputForLook(true);
|
||||||
|
inputManager.SetInputForMove(true);
|
||||||
break;
|
break;
|
||||||
case WatchMode.Inside:
|
case WatchMode.Inside:
|
||||||
SetSeeLines(false);
|
SetSeeLines(false);
|
||||||
|
inputManager.SetCursorState(true, CursorLockMode.Confined);
|
||||||
|
inputManager.SetInputForLook(false);
|
||||||
|
inputManager.SetInputForMove(false);
|
||||||
break;
|
break;
|
||||||
case WatchMode.Outside:
|
case WatchMode.Outside:
|
||||||
SetSeeLines(true);
|
SetSeeLines(true);
|
||||||
|
inputManager.SetCursorState(false, CursorLockMode.Locked);
|
||||||
|
inputManager.SetInputForLook(true);
|
||||||
|
inputManager.SetInputForMove(true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
|
@@ -33,7 +33,6 @@ namespace UI
|
|||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
inputManager = InputManager.Instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnEnterInsideWatchMode()
|
public void OnEnterInsideWatchMode()
|
||||||
@@ -47,16 +46,11 @@ namespace UI
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//TODO: 这里可能需要显示“无可编辑对象”之类的提示
|
|
||||||
if (noEditableTargetPanel != null)
|
if (noEditableTargetPanel != null)
|
||||||
{
|
{
|
||||||
noEditableTargetPanel.SetActive(true);
|
noEditableTargetPanel.SetActive(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inputManager.SetCursorState(true, CursorLockMode.Confined);
|
|
||||||
inputManager.SetInputForLook(false);
|
|
||||||
inputManager.SetInputForMove(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnExitInsideWatchMode()
|
public void OnExitInsideWatchMode()
|
||||||
@@ -69,9 +63,6 @@ namespace UI
|
|||||||
noEditableTargetPanel.SetActive(false);
|
noEditableTargetPanel.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
inputManager.SetCursorState(true, CursorLockMode.Locked);
|
|
||||||
inputManager.SetInputForLook(true);
|
|
||||||
inputManager.SetInputForMove(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取 PlayerEditController 的回调
|
// 获取 PlayerEditController 的回调
|
||||||
@@ -128,7 +119,7 @@ namespace UI
|
|||||||
componentViewers.Clear();
|
componentViewers.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: 根据 components 生成 UI, 根据拥有的 IEditComponent 的数量动态生成 UI 元素。布局为环绕着面板中心排列(自适应间隔)。
|
// 根据 components 生成 UI, 根据拥有的 IEditComponent 的数量动态生成 UI 元素。布局为环绕着面板中心排列(自适应间隔)。
|
||||||
private void GenerateComponentUI()
|
private void GenerateComponentUI()
|
||||||
{
|
{
|
||||||
if (components == null || components.Count == 0 || componentEditViewerPrefab == null) return;
|
if (components == null || components.Count == 0 || componentEditViewerPrefab == null) return;
|
||||||
|
Reference in New Issue
Block a user