/// <summary>
        /// 生成删除Entity的Patch
        /// </summary>
        /// <param name="leftEntity"></param>
        public override void OnRightEntityMissing(IGameEntity leftEntity)
        {
            logger.DebugFormat("DeleteEntityPatch ::{0},", leftEntity.EntityKey);
            EntityKey entityKey = leftEntity.EntityKey;
            var       patch     = DeleteEntityPatch.Allocate(entityKey);

            snapshotPatch.AddEntityPatch(patch);
            patch.ReleaseReference();
        }
示例#2
0
        private AbstractEntityPatch CreateEntityPatch(EntityReplicateOperationType type)
        {
            switch (type)
            {
            case EntityReplicateOperationType.Add:
                return(Patch.AddEntityPatch.Allocate());

            case EntityReplicateOperationType.Del:
                return(DeleteEntityPatch.Allocate());

            case EntityReplicateOperationType.Mod:
                return(ModifyEntityPatch.Allocate());

            default:
                throw new Exception(string.Format("type {0} not exist", type));
            }
        }