None
How do I use None
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: ToHubButton.cs
Copy
21 public void OnGUI()
22 {
23 if (Application.loadedLevel != 0)
24 {
25 int w = ButtonTexture.width + 4;
26 int h = ButtonTexture.height + 4;
27
28 ButtonRect = new Rect(Screen.width - w, Screen.height - h, w, h);
29 if (GUI.Button(ButtonRect, ButtonTexture, GUIStyle.none))
30 {
31 PhotonNetwork.Disconnect();
32 Application.LoadLevel(0);
33 }
34 }
35 }
File name: WorkerMenu.cs
Copy
217 public void OnPhotonRandomJoinFailed()
218 {
219 this.ErrorDialog = "Error: Can't join random room (none found).";
220 Debug.Log("OnPhotonRandomJoinFailed got called. Happens if no room is available (or all full or invisible or closed). JoinrRandom filter-options can limit available rooms.");
221 }
File name: PlayerVariables.cs
Copy
18 public static string GetColorName(int playerId)
19 {
20 if (playerId <= 0)
21 {
22 return "none";
23 }
24 return playerColorNames[playerId%playerColors.Length];
25 }
File name: PhotonTransformViewEditor.cs
Copy
220 private void DrawPropertyWithHelpIcon(ref Rect propertyRect, ref bool isHelpOpen, SerializedProperty property, string tooltip)
221 {
222 Rect propertyFieldRect = new Rect(propertyRect.xMin, propertyRect.yMin, propertyRect.width - 20, propertyRect.height);
223 string propertyName = ObjectNames.NicifyVariableName(property.name);
224 EditorGUI.PropertyField(propertyFieldRect, property, new GUIContent(propertyName, tooltip));
225
226 Rect helpIconRect = new Rect(propertyFieldRect.xMax + 5, propertyFieldRect.yMin, 20, propertyFieldRect.height);
227 isHelpOpen = GUI.Toggle(helpIconRect, isHelpOpen, PhotonGUI.HelpIcon, GUIStyle.none);
228
229 propertyRect.y += EDITOR_LINE_HEIGHT;
230 }
File name: PhotonEditor.cs
Copy
215 static PhotonEditor()
216 {
217 EditorApplication.projectWindowChanged += EditorUpdate;
218 EditorApplication.hierarchyWindowChanged += EditorUpdate;
219 EditorApplication.playmodeStateChanged += PlaymodeStateChanged;
220 EditorApplication.update += OnUpdate;
221
222 WizardIcon = AssetDatabase.LoadAssetAtPath("Assets/Photon Unity Networking/photoncloud-icon.png", typeof(Texture2D)) as Texture2D;
223
224 // to be used in toolbar, the enum needs conversion to string[] being done here, once.
225 Array enumValues = Enum.GetValues(typeof(CloudRegionCode));
226 CloudServerRegionNames = new string[enumValues.Length];
227 for (int i = 0; i < CloudServerRegionNames.Length; i++)
228 {
229 CloudServerRegionNames[i] = enumValues.GetValue(i).ToString();
230 if (CloudServerRegionNames[i].Equals("none"))
231 {
232 CloudServerRegionNames[i] = PhotonEditor.CurrentLang.BestRegionLabel;
233 }
234 }
235
236 // detect optional packages
237 PhotonEditor.CheckPunPlus();
238
239 }
File name: PhotonEditor.cs
Copy
649 protected virtual void OnGuiSetupCloudAppId()
650 {
651 GUILayout.Label(CurrentLang.AppIdLabel);
652
653 GUILayout.BeginHorizontal();
654 this.cloudAppId = EditorGUILayout.TextField(this.cloudAppId);
655
656 open = GUILayout.Toggle(open, PhotonGUI.HelpIcon, GUIStyle.none, GUILayout.ExpandWidth(false));
657
658 GUILayout.EndHorizontal();
659
660 if (open) GUILayout.Label(CurrentLang.AppIdInfoLabel);
661
662
663
664 EditorGUILayout.Separator();
665
666 GUILayout.Label(CurrentLang.CloudRegionLabel);
667
668 GUILayout.BeginHorizontal();
669 int toolbarValue = GUILayout.Toolbar((int)selectedRegion, CloudServerRegionNames); // the enum CloudRegionCode is converted into a string[] in init (toolbar can't use enum)
670 helpRegion = GUILayout.Toggle( helpRegion, PhotonGUI.HelpIcon, GUIStyle.none, GUILayout.ExpandWidth( false ) );
671 GUILayout.EndHorizontal();
672
673
674 if (helpRegion) GUILayout.Label(CurrentLang.RegionalServersInfo);
675 PhotonEditor.selectedRegion = (CloudRegionCode)toolbarValue;
676
677 EditorGUILayout.Separator();
678
679 GUILayout.BeginHorizontal();
680 if (GUILayout.Button(CurrentLang.CancelButton))
681 {
682 GUIUtility.keyboardControl = 0;
683 this.ReApplySettingsToWindow();
684 }
685
686
687
688 if (GUILayout.Button(CurrentLang.SaveButton))
689 {
690 GUIUtility.keyboardControl = 0;
691 this.cloudAppId = this.cloudAppId.Trim();
692 PhotonEditor.Current.UseCloud(this.cloudAppId);
693
694 PhotonEditor.Current.PreferredRegion = PhotonEditor.selectedRegion;
695 PhotonEditor.Current.HostType = (PhotonEditor.Current.PreferredRegion == CloudRegionCode.none)
696 ? ServerSettings.HostingOption.BestRegion
697 : ServerSettings.HostingOption.PhotonCloud;
698 PhotonEditor.Save();
699
700 Inspect();
701 EditorUtility.DisplayDialog(CurrentLang.SettingsSavedTitle, CurrentLang.SettingsSavedMessage, CurrentLang.OkButton);
702 }
703
704 GUILayout.EndHorizontal();
705
706
707
708 GUILayout.Space(20);
709
710 GUILayout.Label(CurrentLang.SetupOwnServerLabel);
711
712 if (GUILayout.Button(CurrentLang.SelfHostSettingsButton))
713 {
714 //this.photonAddress = ServerSettings.DefaultServerAddress;
715 //this.photonPort = ServerSettings.DefaultMasterPort;
716 this.photonSetupState = PhotonSetupStates.SetupSelfHosted;
717 }
718
719 EditorGUILayout.Separator();
720 GUILayout.Label(CurrentLang.OwnHostCloudCompareLabel);
721 if (GUILayout.Button(CurrentLang.ComparisonPageButton))
722 {
723 Application.OpenURL(UrlCompare);
724 }
725 }
File name: PhotonEditor.cs
Copy
886 public static void ReLoadCurrentSettings()
887 {
888 // this now warns developers if there are more than one settings files in resources folders. first will be used.
889 UnityEngine.Object[] settingFiles = Resources.LoadAll(PhotonNetwork.serverSettingsAssetFile, typeof(ServerSettings));
890 if (settingFiles != null && settingFiles.Length > 0)
891 {
892 PhotonEditor.Current = (ServerSettings)settingFiles[0];
893
894 if (settingFiles.Length > 1)
895 {
896 Debug.LogWarning(CurrentLang.MoreThanOneLabel + PhotonNetwork.serverSettingsAssetFile + CurrentLang.FilesInResourceFolderLabel + AssetDatabase.GetAssetPath(PhotonEditor.Current));
897 }
898 }
899 }
File name: PhotonGUI.cs
Copy
197 SerializedProperty gizmoSizeProperty )
198 {
199 float height = EditorGUIUtility.singleLineHeight;
200 float flexibleWidth = Mathf.Max( 40, position.width - EditorGUIUtility.labelWidth - 20 - 75 - 5 - 40 - 5 );
201
202 Rect labelRect = new Rect( position.xMin, position.yMin, EditorGUIUtility.labelWidth, height );
203 GUI.Label( labelRect, label );
204
205 Rect enabledRect = new Rect( labelRect.xMax, labelRect.yMin, 20, height );
206 EditorGUI.PropertyField( enabledRect, gizmoEnabledProperty, GUIContent.none );
207
208 bool oldGUIEnabled = GUI.enabled;
209 GUI.enabled = gizmoEnabledProperty.boolValue;
210
211 Rect colorRect = new Rect( enabledRect.xMax + 5, labelRect.yMin, 70, height );
212 EditorGUI.PropertyField( colorRect, gizmoColorProperty, GUIContent.none );
213
214 Rect typeRect = new Rect( colorRect.xMax + 5, labelRect.yMin, flexibleWidth * 0.7f, height );
215 EditorGUI.PropertyField( typeRect, gizmoTypeProperty, GUIContent.none );
216
217 Rect sizeLabelRect = new Rect( typeRect.xMax + 10, labelRect.yMin, 30, height );
218 GUI.Label( sizeLabelRect, "Size" );
219
220 Rect sizeRect = new Rect( sizeLabelRect.xMax + 5, labelRect.yMin, flexibleWidth * 0.3f, height );
221 EditorGUI.PropertyField( sizeRect, gizmoSizeProperty, GUIContent.none );
222
223 GUI.enabled = oldGUIEnabled;
224 }
File name: PhotonGUI.cs
Copy
229 static Rect DoContainerBody( float height )
230 {
231 Rect controlRect = EditorGUILayout.GetControlRect( false, height );
232 controlRect.yMin -= 3;
233 controlRect.yMax -= 2;
234
235 int controlID = GUIUtility.GetControlID( FocusType.Passive, controlRect );
236
237 if( Event.current.type == EventType.Repaint )
238 {
239 PhotonGUI.DefaultContainerStyle.Draw( controlRect, GUIContent.none, controlID );
240 }
241
242 return controlRect;
243 }
File name: PhotonGUI.cs
Copy
262 static Rect DoContainerHeader( string headline, float height, float contentOffset )
263 {
264 GUILayout.Space( 5 );
265 Rect controlRect = EditorGUILayout.GetControlRect( false, height );
266
267 int controlID = GUIUtility.GetControlID( FocusType.Passive, controlRect );
268
269 if( Event.current.type == EventType.Repaint )
270 {
271 PhotonGUI.DefaultTitleStyle.Draw( controlRect, GUIContent.none, controlID );
272
273 Rect labelRect = new Rect( controlRect.xMin + 5 + contentOffset, controlRect.yMin + 5, controlRect.width, controlRect.height );
274 GUI.Label( labelRect, headline, EditorStyles.boldLabel );
275 }
276
277 return controlRect;
278 }
None 225 lượt xem
Gõ tìm kiếm nhanh...