-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
552471c
commit a57191c
Showing
7 changed files
with
113 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
Assets/Huawei/Editor/View/ModelingTab/ModelingSettingsDrawer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using HmsPlugin.Button; | ||
using HmsPlugin.TextField; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace HmsPlugin | ||
{ | ||
internal class ModelingSettingsDrawer : VerticalSequenceDrawer | ||
{ | ||
private TextField.TextFieldWithAccept _keyAPITextField; | ||
|
||
private HMSSettings _settings; | ||
|
||
public ModelingSettingsDrawer() | ||
{ | ||
_settings = HMSModelingKitSettings.Instance.Settings; | ||
_keyAPITextField = new TextFieldWithAccept("KeyAPI", _settings.Get(HMSModelingKitSettings.ModelingKeyAPI), | ||
"Save", OnKeyAPISaveButtonClick).SetLabelWidth(0).SetButtonWidth(100); | ||
|
||
SetupSequence(); | ||
} | ||
private void OnKeyAPISaveButtonClick() | ||
{ | ||
_settings.Set(HMSModelingKitSettings.ModelingKeyAPI, _keyAPITextField.GetCurrentText()); | ||
} | ||
|
||
private void SetupSequence() | ||
{ | ||
GUIStyle style = new GUIStyle(); | ||
style.normal.textColor = Color.cyan; | ||
AddDrawer(new Space(3)); | ||
AddDrawer(new Space(3)); | ||
AddDrawer(new HorizontalSequenceDrawer(new HorizontalLine(), new Label.Label("KeyAPI").SetBold(true), | ||
new HorizontalLine())); | ||
AddDrawer(new Space(3)); | ||
AddDrawer(_keyAPITextField); | ||
AddDrawer(new HorizontalSequenceDrawer(new HorizontalLine())); | ||
AddDrawer(new HorizontalSequenceDrawer(new Label.Label("\tNeed help? You can refer to"), new Clickable(new Label.Label("Guides & References").SetBold(true) | ||
.SetStyle(style).SetFontSize(10), | ||
() => { Application.OpenURL("https://evilminddevs.gitbook.io/hms-unity-plugin_/kits-and-services/3d-modeling-kit/guides-and-references"); }) | ||
,new Label.Label("."))); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Huawei/Editor/View/ModelingTab/ModelingSettingsDrawer.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
Assets/Huawei/Editor/View/ModelingTab/ModelingTabFactory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace HmsPlugin | ||
{ | ||
internal class ModelingTabFactory | ||
{ | ||
public static TabView CreateTab(string title) | ||
{ | ||
var tabView = new TabView(title); | ||
tabView.AddDrawer(new ModelingSettingsDrawer()); | ||
return tabView; | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Huawei/Editor/View/ModelingTab/ModelingTabFactory.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.