Merge remote-tracking branch 'origin/master' into LouDi_Pig

This commit is contained in:
李浩 2025-01-22 18:22:21 +08:00
commit 30188c0a5b
4 changed files with 61 additions and 41 deletions

View File

@ -65,55 +65,61 @@ namespace QFramework
if (obj.activeSelf == false)
{
Debug.LogError(obj.name + "µ±Ç°ÊÇÒþ²Ø×´Ì¬");
this.Finish();
}
try
else
{
anim = obj.GetComponent<Animation>();
if (string.IsNullOrEmpty(frame) == false && frame != "-1")
try
{
int curFrame = 0;
int.TryParse(frame, out curFrame);
anim.clip = anim[animName].clip;
anim[animName].time = curFrame / anim.clip.frameRate;
anim[animName].speed = 0;
anim.Play(animName);
this.Finish();
}
else
{
float curSpeed = 1;
if (string.IsNullOrEmpty(speed) == false)
{
float.TryParse(speed, out curSpeed);
}
anim = obj.GetComponent<Animation>();
if (curSpeed < 0)
if (string.IsNullOrEmpty(frame) == false && frame != "-1")
{
int curFrame = 0;
int.TryParse(frame, out curFrame);
anim.clip = anim[animName].clip;
anim[animName].time = curFrame / anim.clip.frameRate;
anim[animName].speed = 0;
anim.Play(animName);
anim[animName].normalizedTime = 1;
animDot = DOTween.To(() => anim[animName].normalizedTime, v => anim[animName].normalizedTime = v, 0, anim[animName].length / Math.Abs(curSpeed));
animDot.onComplete = () =>
{
anim.Stop();
};
this.Finish();
}
else
{
anim[animName].speed = curSpeed;
anim.Play(animName);
if (anim[animName].wrapMode == WrapMode.Loop)
float curSpeed = 1;
if (string.IsNullOrEmpty(speed) == false)
{
this.Finish();
float.TryParse(speed, out curSpeed);
}
if (curSpeed < 0)
{
anim.Play(animName);
anim[animName].normalizedTime = 1;
animDot = DOTween.To(() => anim[animName].normalizedTime, v => anim[animName].normalizedTime = v, 0, anim[animName].length / Math.Abs(curSpeed));
animDot.onComplete = () =>
{
anim.Stop();
};
}
else
{
anim[animName].speed = curSpeed;
anim.Play(animName);
if (anim[animName].wrapMode == WrapMode.Loop)
{
this.Finish();
}
}
totalTime = Math.Abs(anim[animName].length / curSpeed);
}
totalTime = Math.Abs(anim[animName].length / curSpeed);
}
catch (Exception)
{
anim = obj.GetComponent<Animation>();
Debug.LogError($"{path} ²¥·Å¶¯»­ {animName} ³ö´í");
}
}
catch (Exception)
{
Debug.LogError($"{path} ²¥·Å¶¯»­ {animName} ³ö´í");
}
}
else
@ -151,7 +157,10 @@ namespace QFramework
{
if (obj != null)
{
anim?.Stop();
if (anim!=null)
{
anim.Stop();
}
}
animDot?.Kill();
OnFinished = null;

View File

@ -96,9 +96,6 @@ public class ScoreController : MonoSingleton<ScoreController>
private void OnQuit(OnModuleQuit quit)
{
var data = moduleDict[Global.Instance.curModule.ModuleName];
var scoreDict = data.scoreDict;
scoreDict.Clear();
TypeEventSystem.Global.UnRegister<OnModuleStart>(OnStart);
TypeEventSystem.Global.UnRegister<OnModuleQuit>(OnQuit);
}

View File

@ -37,7 +37,7 @@ public class Point3DItem : MonoBehaviour
}
rotSpeed = data.rotateSpeed;
gameObject.GetComponent<SpriteRenderer>().sortingOrder = data.order;
TypeEventSystem.Global.Register<OnPoint3DQuestionDestroy>(OnObjDestroy).UnRegisterWhenGameObjectDestroyed(gameObject);
TypeEventSystem.Global.Register<OnPoint3DQuestionDestroy>(OnObjDestroy);
TypeEventSystem.Global.Register<StepStatusOnChange>(OnStepChanged);
}
@ -49,8 +49,16 @@ public class Point3DItem : MonoBehaviour
private void OnObjDestroy(OnPoint3DQuestionDestroy destroy)
{
if (gameObject != null)
{
GameObject.Destroy(gameObject);
}
}
private void OnDestroy()
{
TypeEventSystem.Global.UnRegister<StepStatusOnChange>(OnStepChanged);
GameObject.Destroy(gameObject);
TypeEventSystem.Global.UnRegister<OnPoint3DQuestionDestroy>(OnObjDestroy);
}
private void OnMouseUpAsButton()

View File

@ -15,9 +15,11 @@ namespace QFramework.Example
mData = uiData as UISettingData ?? new UISettingData();
AudioKit.Settings.MusicVolume.RegisterWithInitValue(v => VoiceSlider.value = v).UnRegisterWhenGameObjectDestroyed(this);
AudioKit.Settings.VoiceVolume.RegisterWithInitValue(v => VoiceSlider.value = v).UnRegisterWhenGameObjectDestroyed(this);
VoiceSlider.onValueChanged.AddListener(volume =>
{
AudioKit.Settings.MusicVolume.Value = volume;
AudioKit.Settings.VoiceVolume.Value = volume;
});
Global.appSetting.MouseMoveSpeed.RegisterWithInitValue(v => MouseSlider.value = v).UnRegisterWhenGameObjectDestroyed(this);
@ -48,6 +50,10 @@ namespace QFramework.Example
{
AudioKit.Settings.MusicVolume.Value += value;
}
if (AudioKit.Settings.VoiceVolume.Value > 0.1f && AudioKit.Settings.VoiceVolume.Value < 1f)
{
AudioKit.Settings.VoiceVolume.Value += value;
}
}