예제 #1
0
        //-----------------------------------------------------------------------------
        public void Set(int value, AREntity entity)
        {
            if (!HasSetPermission(entity))
            {
                Debug.LogError("Error in SetProperty :: this entity has no permission");
                return;
            }

            mValue = value;

            if (OnPropertyChanged != null)
            {
                OnPropertyChanged(this, null);
            }
        }
예제 #2
0
        public override void RegisterMsg(int msg_id, AREntity entity)
        {
            //Debug.Log("Final in MsgEntity.RegisterMsg()");
            if (msgRegisterDic == null)
            {
                msgRegisterDic = new Dictionary <int, List <AREntity> >();
            }

            if (msgRegisterDic.ContainsKey(msg_id))
            {
                msgRegisterDic[msg_id].Add(entity);
            }
            else
            {
                List <AREntity> paramList = new List <AREntity>()
                {
                    entity
                };
                msgRegisterDic.Add(msg_id, paramList);
            }
        }
예제 #3
0
        /// <summary>
        /// 注册模块
        /// </summary>
        /// <param name="entityID"></param>
        /// <param name="entity"></param>
        public void RegisterEntity(int entityID, AREntity entity)
        {
            if (entityDic == null)
            {
                entityDic = new Dictionary <int, AREntity>();
            }

            int key = entityID;

            if (!entityDic.ContainsValue(entity))
            {
                entity.EntityID = key;
                entityDic.Add(entity.EntityID, entity);
                //Debug.Log((EntityLib)entity.EntityID);
            }
            else
            {
                Debug.LogError("Error in RegisterEntity :: this entity has already been registered");
            }

            entity.Init();
        }
예제 #4
0
 /// <summary>
 /// 用于entity注册功能性消息(功能模块需要接收的消息需要在Init时进行注册)
 /// </summary>
 /// <param name="msg_id"></param>
 public virtual void RegisterMsg(int msg_id, AREntity entity)
 {
     entityMgr.RegisterMsg(msg_id, entity);
 }
예제 #5
0
 public override void RegisterMsg(int msg_id, AREntity entity)
 {
     MsgEntityIns.RegisterMsg(msg_id, entity);
 }
예제 #6
0
 /// <summary>
 /// 检测是否具有修改数据的权限
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 private bool HasSetPermission(AREntity entity)
 {
     return entity.EntityID == (int)EntityLib.PlayerPrefsEntity;
 }
예제 #7
0
 // Use this for initialization
 private void Awake()
 {
     entity = AREntity.Instance;
     // 注册EntityMgr
     entity.SetEntityMgr(new EntityMgr());
 }