예제 #1
0
        public static T Populate <T>(this object o, int poolID, int prefabID, string parentID,
                                     Vector3 startPosition = default(Vector3), Quaternion startRotation = default(Quaternion)) where T : class
        {
            var parent = Toolbox.Get <ProcessingScene>().Get(parentID);
            var tr     = o.Populate(poolID, prefabID, startPosition, startRotation, parent);

            return(tr.GetComponent <T>());
        }
예제 #2
0
 public void GetFromToolbox(object behavior)
 {
     for (int i = 0; i < cachedToolboxFields.Count; i++)
     {
         var myFieldInfo = cachedToolboxFields[i];
         var fieldType   = myFieldInfo.FieldType;
         myFieldInfo.SetValue(behavior, Toolbox.Get(fieldType));
     }
 }
예제 #3
0
        public static void Setup(object b)
        {
            var        type = b.GetType();
            CachedType o;
            bool       isCached = cached.TryGetValue(type, out o);

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

                var objectFields = type.GetFields(BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public |
                                                  BindingFlags.NonPublic);
                int length = objectFields.Length;
                cached.Add(type, o);
                for (int 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:


                        break;

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

                    case 2:


                        break;

                    case 3:

                        break;
                    }
                }
            }
            else
            {
                o.GetFromToolbox(b);
            }
        }
예제 #4
0
 public string Help()
 {
     return(Toolbox.Get <ProcessorConsole>().Help());
 }