NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/JumpTo/JumpToManager.cs

72 lines
1.9 KiB
C#

using System;
using System.Collections.Generic;
using cfg;
using cfg.LevelCfg;
using Framework;
using Gameplay;
using Gameplay.Level;
using PhxhSDK;
namespace Gameplay
{
public class JumpToManager
{
private static Dictionary<JumpFuncType, Delegate> _jumpDic = new Dictionary<JumpFuncType, Delegate>()
{
[JumpFuncType.Cultivate_Character] = (Action<int>) JumpToCultivateCharacter,
};
private static void _DoJumpFunc(JumpFuncType key)
{
var action = _jumpDic[key];
if (action is Action act)
{
act();
}
}
private static void _DoJumpFunc<T>(JumpFuncType key, T param)
{
var action = _jumpDic[key];
if (action is Action<T> act)
{
act(param);
}
}
public static void JumpFunc(JumpFuncType key)
{
_DoJumpFunc(key);
}
public static void JumpFunc<T>(JumpFuncType key, T param)
{
_DoJumpFunc(key, param);
}
public static void JumpToCultivateCharacter(int uid)
{
}
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;
}
//TODO: levelmanager检查关卡合法性与解锁情况
LevelInfo levelInfo = LevelManager.Instance.GetLevelInfoByID(levelId);//new LevelInfo(data);
await UI_LevelSelectController.Open(levelInfo);
UI_LevelDetailController.Open(levelInfo);
//EventManager.Instance.Send(EventManager.EventName.WindowJumpFinished);
}
}
}