private bool PopulateItem(TData item,
                                  int index,
                                  FilterDelegate filter,
                                  InitializeDelegate initializer,
                                  InstantiateDelegate instantiator
                                  )
        {
            if (filter != null && !filter(item))
            {
                return(false);
            }

            TComponent component;

            if (index < this.pool.Count)
            {
                component = this.pool[index];
            }
            else
            {
                component = instantiator != null
                    ? instantiator(this.prefab, this.root)
                    : Object.Instantiate(this.prefab, this.root);

                this.pool.Add(component);
            }

            component.gameObject.SetActive(true);
            initializer?.Invoke(item, component);

            return(true);
        }
示例#2
0
 public override void PostInitialize(Harmony plibInstance)
 {
     doPostInitialize?.Invoke(plibInstance);
 }
示例#3
0
 internal override object DoInitialize(Harmony plibInstance)
 {
     doInitialize.Invoke(plibInstance);
     return(wrapped);
 }
示例#4
0
 public override void Bootstrap(Harmony plibInstance)
 {
     doBootstrap?.Invoke(plibInstance);
 }