石头
This commit is contained in:
@@ -4,7 +4,9 @@ using AibisDream.FixSystem;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.Kit;
|
||||
using AibisDream.Utility;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
@@ -12,16 +14,24 @@ namespace AibisDream
|
||||
{
|
||||
public static string DataPath = Application.streamingAssetsPath + "/LevelData/EngineSystem/";
|
||||
|
||||
private SpriteRenderer _cover;
|
||||
|
||||
[Header("系统配置")] [SerializeField] public EngineConfig config;
|
||||
[Header("系统数据")] [SerializeField] private EngineData engineData;
|
||||
|
||||
[FormerlySerializedAs("盖板移动时间")] [SerializeField]
|
||||
private float coverMoveDuration = 5f;
|
||||
[FormerlySerializedAs("盖板移动距离")] [SerializeField]
|
||||
private float coverMoveDistance = 2.8f;
|
||||
|
||||
private bool IsValid => engineData.isValid.Value;
|
||||
|
||||
|
||||
public event Action<EngineData> UpdateDashboard;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
FixSystemCenter.SystemDic.Register(this);
|
||||
_cover = transform.Find("Cover").GetComponent<SpriteRenderer>();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
@@ -58,13 +68,65 @@ namespace AibisDream
|
||||
// 失效期无法加油门
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新引擎气门变化
|
||||
/// </summary>
|
||||
/// <param name="curLevel">当前气门等级</param>
|
||||
public void UpdateAirLevel(int curLevel)
|
||||
{
|
||||
engineData.UpdateAirLevel(curLevel, config.maxLevel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打开盖板
|
||||
/// </summary>
|
||||
/// <returns>动画序列</returns>
|
||||
public Tween OpenCover()
|
||||
{
|
||||
var sq = DOTween.Sequence();
|
||||
// 盖板上移
|
||||
var moveDis = new Vector3(0, coverMoveDistance, 0);
|
||||
sq.Join(_cover.transform.DOBlendableMoveBy(moveDis, coverMoveDuration));
|
||||
// 盖板淡出
|
||||
sq.Join(_cover.DOFade(0, coverMoveDuration));
|
||||
|
||||
// 为引擎系统解锁
|
||||
sq.OnComplete(Unlock);
|
||||
|
||||
return sq;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 关闭盖板
|
||||
/// </summary>
|
||||
/// <returns>动画序列</returns>
|
||||
public Tween CloseCover()
|
||||
{
|
||||
var sq = DOTween.Sequence();
|
||||
sq.Join(_cover.DOFade(1, coverMoveDuration));
|
||||
|
||||
var moveDis = new Vector3(0, -coverMoveDistance, 0);
|
||||
sq.Join(_cover.transform.DOBlendableMoveBy(moveDis, coverMoveDuration));
|
||||
|
||||
// 锁定引擎系统
|
||||
sq.OnComplete(Lock);
|
||||
|
||||
return sq;
|
||||
}
|
||||
|
||||
public void Lock()
|
||||
{
|
||||
// 禁止油门和气门
|
||||
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
// 开启油门和气门
|
||||
}
|
||||
|
||||
#region 数据加载与保存
|
||||
|
||||
|
||||
private string[] _keyOptions;
|
||||
|
||||
public override string CurDataKey { get; set; }
|
||||
@@ -81,7 +143,7 @@ namespace AibisDream
|
||||
Debug.Log("配置项名称为空");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!ConfigUtil.Instance.TryLoadConfig<EngineConfig>(DataPath + CurDataKey,
|
||||
out var data))
|
||||
{
|
||||
@@ -94,13 +156,14 @@ namespace AibisDream
|
||||
|
||||
public override void Save()
|
||||
{
|
||||
if (string.IsNullOrEmpty(CurDataKey))
|
||||
if (string.IsNullOrEmpty(CurDataKey))
|
||||
{
|
||||
Debug.Log("名称不为空");
|
||||
return;
|
||||
}
|
||||
|
||||
ConfigUtil.Instance.SaveConfig(config, DataPath + CurDataKey);
|
||||
|
||||
|
||||
if (!_keyOptions.Contains(CurDataKey))
|
||||
{
|
||||
// 重新读取key
|
||||
@@ -176,6 +239,8 @@ namespace AibisDream
|
||||
{
|
||||
isValid.Value = false;
|
||||
}
|
||||
|
||||
inAirRange = curInAirRange;
|
||||
}
|
||||
|
||||
public void UpdateAirLevel(int level, int maxLevel)
|
||||
|
||||
Reference in New Issue
Block a user