void DrawFooter()
    {
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();

        EditorGUI.BeginDisabledGroup((int)currentStage == 1);

#if !BOLT_CLOUD
        if (currentStage == BoltSetupStage.SetupPhoton)
        {
            if (GUILayout.Button("Skip", GUILayout.Width(ButtonWidth)))
            {
                NextStep();
                beforeNextCallback = null;
            }
        }
#endif

        if (GUILayout.Button("Back", GUILayout.Width(ButtonWidth)))
        {
            beforeNextCallback = null;
            BackStep();
        }

        EditorGUI.EndDisabledGroup();

        var nextLabel = currentStage == BoltSetupStage.SetupSupport ? "Done" : "Next";

        if (GUILayout.Button(nextLabel, GUILayout.Width(ButtonWidth)))
        {
            if (beforeNextCallback == null || beforeNextCallback())
            {
                if (currentStage == BoltSetupStage.SetupSupport)
                {
                    EditorPrefs.SetBool(FirstStartupKey, true);
                    Close();

                    if (RunCompiler)
                    {
                        BoltMenuItems.RunCompiler();
                    }
                }

                NextStep();
                beforeNextCallback = null;
            }
        }

        GUILayout.Space(5);
        GUILayout.EndHorizontal();
        GUILayout.Space(5);
    }
Exemple #2
0
        void InitialSetup()
        {
            string SETTINGS_PATH = Path.Combine(BoltPathUtility.ResourcesPath, "BoltRuntimeSettings.asset");
            string PREFABDB_PATH = Path.Combine(BoltPathUtility.ResourcesPath, "BoltPrefabDatabase.asset");

            if (!AssetDatabase.LoadAssetAtPath(SETTINGS_PATH, typeof(BoltRuntimeSettings)))
            {
                BoltRuntimeSettings settings = CreateInstance <BoltRuntimeSettings>();

                AssetDatabase.CreateAsset(settings, SETTINGS_PATH);
                AssetDatabase.ImportAsset(SETTINGS_PATH, ImportAssetOptions.Default);
            }

            if (!AssetDatabase.LoadAssetAtPath(PREFABDB_PATH, typeof(PrefabDatabase)))
            {
                AssetDatabase.CreateAsset(CreateInstance <PrefabDatabase>(), PREFABDB_PATH);
                AssetDatabase.ImportAsset(PREFABDB_PATH, ImportAssetOptions.Default);
            }

            BoltMenuItems.RunCompiler();
        }
    static void InitialSetup()
    {
        const string SETTINGS_PATH = "Assets/bolt/resources/BoltRuntimeSettings.asset";
        const string PREFABDB_PATH = "Assets/bolt/resources/BoltPrefabDatabase.asset";

        if (!AssetDatabase.LoadAssetAtPath(SETTINGS_PATH, typeof(BoltRuntimeSettings)))
        {
            BoltRuntimeSettings settings = BoltRuntimeSettings.CreateInstance <BoltRuntimeSettings>();
            settings.masterServerGameId = Guid.NewGuid().ToString().ToUpperInvariant();

            AssetDatabase.CreateAsset(settings, SETTINGS_PATH);
            AssetDatabase.ImportAsset(SETTINGS_PATH, ImportAssetOptions.Default);
        }

        if (!AssetDatabase.LoadAssetAtPath(PREFABDB_PATH, typeof(Bolt.PrefabDatabase)))
        {
            AssetDatabase.CreateAsset(Bolt.PrefabDatabase.CreateInstance <Bolt.PrefabDatabase>(), PREFABDB_PATH);
            AssetDatabase.ImportAsset(PREFABDB_PATH, ImportAssetOptions.Default);
        }

        BoltMenuItems.RunCompiler();
    }
    protected void InitialSetup()
    {
        string SETTINGS_PATH = Path.Combine(BoltPathUtility.ResourcesPath, "BoltRuntimeSettings.asset");
        string PREFABDB_PATH = Path.Combine(BoltPathUtility.ResourcesPath, "BoltPrefabDatabase.asset");

        if (!AssetDatabase.LoadAssetAtPath(SETTINGS_PATH, typeof(BoltRuntimeSettings)))
        {
            BoltRuntimeSettings settings = CreateInstance <BoltRuntimeSettings>();
            settings.masterServerGameId = Guid.NewGuid().ToString().ToUpperInvariant();

            AssetDatabase.CreateAsset(settings, SETTINGS_PATH);
            AssetDatabase.ImportAsset(SETTINGS_PATH, ImportAssetOptions.Default);
        }

        if (!AssetDatabase.LoadAssetAtPath(PREFABDB_PATH, typeof(Bolt.PrefabDatabase)))
        {
            AssetDatabase.CreateAsset(CreateInstance <Bolt.PrefabDatabase>(), PREFABDB_PATH);
            AssetDatabase.ImportAsset(PREFABDB_PATH, ImportAssetOptions.Default);
        }

        BoltMenuItems.RunCompiler();
    }
    void DrawFooter()
    {
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();

        EditorGUI.BeginDisabledGroup((int)currentStage == 1);

#if !BOLT_CLOUD
        if (currentStage == BoltSetupStage.Photon)
        {
            if (GUILayout.Button("Skip", GUILayout.Width(ButtonWidth)))
            {
                NextStep();
                beforeNextCallback = null;
            }
        }
#endif

        if (GUILayout.Button("Back", GUILayout.Width(ButtonWidth)))
        {
            beforeNextCallback = null;
            BackStep();
        }

        EditorGUI.EndDisabledGroup();

        var nextLabel = "Next";

        switch (currentStage)
        {
        case BoltSetupStage.Photon:
            nextLabel = AccountService.IsValidEmail(AppIdOrEmail) ? "Register by Email" : nextLabel;
            break;

        case BoltSetupStage.Support:
            nextLabel = "Done";
            break;

        default:
            nextLabel = "Next";
            break;
        }

        if (GUILayout.Button(nextLabel, GUILayout.Width(ButtonWidth)))
        {
            if (beforeNextCallback == null || beforeNextCallback())
            {
                if (currentStage == BoltSetupStage.Support)
                {
                    EditorPrefs.SetBool(FirstStartupKey, true);
                    Close();

                    if (RunCompiler)
                    {
                        BoltMenuItems.RunCompiler();
                    }
                }

                NextStep();
                beforeNextCallback = null;
            }
        }

        GUILayout.Space(5);
        GUILayout.EndHorizontal();
        GUILayout.Space(5);
    }