Example #1
0
        public void Awake(Disposer disposer)
        {
            if (!this.disposerEvents.TryGetValue(disposer.GetType(), out IObjectEvent objectEvent))
            {
                return;
            }
            IAwake iAwake = objectEvent as IAwake;

            if (iAwake == null)
            {
                return;
            }
            objectEvent.Set(disposer);
            iAwake.Awake();
        }
Example #2
0
        public void Awake <P1, P2, P3>(Disposer disposer, P1 p1, P2 p2, P3 p3)
        {
            if (!this.disposerEvents.TryGetValue(disposer.GetType(), out IObjectEvent objectEvent))
            {
                throw new Exception($"{disposer.GetType().Name} not found awake3");
            }
            IAwake <P1, P2, P3> iAwake = objectEvent as IAwake <P1, P2, P3>;

            if (iAwake == null)
            {
                throw new Exception($"{disposer.GetType().Name} not found awake3");
            }
            objectEvent.Set(disposer);
            iAwake.Awake(p1, p2, p3);
        }
Example #3
0
        public void Awake <P1, P2, P3>(Disposer disposer, P1 p1, P2 p2, P3 p3)
        {
            if (!this.disposerEvents.TryGetValue(disposer.GetType(), out IObjectEvent objectEvent))
            {
                return;
            }
            IAwake <P1, P2, P3> iAwake = objectEvent as IAwake <P1, P2, P3>;

            if (iAwake == null)
            {
                return;
            }
            objectEvent.Set(disposer);
            iAwake.Awake(p1, p2, p3);
        }
Example #4
0
        public void Awake <P1, P2>(Disposer disposer, P1 p1, P2 p2)
        {
            this.Add(disposer);

            if (!this.disposerEvents.TryGetValue(disposer.GetType(), out IObjectSystem objectEvent))
            {
                throw new Exception($"{disposer.GetType().Name} not found awake2");
            }
            IAwake <P1, P2> iAwake = objectEvent as IAwake <P1, P2>;

            if (iAwake == null)
            {
                throw new Exception($"{disposer.GetType().Name} not found awake2");
            }
            objectEvent.Set(disposer);
            iAwake.Awake(p1, p2);
        }
Example #5
0
        public void Awake <P1>(Disposer disposer, P1 p1)
        {
            IObjectEvent objectEvent;

            if (!this.disposerEvents.TryGetValue(disposer.GetType(), out objectEvent))
            {
                return;
            }
            IAwake <P1> iAwake = objectEvent as IAwake <P1>;

            if (iAwake == null)
            {
                return;
            }
            objectEvent.Set(disposer);
            iAwake.Awake(p1);
        }
Example #6
0
        public void Awake <P1, P2, P3>(Object obj, P1 p1, P2 p2, P3 p3)
        {
            IObjectEvent objectEvent;

            if (!objectEvents.TryGetValue(obj.GetType(), out objectEvent))
            {
                return;
            }
            IAwake <P1, P2, P3> iAwake = objectEvent as IAwake <P1, P2, P3>;

            if (iAwake == null)
            {
                return;
            }
            objectEvent.SetValue(obj);
            iAwake.Awake(p1, p2, p3);
        }
Example #7
0
        public void Awake(Component disposer)
        {
            this.Add(disposer);

            if (!this.disposerEvents.TryGetValue(disposer.GetType(), out IObjectSystem objectEvent))
            {
                return;
            }
            IAwake iAwake = objectEvent as IAwake;

            if (iAwake == null)
            {
                return;
            }
            objectEvent.Set(disposer);
            iAwake.Awake();
        }
Example #8
0
        public void Awake(Object obj)
        {
            IObjectEvent objectEvent;

            if (!objectEvents.TryGetValue(obj.GetType(), out objectEvent))
            {
                return;
            }
            IAwake iAwake = objectEvent as IAwake;

            if (iAwake == null)
            {
                return;
            }
            objectEvent.SetValue(obj);
            iAwake.Awake();
        }
Example #9
0
        public void Awake <P1>(Disposer disposer, P1 p1)
        {
            Instance.Add(disposer);

            if (!this.disposerEvents.TryGetValue(disposer.GetType(), out IObjectEvent objectEvent))
            {
                throw new Exception($"{disposer.GetType().Name} not found awake1");
            }
            IAwake <P1> iAwake = objectEvent as IAwake <P1>;

            if (iAwake == null)
            {
                throw new Exception($"{disposer.GetType().Name} not found awake1");
            }
            objectEvent.Set(disposer);
            iAwake.Awake(p1);
        }
Example #10
0
        public void Awake <P1, P2>(Disposer disposer, P1 p1, P2 p2)
        {
            ObjectEvents.Instance.Add(disposer);

            IObjectEvent objectEvent;

            if (!this.disposerEvents.TryGetValue(disposer.GetType(), out objectEvent))
            {
                return;
            }
            IAwake <P1, P2> iAwake = objectEvent as IAwake <P1, P2>;

            if (iAwake == null)
            {
                return;
            }
            objectEvent.Set(disposer);
            iAwake.Awake(p1, p2);
        }
Example #11
0
        public void Awake <P1, P2, P3>(Disposer disposer, P1 p1, P2 p2, P3 p3)
        {
            this.Add(disposer);

            IObjectSystem objectSystem;

            if (!this.disposerEvents.TryGetValue(disposer.GetType(), out objectSystem))
            {
                return;
            }
            IAwake <P1, P2, P3> iAwake = objectSystem as IAwake <P1, P2, P3>;

            if (iAwake == null)
            {
                return;
            }
            objectSystem.Set(disposer);
            iAwake.Awake(p1, p2, p3);
        }
Example #12
0
        public void Awake(Disposer disposer)
        {
            this.Add(disposer);

            IObjectSystem objectSystem;

            if (!this.disposerEvents.TryGetValue(disposer.GetType(), out objectSystem))
            {
                return;
            }
            IAwake iAwake = objectSystem as IAwake;

            if (iAwake == null)
            {
                return;
            }
            objectSystem.Set(disposer);
            iAwake.Awake();
        }
Example #13
0
        public void Awake <P1>(Component disposer, P1 p1)
        {
            this.Add(disposer);

            IObjectSystem objectSystem;

            if (!this.disposerEvents.TryGetValue(disposer.GetType(), out objectSystem))
            {
                return;
            }
            IAwake <P1> iAwake = objectSystem as IAwake <P1>;

            if (iAwake == null)
            {
                return;
            }
            objectSystem.Set(disposer);
            iAwake.Awake(p1);
        }
Example #14
0
        public K AddComponent <K>() where K : Component, new()
        {
            K component = (K)Activator.CreateInstance(typeof(K));

            component.Owner = this;
            if (this.componentDict.ContainsKey(component.GetType()))
            {
                throw new Exception($"AddComponent, component already exist, id: {this.Id}, component: {typeof (K).Name}");
            }
            if (this.components == null)
            {
                this.components = new HashSet <Component>();
            }
            this.components.Add(component);
            this.componentDict.Add(component.GetType(), component);
            IAwake awake = component as IAwake;

            awake?.Awake();
            return(component);
        }
Example #15
0
		public void Awake<P1, P2>(long id, P1 p1, P2 p2)
		{
			Object obj;
			if (!objects.TryGetValue(id, out obj))
			{
				return;
			}
			IObjectEvent objectEvent;
			if (!objectEvents.TryGetValue(obj.GetType(), out objectEvent))
			{
				return;
			}
			IAwake<P1, P2> iAwake = objectEvent as IAwake<P1, P2>;
			if (iAwake == null)
			{
				return;
			}
			objectEvent.SetValue(obj);
			iAwake.Awake(p1, p2);
		}