void OnEnable()
        {
            // Disallow resizing to ensure consistent results across runs
            minSize = maxSize = new Vector2(1000, 800);

            rootVisualElement.styleSheets.Add(AssetDatabase.LoadAssetAtPath <StyleSheet>("Assets/Editor/ManyElementsTest/resources/style.uss"));
            var xmlAsset = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>("Assets/Editor/ManyElementsTest/resources/TestWindow.uxml");

            xmlAsset.CloneTree(rootVisualElement);

            TestTexture = AssetDatabase.LoadAssetAtPath <Texture2D>("Assets/Editor/ManyElementsTest/resources/testImage.png");

            var gridContainer = rootVisualElement.Q("testGridContainer");
            var sizeSlider    = rootVisualElement.Q <Slider>("sizeSlider");

            // Hook up run tests button
            rootVisualElement.Q <Button>("RunTests").clicked += () => EditorCoroutines.Execute(TestRunner.RunTests(sizeSlider, gridContainer));
            rootVisualElement.Q <Button>("ShowOne").clicked  += () => showOneGrid(gridContainer, sizeSlider);

            var prepopulate = false;

            if (prepopulate)
            {
                showOneGrid(gridContainer, sizeSlider);
            }
        }
Exemplo n.º 2
0
 public static void Check(string _serverUrl, string _uniqueId, DataboxObject _databoxObject)
 {
     serverRootURL = _serverUrl;
     id            = _uniqueId;
     database      = _databoxObject;
                 #if UNITY_EDITOR
     EditorCoroutines.Execute(CheckIE());
                 #endif
 }
Exemplo n.º 3
0
        private void OnEnable()
        {
            window = this;

            // Tabs
            List <TabContainer> tabsList = new List <TabContainer>();

            tabsList.Add(new TabContainer("Info", window.TabInfo, -1));

            Assembly assembly = Assembly.GetAssembly(typeof(SetupTabAttribute));

            Type[] gameTypes = assembly.GetTypes().Where(m => m.IsDefined(typeof(SetupTabAttribute), true)).ToArray();

            foreach (Type type in gameTypes)
            {
                //Get attribute
                SetupTabAttribute[] tabAttributes = (SetupTabAttribute[])Attribute.GetCustomAttributes(type, typeof(SetupTabAttribute));

                for (int i = 0; i < tabAttributes.Length; i++)
                {
                    UnityEngine.Object tabObject = EditorUtils.GetAsset(type);
                    if (tabObject != null)
                    {
                        tabsList.Add(new TabContainer(tabAttributes[i].tabName, tabObject, tabAttributes[i].priority));
                    }
                }
            }

            tabContainers = tabsList.OrderBy(x => x.priority).ToArray();
            tabs          = new string[tabContainers.Length];
            for (int i = 0; i < tabs.Length; i++)
            {
                tabs[i] = tabContainers[i].name;
            }

            //Buttons
            //Project settings
            for (int i = 0; i < projectSettings.Length; i++)
            {
                projectSettings[i].Init();
            }

            //Project folders
            for (int i = 0; i < projectFolders.Length; i++)
            {
                projectFolders[i].Init();
            }

            //Project files
            for (int i = 0; i < projectFiles.Length; i++)
            {
                projectFiles[i].Init();
            }

            EditorCoroutines.Execute(GetRequest(PROTOTYPE_URL));
        }
Exemplo n.º 4
0
        private IEnumerator GetRequest(string uri)
        {
            UnityWebRequest www = UnityWebRequest.Get(uri);

            www.SendWebRequest();

            while (!www.isDone)
            {
                yield return(null);
            }

            if (www.isNetworkError || www.isHttpError)
            {
                Debug.Log(www.error);
            }
            else
            {
                if (www.downloadHandler.data != null)
                {
                    // Or retrieve results as binary data
                    byte[] results = www.downloadHandler.data;

                    // For that you will need to add reference to System.Runtime.Serialization
                    var jsonReader = JsonReaderWriterFactory.CreateJsonReader(results, new System.Xml.XmlDictionaryReaderQuotas());

                    // For that you will need to add reference to System.Xml and System.Xml.Linq
                    var root = XElement.Load(jsonReader);

                    List <FinishedProject> finishedProjectsTemp = new List <FinishedProject>();
                    foreach (var element in root.Elements())
                    {
                        FinishedProject projectTemp = new FinishedProject(element.XPathSelectElement("name").Value, element.XPathSelectElement("url").Value, null);

                        EditorCoroutines.Execute(GetTexture(element.XPathSelectElement("image").Value, (texture) =>
                        {
                            projectTemp.gameTexture = texture;
                        }));

                        finishedProjectsTemp.Add(projectTemp);
                    }

                    finishedProjects = finishedProjectsTemp.ToArray();
                }
            }
        }
Exemplo n.º 5
0
        public static void InitializeStyles()
        {
            if (isInited)
            {
                return;
            }

            if (!editorSkin)
            {
                if (EditorGUIUtility.isProSkin)
                {
                    editorSkin = EditorUtils.GetAsset <GUISkin>(GUISKIN_PRO_NAME);
                }

                if (!editorSkin)
                {
                    editorSkin = EditorUtils.GetAsset <GUISkin>(GUISKIN_NAME);
                }
            }

            if (editorSkin)
            {
                LoadIcons();

                tab = editorSkin.GetStyle("Tab");

                box_01 = editorSkin.GetStyle("box_01");
                box_02 = editorSkin.GetStyle("box_02");
                box_03 = editorSkin.GetStyle("box_03");

                label_small      = editorSkin.GetStyle("label_small");
                label_small_bold = editorSkin.GetStyle("label_small_bold");

                label_medium      = editorSkin.GetStyle("label_medium");
                label_medium_bold = editorSkin.GetStyle("label_medium_bold");

                label_large      = editorSkin.GetStyle("label_large");
                label_large_bold = editorSkin.GetStyle("label_large_bold");

                button_01       = editorSkin.GetStyle("button_01");
                button_01_large = editorSkin.GetStyle("button_01_large");

                button_02       = editorSkin.GetStyle("button_02");
                button_02_large = editorSkin.GetStyle("button_02_large");

                button_03       = editorSkin.GetStyle("button_03");
                button_03_large = editorSkin.GetStyle("button_03_large");

                button_04       = editorSkin.GetStyle("button_04");
                button_04_large = editorSkin.GetStyle("button_04_large");

                button_05       = editorSkin.GetStyle("button_05");
                button_05_large = editorSkin.GetStyle("button_05_large");

                helpbox = editorSkin.GetStyle("helpbox");

                isInited = true;
            }
            else
            {
                if (!isLoading)
                {
                    EditorCoroutines.Execute(TryToInitStyles());
                }

                isLoading = true;
            }
        }
Exemplo n.º 6
0
 public void Run()
 {
     // StartCoroutine(RunCoroutine());
     EditorCoroutines.Execute(RunCoroutine());
 }
Exemplo n.º 7
0
 public static void ForceDownloadEditor()
 {
                 #if UNITY_EDITOR
     EditorCoroutines.Execute(GetDataIE());
                 #endif
 }
Exemplo n.º 8
0
 public static void ForceUploadEditor()
 {
                 #if UNITY_EDITOR
     EditorCoroutines.Execute(ForceUploadIE());
                 #endif
 }