예제 #1
0
 public void Dispose()
 {
     Toolbox.Get <ProcessingSignals>().Remove(this);
     OnDispose();
 }
예제 #2
0
        public static void Setup(IComponent b, Actor a)
        {
            var        type = b.GetType();
            CachedType o;
            var        isCached = cached.TryGetValue(type, out o);

            if (!isCached)
            {
                o = new CachedType();

                var objectFields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
                var length       = objectFields.Length;
                cached.Add(type, o);
                for (var i = 0; i < length; i++)
                {
                    var myFieldInfo = objectFields[i];
                    var attribute   =
                        Attribute.GetCustomAttribute(objectFields[i], typeof(BindAttribute)) as BindAttribute;

                    if (attribute == null)
                    {
                        continue;
                    }
                    var fieldType = myFieldInfo.FieldType;


                    switch (attribute.bindType)
                    {
                    case 0:


                        //var isStorage =	typeof(IStorage).IsAssignableFrom(fieldType);
                        //isStorage ? ComponentType.STORAGE : ComponentType.LOCAL)
                        myFieldInfo.SetValue(b, a.Get(fieldType));
                        o.cachedBindFields.Add(myFieldInfo);
                        break;

                    case 1:
                        myFieldInfo.SetValue(b, Toolbox.Get(fieldType));
                        o.cachedToolboxFields.Add(myFieldInfo);
                        break;

                    case 2:

                        myFieldInfo.SetValue(b, a.selfTransform.GetComponentInChildren(fieldType));
                        o.cachedFromObjFields.Add(myFieldInfo);
                        break;

                    case 3:
                        var blueprint = a.Get <DataBlueprint>().blueprint;
                        myFieldInfo.SetValue(b, blueprint.Get(fieldType));
                        o.cachedFromBlueprintFields.Add(myFieldInfo);
                        break;
                    }
                }
            }
            else
            {
                o.Bind(b, a);

                o.GetFromToolbox(b);
                o.GetFromObject(b, a);
                o.GetFromBlueprint(b, a);
            }
        }
예제 #3
0
        public void Spawn(int id)
        {
            var go = Toolbox.Get <FactorySpawner>().Spawn(id);

            go.position = Toolbox.Get <DataCryoshockGameSession>().spawners[0].selfTransform.position;
        }
        public static void To(string name)
        {
            var processing = Toolbox.Get <ProcessingSceneLoad>();

            Toolbox.Instance.StartCoroutine(processing._Load(name));
        }
예제 #5
0
 private void ButtonUnitDown(UICallBack callBack, ButtonCountdown button, DataPlayer dataPlayer)
 {
     button.StartCountdown(callBack.data as DataUnit, dataPlayer);
     Toolbox.Get <ManagerUI>().OnButtonClick.OnNext(callBack);
 }
예제 #6
0
 private void ButtonSpellDown(UICallBack callBack, ButtonCountdown button, DataPlayer dataPlayer)
 {
     button.StartCountdown((callBack.data as DataSpell).countdown);
     Toolbox.Get <ManagerUI>().OnButtonClick.OnNext(callBack);
 }
예제 #7
0
        public static void To(int id)
        {
            var processing = Toolbox.Get <ProcessingSceneLoad>();

            Toolbox.Instance.StartCoroutine(processing._Load(id));
        }
예제 #8
0
 public override void Plug()
 {
     Toolbox.Add <ProcessingConsole>().Setup(commandsDebug);
 }