石头
This commit is contained in:
@@ -15,8 +15,6 @@ namespace AibisDream.Framework
|
||||
public interface ISystem
|
||||
{
|
||||
void Init();
|
||||
void Enable();
|
||||
void Disable();
|
||||
void Deinit();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
<<<<<<<< HEAD:Assets/Scripts/Framework/LifeCycle.meta
|
||||
guid: e83cc72ae645d204ba5edddce2e36596
|
||||
folderAsset: yes
|
||||
========
|
||||
guid: 39db4a518afdbd74f8c0100de0f68c74
|
||||
>>>>>>>> develop:Assets/Scenes/ScanScopeTest.unity.meta
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,51 +0,0 @@
|
||||
using AibisDream.Kit;
|
||||
using Yarn.Unity;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class LifeCycleManager : Singleton<LifeCycleManager>
|
||||
{
|
||||
private ILifeCycle _lifeCycle;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
SceneLoader.Instance.LoadSceneEvent += OnInit;
|
||||
SceneLoader.Instance.UnloadSceneEvent += OnSceneUnload;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
SceneLoader.Instance.LoadSceneEvent -= OnInit;
|
||||
SceneLoader.Instance.UnloadSceneEvent -= OnSceneUnload;
|
||||
}
|
||||
|
||||
public void Register(ILifeCycle lifeCycle)
|
||||
{
|
||||
_lifeCycle = lifeCycle;
|
||||
}
|
||||
|
||||
private void OnInit()
|
||||
{
|
||||
_lifeCycle?.OnInit();
|
||||
}
|
||||
|
||||
[YarnCommand("game_start")]
|
||||
public void OnGameStart()
|
||||
{
|
||||
_lifeCycle?.OnGameStart();
|
||||
}
|
||||
|
||||
[YarnCommand("game_end")]
|
||||
public void OnGameEnd()
|
||||
{
|
||||
_lifeCycle?.OnGameEnd();
|
||||
}
|
||||
|
||||
private void OnSceneUnload()
|
||||
{
|
||||
_lifeCycle.OnSceneUnload();
|
||||
_lifeCycle = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3e9b9d16043250e43b350ea79cda5e7a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,28 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public interface ILifeCycle
|
||||
{
|
||||
void OnInit();
|
||||
|
||||
void OnGameStart();
|
||||
|
||||
void OnGameEnd();
|
||||
|
||||
void OnSceneUnload();
|
||||
}
|
||||
|
||||
public abstract class AbsLifeCycle : MonoBehaviour, ILifeCycle
|
||||
{
|
||||
private void Start()
|
||||
{
|
||||
LifeCycleManager.Instance.Register(this);
|
||||
}
|
||||
|
||||
public abstract void OnInit();
|
||||
public abstract void OnGameStart();
|
||||
public abstract void OnGameEnd();
|
||||
public abstract void OnSceneUnload();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c928711dc2b0dc4c995288fdb23d1c7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -4,6 +4,8 @@ namespace AibisDream.Framework
|
||||
{
|
||||
public interface IMoveable
|
||||
{
|
||||
bool IsBlock { get; }
|
||||
|
||||
void StartMove();
|
||||
|
||||
void Move(Vector2 mousePos);
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace AibisDream.Framework
|
||||
{
|
||||
_dragObj = hit.collider.gameObject.GetComponent<IMoveable>();
|
||||
if (_dragObj == null) return;
|
||||
if (_dragObj.IsBlock) return;
|
||||
|
||||
_dragObj.StartMove();
|
||||
_offset = hit.collider.transform.position - GetMouseAsWorldPoint();
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
using AibisDream.Kit;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream.Framework
|
||||
{
|
||||
public class CameraKit : SingletonBase<CameraKit>
|
||||
{
|
||||
private readonly Camera _mainCamera = Camera.main;
|
||||
|
||||
private Vector3 _initPos;
|
||||
private float _initOrthographicSize;
|
||||
|
||||
private CameraKit() {}
|
||||
|
||||
public override void OnSingletonInit()
|
||||
{
|
||||
// 无需初始化
|
||||
}
|
||||
|
||||
public void ResetCamara()
|
||||
{
|
||||
_mainCamera.transform.position = _initPos;
|
||||
_mainCamera.orthographicSize = _initOrthographicSize;
|
||||
}
|
||||
|
||||
public Tween TransCamera(Vector3 targetPos, float targetOrthographicSize, float duration)
|
||||
{
|
||||
var sq = DOTween.Sequence();
|
||||
// 移动
|
||||
sq.Join(_mainCamera.transform.DOMove(targetPos, duration));
|
||||
// 缩放
|
||||
sq.Join(_mainCamera.DOOrthoSize(targetOrthographicSize, duration));
|
||||
|
||||
return sq;
|
||||
}
|
||||
|
||||
public Tween ReturnInitCamera(float duration)
|
||||
{
|
||||
return TransCamera(_initPos, _initOrthographicSize, duration);
|
||||
}
|
||||
|
||||
public Tween TransCamera(Vector3 targetPos, float duration)
|
||||
{
|
||||
return _mainCamera.transform.DOMove(targetPos, duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab36b5f5522a4b42bf6e1054aa92bdce
|
||||
timeCreated: 1733666233
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using AibisDream.FixSystem;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream.Framework
|
||||
@@ -24,6 +25,7 @@ namespace AibisDream.Framework
|
||||
_iocContainer ??= new IOCContainer();
|
||||
// 在这里添加相应的工具
|
||||
Register(new MoveableSystem());
|
||||
Register(new TransTest());
|
||||
}
|
||||
|
||||
private void Register<T>(T kit) where T : IMonoKit
|
||||
@@ -41,6 +43,17 @@ namespace AibisDream.Framework
|
||||
private void Update() => OnUpdate?.Invoke();
|
||||
}
|
||||
|
||||
public class TransTest : IMonoKit
|
||||
{
|
||||
public void OnUpdate()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.K))
|
||||
{
|
||||
FixSystemCenter.Instance.TransToNextState(FixState.Engine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface IMonoKit
|
||||
{
|
||||
void OnUpdate();
|
||||
|
||||
Reference in New Issue
Block a user