コード例 #1
0
    public void OnGUI()
    {
        tab = GUILayout.Toolbar(tab, new string[] { "Documentation", "Updater", "Social" });
        XSStyles.SeparatorThin();
        switch (tab)
        {
        case 0:
            //show Docs from git
            XSStyles.doLabel("You can find Documentation here.");
            if (GUILayout.Button("Open Documentation"))
            {
                Application.OpenURL(docsURL);
            }

            break;

        case 1:
            EditorGUI.BeginChangeCheck();

            XSStyles.HelpBox("The currently installed version is: v" + XSStyles.ver + "\n\nTo check for updates, use the update button. If you choose to download an update, you will need to manually overwrite the old install by extracting the .zip into the project using the windows explorer. \n\nDo not drag the update directly into Unity - it won't ask to overwrite - it'll just create a duplicate and break.", MessageType.Info);
            XSStyles.SeparatorThin();
            if (GUILayout.Button("Check for Updates"))
            {
                req(updateUrl);
                EditorApplication.update += changelogEditorUpdate;
                showInfo = true;
            }

            if (showInfo)
            {
                scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
                Repaint();
                XSStyles.doLabelLeft("Newest version: ");
                XSStyles.doLabelSmall(curVer);
                XSStyles.SeparatorThin();

                XSStyles.doLabelLeft("Release Date: ");
                XSStyles.doLabelSmall(publishdate);
                XSStyles.SeparatorThin();

                XSStyles.doLabelLeft("Changelog: ");
                XSStyles.doLabelSmall(changelog);

                EditorGUILayout.EndScrollView();
                XSStyles.SeparatorThin();
                if (GUILayout.Button("Download"))
                {
                    Application.OpenURL(downloadLink);
                }
            }
            else
            {
                XSStyles.doLabel("Hit 'Check for Updates' to begin");
            }
            EditorGUI.EndChangeCheck();

            break;

        case 2:
            //show Patrons

            XSStyles.doLabel("Thank you to my patreon supporters, and the people who have helped me along the way, you guys are great!\n Note: You must be in the Discord server to show on this list.");
            XSStyles.SeparatorThin();
            XSStyles.doLabel("Current Patrons");
            XSStyles.SeparatorThin();
            scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
            if (!hasCalledPatronlist)
            {
                hasCalledPatronlist = true;
                req(patronsURL);
                EditorApplication.update += EditorUpdate;
            }
            for (int i = 0; i < patrons.Length; i++)
            {
                XSStyles.doLabel(" - " + patrons[i]);
            }
            EditorGUILayout.EndScrollView();

            XSStyles.SeparatorThin();
            //show social links
            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            XSStyles.discordButton(70, 30);
            XSStyles.patreonButton(70, 30);
            XSStyles.githubButton(70, 30);
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();
            break;
        }
    }