/// <summary> /// 生成新加Component的Patch /// </summary> /// <param name="rightEntity"></param> /// <param name="leftEntity"></param> /// <param name="rightComponent"></param> public override void OnLeftComponentMissing(IGameEntity leftEntity, IGameEntity rightEntity, IGameComponent rightComponent) { logger.DebugFormat("AddComponentPatch :{0}, {1}", leftEntity.EntityKey, rightComponent.GetComponentId()); var componentPatch = AddComponentPatch.Allocate(rightComponent); currentEntityPatch.AddComponentPatch(componentPatch); componentPatch.ReleaseReference(); }
/// <summary> /// 在Patch中生成新加Entity的信息 /// </summary> /// <param name="rightEntity"></param> public override void OnLeftEntityMissing(IGameEntity rightEntity) { var addEntityPath = AddEntityPatch.Allocate(); addEntityPath.Key = rightEntity.EntityKey; logger.DebugFormat("AddEntityPatch ::{0},", rightEntity.EntityKey); foreach (var comp in rightEntity.ComponentList) { AddComponentPatch patch = AddComponentPatch.Allocate(comp); addEntityPath.AddComponentPatch(patch); patch.ReleaseReference(); } snapshotPatch.AddEntityPatch(addEntityPath); addEntityPath.ReleaseReference(); }