1 using System.Collections;
2 using System.Collections.Generic;
9 namespace AVR.UEditor.Core {
13 private static Font fa_cache => _fa_cache!=null ? _fa_cache : _fa_cache = GetFont(
"/editor/fonts/font-awesome");
16 private static Font fab_cache => _fab_cache != null ? _fab_cache : _fab_cache = GetFont(
"/editor/fonts/font-awesome-brands");
20 Object prefab = AssetDatabase.LoadAssetAtPath(AVR.Core.AVR_Settings.get_string(settings_token), typeof(GameObject));
23 AVR.Core.AVR_DevConsole.error(
"There is a prefab missing at: " + AVR.Core.AVR_Settings.get_string(settings_token));
28 GameObject o = (GameObject)PrefabUtility.InstantiatePrefab(prefab);
29 o.transform.SetParent(parent);
30 o.transform.localPosition = Vector3.zero;
31 o.transform.localRotation = Quaternion.identity;
32 AVR.Core.AVR_DevConsole.success(
"Instantiated Prefab. Token: " + settings_token);
37 public static Font
GetFont(
string settings_token) {
38 return (Font)AssetDatabase.LoadAssetAtPath(AVR.Core.AVR_Settings.get_string(settings_token), typeof(Font));
42 return ((
char)
int.Parse(unicode, System.Globalization.NumberStyles.HexNumber)).ToString();
46 return ((
char)unicode).ToString();
49 public static bool FAButton(
string unicode,
bool isBrandIcon=
false,
int buttonSize=25) {
50 var style =
new GUIStyle(GUI.skin.button);
51 style.font = isBrandIcon ? fab_cache : fa_cache;
52 style.fontSize = Mathf.Max(7, buttonSize - 12);
53 return GUILayout.Button(Unicode_to_String(unicode), style, GUILayout.Width(buttonSize), GUILayout.Height(buttonSize));
56 public static void FALabel(
string unicode,
bool isBrandIcon =
false,
int buttonSize = 25)
58 var style =
new GUIStyle(GUI.skin.label);
59 style.font = isBrandIcon ? fab_cache : fa_cache;
60 style.fontSize = Mathf.Max(7, buttonSize - 12);
61 GUILayout.Label(Unicode_to_String(unicode), style, GUILayout.Width(buttonSize), GUILayout.Height(buttonSize));
65 if(FAButton(
"f02d")) {
66 string path = System.IO.Path.GetFullPath(AVR.Core.AVR_Settings.get_string(
"/editor/documentationPath") + page);
67 Application.OpenURL(
"file:///"+path);
74 AVR_Component_EventsWizard.CreateWizard(component);
79 public static void NetworkSetting_Button(AVR.Core.AVR_Component component) {
80 if(FAButton(
"f6ff")) {
81 AVR_Component_NetworkWizard.CreateWizard(component);
static string Unicode_to_String(int unicode)
static void Documentation_Url(string page)
static bool FAButton(string unicode, bool isBrandIcon=false, int buttonSize=25)
static void FALabel(string unicode, bool isBrandIcon=false, int buttonSize=25)
static Font GetFont(string settings_token)
static void EventsSettings_Button(AVR.Core.AVR_Component component)
static GameObject InstantiatePrefabAsChild(Transform parent, string settings_token)
static string Unicode_to_String(string unicode)