Exemplo n.º 1
0
        public static void      Init(NGRemoteHierarchyWindow hierarchy, Type type, string valuePath, Func <string, byte[], Packet> packetGenerator, Action <ResponsePacket> onPacketComplete, int initialInstanceID)
        {
            ResourcesPickerWindow picker = EditorWindow.GetWindow <ResourcesPickerWindow>(true, "Select " + type.Name);

            picker.hierarchy = hierarchy;
            picker.hierarchy.ResourcesUpdated += picker.RefreshResources;
            picker.type               = type;
            picker.valuePath          = valuePath;
            picker.packetGenerator    = packetGenerator;
            picker.onPacketComplete   = onPacketComplete;
            picker.searchString       = string.Empty;
            picker.selectedInstanceID = 0;
            picker.filteredResources.Clear();
            picker.filteredResourceIDs.Clear();
            picker.initialInstanceID  = initialInstanceID;
            picker.selectedInstanceID = initialInstanceID;
            picker.typeHandler        = TypeHandlersManager.GetTypeHandler(type);
            picker.SetTab(0);
            picker.tabs.Clear();

            foreach (Type t in Utility.EachNGTSubClassesOf(typeof(TabModule), (Type t) =>
            {
                TabModuleForTypeAttribute[]     attributes = t.GetCustomAttributes(typeof(TabModuleForTypeAttribute), false) as TabModuleForTypeAttribute[];

                return(attributes.Length > 0 && type.IsAssignableFrom(attributes[0].type));
            }))
            {
                picker.tabs.Add(Activator.CreateInstance(t, new object[] { picker }) as TabModule);
            }
        }
Exemplo n.º 2
0
 public UserTexture2DTab(ResourcesPickerWindow window) : base("User Texture2D", window)
 {
 }
Exemplo n.º 3
0
 public UserSpriteTab(ResourcesPickerWindow window) : base("User Sprite", window)
 {
 }
Exemplo n.º 4
0
 protected TabModule(string name, ResourcesPickerWindow window)
 {
     this.name   = name;
     this.window = window;
 }