2023-12-27 19:42:58 +08:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using cfg;
|
2024-05-24 13:37:59 +08:00
|
|
|
using cfg.LevelCfg;
|
|
|
|
|
using Framework;
|
2023-12-27 19:42:58 +08:00
|
|
|
using Gameplay;
|
2024-05-24 13:37:59 +08:00
|
|
|
using Gameplay.Level;
|
|
|
|
|
using PhxhSDK;
|
2023-12-27 19:42:58 +08:00
|
|
|
|
|
|
|
|
namespace Gameplay
|
|
|
|
|
{
|
|
|
|
|
public class JumpToManager
|
|
|
|
|
{
|
|
|
|
|
private static Dictionary<JumpFuncType, Delegate> _jumpDic = new Dictionary<JumpFuncType, Delegate>()
|
|
|
|
|
{
|
2024-05-23 18:50:37 +08:00
|
|
|
[JumpFuncType.Cultivate_Character] = (Action<int>) JumpToCultivateCharacter,
|
2024-05-28 12:32:37 +08:00
|
|
|
[JumpFuncType.Level_Detail] = (Action<int>) JumpToLevelDetail
|
2023-12-27 19:42:58 +08:00
|
|
|
};
|
|
|
|
|
|
2023-12-28 14:06:06 +08:00
|
|
|
private static void _DoJumpFunc(JumpFuncType key)
|
2023-12-27 19:42:58 +08:00
|
|
|
{
|
|
|
|
|
var action = _jumpDic[key];
|
|
|
|
|
if (action is Action act)
|
|
|
|
|
{
|
|
|
|
|
act();
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-23 18:50:37 +08:00
|
|
|
|
|
|
|
|
private static void _DoJumpFunc<T>(JumpFuncType key, T param)
|
|
|
|
|
{
|
|
|
|
|
var action = _jumpDic[key];
|
|
|
|
|
if (action is Action<T> act)
|
|
|
|
|
{
|
|
|
|
|
act(param);
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-12-27 19:42:58 +08:00
|
|
|
|
2023-12-28 14:06:06 +08:00
|
|
|
public static void JumpFunc(JumpFuncType key)
|
|
|
|
|
{
|
|
|
|
|
_DoJumpFunc(key);
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-23 18:50:37 +08:00
|
|
|
public static void JumpFunc<T>(JumpFuncType key, T param)
|
|
|
|
|
{
|
|
|
|
|
_DoJumpFunc(key, param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void JumpToCultivateCharacter(int uid)
|
2023-12-27 19:42:58 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2024-05-24 13:37:59 +08:00
|
|
|
|
|
|
|
|
public static async void JumpToLevelDetail(int levelId)
|
|
|
|
|
{
|
|
|
|
|
DebugUtil.Log("Jump to : " + levelId);
|
|
|
|
|
DataLevel data = TableManager.Instance.Tables.Level.Get(levelId);
|
|
|
|
|
if(data == null)
|
|
|
|
|
{
|
|
|
|
|
DebugUtil.Log("Jump to level detail failed, level id not found: " + levelId);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-24 14:21:11 +08:00
|
|
|
//TODO: levelmanager检查关卡合法性与解锁情况
|
2024-05-24 13:37:59 +08:00
|
|
|
|
2024-05-24 14:21:28 +08:00
|
|
|
LevelInfo levelInfo = LevelManager.Instance.GetLevelInfoByID(levelId);//new LevelInfo(data);
|
2024-05-24 13:37:59 +08:00
|
|
|
|
|
|
|
|
await UI_LevelSelectController.Open(levelInfo);
|
2024-05-24 14:50:10 +08:00
|
|
|
UI_LevelDetailController.Open(levelInfo);
|
2024-05-24 13:37:59 +08:00
|
|
|
|
2024-05-24 14:21:11 +08:00
|
|
|
//EventManager.Instance.Send(EventManager.EventName.WindowJumpFinished);
|
2024-05-24 13:37:59 +08:00
|
|
|
}
|
2023-12-27 19:42:58 +08:00
|
|
|
}
|
|
|
|
|
}
|