예제 #1
0
    void OnEnable()
    {
        credentials = LumosCredentialsManager.GetCredentials();

        if (LumosPackages.package == LumosPackages.Update.None || LumosPackages.package == LumosPackages.Update.CheckingVersion)
        {
            LumosPackages.CheckForUpdates();
        }
    }
예제 #2
0
    void InstallLumos()
    {
        showError = false;
        const string undoTitle = "Add Lumos To Scene";
        var          prefab    = Resources.LoadAssetAtPath(prefabPath, typeof(GameObject));

                #if UNITY_3_5
        Undo.RegisterSceneUndo(undoTitle);
        PrefabUtility.InstantiatePrefab(prefab);
                #else
        var obj = PrefabUtility.InstantiatePrefab(prefab);
        Undo.RegisterCreatedObjectUndo(obj, undoTitle);
                #endif

        LumosPackages.RunSetupScripts();
        this.Close();
    }
예제 #3
0
    public static void PreferencesGUI()
    {
        if (!prefsLoaded)
        {
            prefsLoaded = true;
            credentials = LumosCredentialsManager.GetCredentials();
            LumosPackages.CheckForUpdates();
        }

        // General settings.
        GUILayout.Label("General", EditorStyles.boldLabel);
        EditorGUILayout.LabelField("Version", Lumos.version);
        credentials.apiKey = EditorGUILayout.TextField(apiKeyLabel, credentials.apiKey);

        EditorGUILayout.Space();

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();

        if (GUILayout.Button(new GUIContent("Run Setup Scripts", "Attaches required powerup scripts to the Lumos GameObject. Click this if you subscribed to new powerups since first installing Lumos."), GUILayout.Width(Screen.width / 2.9f)))
        {
            LumosPackages.RunSetupScripts();
        }
        GUILayout.EndHorizontal();

        EditorGUILayout.Space();

        // Checking for updates
        GUILayout.Label("Updates", EditorStyles.boldLabel);

        switch (LumosPackages.package)
        {
        case LumosPackages.Update.CheckingVersion:
            GUILayout.Label("Checking for updates...");
            break;

        case LumosPackages.Update.OutOfDate:
            GUILayout.Label("An update is available.");

            EditorGUILayout.Space();

            if (GUILayout.Button("Download Lumos " + LumosPackages.latestVersion, GUILayout.Width(Screen.width / 3)))
            {
                Application.OpenURL("https://www.lumospowered.com/downloads");
            }

            break;

        case LumosPackages.Update.UpToDate:
            GUILayout.Label("You are up to date!");
            break;
        }

        EditorGUILayout.Space();

        // Save changed preferences.
        if (GUI.changed)
        {
            EditorUtility.SetDirty(credentials);
        }
    }