Exemplo n.º 1
0
        /// <summary>
        /// 删除游戏逻辑
        /// </summary>
        public bool RemoveGameLogic(GameLogic logic)
        {
            if (logic == null || logic.Name == 0)
            {
                return(false);
            }

            eGameLogicType type = logic.Type;

            if (type < 0 || type >= eGameLogicType.MAX)
            {
                return(false);
            }

            if (!mLogics.ContainsKey(type))
            {
                return(false);
            }

            if (!mLogics[type].ContainsKey(logic.Name))
            {
                return(false);
            }

            return(mLogics[type].Remove(logic.Name));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加游戏逻辑
        /// </summary>
        public bool AddGameLogic(GameLogic logic)
        {
            if (logic == null || logic.Name == 0)
            {
                return(false);
            }

            eGameLogicType type = logic.Type;

            if (type < 0 || type >= eGameLogicType.MAX)
            {
                return(false);
            }

            if (!mLogics.ContainsKey(type))
            {
                mLogics[type] = new Dictionary <short, GameLogic>();
            }

            if (mLogics[type].ContainsKey(logic.Name))
            {
                return(false);
            }

            mLogics[type][logic.Name] = logic;

            return(true);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 取得游戏逻辑
        /// </summary>
        public GameLogic GetGameLogic(eGameLogicType type, short name)
        {
            if (type < 0 || type >= eGameLogicType.MAX || name == 0)
            {
                return(null);
            }

            if (mLogics.ContainsKey(type) && mLogics[type].ContainsKey(name))
            {
                return(mLogics[type][name]);
            }

            return(null);
        }
Exemplo n.º 4
0
 public BaseGameLogic(eGameLogicType type, short name, logicT logic) : base(type, name)
 {
     mLogic = logic;
 }
Exemplo n.º 5
0
 public GameLogic(eGameLogicType type, short name)
 {
     mType = type;
     mName = name;
     GameLogicManager.Instance.AddGameLogic(this);
 }