当前位置: 首页>>代码示例>>C#>>正文


C# Pool类代码示例

本文整理汇总了C#中Pool的典型用法代码示例。如果您正苦于以下问题:C# Pool类的具体用法?C# Pool怎么用?C# Pool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Pool类属于命名空间,在下文中一共展示了Pool类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Awake

	void Awake(){
		gene = geneIni;
		biomatter = biomatterIni;
		newSpawnCostGene = newSpawnGene;
		newSpawnCostBio = newSpawnBio;
		pool = GameObject.Find ("Pool").GetComponent<Pool> ();
	}
开发者ID:Cestt,项目名称:Swarmpositorio,代码行数:7,代码来源:EconomyManager.cs

示例2: Awake

	void Awake() {
		if (GameObject.FindWithTag("PoolHolder")) {
			masterPoolHolder = GameObject.FindWithTag("PoolHolder");
		} else {
			masterPoolHolder = new GameObject("Pool Holder");
			masterPoolHolder.tag = "PoolHolder";
		}
		if (masterPool == null) {
			masterPool = new List<Pool>();
		}
		Pool existingPool = null;
		foreach (var p in masterPool) {
			if (p.prefab == prefab) existingPool = p;
		}
		if (existingPool == null) {
			pool = new Pool();
			pool.prefab = prefab;
			if (parentGO == null) {
				pool.holder = new GameObject(string.Format("{0} Holder", prefab.name));
				pool.holder.transform.parent = masterPoolHolder.transform;
			} else {
				pool.holder = parentGO;
			}
			if (instantiateOnAwake) {
				for (int i = 0; i < poolAmount; i++) {
					AddPoolObject();
				}
			}
			masterPool.Add(pool);
		} else {
			pool = existingPool;
		}
	}
开发者ID:JosephFerano,项目名称:HackerDefense,代码行数:33,代码来源:ObjectPool.cs

示例3: SetPool

 public void SetPool(Pool pool)
 {
     _pool = pool;
     _pool.GetGroup(Matcher.SettingsModel).OnEntityUpdated += update;
     _group = pool.GetGroup(Matcher.DifficultyController);
     _models = pool.GetGroup(Matcher.DifficultyModel);
 }
开发者ID:Namek,项目名称:SpaceShooter,代码行数:7,代码来源:DifficultyControllerSystem.cs

示例4: SetPool

 public void SetPool(Pool pool)
 {
     _pool = pool;
     _camera = _pool.GetGroup(Matcher.Camera);
     _time = _pool.GetGroup(Matcher.Time);
     _group = pool.GetGroup(Matcher.AllOf(Matcher.Path, Matcher.GameObject, Matcher.Velocity, Matcher.VelocityLimit, Matcher.Position));
 }
开发者ID:kicholen,项目名称:SpaceShooter,代码行数:7,代码来源:PathSystem.cs

示例5: Start

 void Start()
 {
     _pool = new Pool(ComponentIds.TotalComponents);
     _systems = createSystems();
     _systems.Start();
     _pool.CreateEntity().AddMyString("");
 }
开发者ID:mihail-georgiev,项目名称:Entitas-CSharp,代码行数:7,代码来源:SystemsController.cs

示例6: Start

	void Start () {
		//Inicializamos el path para evitar errores;
		initPos = new Vector3(0,0,100000);
		//Buscamos la pool para solicitar los creeps;
		pool = GameObject.Find ("Pool").GetComponent<Pool> ();
		//Iniciamos la solicitud de creeps basicos;
		invokeGene [0] = true;
		invokeGene [1] = false;
		Invoke("Create",1f/spawnRate);
		//Iniciamos la solicitud de creeps de tier;
		//Invoke("CreateTier",spawnRateTier);
		//Texto para ver el numero de creeps;
		textNumberCreeps = GameObject.Find ("CreepsText/Number").GetComponent<UITest> ();
		numberCreeps = 0;
		pathfinder = GameObject.Find("GameManager/PathFinder").GetComponent<PathFinding>();
		geneSpeed = 0;
		/***************************
	 	* SOLO PARA LAS PRUEBAS DE LA BARRA DE GENERACION*/
		spritesGene [0] = transform.FindChild ("ProductionBar/Prod_0").GetComponent<SpriteRenderer> ();
		spritesGene [1] = transform.FindChild ("ProductionBar/Prod_1").GetComponent<SpriteRenderer> ();
		spritesGene [2] = transform.FindChild ("ProductionBar/Prod_2").GetComponent<SpriteRenderer> ();
		spritesGene [3] = transform.FindChild ("ProductionBar/Prod_3").GetComponent<SpriteRenderer> ();
		spritesGene [4] = transform.FindChild ("ProductionBar/Prod_4").GetComponent<SpriteRenderer> ();
		/*****************************/
		touchManager = GameObject.Find ("GameManager/TouchManager").GetComponent<TouchManager> ();
		tier = 0;
		subType = -1;
		numBioPools = 0;
	}
开发者ID:Cestt,项目名称:Swarmpositorio,代码行数:29,代码来源:Spawn.cs

示例7: OnEnable

  public void OnEnable()
  {
    m_Pool = PoolManager.CreatePool(PrefabPaths.CAPSULE, poolSize: 0, parent: transform);


    StartCoroutine(TestQueueInit());
  }
开发者ID:ByronMayne,项目名称:IPool,代码行数:7,代码来源:Test_ReusePrefabs.cs

示例8: Test_DisposeContainedResources

 public void Test_DisposeContainedResources()
 {
     var disposable = new Disposable();
     var pool = new Pool<Disposable>(() => disposable, AccessStrategy.LIFO, LoadingStrategy.Eager, 1);
     pool.Dispose();
     Assert.True(disposable.Disposed);
 }
开发者ID:iloktionov,项目名称:CookBook,代码行数:7,代码来源:Pool_CleanupTests.cs

示例9: Test_Dispose_4

        public void Test_Dispose_4()
        {
            Disposable disposable;
            PoolResourceHolder<Disposable> poolResourceHolder;
            var pool = new Pool<Disposable>(() => new Disposable(), AccessStrategy.LIFO, LoadingStrategy.Eager, 1);
            pool.Dispose();

            Assert.Throws<ObjectDisposedException>(() => pool.Acquire());
            Assert.Throws<ObjectDisposedException>(() => pool.AcquireHolder());
            Assert.Throws<ObjectDisposedException>(() => pool.TryAcquire(TimeSpan.FromDays(1), out disposable));
            Assert.Throws<ObjectDisposedException>(() => pool.TryAcquireHolder(TimeSpan.FromDays(1), out poolResourceHolder));
            Assert.Throws<ObjectDisposedException>(() => pool.TryAcquireImmediately(out disposable));
            Assert.Throws<ObjectDisposedException>(() => pool.TryAcquireHolderImmediately(out poolResourceHolder));

            // Асинхронные методы.
            try
            {
                pool.AcquireAsync().Wait();
                Assert.Fail("Must throw exception.");
            }
            catch (AggregateException error)
            {
                Assert.True(error.InnerExceptions.Single() is ObjectDisposedException);
            }
            try
            {
                pool.AcquireHolderAsync().Wait();
                Assert.Fail("Must throw exception.");
            }
            catch (AggregateException error)
            {
                Assert.True(error.InnerExceptions.Single() is ObjectDisposedException);
            }
        }
开发者ID:iloktionov,项目名称:CookBook,代码行数:34,代码来源:Pool_CleanupTests.cs

示例10: LeaderboardCoroutine

	static IEnumerable LeaderboardCoroutine(Pool pool, Entity e, float startTime)
	{
		var audioSource = GameObject.Find("MusicSource").GetComponent<AudioSource>();
		
		for (int i = 3; i >= 0; --i)
		{
			audioSource.volume = 0.25f * (i / 3.0f);
			yield return WaitMs(e, 200);
		}
		
		audioSource.Stop();
		if(pool.hasLowestScoreLeaderboard && pool.lowestScoreLeaderboard.value <= pool.score.value)
		{
			audioSource.clip = (AudioClip)Resources.Load("Music/GameOverHighScore");
		}
		else
		{
			audioSource.clip = (AudioClip)Resources.Load("Music/GameOver");
		}
		audioSource.volume = 0.25f;
		audioSource.loop = false;
		audioSource.Play();
		
		yield return WaitMs(e, 1200);
		
		e.AddLeaderboard("");
		e.AddResource("Leaderboard");
	}
开发者ID:JuDelCo,项目名称:Shmup-AAA-plus,代码行数:28,代码来源:LeaderboardComponent.cs

示例11: Start

 void Start() {
     _pool = new Pool(ComponentIds.TotalComponents);
     new PoolObserver(_pool, ComponentIds.componentNames, ComponentIds.componentTypes, "Systems Pool");
     _systems = createSystems();
     _systems.Initialize();
     _pool.CreateEntity().AddMyString("");
 }
开发者ID:ntl92bk,项目名称:Entitas-CSharp,代码行数:7,代码来源:SystemsController.cs

示例12: EditVmHaPrioritiesDialog

        /// <summary>
        /// 
        /// </summary>
        /// <param name="pool">May not be null. HA must be turned off on the pool.</param>
        public EditVmHaPrioritiesDialog(Pool pool)
        {
            if (pool == null)
                throw new ArgumentNullException("pool");
            if (!pool.ha_enabled)
                throw new ArgumentException("You may only show the EditVmHaPrioritiesDialog for pools that already have HA turned on");

            this.pool = pool;
            InitializeComponent();
            Text += string.Format(" - '{0}'", pool.Name.Ellipsise(30));
            assignPriorities.StatusChanged += assignPriorities_StatusChanged;

            pool.PropertyChanged += pool_PropertyChanged;
            originalNtol = pool.ha_host_failures_to_tolerate;

            if (pool.ha_statefiles.Length != 1)
            {
                log.ErrorFormat("Cannot show dialog: pool {0} has {1} statefiles, but this dialog can only handle exactly 1. Closing dialog.",
                    pool.Name, pool.ha_statefiles.Length);
                this.Close();
                return;
            }

            XenRef<VDI> vdiRef = new XenRef<VDI>(pool.ha_statefiles[0]);
            VDI vdi = pool.Connection.Resolve(vdiRef);
            if (vdi == null)
            {
                log.Error("Could not resolve HA statefile reference. Closing dialog.");
                this.Close();
                return;
            }

            pictureBoxWarningIcon.Image = SystemIcons.Warning.ToBitmap();
            Rebuild();
        }
开发者ID:ushamandya,项目名称:xenadmin,代码行数:39,代码来源:EditVmHaPrioritiesDialog.cs

示例13: MissingSRProblem

 public MissingSRProblem(Check check, Pool pool, SR sr, Dictionary<string, string> device_config)
     : base(check)
 {
     this.pool = pool;
     this.sr = sr;
     this.device_config = device_config;
 }
开发者ID:agimofcarmen,项目名称:xenadmin,代码行数:7,代码来源:MissingSRProblem.cs

示例14: PerfmonOptionsDefinitionAction

 public PerfmonOptionsDefinitionAction(IXenConnection connection, PerfmonOptionsDefinition perfmonOptions)
     : base(connection, Messages.ACTION_CHANGE_EMAIL_OPTIONS)
 {
     this.perfmonOptions = perfmonOptions;
     pool = Helpers.GetPoolOfOne(connection);
     this.Description = string.Format(Messages.ACTION_CHANGING_EMAIL_OPTIONS_FOR, pool);
 }
开发者ID:ChrisH4rding,项目名称:xenadmin,代码行数:7,代码来源:PerfmonOptionsDefinitionAction.cs

示例15: BonusesView

 public BonusesView(Pool pool, IViewService viewService, IBonusService bonusService)
     : base("EditorView/Bonus/BonusesView")
 {
     this.pool = pool;
     this.viewService = viewService;
     this.bonusService = bonusService;
 }
开发者ID:kicholen,项目名称:SpaceShooter,代码行数:7,代码来源:BonusesView.cs


注:本文中的Pool类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。