private void CopyComponent() { if (GUI.Button("CloneComp")) { selectedGameObject = selectedGameObject == null ? Selection.activeGameObject : null; } if (selectedGameObject != null) { foreach (var c in selectedGameObject.GetComponents <Component>()) { if (GUI.Button(c.GetType().Name)) { foreach (GameObject g in Selection.gameObjects) { var c2 = g.AddComponent(c.GetType()); foreach (FieldInfo f in c.GetType().GetFields()) { f.SetValue(c2, f.GetValue(c)); } //foreach (PropertyInfo p in c.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) // if(p.CanRead && p.CanWrite) // p.SetValue(c2, p.GetValue(c,null),null); //Debug.Log(c.GetType().GetProperties().Length+"+"); } } } GUI.Space(10); } }
private void DrawAssurer(VAssetManager Manager) { GL.BeginVertical("OL box"); GL.Label(Manager.ManagerName); var list = Manager.GetAssurerList(); if (list.Count == 0) { EGL.HelpBox("暂无资产", MessageType.Info); } else { list.ForEach(assurer => { GL.BeginVertical("GroupBox"); GL.BeginHorizontal(); GL.Label(String.Format("{0} : Ref {1}", assurer.Value.AssetPath, assurer.Value.UseCount)); if (GL.Button("Kill", GUILayout.Width(100))) { assurer.Value.ForceRecycle(); } GL.EndHorizontal(); GL.EndVertical(); GL.Space(2); }); } GL.EndVertical(); }
private void EndGUI() { GL.Space(5); EGL.EndHorizontal(); GL.Space(2); EGL.EndVertical(); }
public void DrawLuaScript(string filePath) { FindLuaTableInfo(filePath); // 以上是初始化环节 var luaName = filePath.Substring(filePath.LastIndexOf("/") + 1, filePath.Length - filePath.LastIndexOf("/") - 1).Replace(".lua", ""); GL.BeginVertical("OL box"); GL.Label(luaName, EditorStyles.boldLabel); if (mExecuteFunctionDirt == null || mExecuteFunctionDirt.Count() < 1) { EGL.HelpBox("没有可以被执行的方法", MessageType.Warning); } else { foreach (var m in mExecuteFunctionDirt) { GL.BeginHorizontal("box"); var methodName = string.Format("{0}:{1}", luaName, m.Key); GL.Label(methodName); if (GL.Button("Execute", GUILayout.Width(100))) { UnityEngine.Debug.LogFormat("<color=#FFA80B>Execute {0}:{1}</color>", luaName, m.Key); m.Value.Invoke(); } GL.EndHorizontal(); GL.Space(2); } } GL.EndVertical(); }
public static void TextField(Setting <string> val, string label, GUILayoutOption[] lblOpts, GUILayoutOption[] txtopts) { UGUI.BeginHorizontal(); UGUI.Label(label, Style.Label, lblOpts); UGUI.Space(5f); val.Value = UGUI.TextField(val.Value, Style.TextButton, txtopts); UGUI.EndHorizontal(); }
public static void ToggleButton(Setting <bool> val, string label) { UGUI.BeginHorizontal(); UGUI.Label(label, Style.Label, DefaultOption); UGUI.Space(5f); val.Value = UGUI.Button(val.Value ? GUI.LabelEnabled : GUI.LabelDisabled, Style.TextButton, DefaultOption); UGUI.EndHorizontal(); }
public static void TextField(Setting <int> val, string label) { UGUI.BeginHorizontal(); UGUI.Label(label, Style.Label, DefaultOption); UGUI.Space(5f); TextField(val); UGUI.EndHorizontal(); }
public static void TextField(Setting <string> val, string label) { UGUI.BeginHorizontal(); UGUI.Label(label, Style.Label, DefaultOption); UGUI.Space(5f); val.Value = UGUI.TextField(val.Value, Style.TextButton, DefaultOption); UGUI.EndHorizontal(); }
public static void HorizontalSlider(Setting <float> val, string label, float min, float max, GUILayoutOption[] lblOpts, GUILayoutOption[] sliderOpts) { UGUI.BeginHorizontal(); UGUI.Label(label, Style.Label, lblOpts); UGUI.Space(5f); val.Value = UGUI.HorizontalSlider(val.Value, min, max, Style.Slider, Style.SliderBody, sliderOpts); UGUI.EndHorizontal(); }
public static void HorizontalSlider(Setting <float> val, string label, float min, float max) { UGUI.BeginHorizontal(); UGUI.Label(label, Style.Label, DefaultOption); UGUI.Space(5f); val.Value = UGUI.HorizontalSlider(val.Value, min, max, Style.Slider, Style.SliderBody, DefaultOption); UGUI.EndHorizontal(); }
public static void ToggleButton(Setting <bool> val, string label, GUILayoutOption[] lblOpts, GUILayoutOption[] btnOpts) { UGUI.BeginHorizontal(); UGUI.Label(label, Style.Label, lblOpts); UGUI.Space(5f); val.Value = UGUI.Button(val.Value ? GUI.LabelEnabled : GUI.LabelDisabled, Style.TextButton, btnOpts); UGUI.EndHorizontal(); }
public static void TextField(Setting <int> val, string label, GUILayoutOption[] lblOpts, GUILayoutOption[] txtopts) { UGUI.BeginHorizontal(); UGUI.Label(label, Style.Label, lblOpts); UGUI.Space(5f); TextField(val, txtopts); UGUI.EndHorizontal(); }
public static bool ToggleButton(bool val, string label, GUILayoutOption[] lblOpts, GUILayoutOption[] btnOpts) { UGUI.BeginHorizontal(); UGUI.Label(label, Style.Label, lblOpts); UGUI.Space(5f); val = UGUI.Button(val ? GUI.LabelEnabled : GUI.LabelDisabled, Style.TextButton, btnOpts); UGUI.EndHorizontal(); return(val); }
public static bool ToggleButton(bool val, string label) { UGUI.BeginHorizontal(); UGUI.Label(label, Style.Label, DefaultOption); UGUI.Space(5f); val = UGUI.Button(val ? GUI.LabelEnabled : GUI.LabelDisabled, Style.TextButton, DefaultOption); UGUI.EndHorizontal(); return(val); }
public static string TextField(string val, string label, GUILayoutOption[] lblOpts, GUILayoutOption[] txtopts) { UGUI.BeginHorizontal(); UGUI.Label(label, Style.Label, lblOpts); UGUI.Space(5f); val = UGUI.TextField(val, Style.TextButton, txtopts); UGUI.EndHorizontal(); return(val); }
public static string TextField(string val, string label) { UGUI.BeginHorizontal(); UGUI.Label(label, Style.Label, DefaultOption); UGUI.Space(5f); val = UGUI.TextField(val, Style.TextButton, DefaultOption); UGUI.EndHorizontal(); return(val); }
public static float HorizontalSlider(float val, string label, float min, float max, GUILayoutOption[] lblOpts, GUILayoutOption[] sliderOpts) { UGUI.BeginHorizontal(); UGUI.Label(label, Style.Label, lblOpts); UGUI.Space(5f); val = UGUI.HorizontalSlider(val, min, max, Style.Slider, Style.SliderBody, sliderOpts); UGUI.EndHorizontal(); return(val); }
public static float HorizontalSlider(float val, string label, float min, float max) { UGUI.BeginHorizontal(); Label(label); UGUI.Space(5f); val = UGUI.HorizontalSlider(val, min, max, Style.Slider, Style.SliderBody, DefaultOption); UGUI.EndHorizontal(); return(val); }
/// <summary> /// Open auto property drawer indent /// </summary> private static void OpenIndent(int depth) { Gl.BeginHorizontal(); for (int i = 0; i < depth; i++) { Gl.Space(8); } Gl.BeginVertical(); }
private void DrawScript(Type t) { var att = t.RTGetAttribute <QuickExecuteAttribute>(false); if (att == null) { return; } GL.BeginVertical("OL box"); GL.Label(t.Name, EditorStyles.boldLabel); var methods = t.GetMethods().Where((i) => { return(i.RTGetAttribute <ExecuteMethodAttribute>(false) != null); }); if (methods.Count() < 1) { EGL.HelpBox("没有可以被执行的方法(请检查是否添加了[ExecuteMethodAttribute])", MessageType.Warning); } else { foreach (var m in methods) { GL.Space(2); GL.BeginHorizontal(); var methodName = m.Name + ":("; var param = m.GetParameters(); for (int i = 0; i < param.Length; i++) { var p = param[i]; if (i != param.Length - 1) { methodName += string.Format("<b>{0}</b> , ", p.ToString()); } else { methodName += string.Format("<b>{0}</b>", p.ToString()); } } methodName += ")"; GL.Label(methodName); if (GL.Button("Execute", GUILayout.Width(100))) { var o = ReflectionTools.CreateObject(t); //TODO 扩展编辑参数 if (param.Length == 0) { m.Invoke(o, null); } Log.I(string.Format("<color=#FFA80B>Execute {0}</color>", methodName)); } GL.EndHorizontal(); GL.Space(2); } } GL.EndVertical(); }
private void StartGUI(string name) { Rect r = EGL.BeginVertical( ); GL.Space(3); EGL.BeginHorizontal(); GUI.backgroundColor = Color.black * 2; GUI.contentColor = Color.white; GUI.Box(r, GUIContent.none); GUI.contentColor = Color.white * 10; EGL.LabelField(" " + name, EditorStyles.boldLabel, GL.Width(85)); }
void blockHeader(string mainHeader, string secondHeader, int blockIdex) { BV(); GL.Label(mainHeader, "TL Selection H2"); BH(); if (GL.Button(buttons[blockIdex], GL.Height(25f), GL.Width(50f))) toggles[blockIdex] = !toggles[blockIdex]; BHS("HelpBox"); GL.Label(secondHeader, "infoHelpBoxText"); GL.Label(book, GL.Height(18f), GL.Width(20f)); EH(); EH(); GL.Space(3); }
private void DrawSearchResult() { if (searchTypeList == null || searchTypeList.Count < 1) { return; } scrollRect = GL.BeginScrollView(scrollRect, "box"); searchTypeList.ForEach((t) => { DrawScript(t); GL.Space(5); }); GL.EndScrollView(); }
public static void SetModifiedValueButtonBool <T>(string name, string guid) { if (GL.Button(Strings.GetText("button_SetTo") + $" {Strings.GetText("misc_True")}", GL.ExpandWidth(false))) { FileInfo file = new FileInfo(Storage.modEntryPath + Storage.modifiedBlueprintsFolder + "\\" + guid + ".json"); if (File.Exists(file.FullName)) { T modifiedItem = ModifiedBlueprintTools.DeserialiseItem <T>(file); Traverse.Create(modifiedItem).Property(name).SetValue(true); string json = JsonConvert.SerializeObject(modifiedItem, Formatting.Indented); File.WriteAllText(file.FullName, json); } else { T modifiedItem = default(T); modifiedItem = Activator.CreateInstance <T>(); Traverse.Create(modifiedItem).Property(name).SetValue(true); string json = JsonConvert.SerializeObject(modifiedItem, Formatting.Indented); File.WriteAllText(file.FullName, json); } ModifiedBlueprintTools.blueprintLists = false; ModifiedBlueprintTools.Patch(); } GL.Space(10); if (GL.Button(Strings.GetText("button_SetTo") + $" {Strings.GetText("misc_False")}", GL.ExpandWidth(false))) { FileInfo file = new FileInfo(Storage.modEntryPath + Storage.modifiedBlueprintsFolder + "\\" + guid + ".json"); if (File.Exists(file.FullName)) { T modifiedItem = ModifiedBlueprintTools.DeserialiseItem <T>(file); Traverse.Create(modifiedItem).Property(name).SetValue(false); string json = JsonConvert.SerializeObject(modifiedItem, Formatting.Indented); File.WriteAllText(file.FullName, json); } else { T modifiedItem = default(T); modifiedItem = Activator.CreateInstance <T>(); Traverse.Create(modifiedItem).Property(name).SetValue(false); string json = JsonConvert.SerializeObject(modifiedItem, Formatting.Indented); File.WriteAllText(file.FullName, json); } ModifiedBlueprintTools.blueprintLists = false; ModifiedBlueprintTools.Patch(); } }
private void OnGUI() { GUI.skin.label.richText = true; if (GL.Button("Search Can Execute Script")) { searchScript = true; DoSearch(); } if (searchScript == true) { DrawSearchResult(); } if (focusFileName.IsNullOrEmpty()) { DrawDragSpace(); } else { GL.Space(5); GL.BeginVertical("box"); GL.Label(string.Format("FocusFileName : {0}", focusFileName), EditorStyles.boldLabel); GL.Label(string.Format("FocusFileType : {0}", focusFileType.ToString()), EditorStyles.boldLabel); GL.Label(string.Format("FocusFilePath : {0}", focusFilePath), EditorStyles.boldLabel); focusFileRect = GL.BeginScrollView(focusFileRect, "box"); if (focusFileType == QEType.CSharp) { DrawScript(GetFocusFileType(focusFileName)); } if (focusFileType == QEType.Lua) { #if LUA_KIT luaVeiwer.DrawLuaScript(focusFilePath); #else EGL.HelpBox("没有LUA_KIT环境,请查看说明", MessageType.Warning); #endif } if (GL.Button("ClearFocus")) { ClearFocusFile(); } GL.EndScrollView(); GL.EndVertical(); } }
public static void Space(float offset) { UGUI.Space(offset); }
public static void Indent(int indent, float size = 75f) => GL.Space(indent * size);
public static void space(this int size) => GL.Space(size);
public static void Space(float size = 150f) => GL.Space(size);
void separator() { GL.Space(10f); GL.Label("", "separator", GL.Height(1f)); GL.Space(10f); }