NotSet









How do I use Not Set
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: PhotonEditor.cs Copy
294     protected void InitPhotonSetupWindow()
295     {
296         this.minSize = MinSize;
297
298         this.SwitchMenuState(GUIState.Setup);
299         this.ReApplySettingsToWindow();
300
301         switch (PhotonEditor.Current.HostType)
302         {
303             case ServerSettings.HostingOption.PhotonCloud:
304             case ServerSettings.HostingOption.BestRegion:
305                 this.photonSetupState = PhotonSetupStates.SetupPhotonCloud;
306                 break;
307             case ServerSettings.HostingOption.SelfHosted:
308                 this.photonSetupState = PhotonSetupStates.SetupSelfHosted;
309                 break;
310             case ServerSettings.HostingOption.NotSet:
311             default:
312                 this.photonSetupState = PhotonSetupStates.RegisterForPhotonCloud;
313                 break;
314         }
315     }
File name: PhotonEditor.cs Copy
336     // called in editor, opens wizard for initial setup, keeps scene PhotonViews up to date and closes connections when compiling (to avoid issues)
337     private static void EditorUpdate()
338     {
339         if (dontCheckPunSetup || PhotonEditor.Current == null)
340         {
341             return;
342         }
343
344         // serverSetting is null when the file gets deleted. otherwise, the wizard should only run once and only if hosting option is not (yet) set
345         if (!PhotonEditor.Current.DisableAutoOpenWizard && PhotonEditor.Current.HostType == ServerSettings.HostingOption.NotSet)
346         {
347             ShowRegistrationWizard();
348         }
349
350         // Workaround for TCP crash. Plus this surpresses any other recompile errors.
351         if (EditorApplication.isCompiling)
352         {
353             if (PhotonNetwork.connected)
354             {
355                 if (lastWarning > EditorApplication.timeSinceStartup - 3)
356                 {
357                     // Prevent error spam
358                     Debug.LogWarning(CurrentLang.WarningPhotonDisconnect);
359                     lastWarning = EditorApplication.timeSinceStartup;
360                 }
361
362                 PhotonNetwork.Disconnect();
363             }
364         }
365     }
File name: PhotonEditor.cs Copy
367     // called in editor on change of play-mode (used to show a message popup that connection settings are incomplete)
368     private static void PlaymodeStateChanged()
369     {
370         if (dontCheckPunSetup || EditorApplication.isPlaying || !EditorApplication.isPlayingOrWillChangePlaymode)
371         {
372             return;
373         }
374
375         if (PhotonEditor.Current.HostType == ServerSettings.HostingOption.NotSet)
376         {
377             EditorUtility.DisplayDialog(CurrentLang.SetupWizardWarningTitle, CurrentLang.SetupWizardWarningMessage, CurrentLang.OkButton);
378         }
379     }
File name: PhotonEditor.cs Copy
390     protected virtual void OnGUI()
391     {
392         PhotonSetupStates oldGuiState = this.photonSetupState; // used to fix an annoying Editor input field issue: wont refresh until focus is changed.
393
394         GUI.SetNextControlName("");
395         this.scrollPos = GUILayout.BeginScrollView(this.scrollPos);
396
397         if (this.guiState == GUIState.Uninitialized)
398         {
399             this.ReApplySettingsToWindow();
400             this.guiState = (PhotonEditor.Current.HostType == ServerSettings.HostingOption.NotSet) ? GUIState.Setup : GUIState.Main;
401         }
402
403         if (this.guiState == GUIState.Main)
404         {
405             this.OnGuiMainWizard();
406         }
407         else
408         {
409             this.OnGuiRegisterCloudApp();
410         }
411
412         GUILayout.EndScrollView();
413
414         if (oldGuiState != this.photonSetupState)
415         {
416             GUI.FocusControl("");
417         }
418     }
File name: ServerSettingsInspector.cs Copy
17     public override void OnInspectorGUI()
18     {
19         ServerSettings settings = (ServerSettings)this.target;
20
21         #if UNITY_3_5
22         EditorGUIUtility.LookLikeInspector();
23         #endif
24
25
26         settings.HostType = (ServerSettings.HostingOption)EditorGUILayout.EnumPopup("Hosting", settings.HostType);
27         EditorGUI.indentLevel = 1;
28
29         switch (settings.HostType)
30         {
31             case ServerSettings.HostingOption.BestRegion:
32             case ServerSettings.HostingOption.PhotonCloud:
33                 if (settings.HostType == ServerSettings.HostingOption.PhotonCloud)
34                     settings.PreferredRegion = (CloudRegionCode)EditorGUILayout.EnumPopup("Region", settings.PreferredRegion);
35                 settings.AppID = EditorGUILayout.TextField("AppId", settings.AppID);
36                 settings.Protocol = (ConnectionProtocol)EditorGUILayout.EnumPopup("Protocol", settings.Protocol);
37
38                 if (string.IsNullOrEmpty(settings.AppID) || settings.AppID.Equals("master"))
39                 {
40                     EditorGUILayout.HelpBox("The Photon Cloud needs an AppId (GUID) set.\nYou can find it online in your Dashboard.", MessageType.Warning);
41                 }
42                 break;
43
44             case ServerSettings.HostingOption.SelfHosted:
45                 bool hidePort = false;
46                 if (settings.Protocol == ConnectionProtocol.Udp && (settings.ServerPort == 4530 || settings.ServerPort == 0))
47                 {
48                     settings.ServerPort = 5055;
49                 }
50                 else if (settings.Protocol == ConnectionProtocol.Tcp && (settings.ServerPort == 5055 || settings.ServerPort == 0))
51                 {
52                     settings.ServerPort = 4530;
53                 }
54                 #if RHTTP
55                 if (settings.Protocol == ConnectionProtocol.RHttp)
56                 {
57                     settings.ServerPort = 0;
58                     hidePort = true;
59                 }
60                 #endif
61                 settings.ServerAddress = EditorGUILayout.TextField("Server Address", settings.ServerAddress);
62                 settings.ServerAddress = settings.ServerAddress.Trim();
63                 if (!hidePort)
64                 {
65                     settings.ServerPort = EditorGUILayout.IntField("Server Port", settings.ServerPort);
66                 }
67                 settings.Protocol = (ConnectionProtocol)EditorGUILayout.EnumPopup("Protocol", settings.Protocol);
68                 settings.AppID = EditorGUILayout.TextField("AppId", settings.AppID);
69                 break;
70
71             case ServerSettings.HostingOption.OfflineMode:
72                 EditorGUI.indentLevel = 0;
73                 EditorGUILayout.HelpBox("In 'Offline Mode', the client does not communicate with a server.\nAll settings are hidden currently.", MessageType.Info);
74                 break;
75
76             case ServerSettings.HostingOption.NotSet:
77                 EditorGUI.indentLevel = 0;
78                 EditorGUILayout.HelpBox("Hosting is 'Not Set'.\nConnectUsingSettings() will not be able to connect.\nSelect another option or run the PUN Wizard.", MessageType.Info);
79                 break;
80
81             default:
82                 DrawDefaultInspector();
83                 break;
84         }
85
86         if (PhotonEditor.CheckPunPlus())
87         {
88             settings.Protocol = ConnectionProtocol.Udp;
89             EditorGUILayout.HelpBox("You seem to use PUN+.\nPUN+ only supports reliable UDP so the protocol is locked.", MessageType.Info);
90         }
91
92         settings.AppID = settings.AppID.Trim();
93
94         EditorGUI.indentLevel = 0;
95         SerializedObject sObj = new SerializedObject(this.target);
96         SerializedProperty sRpcs = sObj.FindProperty("RpcList");
97         EditorGUILayout.PropertyField(sRpcs, true);
98         sObj.ApplyModifiedProperties();
99
100         GUILayout.BeginHorizontal();
101         GUILayout.Space(20);
102         if (GUILayout.Button("Refresh RPCs"))
103         {
104             PhotonEditor.UpdateRpcList();
105             Repaint();
106         }
107         if (GUILayout.Button("Clear RPCs"))
108         {
109             PhotonEditor.ClearRpcList();
110         }
111         if (GUILayout.Button("Log HashCode"))
112         {
113             Debug.Log("RPC-List HashCode: " + RpcListHashCode() + ". Make sure clients that send each other RPCs have the same RPC-List.");
114         }
115         GUILayout.Space(20);
116         GUILayout.EndHorizontal();
117
118         //SerializedProperty sp = serializedObject.FindProperty("RpcList");
119         //EditorGUILayout.PropertyField(sp, true);
120
121         if (GUI.changed)
122         {
123             EditorUtility.SetDirty(target);
124         }
125     }
File name: ServerSettings.cs Copy
45     public enum HostingOption { NotSet, PhotonCloud, SelfHosted, OfflineMode, BestRegion }

NotSet 119 lượt xem

Gõ tìm kiếm nhanh...