Bold
How do I use Bold
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: PhotonEditor.cs
Copy
420 protected virtual void OnGuiRegisterCloudApp()
421 {
422 GUI.skin.label.wordWrap = true;
423 if (!this.isSetupWizard)
424 {
425 GUILayout.BeginHorizontal();
426 GUILayout.FlexibleSpace();
427 if (GUILayout.Button(CurrentLang.MainMenuButton, GUILayout.ExpandWidth(false)))
428 {
429 this.SwitchMenuState(GUIState.Main);
430 }
431
432 GUILayout.EndHorizontal();
433
434 GUILayout.Space(15);
435 }
436
437 if (this.photonSetupState == PhotonSetupStates.RegisterForPhotonCloud)
438 {
439 GUI.skin.label.fontStyle = FontStyle.Bold;
440 GUILayout.Label(CurrentLang.ConnectButton);
441 EditorGUILayout.Separator();
442 GUI.skin.label.fontStyle = FontStyle.Normal;
443
444 GUILayout.Label(CurrentLang.UsePhotonLabel);
445 EditorGUILayout.Separator();
446 this.emailAddress = EditorGUILayout.TextField(CurrentLang.EmailLabel, this.emailAddress);
447
448 if (GUILayout.Button(CurrentLang.SendButton))
449 {
450 GUIUtility.keyboardControl = 0;
451 this.RegisterWithEmail(this.emailAddress);
452 }
453
454 GUILayout.Space(20);
455
456
457 GUILayout.Label(CurrentLang.SignedUpAlreadyLabel);
458 if (GUILayout.Button(CurrentLang.SetupButton))
459 {
460 this.photonSetupState = PhotonSetupStates.SetupPhotonCloud;
461 }
462 EditorGUILayout.Separator();
463
464
465 GUILayout.Label(CurrentLang.RegisterByWebsiteLabel);
466 if (GUILayout.Button(CurrentLang.AccountWebsiteButton))
467 {
468 EditorUtility.OpenWithDefaultApp(UrlAccountPage + Uri.EscapeUriString(this.emailAddress));
469 }
470
471 EditorGUILayout.Separator();
472
473 GUILayout.Label(CurrentLang.SelfHostLabel);
474
475 if (GUILayout.Button(CurrentLang.SelfHostSettingsButton))
476 {
477 this.photonSetupState = PhotonSetupStates.SetupSelfHosted;
478 }
479
480 GUILayout.FlexibleSpace();
481
482
483 if (!InternalEditorUtility.HasAdvancedLicenseOnBuildTarget(BuildTarget.Android) || !InternalEditorUtility.HasAdvancedLicenseOnBuildTarget(BuildTarget.iOS))
484 {
485 GUILayout.Label(CurrentLang.MobileExportNoteLabel);
486 }
487 EditorGUILayout.Separator();
488 }
489 else if (this.photonSetupState == PhotonSetupStates.EmailAlreadyRegistered)
490 {
491 GUI.skin.label.fontStyle = FontStyle.Bold;
492 GUILayout.Label(CurrentLang.OopsLabel);
493 GUI.skin.label.fontStyle = FontStyle.Normal;
494
495 GUILayout.Label(CurrentLang.EmailInUseLabel);
496
497 if (GUILayout.Button(CurrentLang.SeeMyAccountPageButton))
498 {
499 EditorUtility.OpenWithDefaultApp(UrlCloudDashboard + Uri.EscapeUriString(this.emailAddress));
500 }
501
502 EditorGUILayout.Separator();
503
504 GUILayout.Label(CurrentLang.KnownAppIdLabel);
505 GUILayout.BeginHorizontal();
506 if (GUILayout.Button(CurrentLang.CancelButton))
507 {
508 this.photonSetupState = PhotonSetupStates.RegisterForPhotonCloud;
509 }
510
511 if (GUILayout.Button(CurrentLang.SetupButton))
512 {
513 this.photonSetupState = PhotonSetupStates.SetupPhotonCloud;
514 }
515
516 GUILayout.EndHorizontal();
517 }
518 else if (this.photonSetupState == PhotonSetupStates.SetupPhotonCloud)
519 {
520 // cloud setup
521 GUI.skin.label.fontStyle = FontStyle.Bold;
522 GUILayout.Label(CurrentLang.PhotonCloudConnect);
523 GUI.skin.label.fontStyle = FontStyle.Normal;
524
525 EditorGUILayout.Separator();
526 this.OnGuiSetupCloudAppId();
527 this.OnGuiCompareAndHelpOptions();
528 }
529 else if (this.photonSetupState == PhotonSetupStates.SetupSelfHosted)
530 {
531 // self-hosting setup
532 GUI.skin.label.fontStyle = FontStyle.Bold;
533 GUILayout.Label(CurrentLang.SetupOwnHostLabel);
534 GUI.skin.label.fontStyle = FontStyle.Normal;
535
536 EditorGUILayout.Separator();
537
538 this.OnGuiSetupSelfhosting();
539 this.OnGuiCompareAndHelpOptions();
540 }
541 }
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 }
File name: PhotonGUI.cs
Copy
107 {
108 get
109 {
110 if( m_FoldoutBold == null )
111 {
112 m_FoldoutBold = new GUIStyle( EditorStyles.foldout );
113 m_FoldoutBold.fontStyle = FontStyle.Bold;
114 }
115
116 return m_FoldoutBold;
117 }
118 }
File name: PhotonGUI.cs
Copy
254 static bool DoContainerHeaderFoldout( string headline, bool foldout )
255 {
256 Rect rect = DoContainerHeader( "", 27, 0f );
257 Rect foldoutRect = new Rect( rect.xMin + 15, rect.yMin + 5, rect.width, rect.height );
258
259 return EditorGUI.Foldout( foldoutRect, foldout, headline, FoldoutBold );
260 }
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 }
File name: PhotonViewInspector.cs
Copy
21 public override void OnInspectorGUI()
22 {
23 #if UNITY_3_5
24 EditorGUIUtility.LookLikeInspector();
25 #endif
26 //EditorGUI.indentLevel = 1;
27
28 m_Target = (PhotonView)this.target;
29 bool isProjectPrefab = EditorUtility.IsPersistent(m_Target.gameObject);
30
31 if( m_Target.ObservedComponents == null )
32 {
33 m_Target.ObservedComponents = new System.Collections.Generic.List
34 }
35
36 if( m_Target.ObservedComponents.Count == 0 )
37 {
38 m_Target.ObservedComponents.Add( null );
39 }
40
41 EditorGUILayout.BeginHorizontal();
42 // Owner
43 if (isProjectPrefab)
44 {
45 EditorGUILayout.LabelField("Owner:", "Set at runtime");
46 }
47 else if (m_Target.isSceneView)
48 {
49 EditorGUILayout.LabelField("Owner", "Scene");
50 }
51 else
52 {
53 PhotonPlayer owner = m_Target.owner;
54 string ownerInfo = (owner != null) ? owner.name : "
55
56 if (string.IsNullOrEmpty(ownerInfo))
57 {
58 ownerInfo = "
59 }
60
61 EditorGUILayout.LabelField("Owner", "[" + m_Target.ownerId + "] " + ownerInfo);
62 }
63
64 // ownership requests
65 EditorGUI.BeginDisabledGroup(Application.isPlaying);
66 m_Target.ownershipTransfer = (OwnershipOption)EditorGUILayout.EnumPopup(m_Target.ownershipTransfer, GUILayout.Width(100));
67 EditorGUI.EndDisabledGroup();
68
69 EditorGUILayout.EndHorizontal();
70
71
72 // View ID
73 if (isProjectPrefab)
74 {
75 EditorGUILayout.LabelField("View ID", "Set at runtime");
76 }
77 else if (EditorApplication.isPlaying)
78 {
79 EditorGUILayout.LabelField("View ID", m_Target.viewID.ToString());
80 }
81 else
82 {
83 int idValue = EditorGUILayout.IntField("View ID [1.."+(PhotonNetwork.MAX_VIEW_IDS-1)+"]", m_Target.viewID);
84 m_Target.viewID = idValue;
85 }
86
87
88
89 // Locally Controlled
90 if (EditorApplication.isPlaying)
91 {
92 string masterClientHint = PhotonNetwork.isMasterClient ? "(master)" : "";
93 EditorGUILayout.Toggle("Controlled locally: " + masterClientHint, m_Target.isMine);
94 }
95
96
97
98 //DrawOldObservedItem();
99 ConvertOldObservedItemToObservedList();
100
101
102 // ViewSynchronization (reliability)
103 if (m_Target.synchronization == ViewSynchronization.Off)
104 {
105 GUI.color = Color.grey;
106 }
107
108 EditorGUILayout.PropertyField( serializedObject.FindProperty( "synchronization" ), new GUIContent( "Observe option:" ) );
109
110 if( m_Target.synchronization != ViewSynchronization.Off &&
111 m_Target.ObservedComponents.FindAll( item => item != null ).Count == 0 )
112 {
113 GUILayout.BeginVertical( GUI.skin.box );
114 GUILayout.Label( "Warning", EditorStyles.boldLabel );
115 GUILayout.Label( "Setting the synchronization option only makes sense if you observe something." );
116 GUILayout.EndVertical();
117 }
118
119 /*ViewSynchronization vsValue = (ViewSynchronization)EditorGUILayout.EnumPopup("Observe option:", m_Target.synchronization);
120 if (vsValue != m_Target.synchronization)
121 {
122 m_Target.synchronization = vsValue;
123 if (m_Target.synchronization != ViewSynchronization.Off && m_Target.observed == null)
124 {
125 EditorUtility.DisplayDialog("Warning", "Setting the synchronization option only makes sense if you observe something.", "OK, I will fix it.");
126 }
127 }*/
128
129 DrawSpecificTypeSerializationOptions();
130
131 GUI.color = Color.white;
132 DrawObservedComponentsList();
133
134 // Cleanup: save and fix look
135 if (GUI.changed)
136 {
137 EditorUtility.SetDirty(m_Target);
138 PhotonViewHandler.HierarchyChange(); // TODO: check if needed
139 }
140
141 GUI.color = Color.white;
142 EditorGUIUtility.LookLikeControls();
143 }
File name: frmCustomerOrders.cs
Copy
28 private void Button7_Click(object sender, EventArgs e)
29 {
30 if (DataGridView3.DataSource == null)
31 {
32 MessageBox.Show("Sorry nothing to export into excel sheet..", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
33 return;
34 }
35 int rowsTotal = 0;
36 int colsTotal = 0;
37 int I = 0;
38 int j = 0;
39 int iC = 0;
40 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
41 Excel.Application xlApp = new Excel.Application();
42
43 try
44 {
45 Excel.Workbook excelBook = xlApp.Workbooks.Add();
46 Excel.Worksheet excelWorksheet = (Excel.Worksheet)excelBook.Worksheets[1];
47 xlApp.Visible = true;
48
49 rowsTotal = DataGridView3.RowCount;
50 colsTotal = DataGridView3.Columns.Count - 1;
51 var _with1 = excelWorksheet;
52 _with1.Cells.Select();
53 _with1.Cells.Delete();
54 for (iC = 0; iC <= colsTotal; iC++)
55 {
56 _with1.Cells[1, iC + 1].Value = DataGridView3.Columns[iC].HeaderText;
57 }
58 for (I = 0; I <= rowsTotal - 1; I++)
59 {
60 for (j = 0; j <= colsTotal; j++)
61 {
62 _with1.Cells[I + 2, j + 1].value = DataGridView3.Rows[I].Cells[j].Value;
63 }
64 }
65 _with1.Rows["1:1"].Font.FontStyle = "Bold";
66 _with1.Rows["1:1"].Font.Size = 12;
67
68 _with1.Cells.Columns.AutoFit();
69 _with1.Cells.Select();
70 _with1.Cells.EntireColumn.AutoFit();
71 _with1.Cells[1, 1].Select();
72 }
73 catch (Exception ex)
74 {
75 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
76 }
77 finally
78 {
79 //RELEASE ALLOACTED RESOURCES
80 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
81 xlApp = null;
82 }
83 }
File name: frmCustomerOrders.cs
Copy
223 private void Button3_Click(object sender, EventArgs e)
224 {
225 if (DataGridView1.DataSource == null)
226 {
227 MessageBox.Show("Sorry nothing to export into excel sheet..", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
228 return;
229 }
230 int rowsTotal = 0;
231 int colsTotal = 0;
232 int I = 0;
233 int j = 0;
234 int iC = 0;
235 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
236 Excel.Application xlApp = new Excel.Application();
237
238 try
239 {
240 Excel.Workbook excelBook = xlApp.Workbooks.Add();
241 Excel.Worksheet excelWorksheet = (Excel.Worksheet)excelBook.Worksheets[1];
242 xlApp.Visible = true;
243
244 rowsTotal = DataGridView1.RowCount;
245 colsTotal = DataGridView1.Columns.Count - 1;
246 var _with1 = excelWorksheet;
247 _with1.Cells.Select();
248 _with1.Cells.Delete();
249 for (iC = 0; iC <= colsTotal; iC++)
250 {
251 _with1.Cells[1, iC + 1].Value = DataGridView1.Columns[iC].HeaderText;
252 }
253 for (I = 0; I <= rowsTotal - 1; I++)
254 {
255 for (j = 0; j <= colsTotal; j++)
256 {
257 _with1.Cells[I + 2, j + 1].value = DataGridView1.Rows[I].Cells[j].Value;
258 }
259 }
260 _with1.Rows["1:1"].Font.FontStyle = "Bold";
261 _with1.Rows["1:1"].Font.Size = 12;
262
263 _with1.Cells.Columns.AutoFit();
264 _with1.Cells.Select();
265 _with1.Cells.EntireColumn.AutoFit();
266 _with1.Cells[1, 1].Select();
267 }
268 catch (Exception ex)
269 {
270 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
271 }
272 finally
273 {
274 //RELEASE ALLOACTED RESOURCES
275 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
276 xlApp = null;
277 }
278 }
File name: frmCustomersRecord.cs
Copy
85 private void Button3_Click(object sender, EventArgs e)
86 {
87 if (dataGridView1.DataSource == null)
88 {
89 MessageBox.Show("Sorry nothing to export into excel sheet..", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
90 return;
91 }
92 int rowsTotal = 0;
93 int colsTotal = 0;
94 int I = 0;
95 int j = 0;
96 int iC = 0;
97 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
98 Excel.Application xlApp = new Excel.Application();
99
100 try
101 {
102 Excel.Workbook excelBook = xlApp.Workbooks.Add();
103 Excel.Worksheet excelWorksheet = (Excel.Worksheet)excelBook.Worksheets[1];
104 xlApp.Visible = true;
105
106 rowsTotal = dataGridView1.RowCount;
107 colsTotal = dataGridView1.Columns.Count - 1;
108 var _with1 = excelWorksheet;
109 _with1.Cells.Select();
110 _with1.Cells.Delete();
111 for (iC = 0; iC <= colsTotal; iC++)
112 {
113 _with1.Cells[1, iC + 1].Value = dataGridView1.Columns[iC].HeaderText;
114 }
115 for (I = 0; I <= rowsTotal - 1; I++)
116 {
117 for (j = 0; j <= colsTotal; j++)
118 {
119 _with1.Cells[I + 2, j + 1].value = dataGridView1.Rows[I].Cells[j].Value;
120 }
121 }
122 _with1.Rows["1:1"].Font.FontStyle = "Bold";
123 _with1.Rows["1:1"].Font.Size = 12;
124
125 _with1.Cells.Columns.AutoFit();
126 _with1.Cells.Select();
127 _with1.Cells.EntireColumn.AutoFit();
128 _with1.Cells[1, 1].Select();
129 }
130 catch (Exception ex)
131 {
132 MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
133 }
134 finally
135 {
136 //RELEASE ALLOACTED RESOURCES
137 System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
138 xlApp = null;
139 }
140 }
Bold 105 lượt xem
Gõ tìm kiếm nhanh...