基础内容-8

添加BM存档类
This commit is contained in:
SoulliesOfficial
2025-02-02 21:59:43 -05:00
parent efca87e9cd
commit bc1c5d65ef
20 changed files with 926 additions and 90 deletions

View File

@@ -1,16 +1,16 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Ichni.RhythmGame.Beatmap;
namespace Ichni
namespace Ichni.RhythmGame
{
[System.Serializable]
public class AnimatedBool
{
public bool value; //bool值
public float time; //当前时间
public AnimatedBool(bool value, float time)
public AnimatedBool(float time, bool value)
{
this.value = value;
this.time = time;
@@ -37,7 +37,7 @@ namespace Ichni
{
animations.Add(animatedBool);
}
/// <summary>
/// 在动画脚本的Update中更新Bool Value
/// </summary>
@@ -48,7 +48,7 @@ namespace Ichni
value = nowAnimatedBool.value; //更新value
return FlexibleReturnType.MiddleExecuting;
}
/// <summary>
/// 获取songTime对应的AnimatedBool的时间段
/// </summary>
@@ -64,7 +64,63 @@ namespace Ichni
}
}
return new AnimatedBool(false, 0);
return new AnimatedBool(0, false);
}
/// <summary>
/// 转换为Beatmap存档类型
/// </summary>
/// <returns></returns>
public FlexibleBool_BM ConvertToBM()
{
FlexibleBool_BM flexibleBool_BM = new FlexibleBool_BM();
foreach (AnimatedBool animatedBool in animations)
{
flexibleBool_BM.animatedBoolList.Add(new AnimatedBool(animatedBool.time, animatedBool.value));
}
return flexibleBool_BM;
}
}
namespace Beatmap
{
public class FlexibleBool_BM
{
public List<AnimatedBool> animatedBoolList;
public FlexibleBool_BM()
{
this.animatedBoolList = new List<AnimatedBool>();
}
public FlexibleBool_BM(List<AnimatedBool> animatedBoolList)
{
this.animatedBoolList = animatedBoolList;
}
public FlexibleBool ConvertToGameType()
{
FlexibleBool flexibleBool;
if (this.animatedBoolList.Count == 0)
{
flexibleBool = new FlexibleBool();
}
else
{
List<AnimatedBool> animations = new List<AnimatedBool>();
foreach (AnimatedBool animatedBool in animatedBoolList)
{
animations.Add(new AnimatedBool(animatedBool.time, animatedBool.value));
}
flexibleBool = new FlexibleBool(animations);
}
return flexibleBool;
}
}
}
}

View File

@@ -1,23 +1,21 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
using UnityEngine;
using UnityEngine.Serialization;
using Ichni.RhythmGame.Beatmap;
namespace Ichni
namespace Ichni.RhythmGame
{
[System.Serializable]
public class AnimatedFloat : IComparable<AnimatedFloat>
{
public float startValue, endValue; //起止值
public float differenceValue; //差值
public float startTime, endTime; //起止时间
public float totalTime; //总时间
public AnimationCurveType animationCurveType; //动画曲线类型
public float differenceValue => endValue - startValue; //差值
public float totalTime => endTime - startTime; //总时间
public AnimatedFloat(float startTime, float endTime, float startValue, float endValue,
AnimationCurveType animationCurveType)
@@ -26,8 +24,6 @@ namespace Ichni
this.endValue = endValue;
this.startTime = startTime;
this.endTime = endTime;
totalTime = endTime - startTime;
differenceValue = endValue - startValue;
this.animationCurveType = animationCurveType;
}
@@ -152,5 +148,66 @@ namespace Ichni
return null;
}
/// <summary>
/// 转换为Beatmap存档类型
/// </summary>
public FlexibleFloat_BM ConvertToBM()
{
FlexibleFloat_BM flexibleFloat_BM = new FlexibleFloat_BM();
foreach (AnimatedFloat animatedFloat in animations)
{
flexibleFloat_BM.animatedFloatList.Add(new AnimatedFloat(animatedFloat.startTime, animatedFloat.endTime,
animatedFloat.startValue, animatedFloat.endValue, animatedFloat.animationCurveType));
}
return flexibleFloat_BM;
}
}
namespace Beatmap
{
[System.Serializable]
public class FlexibleFloat_BM
{
public List<AnimatedFloat> animatedFloatList;
public FlexibleFloat_BM()
{
this.animatedFloatList = new List<AnimatedFloat>();
}
public FlexibleFloat_BM(List<AnimatedFloat> animatedFloatList)
{
this.animatedFloatList = animatedFloatList;
}
public FlexibleFloat ConvertToGameType()
{
FlexibleFloat flexibleFloat;
if (animatedFloatList.Count == 0)
{
flexibleFloat = new FlexibleFloat();
}
else
{
List<AnimatedFloat> animatedFloatList = new List<AnimatedFloat>();
foreach (AnimatedFloat animatedFloat in this.animatedFloatList)
{
animatedFloatList.Add(new AnimatedFloat(
animatedFloat.startTime, animatedFloat.endTime,
animatedFloat.startValue, animatedFloat.endValue,
animatedFloat.animationCurveType));
}
flexibleFloat = new FlexibleFloat(animatedFloatList);
}
return flexibleFloat;
}
}
}
}

View File

@@ -1,8 +1,10 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
namespace Ichni
namespace Ichni.RhythmGame
{
[System.Serializable]
public class AnimatedInt
@@ -14,7 +16,7 @@ namespace Ichni
{
}
public AnimatedInt(int value, float time)
public AnimatedInt(float time, int value)
{
this.value = value;
this.time = time;
@@ -77,5 +79,63 @@ namespace Ichni
return new AnimatedInt(0, 0);
}
/// <summary>
/// 转换为Beatmap存档类型
/// </summary>
/// <returns></returns>
public FlexibleInt_BM ConvertToBM()
{
FlexibleInt_BM flexibleInt_BM = new FlexibleInt_BM();
foreach (AnimatedInt animatedInt in animations)
{
flexibleInt_BM.animatedIntList.Add(new AnimatedInt(animatedInt.time, animatedInt.value));
}
return flexibleInt_BM;
}
}
namespace Beatmap
{
[System.Serializable]
public class FlexibleInt_BM
{
public List<AnimatedInt> animatedIntList;
public FlexibleInt_BM()
{
this.animatedIntList = new List<AnimatedInt>();
}
public FlexibleInt_BM(List<AnimatedInt> animatedIntList)
{
this.animatedIntList = animatedIntList;
}
public FlexibleInt ConvertToGameType()
{
FlexibleInt flexibleInt;
if (animatedIntList.Count == 0)
{
flexibleInt = new FlexibleInt();
}
else
{
List<AnimatedInt> animations = new List<AnimatedInt>();
foreach (AnimatedInt animatedInt in animatedIntList)
{
animations.Add(new AnimatedInt(animatedInt.time, animatedInt.value));
}
flexibleInt = new FlexibleInt(animations);
}
return flexibleInt;
}
}
}
}