Ejemplo n.º 1
0
        public void Resolve(ref T item)
        {
            Glop glop = item as Glop;

            if (glop == null)
            {
                return;
            }
            item = Get(glop.Id);
        }
Ejemplo n.º 2
0
        public void Destroy(Glop glop)
        {
            if (HasId(glop.Id))
            {
                glop.Die();
                _contents.Remove(glop.Id);
                return;
            }

            Debug.Log("No GLOP found with id " + glop.Id);
        }
Ejemplo n.º 3
0
        /**
         * Register gives the GLOP an Id, injects its dependencies, triggers initialization, and adds it to the GlopContainer.
         */
        public void Register(Glop glop)
        {
            if (glop == null)
            {
                Debug.Log("Tried to register a null Glop!");
                return;
            }

            int id = GenerateGlopId();

            glop.Id = id;
            glop.Initialize();
            _contents.Add(id, glop);
        }
Ejemplo n.º 4
0
        public virtual void RegisterFromLoad(int id, T val)
        {
            Glop glop = val as Glop;

            if (glop == null)
            {
                Debug.Log($"Tried to register a null Glop to id {id} in {this}!");
                return;
            }

            if (_contents.ContainsKey(id))
            {
                Debug.Log($"Already registered a glop with id {id} in {this}");
                return;
            }

            _contents.Add(id, glop);
        }