118 lines
3.6 KiB
C#
118 lines
3.6 KiB
C#
using FSM;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using ZXKFramework;
|
|
namespace YiLiao.XinFeiTingZhen
|
|
{
|
|
public class FeiPaoHuXiYin : FsmState<FSMManager>
|
|
{
|
|
bool step1;
|
|
string id;
|
|
//成功的标志
|
|
List<string> success = new() {"7", "8"};
|
|
Coroutine cor;
|
|
string audioName = "30--肺泡呼吸音";
|
|
public override void OnStateEnter()
|
|
{
|
|
base.OnStateEnter();
|
|
|
|
if (fsm.main_gameModel.modeType == ModeType.KaoHe)
|
|
{
|
|
fsm.ShowTxtImgQuestion("肺部听诊——正常呼吸音——肺泡呼吸音", 15, 0, 5, () => {
|
|
fsm.nextState = true;
|
|
});
|
|
}
|
|
if (fsm.main_gameModel.modeType == ModeType.ShiXun)
|
|
{
|
|
fsm.PlayBgm(0);
|
|
fsm.ShowTip(0);
|
|
fsm.Light("肺泡听诊器位置1");
|
|
fsm.Light("肺泡听诊器位置2");
|
|
fsm.ShowArrow("将实物听诊器放置于乳房下部进行听诊。", "肺泡听诊器位置1", 0, 999);
|
|
Countdown();
|
|
}
|
|
}
|
|
void Countdown()
|
|
{
|
|
fsm.HideTzq();
|
|
id = "";
|
|
step1 = true;
|
|
GameManager.Instance.uiManager.ShowUI<CountdownPanel>();
|
|
GameManager.Instance.uiManager.GetUI<CountdownPanel>().StartCountdown(() => {
|
|
fsm.AddScore(0, 0);
|
|
step1 = false;
|
|
Confirm();
|
|
});
|
|
}
|
|
void Confirm()
|
|
{
|
|
GameManager.Instance.uiManager.GetUI<CountdownPanel>().StopCountdown();
|
|
GameManager.Instance.uiManager.GetUI<ConfirmPanel>().ShowConfirmPanel(() => {
|
|
Countdown();
|
|
}, () => {
|
|
fsm.nextState = true;
|
|
});
|
|
}
|
|
void Success()
|
|
{
|
|
step1 = false;
|
|
fsm.AddScore(0, 2);
|
|
GameManager.Instance.uiManager.GetUI<CountdownPanel>().StopCountdown();
|
|
cor = Game.Instance.IEnumeratorManager.Run(1f, () =>
|
|
{
|
|
GameManager.Instance.uiManager.GetUI<SuccessPanel>().ShowSuccessPanel(() => {
|
|
fsm.nextState = true;
|
|
});
|
|
});
|
|
}
|
|
void False()
|
|
{
|
|
fsm.AddScore(0, 0);
|
|
step1 = false;
|
|
GameManager.Instance.uiManager.GetUI<CountdownPanel>().StopCountdown();
|
|
cor = Game.Instance.IEnumeratorManager.Run(1f, () =>
|
|
{
|
|
Confirm();
|
|
});
|
|
}
|
|
void Audio()
|
|
{
|
|
GameManager.Instance.uiManager.ShowUI<AudioPanel>();
|
|
GameManager.Instance.uiManager.GetUI<AudioPanel>().LoadAudioClip(audioName);
|
|
}
|
|
public override void OnStateStay()
|
|
{
|
|
base.OnStateStay();
|
|
|
|
if (Input.GetKeyDown(KeyCode.L) && step1)
|
|
{
|
|
id = success[0];
|
|
}
|
|
if (step1)
|
|
{
|
|
fsm.ShowTzq(id);
|
|
if (success.Contains(id))
|
|
{
|
|
fsm.HideArrow();
|
|
fsm.Unlight("肺泡听诊器位置1");
|
|
fsm.Unlight("肺泡听诊器位置2");
|
|
Audio();
|
|
Success();
|
|
}
|
|
else if (!string.IsNullOrEmpty(id) && !success.Contains(id))
|
|
{
|
|
False();
|
|
}
|
|
}
|
|
}
|
|
public override void OnStateExit()
|
|
{
|
|
base.OnStateExit();
|
|
fsm.HideTzq();
|
|
id = "";
|
|
Game.Instance.IEnumeratorManager.Stop(cor);
|
|
fsm.nextState = false;
|
|
}
|
|
}
|
|
}
|