public void TestPoolManagerMonitorSuccess() { int _poolSize = 5, _connectTimeout = 300, _monitorInterval = 1000; string _resourceID = string.Empty; //Create PoolManager instance and start it. PoolManager<Socket> _poolManager = new PoolManager<Socket>(_poolSize, _connectTimeout, _monitorInterval); _poolManager.Start(new SocketResourceHandle(this.ListeningSocket_Host, this.ListeningSocket_Port)); //Get a resource and store its ID, then close this resource Resource<Socket> _resource = _poolManager.GetResource(); _resourceID = _resource.ID; _resource.Current.Close(); //Delay current thread with MonitorInterval System.Threading.Thread.Sleep(_monitorInterval + 30); //Reacquire the resource which matches the ID Resource<Socket> _resource2 = _poolManager.GetResource(); while (_resource2 != null && _resource2.ID != _resourceID) { _resource2 = _poolManager.GetResource(); } //Check whether the resource is open Assert.AreEqual(true, _resource2 == null ? false : _resource2.Available, string.Format("The monitor didn't work successfully.")); _poolManager.Dispose(); }
void Awake() { myTransform = transform; shootsPool = new PoolManager(shoot, 10); shootsPool.Init(); currentAngle = 0.0f; }
void Awake() { if (!isSeeker) { shootsPool = new PoolManager (shoot, 10); shootsPool.Init (); } animator = gameObject.GetComponentInChildren<Animator>(); currentAngle = 0f; }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
void Awake() { if(Instance != null && Instance != this) { Destroy(gameObject); } Instance = this; currentPools = new Dictionary<string, ObjectPool>(); }
/// <summary> /// Called when an object containing a component of type PoolManager is selected. /// </summary> public void OnEnable() { TargetObject = target as PoolManager; PoolCollection = TargetObject.PrefabPoolCollection; PrefabFoldouts = new List<bool>(); if (PoolCollection != null) for (int n = 0; n < PoolCollection.Count; n++) PrefabFoldouts.Add(true); ClearNullReferences(); }
public void Fire(PoolManager.PoolType type) { if (Time.time - LastFire > CoolDown) { GameObject laser = PoolManager.Instance.FakeInstantiate(type); laser.transform.SetParent(null); laser.SetActive(true); laser.transform.position = transform.position; laser.transform.rotation = transform.rotation; LastFire = Time.time; } }
void Awake () { current = this; pooledObjects = new List<GameObject> (); for (int i = 0; i < pooledAmount; i++) { GameObject obj = (GameObject)Instantiate (pooledObject); obj.SetActive (false); pooledObjects.Add (obj); obj.transform.SetParent (this.transform); } }
public void TestPoolManagerInitializeSuccess() { int _poolSize = 5; //Create PoolManager instance and start it. PoolManager<Socket> _poolManager = new PoolManager<Socket>(_poolSize); _poolManager.Start(new SocketResourceHandle(this.ListeningSocket_Host, this.ListeningSocket_Port)); //Get all resources List<Resource<Socket>> _resourceList = new List<Resource<Socket>>(); Resource<Socket> _resource = _poolManager.GetResource(); while (_resource != null) { _resourceList.Add(_resource); _resource = _poolManager.GetResource(); } //Check whether the count of resources match the PoolSize Assert.AreEqual(_poolSize, _resourceList.Count, string.Format("The PoolSize is {0}, but the count of resources I got was {1}", _poolSize, _resourceList.Count)); _poolManager.Dispose(); }
public abstract UserBinaryObject DeepClone(PoolManager poolManager);
public override void Destroy() { Stop(); PoolManager.Despawn(xform); }
void register.IRegisterable.SceneRegister(register.SceneInformation sceneInformation, register.LightsAndCameras lightsAndCameras, PoolManager poolManager) { }
public static ProtoPoolBase <LargeUserBinaryObject> GetLargeUserBinaryObjectPool(this PoolManager manager) { return(manager?.GetPool <LargeUserBinaryObject>(ObjectPoolType.LargeUserBinaryObject)); }
public static ProtoPoolBase <RemoveResponse> GetProtobufRemoveResponsePool(this PoolManager manager) { return(manager?.GetSimplePool <RemoveResponse>(ObjectPoolType.ProtobufRemoveResponse)); }
void Awake() { _instance = this; DontDestroyOnLoad(gameObject); }
void register.IRegisterable.RenderRegister(register.Viewpoint viewpoint, ref Viewport viewport, render.RenderQueueGroup queueGroup, PoolManager poolManager) { ContainmentType containment; viewpoint.Frustum.Contains(ref _boundingSphere, out containment); if (containment == ContainmentType.Disjoint) { return; } queueGroup.Register( EllipsoidPrimitiveRenderable.CreateInstance(poolManager.GetPool<EllipsoidPrimitiveRenderable>(), _verticesCount, _indicesWFCount, _indicesCount, _vertexBuffer, _indicesWFBuffer, _indicesBuffer, _world, viewpoint.View, viewpoint.Projection, _color, _isOpaque), render.RenderQueueNames.Custom4); }
protected override void OnExecute() { PoolManager.WarmPool(this.source, this.count); // fire exposed method: OnComplete(); base.OnExecute(); }
public void Init(PoolManager Pool) { _pool = Pool; }
/// <summary> /// Registers types with the Compact Serializatin Framework. Range of reserved /// typeHandle is (61 - 1000). /// </summary> static public void RegisterCompactTypes(PoolManager poolManager) { TypeSurrogateSelector.RegisterTypeSurrogate(new ArraySerializationSurrogate(typeof(CacheEntry[]))); TypeSurrogateSelector.RegisterTypeSurrogate(new CustomArraySerializationSurrogate(typeof(CustomArraySerializationSurrogate))); CompactFormatterServices.RegisterCompactType(typeof(CacheEntry), 61); CompactFormatterServices.RegisterCompactType(typeof(CounterHint), 62); CompactFormatterServices.RegisterCompactType(typeof(TimestampHint), 63); CompactFormatterServices.RegisterCompactType(typeof(PriorityEvictionHint), 64); CompactFormatterServices.RegisterCompactType(typeof(CacheStatistics), 65); CompactFormatterServices.RegisterCompactType(typeof(ClusterCacheStatistics), 66); CompactFormatterServices.RegisterCompactType(typeof(NodeInfo), 67); CompactFormatterServices.RegisterCompactType(typeof(AggregateExpirationHint), 68); CompactFormatterServices.RegisterCompactType(typeof(IdleExpiration), 69, pool: null); CompactFormatterServices.RegisterCompactType(typeof(LockExpiration), 135, pool: null); CompactFormatterServices.RegisterCompactType(typeof(FixedExpiration), 70); CompactFormatterServices.RegisterCompactType(typeof(FixedIdleExpiration), 72, pool: null); CompactFormatterServices.RegisterCompactType(typeof(DependencyHint), 73, pool: null); CompactFormatterServices.RegisterCompactType(typeof(CompactCacheEntry), 105); CompactFormatterServices.RegisterCompactType(typeof(Caching.Notifications), 107, null); CompactFormatterServices.RegisterCompactType(typeof(CallbackInfo), 111); CompactFormatterServices.RegisterCompactType(typeof(AsyncCallbackInfo), 112); CompactFormatterServices.RegisterCompactType(typeof(BucketStatistics), 117); CompactFormatterServices.RegisterCompactType(typeof(CacheInsResultWithEntry), 118); CompactFormatterServices.RegisterCompactType(typeof(UserBinaryObject), 125, pool: null); CompactFormatterServices.RegisterCompactType(typeof(Runtime.Caching.ClientInfo), 370); CompactFormatterServices.RegisterCompactType(typeof(ClientActivityNotification), 371); CompactFormatterServices.RegisterCompactType(typeof(Common.ProductVersion), 302); CompactFormatterServices.RegisterCompactType(typeof(Common.DataStructures.RequestStatus), 303); CompactFormatterServices.RegisterCompactType(typeof(BucketStatistics.TopicStats), 383); #if (!CLIENT && !DEVELOPMENT) CompactFormatterServices.RegisterCompactType(typeof(ReadFromStreamOperation), 138); CompactFormatterServices.RegisterCompactType(typeof(WriteToStreamOperation), 139); CompactFormatterServices.RegisterCompactType(typeof(GetStreamLengthOperation), 140); CompactFormatterServices.RegisterCompactType(typeof(ClusterOperationResult), 141); CompactFormatterServices.RegisterCompactType(typeof(OpenStreamResult), 142); CompactFormatterServices.RegisterCompactType(typeof(CloseStreamResult), 143); CompactFormatterServices.RegisterCompactType(typeof(ReadFromStreamResult), 144); CompactFormatterServices.RegisterCompactType(typeof(WriteToStreamResult), 145); CompactFormatterServices.RegisterCompactType(typeof(GetStreamLengthResult), 146); CompactFormatterServices.RegisterCompactType(typeof(OpenStreamOperation), 147); CompactFormatterServices.RegisterCompactType(typeof(CloseStreamOperation), 148); CompactFormatterServices.RegisterCompactType(typeof(StateTxfrInfo), 116); CompactFormatterServices.RegisterCompactType(typeof(DataAffinity), 106); CompactFormatterServices.RegisterCompactType(typeof(PartitionedCommonBase.Identity), 77); CompactFormatterServices.RegisterCompactType(typeof(Function), 75); CompactFormatterServices.RegisterCompactType(typeof(AggregateFunction), 76); CompactFormatterServices.RegisterCompactType(typeof(ReplicatedCacheBase.Identity), 78); CompactFormatterServices.RegisterCompactType(typeof(AcknowledgeMessageOperation), 358); CompactFormatterServices.RegisterCompactType(typeof(AssignmentOperation), 359); CompactFormatterServices.RegisterCompactType(typeof(ClusterTopicOperation), 360); CompactFormatterServices.RegisterCompactType(typeof(RemoveMessagesOperation), 361); CompactFormatterServices.RegisterCompactType(typeof(StoreMessageOperation), 362); CompactFormatterServices.RegisterCompactType(typeof(AtomicAcknowledgeMessageOperation), 384); CompactFormatterServices.RegisterCompactType(typeof(GetTransferrableMessageOperation), 385); CompactFormatterServices.RegisterCompactType(typeof(AtomicRemoveMessageOperation), 386); CompactFormatterServices.RegisterCompactType(typeof(GetAssignedMessagesResponse), 388); CompactFormatterServices.RegisterCompactType(typeof(GetAssignedMessagesOperation), 389); CompactFormatterServices.RegisterCompactType(typeof(CacheItemBase), 431, pool: null); CompactFormatterServices.RegisterCompactType(typeof(InsertLoggedOperation), 458); CompactFormatterServices.RegisterCompactType(typeof(MessageLoggedOperation), 459); CompactFormatterServices.RegisterCompactType(typeof(RemoveLoggedOperation), 460); CompactFormatterServices.RegisterCompactType(typeof(ReplicaStateTxfrInfo), 469); #endif CompactFormatterServices.RegisterCompactType(typeof(VirtualArray), 149); CompactFormatterServices.RegisterCompactType(typeof(Common.Locking.LockManager), 150); CompactFormatterServices.RegisterCompactType(typeof(DistributionMaps), 160); CompactFormatterServices.RegisterCompactType(typeof(EventCacheEntry), 262); CompactFormatterServices.RegisterCompactType(typeof(EventContext), 263); CompactFormatterServices.RegisterCompactType(typeof(LockMetaInfo), 264); CompactFormatterServices.RegisterCompactType(typeof(NodeExpiration), 74); CompactFormatterServices.RegisterCompactType(typeof(SqlCmdParams), 134); CompactFormatterServices.RegisterCompactType(typeof(StateTransferInfo), 130); CompactFormatterServices.RegisterCompactType(typeof(ReplicatorStatusInfo), 131); CompactFormatterServices.RegisterCompactType(typeof(CompressedValueEntry), 133); CompactFormatterServices.RegisterCompactType(typeof(OperationContext), 153); CompactFormatterServices.RegisterCompactType(typeof(OperationContext[]), 345); CompactFormatterServices.RegisterCompactType(typeof(EventContext[]), 346); CompactFormatterServices.RegisterCompactType(typeof(OperationID), 163); CompactFormatterServices.RegisterCompactType(typeof(Persistence.Event), 258); CompactFormatterServices.RegisterCompactType(typeof(Persistence.EventInfo), 259); CompactFormatterServices.RegisterCompactType(typeof(Common.Events.PollingResult), 357); CompactFormatterServices.RegisterCompactType(typeof(Common.TopicOperation), 373); CompactFormatterServices.RegisterCompactType(typeof(Common.SubscriptionOperation), 374); CompactFormatterServices.RegisterCompactType(typeof(Common.SubscriptionInfo), 375); CompactFormatterServices.RegisterCompactType(typeof(Common.MessageMetaData), 376); CompactFormatterServices.RegisterCompactType(typeof(MessageInfo), 377); CompactFormatterServices.RegisterCompactType(typeof(Caching.Messaging.Message), 379); CompactFormatterServices.RegisterCompactType(typeof(ClientSubscriptionManager.State), 380); CompactFormatterServices.RegisterCompactType(typeof(TransferrableMessage), 381); CompactFormatterServices.RegisterCompactType(typeof(Topic.State), 382); CompactFormatterServices.RegisterCompactType(typeof(Common.Monitoring.TopicStats), 387); CompactFormatterServices.RegisterCompactType(typeof(Alachisoft.NCache.Config.NewDom.CacheServerConfig), 393); CompactFormatterServices.RegisterCompactType(typeof(Alachisoft.NCache.Config.NewDom.CacheDeployment), 394); CompactFormatterServices.RegisterCompactType(typeof(Alachisoft.NCache.Config.NewDom.ServersNodes), 396); CompactFormatterServices.RegisterCompactType(typeof(Caching.Messaging.EventMessage), 470); CompactFormatterServices.RegisterCompactType(typeof(MultiCastMessage), 471); CompactFormatterServices.RegisterCompactType(typeof(Caching.EventId), 472); CompactFormatterServices.RegisterCompactType(typeof(MessageResponse), 503); CompactFormatterServices.RegisterCompactType(typeof(TopicState), 505); CompactFormatterServices.RegisterCompactType(typeof(SubscriptionIdentifier), 506); CompactFormatterServices.RegisterCompactType(typeof(Subscriptions), 507); CompactFormatterServices.RegisterCompactType(typeof(ExclusiveSubscriptions), 508); CompactFormatterServices.RegisterCompactType(typeof(EventSubscriptions), 515); CompactFormatterServices.RegisterCompactType(typeof(EventMessageBase), 519); CompactFormatterServices.RegisterCompactType(typeof(ExpireSubscriptionOperation), 521); CompactFormatterServices.RegisterCompactType(typeof(BucketStatistics[]), 523); CompactFormatterServices.RegisterCompactType(typeof(ClientProfile), 538); #region - [PoolStats] - CompactFormatterServices.RegisterCompactType(typeof(PoolStats), 526); CompactFormatterServices.RegisterCompactType(typeof(ArrayPoolStats), 527); CompactFormatterServices.RegisterCompactType(typeof(ObjectPoolStats), 528); CompactFormatterServices.RegisterCompactType(typeof(StringPoolStats), 529); CompactFormatterServices.RegisterCompactType(typeof(PoolStatsRequest), 530); CompactFormatterServices.RegisterCompactType(typeof(ArrayPoolStats[]), 531); CompactFormatterServices.RegisterCompactType(typeof(ObjectPoolStats[]), 532); CompactFormatterServices.RegisterCompactType(typeof(StringPoolStats[]), 533); #endregion }
internal static bool ReturnUserBinaryObjectToPool(UserBinaryObject userBinaryObject, PoolManager poolManager) { if (poolManager == null || userBinaryObject == null || !userBinaryObject.FromPool(poolManager)) { return(false); } userBinaryObject.ReturnLeasableToPool(); if (userBinaryObject is SmallUserBinaryObject smallUserBinaryObject) { poolManager.GetSmallUserBinaryObjectPool().Return(smallUserBinaryObject); } else if (userBinaryObject is LargeUserBinaryObject largeUserBinaryObject) { poolManager.GetLargeUserBinaryObjectPool().Return(largeUserBinaryObject); } return(true); }
internal static bool ReturnCacheInsResultToPool(CacheInsResultWithEntry result, PoolManager poolManager) { if (poolManager == null || result == null || !result.FromPool(poolManager)) { return(false); } result.ReturnLeasableToPool(); poolManager.GetCacheInsResultWithEntryPool().Return(result); return(true); }
internal static bool ReturnExpirationHintToPool(ExpirationHint expirationHint, PoolManager poolManager) { if (poolManager == null) { return(false); } if (expirationHint != null && expirationHint.FromPool(poolManager)) { expirationHint.ReturnLeasableToPool(); switch (expirationHint._hintType) { case ExpirationHintType.FixedExpiration: poolManager.GetFixedExpirationPool().Return((FixedExpiration)expirationHint); break; case ExpirationHintType.TTLExpiration: poolManager.GetTTLExpirationPool().Return((TTLExpiration)expirationHint); break; case ExpirationHintType.FixedIdleExpiration: poolManager.GetFixedIdleExpirationPool().Return((FixedIdleExpiration)expirationHint); break; #if !(DEVELOPMENT || CLIENT) case ExpirationHintType.NodeExpiration: poolManager.GetNodeExpirationPool().Return((NodeExpiration)expirationHint); break; #endif case ExpirationHintType.IdleExpiration: poolManager.GetIdleExpirationPool().Return((IdleExpiration)expirationHint); break; case ExpirationHintType.AggregateExpirationHint: poolManager.GetAggregateExpirationHintPool().Return((AggregateExpirationHint)expirationHint); break; default: throw new System.Exception("Invalid expiration hint."); } return(true); } return(false); }
private void DeleteItem(UIDragListItem item) { PoolManager.ReturnObject(item as LogUIItem); }
public void OnEnable() { manager = target as PoolManager; }
public EntityFactory(PoolManager Pool) { Init(Pool); }
public void OnParticleSystemStopped() { Debug.Log("Stop"); PoolManager.ReleaseObject(this.gameObject); }
public static CacheInsResultWithEntry CreateCacheInsResultWithEntry(PoolManager poolManager) { return(poolManager.GetCacheInsResultWithEntryPool()?.Rent(true) ?? new CacheInsResultWithEntry()); }
/// <summary> /// Set the reference for the Pool manager /// </summary> /// <param name="_poolManager"></param> public void SetPoolManager(PoolManager _poolManager) { I.poolMng = _poolManager; }
public EvictionHint CompatibleHint(EvictionHint eh, PoolManager poolManager) { return(_evctPolicy.CompatibleHint(eh, poolManager)); }
public static ProtoPoolBase <SmallUserBinaryObject> GetSmallUserBinaryObjectPool(this PoolManager manager) { return(manager?.GetPool <SmallUserBinaryObject>(ObjectPoolType.SmallUserBinaryObject)); }
private void Awake() { _instance = this; }
public static ProtoPoolBase <RemoveCommand> GetProtobufRemoveCommandPool(this PoolManager manager) { return(manager?.GetSimplePool <RemoveCommand>(ObjectPoolType.ProtobufRemoveCommand)); }
public void SetPoolManagerReference(PoolManager poolManager_) { Pool = poolManager_; }
public static ProtoPoolBase <LockInfo> GetProtobufLockInfoPool(this PoolManager manager) { return(manager?.GetPool <LockInfo>(ObjectPoolType.ProtobufLockInfo)); }
/// <summary> /// Local initialize. /// </summary> private void Awake() { Pools.Clear(); if (Instance != null) { Destroy(gameObject); } else { Instance = this; InitializePrefabPools(); } }
void PlaySkillEffect(string effectName) { PoolManager.GetObject(effectName, transform.position + transform.up * 1.3f, transform.rotation); }
public void OnEnable() { poolMgr = (PoolManager)target; poolMgr.RefreshIncludedTypes(); }
private void OnDisable() { PoolManager.ReleaseObject(this._shadow); _renderer.color = new Color(_renderer.color.r, _renderer.color.g, _renderer.color.b, _originalAlpha); _renderer = null; }
public void Awake() { Instance = this; }
public override void Evict() { PoolManager.GetObjectPool <Patch>().Push(_patch); _patch = null; }
protected virtual void Awake() { _poolManager = PoolManager.Instance; }
private void InitStaticObjects() { if(!objectsInitialized) { DontDestroyOnLoad(gameObject); //Double check for every static variable if (debugMng == null) { Debug.Log("Storing Debug Manager"); debugMng = debugManager; } if (eventMng == null) { Debug.Log("Storing Event Manager"); eventMng = eventManager; } if (enemyMng == null) { Debug.Log("Storing Enemy Manager"); enemyMng = enemyManager; } if (poolMng == null) { Debug.Log("Storing Pool Manager"); poolMng = poolManager; } if (colorMng == null) { Debug.Log("Storing Color Manager"); colorMng = colorManager; } if (coloredObjectsMng == null) { Debug.Log("Storing Colored Objects Manager"); coloredObjectsMng = coloredObjectsManager; } if (gameMng == null) { Debug.Log("Storing Game Manager"); gameMng = gameManager; } if (gameInfo == null) { gameInfo = new GameInfo(); gameInfo.player1 = GameObject.Instantiate<GameObject>(player1prefab); gameInfo.player1.name = "Player1"; DontDestroyOnLoad(gameInfo.player1); gameInfo.player1Controller = gameInfo.player1.GetComponent<PlayerController>(); gameInfo.player2 = GameObject.Instantiate<GameObject>(player2prefab); gameInfo.player2.name = "Player2"; DontDestroyOnLoad(gameInfo.player2); gameInfo.player2Controller = gameInfo.player2.GetComponent<PlayerController>(); gameInfo.gameCameraOffset = gameCameraOffset; gameInfo.gameCameraRotation = gameCameraRotation.rotation; } objectsInitialized = true; } }
private void PushThisObject() { PoolManager.PushObject(gameObject.name, gameObject); }
void Awake() { Instance = this; }
void Start() { poolManager = FindObjectOfType <PoolManager>(); prefabPool = poolManager.AddPool(prefab); }
void Awake() { if(game == null) game = this; if (pool == null) { pool = GetComponent<PoolManager>(); if (pool == null) { Debug.LogWarning("No hay ningĂșn pool en funcionamiento, ligue una."); } } if (generador == null) { Debug.LogWarning("Ligue el generador para que funcione."); } }
void Awake() { _instance = this; }
/// <summary> /// Create pool and cache prefab. /// </summary> /// <param name="poolManager"></param> /// <param name="prefab"></param> /// <param name="parent"></param> public Pool(PoolManager poolManager, PoolObject prefab, Transform parent = null) { this.poolManager = poolManager; if (prefab != null) { this.prefab = prefab; } }
void Destroy() { instance = null; }
/// <summary> /// This is like the Init but done by the MonoBehaviour /// </summary> private void Awake() { if (m_Instance == null) { m_Instance = this; InitPool(); } else { Debug.LogError("Someone is trying to create various ClassName [" + name + "]"); this.enabled = false; } }
public async IAsyncEnumerable <Image> Paint(string map) { var stopwatch = new Stopwatch(); stopwatch.Start(); await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings (){ Map = map }); var server = pairTracker.Pair.Server; var client = pairTracker.Pair.Client; Console.WriteLine($"Loaded client and server in {(int) stopwatch.Elapsed.TotalMilliseconds} ms"); stopwatch.Restart(); var cEntityManager = client.ResolveDependency <IClientEntityManager>(); var cPlayerManager = client.ResolveDependency <Robust.Client.Player.IPlayerManager>(); await client.WaitPost(() => { if (cEntityManager.TryGetComponent(cPlayerManager.LocalPlayer !.ControlledEntity !, out SpriteComponent? sprite)) { sprite.Visible = false; } }); var sEntityManager = server.ResolveDependency <IServerEntityManager>(); var sPlayerManager = server.ResolveDependency <IPlayerManager>(); await PoolManager.RunTicksSync(pairTracker.Pair, 10); await Task.WhenAll(client.WaitIdleAsync(), server.WaitIdleAsync()); var sMapManager = server.ResolveDependency <IMapManager>(); var tilePainter = new TilePainter(client, server); var entityPainter = new GridPainter(client, server); IMapGrid[] grids = null !; await server.WaitPost(() => { var playerEntity = sPlayerManager.ServerSessions.Single().AttachedEntity; if (playerEntity.HasValue) { sEntityManager.DeleteEntity(playerEntity.Value); } grids = sMapManager.GetAllMapGrids(new MapId(1)).ToArray(); foreach (var grid in grids) { grid.WorldRotation = Angle.Zero; } }); await PoolManager.RunTicksSync(pairTracker.Pair, 10); await Task.WhenAll(client.WaitIdleAsync(), server.WaitIdleAsync()); foreach (var grid in grids) { // Skip empty grids if (grid.LocalAABB.IsEmpty()) { Console.WriteLine($"Warning: Grid {grid.Index} was empty. Skipping image rendering."); continue; } var tileXSize = grid.TileSize * TilePainter.TileImageSize; var tileYSize = grid.TileSize * TilePainter.TileImageSize; var bounds = grid.LocalAABB; var left = bounds.Left; var right = bounds.Right; var top = bounds.Top; var bottom = bounds.Bottom; var w = (int)Math.Ceiling(right - left) * tileXSize; var h = (int)Math.Ceiling(top - bottom) * tileYSize; var gridCanvas = new Image <Rgba32>(w, h); await server.WaitPost(() => { tilePainter.Run(gridCanvas, grid); entityPainter.Run(gridCanvas, grid); gridCanvas.Mutate(e => e.Flip(FlipMode.Vertical)); }); yield return(gridCanvas); } // We don't care if it fails as we have already saved the images. try { await pairTracker.CleanReturnAsync(); } catch { // ignored } }
public static ArrayPool <byte> GetByteArrayPool(this PoolManager manager) { return(manager?.GetPool <byte>(ArrayPoolType.Byte)); }
public static ProtoPoolBase <BitSet> GetBitSetPool(this PoolManager manager) { return(manager?.GetPool <BitSet>(ObjectPoolType.BitSet)); }
public float movSpeed = 10; protected float currentMovSpeed = 10; [Tooltip("Cadencia disparo, en segundos")]
public override void Register(List<register.IRegisterable> registerables, register.ReflectSet reflects, render.GpuTaskManager gpuManager, MaterialManager materialManager, PoolManager poolManager) { base.Register(registerables, reflects, gpuManager, materialManager, poolManager); BoundingSphere currentBounding; Helpers.TransformBoundingSphere(ref _boundingSphere, ref _lastWorld, out currentBounding); registerables.Add(EllipsoidPrimitiveRegisterable.CreateInstance( poolManager.GetPool<EllipsoidPrimitiveRegisterable>(), _vertices.Length, _indicesWF.Length, _indices.Length, _vertexBuffer, _indexWFBuffer, _indexBuffer, _lastWorld, Color, IsOpaque, currentBounding)); }