using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using DG.Tweening;
using UnityEngine.U2D;
using ActionForm = System.Action<string, int>;
//using UnityEditor;
public enum RedStateType
{
HERO_RED,//英灵红点
HERO_UPGRADE,//进阶红点
HERO_DESTINY,//宿命红点
HERO_TREE,//树枝红点
HERO_STORY,//故事红点
HERO_SKILL_SLOT,//空技能槽红点
HERO_SKILL_SLOT_ID,//指定空技能槽红点
};
public delegate bool RedFunctionDelegate(params object[] paramNames);
public class RedPoint : MonoBehaviour
{
public List<RedStateType> _keys;
private Dictionary<RedStateType, RedFunctionDelegate> _dic = new Dictionary<RedStateType, RedFunctionDelegate>();
void Awake()
{
if (this._dic.Count > 0)
return;
_dic.Add(RedStateType.HERO_RED, RedController.Ins.isHeroRed);
_dic.Add(RedStateType.HERO_UPGRADE, RedController.Ins.isHeroUpgradeRed);
_dic.Add(RedStateType.HERO_DESTINY,
枚举类型作为key,函数作为value的delegate调用方案
最新推荐文章于 2023-06-25 17:00:44 发布
本文探讨了一种使用枚举类型作为键,函数作为值的委托调用方案。通过这种方式,可以实现根据枚举状态执行不同的操作,提高了代码的可读性和组织性。这种设计模式在处理多态行为或条件分支时非常有用。
最低0.47元/天 解锁文章
481

被折叠的 条评论
为什么被折叠?



