2025-09-08 14:51:28 +08:00
|
|
|
|
using FSM;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Security.Cryptography;
|
|
|
|
|
|
using Unity.VisualScripting.Dependencies.NCalc;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.SocialPlatforms.Impl;
|
|
|
|
|
|
using ZXKFramework;
|
|
|
|
|
|
|
2025-09-08 17:37:12 +08:00
|
|
|
|
namespace DongWuYiXue.DaoNiaoShu
|
2025-09-08 14:51:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
public class FSMManager : FsmBase<FSMManager>
|
|
|
|
|
|
{
|
|
|
|
|
|
[HideInInspector]
|
|
|
|
|
|
public bool nextState;
|
|
|
|
|
|
public GameModel gameModel;
|
|
|
|
|
|
public Main.GameModel main_gameModel;
|
|
|
|
|
|
bool tip;
|
|
|
|
|
|
//string gudieTxt_kaoHe;
|
|
|
|
|
|
//bool tip;
|
|
|
|
|
|
public void Init()
|
|
|
|
|
|
{
|
|
|
|
|
|
gameModel = MVC.GetModel<GameModel>();
|
|
|
|
|
|
main_gameModel = MVC.GetModel<Main.GameModel>();
|
|
|
|
|
|
StartCoroutine(InitData(ChangeStateEvent));
|
|
|
|
|
|
}
|
2025-09-10 19:05:05 +08:00
|
|
|
|
|
2025-09-08 14:51:28 +08:00
|
|
|
|
private void ChangeStateEvent(string stateName)
|
|
|
|
|
|
{
|
|
|
|
|
|
gameModel.ChangeState(stateName);
|
|
|
|
|
|
if (gameModel.bData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
InteractionDisableAll();
|
|
|
|
|
|
GameManager.Instance.uiManager.CloseUI<PopPanel>();
|
2025-09-10 19:05:05 +08:00
|
|
|
|
|
2025-09-08 14:51:28 +08:00
|
|
|
|
GameManager.Instance.uiManager.CloseUI<ImgSelectQuestionPanel>();
|
|
|
|
|
|
GameManager.Instance.uiManager.CloseUI<DragQuestionPanel>();
|
|
|
|
|
|
GameManager.Instance.uiManager.CloseUI<LineQuestionPanel>();
|
|
|
|
|
|
GameManager.Instance.uiManager.CloseUI<TxtSelectQuestionPanel>();
|
|
|
|
|
|
GameManager.Instance.uiManager.CloseUI<BookPanel>();
|
|
|
|
|
|
GameManager.Instance.uiManager.CloseUI<ShiXunPanel>();
|
|
|
|
|
|
GameManager.Instance.uiManager.CloseUI<ArrowPanel>();
|
|
|
|
|
|
GameManager.Instance.uiManager.CloseUI<SpeakPanel>();
|
|
|
|
|
|
GameManager.Instance.uiManager.CloseUI<VideoPanel>();
|
|
|
|
|
|
GameManager.Instance.uiManager.CloseUI<TipBtnPanel>();
|
|
|
|
|
|
GameManager.Instance.highLightManager.HideAllHighLight();
|
|
|
|
|
|
GameManager.Instance.sceneDataHandler.SaveSceneDataToJson(main_gameModel.mainData.folder + "/SaveData/" + stateName + ".json");
|
|
|
|
|
|
GameManager.Instance.uiManager.GetUI<TipPanel>().AddTip(gameModel.bData.txt);
|
|
|
|
|
|
GameManager.Instance.uiManager.GetUI<TreeViewPanel>().Locate(gameModel.parentBtnName, gameModel.childBtnName);
|
2025-09-10 19:05:05 +08:00
|
|
|
|
if (main_gameModel.modeType == ModeType.ShiXun)
|
2025-09-08 14:51:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
GameManager.Instance.kaoheManager.AddData(gameModel.bData.parentName, gameModel.bData.name, gameModel.bData.type, gameModel.bData.score_sx);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (main_gameModel.modeType == ModeType.KaoHe)
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.Instance.kaoheManager.AddData(gameModel.bData.parentName, gameModel.bData.name, gameModel.bData.type, gameModel.bData.score_kh);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//public void ShowPopText(string str)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// GameManager.Instance.uiManager.ShowUI<PopPanel>(null, new string[] { str });
|
|
|
|
|
|
//}
|
|
|
|
|
|
//public void ClosePopText()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// GameManager.Instance.uiManager.CloseUI<PopPanel>();
|
|
|
|
|
|
//}
|
2025-09-10 19:05:05 +08:00
|
|
|
|
public void ShowTip(int i, bool isKaohe = false)
|
2025-09-08 14:51:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (main_gameModel.modeType == ModeType.KaoHe && !isKaohe) return;//<2F><><EFBFBD><EFBFBD>ģʽ<C4A3><CABD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
|
GameManager.Instance.uiManager.GetUI<TipPanel>().ShowTip(i);
|
|
|
|
|
|
GameManager.Instance.uiManager.ShowUI<TipPanel>();
|
|
|
|
|
|
}
|
|
|
|
|
|
public void HideTip()
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.Instance.uiManager.CloseUI<TipPanel>();
|
|
|
|
|
|
}
|
|
|
|
|
|
public void ShowCamera(string value)
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.Instance.virtualCameraManager.ShowCamera(value);
|
|
|
|
|
|
}
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
public void PlayBgm(int id, bool isKaohe = false)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (main_gameModel.modeType == ModeType.KaoHe && !isKaohe) return;//<2F><><EFBFBD><EFBFBD>ģʽ<C4A3><CABD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
|
if (gameModel.bData.sound.Split('|').Length <= id) return;
|
|
|
|
|
|
Game.Instance.eventManager.Raise(new PlaySoundEvent()
|
|
|
|
|
|
{
|
|
|
|
|
|
path = gameModel.bData.sound.Split('|')[id],
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
public GameObject Get(string value)
|
|
|
|
|
|
{
|
|
|
|
|
|
return GameManager.Instance.interactionManager._allInteraction[value];
|
|
|
|
|
|
}
|
|
|
|
|
|
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|
|
|
|
|
public void Show(string value)
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.Instance.interactionManager._allInteraction[value].SetActive(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
//<2F><><EFBFBD>ؽ<EFBFBD><D8BD><EFBFBD>
|
|
|
|
|
|
public void Hide(string value)
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.Instance.interactionManager._allInteraction[value].SetActive(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>Down<77><6E><EFBFBD><EFBFBD>
|
|
|
|
|
|
public void InteractionDown(string value, Action<GameObject> callBack)
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.Instance.interactionManager._allInteraction[value].TryGetComponent(out IDown down);
|
|
|
|
|
|
down?.Down(callBack);
|
|
|
|
|
|
}
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>Down<77><6E><EFBFBD><EFBFBD>
|
|
|
|
|
|
public void InteractionUp(string value, Action<GameObject> callBack)
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.Instance.interactionManager._allInteraction[value].TryGetComponent(out IUp up);
|
|
|
|
|
|
up?.Up(callBack);
|
|
|
|
|
|
}
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>Stay<61><79><EFBFBD><EFBFBD>
|
|
|
|
|
|
public void InteractionStay(string value, Action<GameObject> callBack)
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.Instance.interactionManager._allInteraction[value].TryGetComponent(out IStay stay);
|
|
|
|
|
|
stay?.Stay(callBack);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>Trigger<65><72><EFBFBD><EFBFBD>
|
|
|
|
|
|
public void InteractionTrigger(string value, Action<GameObject> callBack)
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.Instance.interactionManager._allInteraction[value].TryGetComponent(out ITrigger trigger);
|
|
|
|
|
|
trigger?.Trigger(callBack);
|
|
|
|
|
|
}
|
|
|
|
|
|
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|
|
|
|
|
public void Light(string value, bool isKaohe = false)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (main_gameModel.modeType == ModeType.KaoHe && !isKaohe) return;//<2F><><EFBFBD><EFBFBD>ģʽ<C4A3><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
Game.Instance.eventManager.Raise(new HighLightEvent()
|
|
|
|
|
|
{
|
|
|
|
|
|
name = value,
|
|
|
|
|
|
visiable = true
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// <20><EFBFBD><F2BFAAB8><EFBFBD> <20><EFBFBD><F2BFAABD><EFBFBD>
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public void Light_EnableInteraction(string value, bool isKaohe = false)
|
|
|
|
|
|
{
|
2025-09-10 19:05:05 +08:00
|
|
|
|
Light(value, isKaohe);
|
2025-09-08 14:51:28 +08:00
|
|
|
|
GameManager.Instance.interactionManager.EnableInteraction(value);
|
|
|
|
|
|
}
|
|
|
|
|
|
//<2F><><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>
|
|
|
|
|
|
public void Unlight(string value)
|
|
|
|
|
|
{
|
|
|
|
|
|
Game.Instance.eventManager.Raise(new HighLightEvent()
|
|
|
|
|
|
{
|
|
|
|
|
|
name = value,
|
|
|
|
|
|
visiable = false
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// <20>رո<D8B1><D5B8><EFBFBD> <20>رս<D8B1><D5BD><EFBFBD>
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public void Unlight_DisableInteraction(string value)
|
|
|
|
|
|
{
|
|
|
|
|
|
Unlight(value);
|
|
|
|
|
|
GameManager.Instance.interactionManager.DisableInteraction(value);
|
|
|
|
|
|
}
|
|
|
|
|
|
public void InteractionDisableAll()
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var item in GameManager.Instance.interactionManager._allInteraction)
|
|
|
|
|
|
{
|
|
|
|
|
|
item.Value.TryGetComponent(out ITrigger trigger);
|
|
|
|
|
|
trigger?.Trigger(null);
|
|
|
|
|
|
item.Value.TryGetComponent(out IStay stay);
|
|
|
|
|
|
stay?.Stay(null);
|
|
|
|
|
|
item.Value.TryGetComponent(out IDown down);
|
|
|
|
|
|
down?.Down(null);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>Timeline
|
|
|
|
|
|
Coroutine coroutine;
|
|
|
|
|
|
|
|
|
|
|
|
public void PlayClip(string value, Action callBack = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
float t = GetClipLength(value);
|
|
|
|
|
|
if (t > 0.1f) GameManager.Instance.uiManager.GetUI<TreeViewPanel>().LockAllBtn();
|
|
|
|
|
|
GameManager.Instance.timelineManager.PlayNormalClip(value);
|
|
|
|
|
|
if (Game.Instance)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (coroutine != null) Game.Instance.IEnumeratorManager.Stop(coroutine);
|
2025-09-10 19:05:05 +08:00
|
|
|
|
coroutine = Game.Instance.IEnumeratorManager.Run(WaitExecute(t, () =>
|
|
|
|
|
|
{
|
2025-09-08 14:51:28 +08:00
|
|
|
|
GameManager.Instance.uiManager.GetUI<TreeViewPanel>().UnLockAllBtn();
|
|
|
|
|
|
callBack?.Invoke();
|
|
|
|
|
|
}));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-09-10 19:05:05 +08:00
|
|
|
|
|
|
|
|
|
|
public void PlayClip(string value, Action callBack, float progress)
|
|
|
|
|
|
{
|
|
|
|
|
|
float t = GetClipLength(value);
|
|
|
|
|
|
if (t > 0.1f) GameManager.Instance.uiManager.CloseUI<TreeViewPanel>();
|
|
|
|
|
|
//GameManager.Instance.timelineManager.PlayNormalClip(value);
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < GameManager.Instance.timelineManager.clips.Length; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (GameManager.Instance.timelineManager.clips[i].name == value)
|
|
|
|
|
|
{
|
|
|
|
|
|
// ȷ<><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0-1֮<31><D6AE>
|
|
|
|
|
|
progress = Mathf.Clamp01(progress);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
|
|
|
|
|
float time = progress * (float)GameManager.Instance.timelineManager.clips[i].playClip.duration;
|
|
|
|
|
|
//GameManager.Instance.timelineManager.clips[i].PlayNormal();
|
|
|
|
|
|
time = Mathf.Clamp(time, 0f, (float)GameManager.Instance.timelineManager.clips[i].playClip.duration);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>Timeline<6E>ĵ<EFBFBD>ǰʱ<C7B0><CAB1>
|
|
|
|
|
|
GameManager.Instance.timelineManager.clips[i].playClip.time = time;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GameManager.Instance.timelineManager.clips[i].playClip.Play();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (Game.Instance)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (coroutine != null) Game.Instance.IEnumeratorManager.Stop(coroutine);
|
|
|
|
|
|
coroutine = Game.Instance.IEnumeratorManager.Run(WaitExecute(t, () =>
|
|
|
|
|
|
{
|
|
|
|
|
|
//GameManager.Instance.uiManager.GetUI<TreeViewPanel>().InteractableTrue(t);
|
|
|
|
|
|
if (main_gameModel.modeType == ModeType.ShiXun) GameManager.Instance.uiManager.ShowUI<TreeViewPanel>();
|
|
|
|
|
|
callBack?.Invoke();
|
|
|
|
|
|
}));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-08 14:51:28 +08:00
|
|
|
|
IEnumerator WaitExecute(float length, Action callBack)
|
|
|
|
|
|
{
|
|
|
|
|
|
yield return new WaitForSeconds(length);
|
|
|
|
|
|
callBack?.Invoke();
|
|
|
|
|
|
}
|
|
|
|
|
|
//ʱ<><CAB1>Timeline
|
|
|
|
|
|
public float GetClipLength(string value)
|
|
|
|
|
|
{
|
|
|
|
|
|
return GameManager.Instance.timelineManager.GetNormalTime(value);
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD> <20><EFBFBD><F2BFAAB8><EFBFBD>
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public void Show_Light(string value)
|
|
|
|
|
|
{
|
|
|
|
|
|
Show(value);
|
|
|
|
|
|
Light(value);
|
|
|
|
|
|
}
|
2025-09-10 19:05:05 +08:00
|
|
|
|
public void Show_Light_EnableInteraction(string value, bool isKaoHe = false)
|
2025-09-08 14:51:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
Show(value);
|
|
|
|
|
|
Light(value, isKaoHe);
|
|
|
|
|
|
GameManager.Instance.interactionManager.EnableInteraction(value);
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>رո<D8B1><D5B8><EFBFBD>
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public void Hide_Unlight(string value)
|
|
|
|
|
|
{
|
|
|
|
|
|
Hide(value);
|
|
|
|
|
|
Unlight(value);
|
|
|
|
|
|
}
|
|
|
|
|
|
public void Hide_Unlight_DisableInteraction(string value)
|
|
|
|
|
|
{
|
|
|
|
|
|
Hide(value);
|
|
|
|
|
|
Unlight(value);
|
|
|
|
|
|
GameManager.Instance.interactionManager.DisableInteraction(value);
|
|
|
|
|
|
}
|
2025-09-25 17:30:19 +08:00
|
|
|
|
//public void ShowTxtQuestion(int id, int score, int scoreId, Action nextFun)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// TxtSelectQuestionPanel txtSelectQuestionPanel = GameManager.Instance.uiManager.GetUI<TxtSelectQuestionPanel>();
|
|
|
|
|
|
// txtSelectQuestionPanel.ShowImgQuestion(id);
|
|
|
|
|
|
// txtSelectQuestionPanel.nextAction = nextFun;
|
|
|
|
|
|
// txtSelectQuestionPanel.subAction = isTrue =>
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (main_gameModel.modeType == ModeType.KaoHe)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (isTrue)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// AddScore(score, scoreId);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// AddScore(0, scoreId);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// Game.Instance.eventManager.Raise(new PlayTrueOrFalseEvent() { isTrue = isTrue });
|
|
|
|
|
|
// }
|
|
|
|
|
|
// };
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
public void ShowTxtQuestion(string stepName, int id, int scoreId, int score, Action nextFun)
|
2025-09-08 14:51:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
TxtSelectQuestionPanel txtSelectQuestionPanel = GameManager.Instance.uiManager.GetUI<TxtSelectQuestionPanel>();
|
2025-09-25 17:30:19 +08:00
|
|
|
|
txtSelectQuestionPanel.ShowImgQuestion(id, stepName);
|
2025-09-08 14:51:28 +08:00
|
|
|
|
txtSelectQuestionPanel.nextAction = nextFun;
|
2025-09-25 17:30:19 +08:00
|
|
|
|
txtSelectQuestionPanel.subAction = isTure =>
|
2025-09-10 19:05:05 +08:00
|
|
|
|
{
|
2025-09-25 17:30:19 +08:00
|
|
|
|
if (isTure)
|
2025-09-08 14:51:28 +08:00
|
|
|
|
{
|
2025-09-25 17:30:19 +08:00
|
|
|
|
GameManager.Instance.kaoheManager.AddScore(score, scoreId, (s, t) => {
|
|
|
|
|
|
GameManager.Instance.uiManager.GetUI<ScorePanel>().SetScore(s.ToString(), t.ToString());
|
|
|
|
|
|
});
|
2025-09-08 14:51:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2025-09-25 17:30:19 +08:00
|
|
|
|
GameManager.Instance.kaoheManager.AddScore(0, scoreId, null);
|
2025-09-08 14:51:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
2025-09-25 17:30:19 +08:00
|
|
|
|
|
2025-09-28 15:59:02 +08:00
|
|
|
|
//public void ShowImgQuestion(int id, int score, int scoreId, Action nextFun)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ImgSelectQuestionPanel imgSelectQuestionPanel = GameManager.Instance.uiManager.GetUI<ImgSelectQuestionPanel>();
|
|
|
|
|
|
// imgSelectQuestionPanel.ShowImgQuestion(id);
|
|
|
|
|
|
// imgSelectQuestionPanel.nextAction = nextFun;
|
|
|
|
|
|
// imgSelectQuestionPanel.subAction = isTrue =>
|
|
|
|
|
|
// {
|
|
|
|
|
|
// //if (main_gameModel.modeType == ModeType.KaoHe)
|
|
|
|
|
|
// //{
|
|
|
|
|
|
// if (isTrue)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// AddScore(score, scoreId);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// AddScore(0, scoreId);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// //}
|
|
|
|
|
|
// //else
|
|
|
|
|
|
// //{
|
|
|
|
|
|
// // Game.Instance.eventManager.Raise(new PlayTrueOrFalseEvent() { isTrue = isTrue });
|
|
|
|
|
|
// //}
|
|
|
|
|
|
// };
|
|
|
|
|
|
//}
|
2025-09-25 11:30:06 +08:00
|
|
|
|
//public void ShowDragQuestion(int id, int score, int scoreId, Action nextFun)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// DragQuestionPanel dragQuestionPanel = GameManager.Instance.uiManager.GetUI<DragQuestionPanel>();
|
|
|
|
|
|
// dragQuestionPanel.ShowDragQuestion(id);
|
|
|
|
|
|
// dragQuestionPanel.nextAction = nextFun;
|
|
|
|
|
|
// dragQuestionPanel.subAction = (a, b) =>
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (a)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// AddScore(score, scoreId);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// AddScore(0, scoreId);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// };
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
2025-09-28 15:59:02 +08:00
|
|
|
|
public void ShowImgQuestion(string stepName, int id, int score, int scoreId, Action nextFun)
|
|
|
|
|
|
{
|
|
|
|
|
|
ImgSelectQuestionPanel imgSelectQuestionPanel = GameManager.Instance.uiManager.GetUI<ImgSelectQuestionPanel>();
|
|
|
|
|
|
imgSelectQuestionPanel.ShowImgQuestion(id, stepName);
|
|
|
|
|
|
imgSelectQuestionPanel.nextAction = nextFun;
|
|
|
|
|
|
imgSelectQuestionPanel.subAction = isTrue =>
|
|
|
|
|
|
{
|
|
|
|
|
|
if (isTrue)
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.Instance.kaoheManager.AddScore(score, scoreId, (s, t) => {
|
|
|
|
|
|
GameManager.Instance.uiManager.GetUI<ScorePanel>().SetScore(s.ToString(), t.ToString());
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.Instance.kaoheManager.AddScore(0, scoreId, null);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-09-25 11:30:06 +08:00
|
|
|
|
public void ShowDragQuestion(string stepName, int id, int scoreId, int score, Action nextFun)
|
2025-09-08 14:51:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
DragQuestionPanel dragQuestionPanel = GameManager.Instance.uiManager.GetUI<DragQuestionPanel>();
|
2025-09-25 11:30:06 +08:00
|
|
|
|
dragQuestionPanel.ShowDragQuestion(id, stepName);
|
2025-09-08 14:51:28 +08:00
|
|
|
|
dragQuestionPanel.nextAction = nextFun;
|
2025-09-25 11:30:06 +08:00
|
|
|
|
dragQuestionPanel.subAction = isTrue => {
|
|
|
|
|
|
if (isTrue)
|
2025-09-08 14:51:28 +08:00
|
|
|
|
{
|
2025-09-25 11:30:06 +08:00
|
|
|
|
GameManager.Instance.kaoheManager.AddScore(score, scoreId, (s, t) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.Instance.uiManager.GetUI<ScorePanel>().SetScore(s.ToString(), t.ToString());
|
|
|
|
|
|
});
|
2025-09-08 14:51:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2025-09-25 11:30:06 +08:00
|
|
|
|
GameManager.Instance.kaoheManager.AddScore(0, scoreId, (s, t) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.Instance.uiManager.GetUI<ScorePanel>().SetScore(s.ToString(), t.ToString());
|
|
|
|
|
|
});
|
2025-09-08 14:51:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
2025-09-25 11:30:06 +08:00
|
|
|
|
|
2025-09-08 14:51:28 +08:00
|
|
|
|
public void ShowLineQuestion(int id, int score, int scoreId, Action nextFun)
|
|
|
|
|
|
{
|
|
|
|
|
|
LineQuestionPanel lineQuestionPanel = GameManager.Instance.uiManager.GetUI<LineQuestionPanel>();
|
|
|
|
|
|
lineQuestionPanel.ShowLineQuestion(id);
|
|
|
|
|
|
lineQuestionPanel.nextAction = nextFun;
|
2025-09-10 19:05:05 +08:00
|
|
|
|
lineQuestionPanel.subAction = isTure =>
|
|
|
|
|
|
{
|
2025-09-08 14:51:28 +08:00
|
|
|
|
if (isTure)
|
|
|
|
|
|
{
|
|
|
|
|
|
AddScore(score, scoreId);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
AddScore(0, scoreId);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
2025-09-10 19:05:05 +08:00
|
|
|
|
public void AddScore(int score, int id)
|
2025-09-08 14:51:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (score > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Game.Instance.eventManager.Raise(new PlayTrueOrFalseEvent() { isTrue = true });
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
Game.Instance.eventManager.Raise(new PlayTrueOrFalseEvent() { isTrue = false });
|
|
|
|
|
|
}
|
|
|
|
|
|
if (GameManager.Instance.uiManager.GetUI<TipBtnPanel>().tip == false)
|
|
|
|
|
|
{
|
2025-09-10 19:05:05 +08:00
|
|
|
|
GameManager.Instance.kaoheManager.AddScore(score, id, (s, t) =>
|
|
|
|
|
|
{
|
2025-09-08 14:51:28 +08:00
|
|
|
|
GameManager.Instance.uiManager.GetUI<ScorePanel>().SetScore(s.ToString(), t.ToString());
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
GameManager.Instance.uiManager.GetUI<TipBtnPanel>().tip = false;
|
|
|
|
|
|
}
|
2025-09-15 14:17:29 +08:00
|
|
|
|
|
|
|
|
|
|
public void AddScore(int score, int id, bool isYiJianShuRu)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (score.Equals(0) && isYiJianShuRu)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (GameManager.Instance.uiManager.GetUI<TipBtnPanel>().tip == false)
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.Instance.kaoheManager.AddScore(score, id, (s, t) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.Instance.uiManager.GetUI<ScorePanel>().SetScore(s.ToString(), t.ToString());
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-10 19:05:05 +08:00
|
|
|
|
public void ShowArrow(string txt, Vector2 v, int arrowType = 0, int showtime = 2, int hidetime = 5, bool isKaoHe = false)
|
2025-09-08 14:51:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (main_gameModel.modeType == ModeType.KaoHe && !isKaoHe) return;
|
|
|
|
|
|
GameManager.Instance.uiManager.GetUI<ArrowPanel>().ShowArrow(txt, v, arrowType, showtime, hidetime);
|
|
|
|
|
|
}
|
|
|
|
|
|
public void ShowArrow(Vector2 v, int arrowType = 0, int showtime = 2, int hidetime = 5, bool isKaoHe = false)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (main_gameModel.modeType == ModeType.KaoHe && !isKaoHe) return;
|
|
|
|
|
|
GameManager.Instance.uiManager.GetUI<ArrowPanel>().ShowArrow(v, arrowType, showtime, hidetime);
|
|
|
|
|
|
}
|
|
|
|
|
|
public void ShowArrow(string txt, string objName, int arrowType = 0, int showtime = 2, int hidetime = 5, bool isKaoHe = false)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (main_gameModel.modeType == ModeType.KaoHe && !isKaoHe) return;
|
2025-09-10 19:05:05 +08:00
|
|
|
|
GameManager.Instance.uiManager.GetUI<ArrowPanel>().ShowArrow(GameManager.Instance.interactionManager._allInteraction[objName].transform, txt, arrowType, showtime, hidetime);
|
2025-09-08 14:51:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
public void HideArrow()
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.Instance.uiManager.CloseUI<ArrowPanel>();
|
|
|
|
|
|
}
|
2025-09-10 19:05:05 +08:00
|
|
|
|
public void ShowTipBtn(Action action, int showt = 2)
|
2025-09-08 14:51:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (main_gameModel.modeType == ModeType.ShiXun) return;
|
|
|
|
|
|
GameManager.Instance.uiManager.GetUI<TipBtnPanel>().ShowTipBtn(action, showt);
|
|
|
|
|
|
}
|
|
|
|
|
|
public void HideTipBtn()
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.Instance.uiManager.CloseUI<TipBtnPanel>();
|
2025-09-10 19:05:05 +08:00
|
|
|
|
|
2025-09-08 14:51:28 +08:00
|
|
|
|
}
|
2025-09-10 19:05:05 +08:00
|
|
|
|
public void ShowSlider(Vector2 v, float maxValue, float minValue, float initValue, Action<float> updateaction, Action<float> okaction)
|
2025-09-08 14:51:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
GameManager.Instance.uiManager.GetUI<SliderPanel>().ShowPanel(v, maxValue, minValue, initValue, updateaction, okaction);
|
|
|
|
|
|
}
|
|
|
|
|
|
public void HideSlider()
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.Instance.uiManager.CloseUI<SliderPanel>();
|
|
|
|
|
|
}
|
2025-09-24 19:24:19 +08:00
|
|
|
|
//public void ShowSpeakPanel(Vector3 TransformWorldPlacement, string speakTxt, string keyword, int showtime, int hidetime, Action<int, string> action)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// GameManager.Instance.uiManager.GetUI<SpeakPanel>().SetTransformWorldPlacement(TransformWorldPlacement);
|
|
|
|
|
|
// if (main_gameModel.modeType == ModeType.ShiXun)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// GameManager.Instance.uiManager.GetUI<SpeakPanel>().ShowSpeakPanel(speakTxt, keyword, true, true, showtime, hidetime, action);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// GameManager.Instance.uiManager.GetUI<SpeakPanel>().ShowSpeakPanel(speakTxt, keyword, false, true, showtime, hidetime, action);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
public void ShowSpeakPanel(string stepName, string tipTxt, Vector2 v, int delayShowTime, int id, int score, Action<bool> action)
|
2025-09-08 14:51:28 +08:00
|
|
|
|
{
|
2025-09-24 19:24:19 +08:00
|
|
|
|
GameManager.Instance.uiManager.GetUI<SpeakPanel>().ShowSpeakPanel(stepName, tipTxt, v, delayShowTime, id, score, action);
|
2025-09-08 14:51:28 +08:00
|
|
|
|
}
|
2025-09-24 19:24:19 +08:00
|
|
|
|
|
2025-09-08 14:51:28 +08:00
|
|
|
|
public void ShowNextPanel(Action action)
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.Instance.uiManager.GetUI<NextPanel>().ShowPanel(action);
|
|
|
|
|
|
}
|
2025-09-10 19:05:05 +08:00
|
|
|
|
public void ShowVideoPanel(string path, Action action)
|
2025-09-08 14:51:28 +08:00
|
|
|
|
{
|
2025-09-10 19:05:05 +08:00
|
|
|
|
GameManager.Instance.uiManager.GetUI<VideoPanel>().ShowVideo(path, action);
|
2025-09-08 14:51:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
public void HideVideoPanel()
|
|
|
|
|
|
{
|
|
|
|
|
|
GameManager.Instance.uiManager.CloseUI<VideoPanel>();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|