diff --git a/Assets/script/application.meta b/Assets/script/application.meta
new file mode 100644
index 0000000..6bdc9c2
--- /dev/null
+++ b/Assets/script/application.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 1f929e13cdfcff040943be73eacb7809
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/script/application/ApplicationBoot.cs b/Assets/script/application/ApplicationBoot.cs
new file mode 100644
index 0000000..b92d94a
--- /dev/null
+++ b/Assets/script/application/ApplicationBoot.cs
@@ -0,0 +1,79 @@
+
+using EasyInject.Attributes;
+using EasyInject.Utils;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+[DefaultExecutionOrder(-1000000000)]
+[GameObjectBean]
+[AddComponentMenu("WXDC/Application/ApplicationBoot")]
+public sealed class ApplicationBoot : MonoBehaviour
+{
+ public static readonly IIoC Instance = new MyIoC();
+
+
+ [Autowired]
+ private ApplicationStateMachine applicationState;
+
+
+ [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
+ static void OnBeforeSceneLoad()
+ {
+ Debug.Log("First scene loading: Before Awake is called.");
+ }
+
+ private void Awake()
+ {
+ Debug.Log("IOC容器初始化");
+ Instance.Init();
+ }
+
+ [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)]
+ private static void Run()
+ {
+ //Debug.Log("IOC容器初始化");
+ //Instance.Init();
+ }
+ private void Start()
+ {
+ applicationState.OnInit();
+ }
+ private void Update()
+ {
+ applicationState.OnUpdate();
+ }
+ private void OnDestroy()
+ {
+ // Clear the Beans in the corresponding scene
+ Shutdown();
+ Instance.ClearBeans(UnityEngine.SceneManagement.SceneManager.GetActiveScene().name);
+ }
+
+
+
+ ///
+ /// 应用关闭执行
+ ///
+ private void Shutdown()
+ {
+ List shutdowns = Instance.GetBeans();
+ shutdowns = shutdowns.Distinct().ToList();
+ foreach(var down in shutdowns)
+ {
+ if (down == null)
+ {
+ continue;
+ }
+ try
+ {
+ down?.Shutdown();
+ }
+ catch (Exception ex)
+ {
+ Debug.LogError(ex);
+ }
+
+ }
+ }
+}
diff --git a/Assets/script/application/ApplicationBoot.cs.meta b/Assets/script/application/ApplicationBoot.cs.meta
new file mode 100644
index 0000000..b0ebb36
--- /dev/null
+++ b/Assets/script/application/ApplicationBoot.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: bf2b446408cd7864abf9d503e7e25d4c
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/script/application/ApplicationStateMachine.cs b/Assets/script/application/ApplicationStateMachine.cs
new file mode 100644
index 0000000..f2a80b5
--- /dev/null
+++ b/Assets/script/application/ApplicationStateMachine.cs
@@ -0,0 +1,85 @@
+using EasyInject.Attributes;
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+///
+/// 程序状态机
+///
+[Component]
+public class ApplicationStateMachine
+{
+ private List processStates;
+ private static IProcessState currentProcess ;
+
+ private static ApplicationStateMachine stateMachine;
+
+ public event ProcessCompleted ProcessCompletedEvent;
+ public delegate void ProcessCompleted();
+ public ApplicationStateMachine()
+ {
+ stateMachine = this;
+ }
+
+ private static void SetCurrentProcess(IProcessState current)
+ {
+ current.IsExecuteProcess = true;
+ currentProcess = current;
+
+ int index = stateMachine.processStates.IndexOf(currentProcess);
+
+ try {
+ current.OnEnter();
+ }catch (Exception ex)
+ {
+ Debug.LogError(ex.Message);
+ }
+ //已经是最后流程了,触发完成事件
+ if (index == stateMachine.processStates.Count - 1)
+ {
+ stateMachine.ProcessCompletedEvent?.Invoke();
+ }
+
+ }
+
+ ///
+ /// 切换下一个流程,根据流程优先级切换
+ ///
+ public static void Chanage(IProcessState currentProcess)
+ {
+ int index = stateMachine.processStates.IndexOf(currentProcess) + 1;
+ if (stateMachine.processStates.Count != index && stateMachine.processStates[index] != null)
+ {
+ currentProcess.IsExecuteProcess = false;
+ currentProcess.OnExit();
+ SetCurrentProcess(stateMachine.processStates[index]);
+ }
+ }
+ public void OnInit()
+ {
+ Debug.Log("初始化状态机");
+ processStates = ApplicationBoot.Instance.GetBeans();
+ if (processStates != null && processStates.Count > 0)
+ {
+ processStates.Sort((a, b) => a.Priority - b.Priority);
+ SetCurrentProcess(processStates[0]);
+ }
+ }
+ ///
+ /// 每帧更新状态机
+ ///
+ public void OnUpdate()
+ {
+ if (currentProcess != null)
+ {
+ try
+ {
+ currentProcess.OnUpdate();
+ }
+ catch (Exception ex)
+ {
+ Debug.LogError(ex.Message);
+ }
+
+ }
+ }
+}
diff --git a/Assets/script/application/ApplicationStateMachine.cs.meta b/Assets/script/application/ApplicationStateMachine.cs.meta
new file mode 100644
index 0000000..732302f
--- /dev/null
+++ b/Assets/script/application/ApplicationStateMachine.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 91a82c44d0f076b478ffbecd1893fd9d
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/script/application/IApplcationShutdown.cs b/Assets/script/application/IApplcationShutdown.cs
new file mode 100644
index 0000000..27b981e
--- /dev/null
+++ b/Assets/script/application/IApplcationShutdown.cs
@@ -0,0 +1,11 @@
+
+///
+/// 程序关闭
+///
+public interface IApplcationShutdown
+{
+ ///
+ /// 程序关闭触发
+ ///
+ void Shutdown();
+}
diff --git a/Assets/script/application/IApplcationShutdown.cs.meta b/Assets/script/application/IApplcationShutdown.cs.meta
new file mode 100644
index 0000000..45d1ca5
--- /dev/null
+++ b/Assets/script/application/IApplcationShutdown.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 3b730479947d8c04d81a74f03b342157
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/script/application/IProcessCompleted.cs b/Assets/script/application/IProcessCompleted.cs
new file mode 100644
index 0000000..c0e2196
--- /dev/null
+++ b/Assets/script/application/IProcessCompleted.cs
@@ -0,0 +1,10 @@
+///
+/// 当流程完成的时候会触发
+///
+public interface IProcessCompleted
+{
+ ///
+ /// 当流程完成的时候会触发
+ ///
+ void ProcessCompleted();
+}
diff --git a/Assets/script/application/IProcessCompleted.cs.meta b/Assets/script/application/IProcessCompleted.cs.meta
new file mode 100644
index 0000000..71cf917
--- /dev/null
+++ b/Assets/script/application/IProcessCompleted.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 112656af330cf334b9ec0267b8321f0a
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/script/application/IProcessState.cs b/Assets/script/application/IProcessState.cs
new file mode 100644
index 0000000..153129e
--- /dev/null
+++ b/Assets/script/application/IProcessState.cs
@@ -0,0 +1,31 @@
+using EasyInject.Attributes;
+using EasyInject.Behaviours;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+///
+/// 流程状态
+///
+
+public interface IProcessState
+{
+ string Name { get;}
+ int Priority { get;}
+ ///
+ /// 进入当前流程
+ ///
+ void OnEnter();
+ ///
+ /// 退出当前流程
+ ///
+ void OnExit();
+ ///
+ /// 处于当前流程每帧都会执行
+ ///
+ void OnUpdate();
+ ///
+ /// 是当前流程
+ ///
+ ///
+ bool IsExecuteProcess { get; set; }
+}
diff --git a/Assets/script/application/IProcessState.cs.meta b/Assets/script/application/IProcessState.cs.meta
new file mode 100644
index 0000000..2e16930
--- /dev/null
+++ b/Assets/script/application/IProcessState.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 55c91436de8ce9e4391616a85bfdf5f7
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/script/application/InitNetWorkProcess.cs b/Assets/script/application/InitNetWorkProcess.cs
new file mode 100644
index 0000000..68c27f4
--- /dev/null
+++ b/Assets/script/application/InitNetWorkProcess.cs
@@ -0,0 +1,58 @@
+using EasyInject.Attributes;
+using System.Collections.Generic;
+using UnityEngine;
+
+///
+/// 初始化网络流程
+///
+[Component("InitNetWorkProcess")]
+public class InitNetWorkProcess : IProcessState
+{
+ [Autowired]
+ private NetWorkComponent netWorkComponent;
+ [Autowired("WcsWebSocket")]
+ private WcsWebSocket wcsWebSocket;
+ [Autowired("WmsStorageWebsocket")]
+ private WmsStorageWebsocket wmsStorageWebsocket;
+ private bool executing = false;
+ public string Name { get => "InitNetWorkProcess"; }
+ public int Priority { get => 0; }
+ public bool IsExecuteProcess { get => executing; set => executing = value; }
+
+ public void OnEnter()
+ {
+ Debug.Log("正在处理网络流程");
+
+ List wcsSocketDataHandles = ApplicationBoot.Instance.GetBeans();
+ wcsSocketDataHandles.ForEach(x =>
+ {
+ ////监听后台数据变化
+ wcsWebSocket.OnMessage(x.GetChannleKey(), x.DataHandle);
+ });
+
+ List storageSocketDataHandles = ApplicationBoot.Instance.GetBeans();
+ storageSocketDataHandles.ForEach(v =>
+ {
+ ////监听后台数据变化
+ wmsStorageWebsocket.OnMessage(v.DataHandle);
+ });
+
+ netWorkComponent?.ConnectAllWebSocket();
+
+ }
+
+ public void OnExit()
+ {
+ Debug.Log("网络服务启动完成");
+ IsExecuteProcess = false;
+
+ }
+
+ public void OnUpdate()
+ {
+ if (netWorkComponent.AllWebSocketConnected())
+ {
+ ApplicationStateMachine.Chanage(this);
+ }
+ }
+}
diff --git a/Assets/script/application/InitNetWorkProcess.cs.meta b/Assets/script/application/InitNetWorkProcess.cs.meta
new file mode 100644
index 0000000..1182a19
--- /dev/null
+++ b/Assets/script/application/InitNetWorkProcess.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: d5829e6adbee6914f9b14646062a4f1d
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/script/application/InitStorageProcess.cs b/Assets/script/application/InitStorageProcess.cs
new file mode 100644
index 0000000..a014220
--- /dev/null
+++ b/Assets/script/application/InitStorageProcess.cs
@@ -0,0 +1,117 @@
+using BestHTTP;
+using EasyInject.Attributes;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System.Collections.Generic;
+using System.Text;
+using Unity.VisualScripting;
+using UnityEngine;
+using static UnityEngine.EventSystems.EventTrigger;
+///
+/// 初始化库存流程
+///
+[Component]
+public class InitStorageProcess : IProcessState
+{
+ [Autowired]
+ private readonly NetWorkComponent netWorkComponent;
+ [Autowired]
+ private readonly LocationStorageManage storageManage;
+ [Autowired]
+ private readonly ContainersManage containerManage;
+ public string Name => "InitStorageProcess";
+ public int Priority => 2;
+
+ private bool isExecuting;
+ public bool IsExecuteProcess { get => isExecuting; set => isExecuting = value; }
+
+ public void OnEnter()
+ {
+ IsExecuteProcess = true;
+ Debug.Log("进入库存初始化流程");
+ ///平库
+ SendRequset(33, 50);
+ SendRequset(1, 32);
+ }
+
+ private void SendRequset(int startRow, int endRow)
+ {
+ List ints = new List();
+ for (int i = startRow; i <= endRow; i++)
+ {
+ ints.Add(i.ToString("D2"));
+ }
+ netWorkComponent.RemoteGetStorageDataByRows(ints, RsultHandle);
+
+ }
+ public void RsultHandle(HTTPRequest originalRequest, HTTPResponse response)
+ {
+ if (response == null)
+ {
+ //请求错误重试
+ if(originalRequest.State == HTTPRequestStates.Error)
+ {
+ Debug.LogWarning("异常重试");
+ originalRequest.Send();
+ }
+ return;
+ }
+
+ if (response.IsSuccess)
+ {
+ Debug.LogWarning("处理");
+ JObject keyValues = JObject.Parse(UTF8Encoding.UTF8.GetString(response.Data));
+ JToken containers = keyValues["object"]["containers"];
+
+ List storageResponses = JsonConvert.DeserializeObject>(containers.ToString());
+
+ if (storageResponses != null)
+ {
+
+
+ foreach (StorageResponseData responseData in storageResponses)
+ {
+
+ //无货的不往下处理了
+ if (string.IsNullOrEmpty(responseData.containerCode))
+ {
+ continue;
+ }
+ //库位号
+ string storageName = responseData.locationCode;
+ GameObject storageObj = storageManage.GetStorageByName(storageName);
+ if (storageObj != null)
+ {
+ //赋值容器数据
+ ContainerEntity containerEntity = new();
+ containerEntity.channelType = responseData.channelType;
+ containerEntity.location = responseData.locationCode;
+ containerEntity.containerCode = responseData.containerCode;
+ containerEntity.procedureCode = responseData.procedureCode;
+ containerEntity.containerType = responseData.containerType;
+ containerEntity.isEmpty = responseData.isEmpty;
+ containerEntity.isTool = responseData.isTool;
+ int row = int.Parse(storageObj.name.Split("-")[0]);
+ if (row >= storageManage.startRow && row <= storageManage.endRow)
+ {
+ containerManage.CreateContainer(new Vector3(0, -0.2472343f, 0.0006999969f), storageObj.transform, containerEntity, storageObj.layer);
+ }
+ else
+ {
+ containerManage.CreateContainer(Vector3.zero, storageObj.transform, containerEntity, storageObj.layer);
+ }
+
+ }
+ }
+ }
+ }
+ }
+ public void OnExit()
+ {
+
+ }
+
+ public void OnUpdate()
+ {
+ }
+}
diff --git a/Assets/script/application/InitStorageProcess.cs.meta b/Assets/script/application/InitStorageProcess.cs.meta
new file mode 100644
index 0000000..b8f3e1c
--- /dev/null
+++ b/Assets/script/application/InitStorageProcess.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 5356c9924db061442ac19e4b9602dc24
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/script/application/SkipUnityLogo.cs b/Assets/script/application/SkipUnityLogo.cs
new file mode 100644
index 0000000..2413e91
--- /dev/null
+++ b/Assets/script/application/SkipUnityLogo.cs
@@ -0,0 +1,32 @@
+#if !UNITY_EDITOR
+using UnityEngine;
+using UnityEngine.Rendering;
+using UnityEngine.Scripting;
+
+[Preserve]
+public class SkipUnityLogo
+{
+ [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)]
+ private static void BeforeSplashScreen()
+ {
+#if UNITY_WEBGL
+ Application.focusChanged += Application_focusChanged;
+#else
+ System.Threading.Tasks.Task.Run(AsyncSkip);
+#endif
+ }
+
+#if UNITY_WEBGL
+ private static void Application_focusChanged(bool obj)
+ {
+ Application.focusChanged -= Application_focusChanged;
+ SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate);
+ }
+#else
+ private static void AsyncSkip()
+ {
+ SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate);
+ }
+#endif
+}
+#endif
diff --git a/Assets/script/application/SkipUnityLogo.cs.meta b/Assets/script/application/SkipUnityLogo.cs.meta
new file mode 100644
index 0000000..f275e10
--- /dev/null
+++ b/Assets/script/application/SkipUnityLogo.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: eb3f51339d2eaff4bb339138c258df10
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/script/camera.meta b/Assets/script/camera.meta
new file mode 100644
index 0000000..beedc0a
--- /dev/null
+++ b/Assets/script/camera.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: e87a7b10ff9f0784aa9fd055039fef4f
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/script/camera/CameraController.cs b/Assets/script/camera/CameraController.cs
new file mode 100644
index 0000000..9a18648
--- /dev/null
+++ b/Assets/script/camera/CameraController.cs
@@ -0,0 +1,83 @@
+
+using EasyInject.Attributes;
+using System;
+using Unity.VisualScripting;
+using UnityEngine;
+using UnityEngine.Playables;
+///
+/// 相机控制
+///
+[GameObjectBean]
+public class CameraController : MonoBehaviour
+{
+ public Transform target; // 要围绕其旋转的目标物体
+
+ [Space(5)]
+ [Header("缩放配置")]
+ public float zoomSpeed = 5.0f; // 缩放速度
+ public float minDistance = 1.0f; // 最小距离
+ public float maxDistance = 30.0f; // 最大距离
+ public float speed = 1f; // 最大距离
+ public float distance = 0f; // 最大距离
+
+ public float yMin = 1;
+ public float yMax = 60;
+ private float xRot = 0;
+ private float yRot = 0;
+
+
+ public bool isPlaying = true;
+ void Start()
+ {
+ distance = Vector3.Distance(transform.position, target.position);
+
+ }
+
+ void FixedUpdate()
+ {
+ //鼠标围绕目标旋转
+ mouseRoundRoller();
+
+ // 检测鼠标滚轮输入并进行缩放
+ float scrollInput = Input.GetAxis("Mouse ScrollWheel");
+
+ if (scrollInput != 0)
+ {
+ // 根据鼠标滚轮的方向改变距离
+ Camera camera = transform.GetComponent();
+
+ float result = camera.fieldOfView - scrollInput * zoomSpeed;
+ // 限制距离范围
+ result = Mathf.Clamp(result, minDistance, maxDistance);
+ camera.fieldOfView = result;
+ }
+ }
+ ///
+ /// 鼠标操作旋转
+ ///
+ void mouseRoundRoller()
+ {
+ if (Input.GetMouseButton(0)) // 检查鼠标左键是否按下
+ {
+ // 根据鼠标移动量调整旋转角度
+ float mouseX = Input.GetAxis("Mouse X") * speed;
+ float mouseY = Input.GetAxis("Mouse Y") * speed;
+
+ yRot -= mouseX;
+ xRot += mouseY;
+
+ // 限制上下旋转角度
+ xRot = Mathf.Clamp(xRot, -90, 90);
+ // 应用新的旋转角度
+ transform.rotation = Quaternion.Euler(xRot, yRot, 0);
+
+ // 更新位置以保持与目标物体的距离不变
+
+ Vector3 v = target.position - transform.forward * distance;
+ transform.position = v;
+ }
+
+ }
+
+
+}
diff --git a/Assets/script/camera/CameraController.cs.meta b/Assets/script/camera/CameraController.cs.meta
new file mode 100644
index 0000000..cee40b6
--- /dev/null
+++ b/Assets/script/camera/CameraController.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 88bd1d8cdefb5004db4a38ccd2f53aa0
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/script/camera/CameraFollow.cs b/Assets/script/camera/CameraFollow.cs
new file mode 100644
index 0000000..4186c57
--- /dev/null
+++ b/Assets/script/camera/CameraFollow.cs
@@ -0,0 +1,90 @@
+using Cinemachine;
+using EasyInject.Attributes;
+using UnityEngine;
+///
+/// 相机的跟随
+///
+[GameObjectBean]
+public class CameraFollow : MonoBehaviour
+{
+ [Header("上下偏移")]
+ public float y;
+ [Header("左右偏移")]
+ public float z;
+ public float speed = 120;
+ [Autowired]
+ private CameraManage cameraManage;
+ public CinemachineVirtualCamera virtualCamera;
+ ///
+ /// 主要控制旋转的句柄
+ ///
+ private GameObject target;
+ private void Update()
+ {
+ mouseRoundRoller();
+ }
+ void mouseRoundRoller()
+ {
+ if(target == null)
+ {
+ return;
+ }
+ //不得当前活动相机返回
+ if (!CinemachineCore.Instance.IsLive(virtualCamera))
+ {
+ return;
+ }
+ if (Input.GetMouseButton(0)) // 检查鼠标左键是否按下
+ {
+ // 根据鼠标移动量调整旋转角度
+ float mouseX = Input.GetAxis("Mouse X") * speed * Time.deltaTime;
+ float y = target.transform.rotation.eulerAngles.y;
+ y -= mouseX;
+ // 应用新的旋转角度
+ target.transform.rotation = Quaternion.Euler(0, y, 0);
+ //transform.position = transform.position - transform.forward;
+ }
+
+ }
+ public void OnEnter(CinemachineVirtualCamera cinemachineCamera)
+ {
+ cinemachineCamera.LookAt = transform;
+ cinemachineCamera.Follow = transform;
+ CinemachineTransposer transposer = cinemachineCamera.GetCinemachineComponent();
+ if (transposer != null )
+ {
+ cameraManage.IsPlaying = false;
+ transposer.m_FollowOffset.y = y;
+ transposer.m_FollowOffset.z = z;
+ ICinemachineCamera cinemachine = cameraManage.GetMaxPriorityCamera();
+ cinemachineCamera.Priority = cinemachine.Priority +1;
+ cinemachine.Priority = 0;
+
+ }
+ }
+ public void OnEnter()
+ {
+ if (target == null)
+ {
+ target = new GameObject(name + "_camera");
+ target.transform.parent = transform;
+ target.transform.localPosition = Vector3.zero;
+ }
+ virtualCamera.LookAt = target.transform;
+ virtualCamera.Follow = target.transform;
+ CinemachineTransposer transposer = virtualCamera.GetCinemachineComponent();
+ if (transposer != null)
+ {
+ cameraManage.IsPlaying = false;
+ //cameraManage.playable.Stop();
+ transposer.m_FollowOffset.y = y;
+ transposer.m_FollowOffset.z = z;
+ ICinemachineCamera cinemachine = cameraManage.GetMaxPriorityCamera();
+ int back = cinemachine.Priority;
+ Debug.LogWarning("相机切换="+transform.name);
+ virtualCamera.Priority = cinemachine.Priority + 1;
+ cinemachine.Priority = 0;
+ }
+ }
+
+}
diff --git a/Assets/script/camera/CameraFollow.cs.meta b/Assets/script/camera/CameraFollow.cs.meta
new file mode 100644
index 0000000..3324d28
--- /dev/null
+++ b/Assets/script/camera/CameraFollow.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 3284cab85002c51468e01d53c50c6f29
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/script/camera/CameraManage.cs b/Assets/script/camera/CameraManage.cs
new file mode 100644
index 0000000..283147b
--- /dev/null
+++ b/Assets/script/camera/CameraManage.cs
@@ -0,0 +1,92 @@
+using Cinemachine;
+using EasyInject.Attributes;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.Playables;
+[GameObjectBean]
+public class CameraManage:MonoBehaviour
+{
+ [Autowired]
+ private AutoRotationButton autoRotation;
+ [SerializeField]
+ private CinemachineVirtualCamera followVirtualCamera;
+ private float startTime = 0;
+ [SerializeField]
+ private bool _isPlaying = true;
+ private PlayableDirector _playableDirector;
+ public bool IsPlaying { get { return _isPlaying; } set {
+ _isPlaying = value;
+ } }
+ private void Start()
+ {
+ _playableDirector = GetComponent();
+ }
+ private void Update()
+ {
+ //if (CinemachineCore.Instance.IsLive(followVirtualCamera))
+ //{
+ // Camera.main.cullingMask = LayerMask.GetMask("storage", LayerMask.LayerToName(followVirtualCamera.Follow.gameObject.layer));
+ //}
+
+
+ if (!_isPlaying)
+ {
+ return;
+ }
+ //如果时间线正在播放
+ //任意键按下
+ //if (Input.anyKeyDown)
+ //{
+ // playable.Pause();
+ // startTime = Time.time + 3;
+ //}
+ //if (Time.time - startTime > 0)
+ //{
+ // playable.Play();
+ //}
+ }
+
+
+ private CinemachineVirtualCameraBase[] cinemachineVirtuals;
+
+ ///
+ /// 获取最高的优先级相机
+ ///
+ ///
+ public ICinemachineCamera GetMaxPriorityCamera()
+ {
+ if (cinemachineVirtuals == null)
+ {
+ cinemachineVirtuals = GameObject.FindObjectsByType(FindObjectsSortMode.InstanceID);
+ }
+ var list = new List(cinemachineVirtuals);
+ list.Sort((a,b) => b.Priority-a.Priority);
+ return list[0];
+ }
+ ///
+ /// 镜头切换
+ ///
+ private void ShotCut(Transform follow,Transform lookAt,Vector3 offset)
+ {
+
+ followVirtualCamera.Follow = follow;
+ followVirtualCamera.LookAt = lookAt;
+ //关闭旋转
+ autoRotation.ClickRotationBtn(false);
+ CinemachineTransposer transposer= followVirtualCamera.GetCinemachineComponent();
+ transposer.m_FollowOffset.x = offset.x;
+ transposer.m_FollowOffset.y = offset.y;
+ transposer.m_FollowOffset.z = offset.z;
+ // Camera.main.cullingMask = LayerMask.GetMask("storage", LayerMask.LayerToName(follow.gameObject.layer));
+
+ ICinemachineCamera maxCamera = GetMaxPriorityCamera();
+ followVirtualCamera.Priority = maxCamera.Priority + 2;
+ maxCamera.Priority -= 1;
+
+ }
+ public void ShotCut(IFollowHelp follow)
+ {
+ ShotCut(follow.Follow,follow.FookAt,follow.Offset);
+ }
+
+}
diff --git a/Assets/script/camera/CameraManage.cs.meta b/Assets/script/camera/CameraManage.cs.meta
new file mode 100644
index 0000000..954d392
--- /dev/null
+++ b/Assets/script/camera/CameraManage.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 4f7bf896c872ab44e8c9ca7cbf489a13
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/script/camera/CameraRotate.cs b/Assets/script/camera/CameraRotate.cs
new file mode 100644
index 0000000..6ce5ca4
--- /dev/null
+++ b/Assets/script/camera/CameraRotate.cs
@@ -0,0 +1,38 @@
+using Cinemachine;
+using EasyInject.Attributes;
+using UnityEngine;
+///
+/// 相机的左右围绕旋转
+///
+[GameObjectBean]
+public sealed class CameraRotate : MonoBehaviour
+{
+ public float speed = 0;
+ [SerializeField]
+ private CinemachineVirtualCamera followVirtualCamera;
+
+ private void Update()
+ {
+ mouseRoundRoller();
+ }
+ void mouseRoundRoller()
+ {
+ //不得当前活动相机返回
+ if (!CinemachineCore.Instance.IsLive(followVirtualCamera))
+ {
+ return;
+ }
+ if (Input.GetMouseButton(0)) // 检查鼠标左键是否按下
+ {
+ // 根据鼠标移动量调整旋转角度
+ float mouseX = Input.GetAxis("Mouse X") * speed * Time.deltaTime;
+ Transform target = followVirtualCamera.LookAt;
+ float y = target.rotation.eulerAngles.y;
+ y -= mouseX;
+ // 应用新的旋转角度
+ target.rotation = Quaternion.Euler(0, y, 0);
+ //transform.position = transform.position - transform.forward;
+ }
+
+ }
+}
diff --git a/Assets/script/camera/CameraRotate.cs.meta b/Assets/script/camera/CameraRotate.cs.meta
new file mode 100644
index 0000000..3a475a4
--- /dev/null
+++ b/Assets/script/camera/CameraRotate.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 53dfad170f20c564cb9314f3c28236ad
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/script/camera/CameraShotCut.cs b/Assets/script/camera/CameraShotCut.cs
new file mode 100644
index 0000000..f4911d7
--- /dev/null
+++ b/Assets/script/camera/CameraShotCut.cs
@@ -0,0 +1,57 @@
+
+using UnityEngine;
+using EasyInject.Attributes;
+using UnityEngine.UI;
+using Cinemachine;
+using Unity.VisualScripting;
+[GameObjectBean(ENameType.GameObjectName)]
+public class CameraShotCut : MonoBehaviour,IFollowHelp
+{
+ [Autowired]
+ private AutoRotationButton autoRotation;
+ [Autowired]
+ private CameraManage cameraManage;
+ [SerializeField]
+ private GameObject follow;
+ [SerializeField]
+ private GameObject lookat;
+ [SerializeField]
+ private Vector3 offset;
+ private Button button;
+
+ [SerializeField]
+ private LayerMask layerMask;
+ [SerializeField]
+ public MonoBehaviour followHelp;
+ public Transform Follow => follow.transform;
+
+ public Transform FookAt => lookat.transform;
+
+ public Vector3 Offset => offset;
+
+ void Start()
+ {
+ button = GetComponent