TOOLTIP
How do I use T O O L T I P
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
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: PhotonTransformViewEditor.cs
Copy
232 private void DrawSynchronizePositionDataExtrapolation(ref Rect propertyRect, SerializedProperty extrapolatePositionProperty, PhotonTransformViewPositionModel.ExtrapolateOptions extrapolateOption)
233 {
234 DrawPropertyWithHelpIcon(ref propertyRect, ref this.m_ExtrapolateHelpOpen, extrapolatePositionProperty, EXTRAPOLATE_TOOLTIP);
235 DrawHelpBox(ref propertyRect, this.m_ExtrapolateHelpOpen, GetExtrapolateHelpBoxHeight(), EXTRAPOLATE_HELP, EXTRAPOLATE_HELP_URL);
236
237 if (extrapolateOption != PhotonTransformViewPositionModel.ExtrapolateOptions.Disabled)
238 {
239 EditorGUI.PropertyField(propertyRect, serializedObject.FindProperty("m_PositionModel.ExtrapolateIncludingRoundTripTime"));
240 propertyRect.y += EDITOR_LINE_HEIGHT;
241 }
242
243 switch (extrapolateOption)
244 {
245 case PhotonTransformViewPositionModel.ExtrapolateOptions.FixedSpeed:
246 EditorGUI.PropertyField(propertyRect, serializedObject.FindProperty("m_PositionModel.ExtrapolateSpeed"));
247 propertyRect.y += EDITOR_LINE_HEIGHT;
248 break;
249 }
250 }
File name: PhotonTransformViewEditor.cs
Copy
264 PhotonTransformViewPositionModel.InterpolateOptions interpolateOption)
265 {
266 DrawPropertyWithHelpIcon(ref propertyRect, ref this.m_InterpolateHelpOpen, interpolatePositionProperty, INTERPOLATE_TOOLTIP);
267 DrawHelpBox(ref propertyRect, this.m_InterpolateHelpOpen, GetInterpolateHelpBoxHeight(), INTERPOLATE_HELP, INTERPOLATE_HELP_URL);
268
269 switch (interpolateOption)
270 {
271 case PhotonTransformViewPositionModel.InterpolateOptions.FixedSpeed:
272 EditorGUI.PropertyField(propertyRect, serializedObject.FindProperty("m_PositionModel.InterpolateMoveTowardsSpeed"),
273 new GUIContent("MoveTowards Speed"));
274 propertyRect.y += EDITOR_LINE_HEIGHT;
275 break;
276
277 case PhotonTransformViewPositionModel.InterpolateOptions.Lerp:
278 EditorGUI.PropertyField(propertyRect, serializedObject.FindProperty("m_PositionModel.InterpolateLerpSpeed"), new GUIContent("Lerp Speed"));
279 propertyRect.y += EDITOR_LINE_HEIGHT;
280 break;
281
282 /*case PhotonTransformViewPositionModel.InterpolateOptions.MoveTowardsComplex:
283 Rect curveRect = new Rect(propertyRect.xMin, propertyRect.yMin, propertyRect.width - 100, propertyRect.height);
284 EditorGUI.PropertyField(curveRect, serializedObject.FindProperty("m_PositionModel.InterpolateSpeedCurve"), new GUIContent("MoveTowards Speed Curve"));
285
286 Rect labelRect = new Rect(propertyRect.xMax - 95, propertyRect.yMin, 10, propertyRect.height);
287 GUI.Label(labelRect, "x");
288
289 Rect multiplierRect = new Rect(propertyRect.xMax - 80, propertyRect.yMin, 80, propertyRect.height);
290 EditorGUI.PropertyField(multiplierRect, serializedObject.FindProperty("m_PositionModel.InterpolateMoveTowardsSpeed"), GUIContent.none);
291 propertyRect.y += EDITOR_LINE_HEIGHT;
292
293 EditorGUI.PropertyField(propertyRect, serializedObject.FindProperty("m_PositionModel.InterpolateMoveTowardsAcceleration"),
294 new GUIContent("Acceleration"));
295 propertyRect.y += EDITOR_LINE_HEIGHT;
296
297 EditorGUI.PropertyField(propertyRect, serializedObject.FindProperty("m_PositionModel.InterpolateMoveTowardsDeceleration"),
298 new GUIContent("Deceleration"));
299 propertyRect.y += EDITOR_LINE_HEIGHT;
300 break;*/
301 }
302 }
File name: PhotonTransformViewEditor.cs
Copy
309 private void DrawSynchronizeRotationData()
310 {
311 if (this.m_SynchronizeRotationProperty == null || this.m_SynchronizeRotationProperty.boolValue == false)
312 {
313 return;
314 }
315
316 SerializedProperty interpolateRotationProperty = serializedObject.FindProperty("m_RotationModel.InterpolateOption");
317 PhotonTransformViewRotationModel.InterpolateOptions interpolateOption =
318 (PhotonTransformViewRotationModel.InterpolateOptions) interpolateRotationProperty.enumValueIndex;
319
320 float containerHeight = 20;
321
322 switch (interpolateOption)
323 {
324 case PhotonTransformViewRotationModel.InterpolateOptions.RotateTowards:
325 case PhotonTransformViewRotationModel.InterpolateOptions.Lerp:
326 containerHeight += EDITOR_LINE_HEIGHT;
327 break;
328 }
329
330 if (this.m_InterpolateRotationHelpOpen == true)
331 {
332 containerHeight += GetInterpolateHelpBoxHeight();
333 }
334
335 Rect rect = PhotonGUI.ContainerBody(containerHeight);
336 Rect propertyRect = new Rect(rect.xMin + 5, rect.yMin + 2, rect.width - 10, EditorGUIUtility.singleLineHeight);
337
338 DrawPropertyWithHelpIcon(ref propertyRect, ref this.m_InterpolateRotationHelpOpen, interpolateRotationProperty, INTERPOLATE_TOOLTIP);
339 DrawHelpBox(ref propertyRect, this.m_InterpolateRotationHelpOpen, GetInterpolateHelpBoxHeight(), INTERPOLATE_HELP, INTERPOLATE_HELP_URL);
340
341 switch (interpolateOption)
342 {
343 case PhotonTransformViewRotationModel.InterpolateOptions.RotateTowards:
344 EditorGUI.PropertyField(propertyRect, serializedObject.FindProperty("m_RotationModel.InterpolateRotateTowardsSpeed"),
345 new GUIContent("RotateTowards Speed"));
346 break;
347 case PhotonTransformViewRotationModel.InterpolateOptions.Lerp:
348 EditorGUI.PropertyField(propertyRect, serializedObject.FindProperty("m_RotationModel.InterpolateLerpSpeed"), new GUIContent("Lerp Speed"));
349 break;
350 }
351 }
File name: PhotonTransformViewEditor.cs
Copy
358 private void DrawSynchronizeScaleData()
359 {
360 if (this.m_SynchronizeScaleProperty == null || this.m_SynchronizeScaleProperty.boolValue == false)
361 {
362 return;
363 }
364
365 SerializedProperty interpolateScaleProperty = serializedObject.FindProperty("m_ScaleModel.InterpolateOption");
366 PhotonTransformViewScaleModel.InterpolateOptions interpolateOption = (PhotonTransformViewScaleModel.InterpolateOptions) interpolateScaleProperty.enumValueIndex;
367
368 float containerHeight = EDITOR_LINE_HEIGHT;
369
370 switch (interpolateOption)
371 {
372 case PhotonTransformViewScaleModel.InterpolateOptions.MoveTowards:
373 case PhotonTransformViewScaleModel.InterpolateOptions.Lerp:
374 containerHeight += EDITOR_LINE_HEIGHT;
375 break;
376 }
377
378 if (this.m_InterpolateScaleHelpOpen == true)
379 {
380 containerHeight += GetInterpolateHelpBoxHeight();
381 }
382
383 Rect rect = PhotonGUI.ContainerBody(containerHeight);
384 Rect propertyRect = new Rect(rect.xMin + 5, rect.yMin + 2, rect.width - 10, EditorGUIUtility.singleLineHeight);
385
386 DrawPropertyWithHelpIcon(ref propertyRect, ref this.m_InterpolateScaleHelpOpen, interpolateScaleProperty, INTERPOLATE_TOOLTIP);
387 DrawHelpBox(ref propertyRect, this.m_InterpolateScaleHelpOpen, GetInterpolateHelpBoxHeight(), INTERPOLATE_HELP, INTERPOLATE_HELP_URL);
388
389 switch (interpolateOption)
390 {
391 case PhotonTransformViewScaleModel.InterpolateOptions.MoveTowards:
392 EditorGUI.PropertyField(propertyRect, serializedObject.FindProperty("m_ScaleModel.InterpolateMoveTowardsSpeed"),
393 new GUIContent("MoveTowards Speed"));
394 break;
395 case PhotonTransformViewScaleModel.InterpolateOptions.Lerp:
396 EditorGUI.PropertyField(propertyRect, serializedObject.FindProperty("m_ScaleModel.InterpolateLerpSpeed"), new GUIContent("Lerp Speed"));
397 break;
398 }
399 }
File name: PhotonEditor.cs
Copy
543 protected virtual void OnGuiMainWizard()
544 {
545 GUILayout.BeginHorizontal();
546 GUILayout.FlexibleSpace();
547 GUILayout.Label(WizardIcon);
548 GUILayout.FlexibleSpace();
549 GUILayout.EndHorizontal();
550
551 EditorGUILayout.Separator();
552
553 GUILayout.Label(CurrentLang.PUNWizardLabel, EditorStyles.boldLabel);
554 if (isPunPlus)
555 {
556 GUILayout.Label(CurrentLang.MobilePunPlusExportNoteLabel);
557 }
558 else if (!InternalEditorUtility.HasAdvancedLicenseOnBuildTarget(BuildTarget.Android) || !InternalEditorUtility.HasAdvancedLicenseOnBuildTarget(BuildTarget.iOS))
559 {
560 GUILayout.Label(CurrentLang.MobileExportNoteLabel);
561 }
562 EditorGUILayout.Separator();
563
564
565 // settings button
566 GUILayout.BeginHorizontal();
567 GUILayout.Label(CurrentLang.SettingsButton, EditorStyles.boldLabel, GUILayout.Width(100));
568 if (GUILayout.Button(new GUIContent(CurrentLang.SetupButton, CurrentLang.SetupServerCloudLabel)))
569 {
570 this.InitPhotonSetupWindow();
571 }
572
573 GUILayout.EndHorizontal();
574 EditorGUILayout.Separator();
575
576
577 // find / select settings asset
578 GUILayout.BeginHorizontal();
579 GUILayout.Label(CurrentLang.SettingsFileLabel, EditorStyles.boldLabel, GUILayout.Width(100));
580 if (GUILayout.Button(new GUIContent(CurrentLang.LocateSettingsButton, CurrentLang.SettingsHighlightLabel)))
581 {
582 EditorGUIUtility.PingObject(PhotonEditor.Current);
583 }
584
585 GUILayout.EndHorizontal();
586
587
588 GUILayout.FlexibleSpace();
589
590 // converter
591 GUILayout.BeginHorizontal();
592 GUILayout.Label(CurrentLang.ConverterLabel, EditorStyles.boldLabel, GUILayout.Width(100));
593 if (GUILayout.Button(new GUIContent(CurrentLang.StartButton, CurrentLang.UNtoPUNLabel)))
594 {
595 PhotonConverter.RunConversion();
596 }
597
598 GUILayout.EndHorizontal();
599 EditorGUILayout.Separator();
600
601
602 // documentation
603 GUILayout.BeginHorizontal();
604 GUILayout.Label(CurrentLang.DocumentationLabel, EditorStyles.boldLabel, GUILayout.Width(100));
605 GUILayout.BeginVertical();
606 if (GUILayout.Button(new GUIContent(CurrentLang.OpenPDFText, CurrentLang.OpenPDFTooltip)))
607 {
608 EditorUtility.OpenWithDefaultApp(DocumentationLocation);
609 }
610
611 if (GUILayout.Button(new GUIContent(CurrentLang.OpenDevNetText, CurrentLang.OpenDevNetTooltip)))
612 {
613 EditorUtility.OpenWithDefaultApp(UrlDevNet);
614 }
615
616 if (GUILayout.Button(new GUIContent(CurrentLang.OpenCloudDashboardText, CurrentLang.OpenCloudDashboardTooltip)))
617 {
618 EditorUtility.OpenWithDefaultApp(UrlCloudDashboard + Uri.EscapeUriString(this.emailAddress));
619 }
620
621 if (GUILayout.Button(new GUIContent(CurrentLang.OpenForumText, CurrentLang.OpenForumTooltip)))
622 {
623 EditorUtility.OpenWithDefaultApp(UrlForum);
624 }
625
626 GUILayout.EndVertical();
627 GUILayout.EndHorizontal();
628 }
File name: PhotonEditor.cs
Copy
727 protected virtual void OnGuiSetupSelfhosting()
728 {
729 GUILayout.Label(CurrentLang.YourPhotonServerLabel);
730
731 this.photonAddress = EditorGUILayout.TextField(CurrentLang.AddressIPLabel, this.photonAddress);
732 this.photonPort = EditorGUILayout.IntField(CurrentLang.PortLabel, this.photonPort);
733 this.photonProtocol = (ConnectionProtocol)EditorGUILayout.EnumPopup("Protocol", this.photonProtocol);
734 EditorGUILayout.Separator();
735
736 GUILayout.BeginHorizontal();
737 if (GUILayout.Button(CurrentLang.CancelButton))
738 {
739 GUIUtility.keyboardControl = 0;
740 this.ReApplySettingsToWindow();
741 }
742
743 if (GUILayout.Button(CurrentLang.SaveButton))
744 {
745 GUIUtility.keyboardControl = 0;
746
747 PhotonEditor.Current.UseMyServer(this.photonAddress, this.photonPort, null);
748 PhotonEditor.Current.Protocol = this.photonProtocol;
749 PhotonEditor.Save();
750
751 Inspect();
752 EditorUtility.DisplayDialog(CurrentLang.SettingsSavedTitle, CurrentLang.SettingsSavedMessage, CurrentLang.OkButton);
753 }
754
755 GUILayout.EndHorizontal();
756
757
758 GUILayout.Space(20);
759
760
761 // license
762 GUILayout.BeginHorizontal();
763 GUILayout.Label(CurrentLang.LicensesLabel, EditorStyles.boldLabel, GUILayout.Width(100));
764
765 if (GUILayout.Button(new GUIContent(CurrentLang.LicenseDownloadText, CurrentLang.LicenseDownloadTooltip)))
766 {
767 EditorUtility.OpenWithDefaultApp(UrlFreeLicense);
768 }
769
770 GUILayout.EndHorizontal();
771
772
773 GUILayout.Space(20);
774
775
776 GUILayout.Label(CurrentLang.TryPhotonAppLabel);
777
778 if (GUILayout.Button(CurrentLang.GetCloudAppButton))
779 {
780 this.cloudAppId = string.Empty;
781 this.photonSetupState = PhotonSetupStates.RegisterForPhotonCloud;
782 }
783
784 EditorGUILayout.Separator();
785 GUILayout.Label(CurrentLang.OwnHostCloudCompareLabel);
786 if (GUILayout.Button(CurrentLang.ComparisonPageButton))
787 {
788 Application.OpenURL(UrlCompare);
789 }
790 }
TOOLTIP 132 lượt xem
Gõ tìm kiếm nhanh...