コード例 #1
0
    protected override void OnGUI()
    {
        if (shouldRefresh)
        {
            Repaint();
        }

        FsmEditorStyles.Init();

        FsmEditorGUILayout.ToolWindowLargeTitle(this, "Photon Setup Wizard");
        GUILayout.Space(_topSpace);
        EditorGUIUtility.LookLikeControls(200);


        // check pun version support
        if (!PlayMakerPhotonEditorUtility.IsPunVersionSupported())
        {
            GUI.color = PlayMakerPhotonEditorUtility.lightOrange;
            GUILayout.Label("WARNING: Photon Network version is newer: " + PhotonNetwork.versionPUN + ". We only support version " + PlayMakerPhotonEditorUtility.supportedPUNVersion + ".\n It is recommended to only use the Photon Network assets provided with PlayMaker, as compatibility issue may be found otherwise.", "box", GUILayout.ExpandWidth(true));
            GUI.color = Color.white;
        }

        bool hasPro = UnityEditorInternal.InternalEditorUtility.HasAdvancedLicenseOnBuildTarget(EditorUserBuildSettings.activeBuildTarget);

        if (!hasPro)
        {
            GUI.color = PlayMakerPhotonEditorUtility.lightOrange;
            GUILayout.Label("WARNING: Photon requires " + EditorUserBuildSettings.activeBuildTarget + " Pro to make an " + EditorUserBuildSettings.activeBuildTarget + " build.", "box", GUILayout.ExpandWidth(true));
            GUI.color = Color.white;
        }

        // custom layout (other parts can be overridden as well)
        //  GUILayout.Label("My Custom Editor");
        base.OnGUI();
    }
コード例 #2
0
ファイル: PlayMakerPhotonWizard.cs プロジェクト: Tovee/Temp
    protected override void OnGUI()
    {
        if (shouldRefresh)
        {
            Repaint();
        }

        FsmEditorStyles.Init();

        FsmEditorGUILayout.ToolWindowLargeTitle(this, "Photon Setup Wizard");
        GUILayout.Space(_topSpace);
#if UNITY_3_5
        EditorGUIUtility.LookLikeControls(200);
#endif

        // check pun version support
        if (!PlayMakerPhotonEditorUtility.IsPunVersionSupported())
        {
            GUI.color = PlayMakerPhotonEditorUtility.lightOrange;
            GUILayout.Label("WARNING: Photon Network version is newer: " + PhotonNetwork.versionPUN + ". We only support version " + PlayMakerPhotonEditorUtility.supportedPUNVersion + ".\n It is recommended to only use the Photon Network assets provided with PlayMaker, as compatibility issue may be found otherwise.", "box", GUILayout.ExpandWidth(true));
            GUI.color = Color.white;
        }



                #if PLAYMAKER_1_9_OR_NEWER
        if (!FsmEditorSettings.UseLegacyNetworking || !FsmEditorSettings.ShowNetworkSync)
        {
            FsmEditorSettings.UseLegacyNetworking = true;
            FsmEditorSettings.ShowNetworkSync     = true;
        }

        // doesn't work, we need to check with PLAYMAKER_LEGACY_NETWORK compile flag
        //EditorStartupPrefs.UseLegacyNetworking = GUILayout.Toggle(EditorStartupPrefs.UseLegacyNetworking,"enabled");

//			#if !PLAYMAKER_LEGACY_NETWORK
//			GUI.color =  PlayMakerPhotonEditorUtility.lightOrange;
//			GUILayout.Label("WARNING: PlayMaker needs to have its network UI system enabled","box",GUILayout.ExpandWidth(true));
//			GUI.color = Color.white;
//
//			if (GUILayout.Button(new GUIContent("Enable PlayMaker Network UI", "Displays the network sync property for Fsm Variables")))
//			{
//				PlayMakerEditorUtils.MountScriptingDefineSymbolToAllTargets("PLAYMAKER_LEGACY_NETWORK");
//			}
//
//			#endif
                #endif

        base.OnGUI();
    }
コード例 #3
0
ファイル: PlayMakerPhotonWizard.cs プロジェクト: Tovee/Temp
    void BuildSceneWizard()
    {
        // JFF : Adds the playmaker proxy, and only display that button if the scene doesn't have it already.
        // mabe make it in red or a lot clearer
        GUILayout.BeginHorizontal();
        GUILayout.Label("Scene", EditorStyles.boldLabel, GUILayout.Width(100));

        if (!PlayMakerPhotonEditorUtility.IsSceneSetup())
        {
            GUI.color = PlayMakerPhotonEditorUtility.lightOrange;
            if (GUILayout.Button(new GUIContent("Add Photon System to the scene", "Required for Photon and PlayMaker to work together")))
            {
                PlayMakerPhotonEditorUtility.DoCreateRpcProxy();
            }
            GUI.color = Color.white;
            if (FsmEditorGUILayout.HelpButton("Required for scenes that will use Photon"))
            {
                EditorUtility.OpenWithDefaultApp(PhotonGOPhotonProxyHelpUrl);
            }
        }
        else
        {
            GUI.color = Color.green;
            GUILayout.Label("The scene is set up properly.", "box", GUILayout.ExpandWidth(true));
        }
        GUI.color = Color.white;
        GUILayout.EndHorizontal();

        if (!PlayMakerPhotonEditorUtility.IsSceneSetup())
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("", EditorStyles.boldLabel, GUILayout.Width(100));
            GUILayout.Label("You need to first add the Photon System Proxy Prefab if you want this scene to work for multi users and PlayMaker", "box", GUILayout.ExpandWidth(true));
            GUILayout.EndHorizontal();
        }
        GUILayout.Space(22);


        // JFF : Adds a photon view to the selected gameObject, will automatically add the gameObject proxy if required.
        if (Selection.activeGameObject)
        {
            // check that it is not the photon proxy
            PlayMakerPhotonProxy prox = Selection.activeGameObject.GetComponent <PlayMakerPhotonProxy>();

            if (prox != null)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label("Photon Proxy", EditorStyles.boldLabel, GUILayout.Width(100));
                GUILayout.Label("This GameObject must not be edited. It is the bridge between Photon and PlayMaker", "box", GUILayout.ExpandWidth(true));


                if (FsmEditorGUILayout.HelpButton("Photon Proxy must not be edited"))
                {
                    EditorUtility.OpenWithDefaultApp(PhotonGOPhotonProxyHelpUrl);
                }

                GUILayout.EndHorizontal();
            }
            else
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label("Component", EditorStyles.boldLabel, GUILayout.Width(100));

                //object[] objects = Selection.GetFiltered(typeof(PlayMakerFSM),SelectionMode.Unfiltered);

                //PlayMakerFSM fsm = objects[0] as PlayMakerFSM;
                GUILayout.BeginVertical();
                GUILayout.BeginHorizontal();
                if (GUILayout.Button(new GUIContent("Add network-ready FSM to  '" + Selection.activeGameObject.name + "'", "Required for Fsm that will use Photon")))
                {
                    PlayMakerPhotonEditorUtility.DoCreateFsmWithPhotonView();
                }

                if (FsmEditorGUILayout.HelpButton("Required on GameObject that will use Photon network engine"))
                {
                    EditorUtility.OpenWithDefaultApp(PhotonGOFsmSetupHelpUrl);
                }

                GUILayout.EndHorizontal();

                GUILayout.Space(12);

                GUILayout.BeginHorizontal();
                if (GUILayout.Button(new GUIContent("Add Photon View to '" + Selection.activeGameObject.name + "'", "Required on GameObject that will use Photon")))
                {
                    PlayMakerPhotonEditorUtility.DoAddPhotonView();
                }

                if (FsmEditorGUILayout.HelpButton("Required on GameObject that will be instantiated over the Photon network"))
                {
                    EditorUtility.OpenWithDefaultApp(PhotonGOPhotonViewSetupHelpUrl);
                }

                GUILayout.EndHorizontal();
                GUILayout.EndVertical();

                GUILayout.EndHorizontal();
            }


            GUILayout.Space(22);
        }
    }