本文整理汇总了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> ();
}
示例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;
}
}
示例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);
}
示例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));
}
示例5: Start
void Start()
{
_pool = new Pool(ComponentIds.TotalComponents);
_systems = createSystems();
_systems.Start();
_pool.CreateEntity().AddMyString("");
}
示例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;
}
示例7: OnEnable
public void OnEnable()
{
m_Pool = PoolManager.CreatePool(PrefabPaths.CAPSULE, poolSize: 0, parent: transform);
StartCoroutine(TestQueueInit());
}
示例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);
}
示例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);
}
}
示例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");
}
示例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("");
}
示例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();
}
示例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;
}
示例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);
}
示例15: BonusesView
public BonusesView(Pool pool, IViewService viewService, IBonusService bonusService)
: base("EditorView/Bonus/BonusesView")
{
this.pool = pool;
this.viewService = viewService;
this.bonusService = bonusService;
}