private void DrawDatas() { var packages = BaseData["Packages"]; if (packages.Count > 0) { for (int i = 0; i < packages.Count; i++) { var value = packages[i]; GL.BeginVertical("OL box"); GL.BeginHorizontal("box"); GL.Label(value["name"].ToString()); GL.Label(value["version"].ToString()); if (Directory.Exists(value["localpath"].ToString())) { if (GL.Button("pack", GUILayout.Width(100))) { Export(value["name"].ToString(), value["localpath"].ToString()); } } else if (ExistsLocalPackage(value["name"].ToString())) { if (GL.Button("Import", GUILayout.Width(100))) { } } GL.EndHorizontal(); GL.EndVertical(); } } }
private void DrawObjects() { List <string> toremove = new List <string>(); foreach (var inst in instances) { GUI.BeginHorizontal(); if (GUI.Button(inst)) { Object o = GameObject.Find(inst) != null?GameObject.Find(inst) : GameObject.FindObjectsOfTypeIncludingAssets(typeof(GameObject)).FirstOrDefault(a => a.name == inst); Selection.activeObject = o; } if (GUI.Button("X", GUI.ExpandWidth(false))) { toremove.Add(inst); } GUI.EndHorizontal(); } foreach (var inst in toremove) { instances.Remove(inst); SaveParams(); } }
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(); }
protected virtual void OnGUI() { if (GUI.Button("Init")) { foreach (var go in Selection.gameObjects) { foreach (var scr in go.GetComponents <Base>()) { scr.Init(); } } } foreach (var a in GameObject.FindGameObjectsWithTag("EditorGUI").Where(a => a != Selection.activeGameObject)) { a.GetComponent <Base>().OnEditorGui(); } if (Selection.activeGameObject != null) { var bs2 = Selection.activeGameObject.GetComponent <Base>(); if (bs2 != null) { bs2.OnEditorGui(); } } GUI.BeginHorizontal(); Base.debug = GUI.Toggle(Base.debug, "debug", GUI.ExpandWidth(false)); GUI.EndHorizontal(); DrawSearch(); }
private void OnGUI() { scrollView = Gl.BeginScrollView(scrollView); { Gl.TextArea(log); } Gl.EndScrollView(); EditorUtil.HorizontalRule(); Gl.BeginHorizontal(); { Gl.Label("Save Log:", Gl.ExpandWidth(false)); outputPath = Gl.TextField(outputPath); } Gl.EndHorizontal(); Gl.BeginHorizontal(); { if (Gl.Button("Save")) { PrintLog(); } if (Gl.Button("Close")) { Close(); } } Gl.EndHorizontal(); }
protected override void DoSpecializedGUI() { GUILayout.BeginHorizontal(); GUILayout.Label(string.Format("Text (Length: {0})", m_Text.Length), Styles.BoldLabel); GUILayout.Label(m_Text, Styles.BoldLabel); GUILayout.EndHorizontal(); m_GUIText = GUILayout.TextField(m_GUIText, Styles.BoldTextField); if (Configuration.Instance.OldInputEnabled == false) { GUILayout.Label("Old Input Disabled", Styles.BoldLabel); return; } m_KeysScrollPosition = GUILayout.BeginScrollView(m_KeysScrollPosition); foreach (var key in m_Keys) { var k = key.Value; if (k.keyCounter == 0 || k.keyDown == 0 || k.keyUp == 0) { continue; } GUILayout.Label(string.Format("{0} down - {1}, up - {2}, counter - {3}", key.Key, k.keyDown, k.keyUp, k.keyCounter), Styles.BoldLabel); } GUILayout.EndScrollView(); }
protected virtual void OnGUI() { if (!SetPivot && Selection.activeGameObject) { oldpos = Selection.activeGameObject.transform.position; } GUI.BeginHorizontal(); SetPivot = (GUI.Toggle(SetPivot, "Pivot", GUI.ExpandWidth(false)) && Selection.activeGameObject != null); var old = SetCam; SetCam = (GUI.Toggle(SetCam && Camera.main != null, "Cam", GUI.ExpandHeight(false))); //camset if (SetCam != old && SetCam == false) { ResetCam(); } if (GUI.Button("Apply")) { ApplyAll(); } if (GUI.Button("Add")) { if (!instances.Contains(Selection.activeObject.name)) { instances.Add(Selection.activeObject.name); SaveParams(); } } GUI.EndHorizontal(); DrawObjects(); DrawSearch(); }
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 Toggle(Setting <bool> val, string label) { UGUI.BeginHorizontal(); Label(label); UGUI.FlexibleSpace(); val.Value = UGUI.Toggle(val.Value, string.Empty, Style.Toggle); UGUI.EndHorizontal(); }
public static void Toggle(Setting <bool> val, string label, GUILayoutOption[] labelOpts, GUILayoutOption[] tglOpts) { UGUI.BeginHorizontal(); UGUI.Label(label, Style.Label, labelOpts); UGUI.FlexibleSpace(); val.Value = UGUI.Toggle(val.Value, string.Empty, Style.Toggle, tglOpts); 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 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 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 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 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(); }
protected virtual void OnGUI() { if (Camera.main == null) { return; } if (!SetPivot && Selection.activeGameObject) { oldpos = Selection.activeGameObject.transform.position; } GUI.BeginHorizontal(); SetPivot = (GUI.Toggle(SetPivot, "Pivot", GUI.ExpandWidth(false)) && Selection.activeGameObject != null); var old = SetCam; SetCam = (GUI.Toggle(SetCam && Camera.main != null, "Cam", GUI.ExpandHeight(false))); //camset Camera.main.renderingPath = (RenderingPath)gui.EnumPopup(Camera.main.renderingPath); if (SetCam != old && SetCam == false) { ResetCam(); } if (GUI.Button("Apply")) { ApplyAll(); } if (GUI.Button("Add")) { if (!instances.Contains(Selection.activeObject.name)) { instances.Add(Selection.activeObject.name); SaveParams(); } } if (GUI.Button("Init")) { foreach (var a in Selection.gameObjects.Select(a => a.GetComponent <MonoBehaviour>())) { a.SendMessage("Init", SendMessageOptions.DontRequireReceiver); } } GUI.EndHorizontal(); QualitySettings.shadowDistance = gui.FloatField("LightmapDist", QualitySettings.shadowDistance); if (Selection.activeGameObject != null) { LayerDistances(); var bs = Selection.activeGameObject.GetComponent <Base>(); if (bs != null) { bs.OnInspectorGUI(); } } DrawObjects(); DrawSearch(); }
public static void SetModifiedValueStatType <T>(string name, string guid) { StatType[] statTypes = (StatType[])Enum.GetValues(typeof(StatType)); for (int i = 0; i < statTypes.Count(); i++) { switch (i) { case 0: case 4: case 8: case 12: case 16: case 20: case 24: case 28: case 32: case 36: GL.BeginHorizontal(); break; } if (GL.Button(Strings.GetText("button_SetTo") + $" {statTypes[i]}", GL.Width(210f))) { 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(statTypes[i]); 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(statTypes[i]); string json = JsonConvert.SerializeObject(modifiedItem, Formatting.Indented); File.WriteAllText(file.FullName, json); } ModifiedBlueprintTools.blueprintLists = false; ModifiedBlueprintTools.Patch(); } switch (i) { case 3: case 7: case 11: case 15: case 19: case 23: case 27: case 31: case 35: case 37: GL.EndHorizontal(); break; } } }
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 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); }
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 bool Toggle(bool val, string label) { UGUI.BeginHorizontal(); Label(label); UGUI.FlexibleSpace(); val = UGUI.Toggle(val, string.Empty, Style.Toggle); UGUI.EndHorizontal(); return(val); }
public static bool Toggle(bool val, string label, GUILayoutOption[] labelOpts, GUILayoutOption[] tglOpts) { UGUI.BeginHorizontal(); UGUI.Label(label, Style.Label, labelOpts); UGUI.FlexibleSpace(); val = UGUI.Toggle(val, string.Empty, Style.Toggle, tglOpts); 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); }
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(); }
protected virtual void OnGUI() { if (!SetPivot && Selection.activeGameObject) { oldpos = Selection.activeGameObject.transform.position; } GUI.BeginHorizontal(); SetPivot = (GUI.Toggle(SetPivot, "Pivot", GUI.ExpandWidth(false)) && Selection.activeGameObject != null); var old = SetCam; SetCam = (GUI.Toggle(SetCam && Camera.main != null, "Cam", GUI.ExpandHeight(false))); //camset if (SetCam != old && SetCam == false) { ResetCam(); } if (GUI.Button("NextCam")) { NextCamera(); } if (GUI.Button("Init")) { Inits(); } GUI.EndHorizontal(); QualitySettings.shadowDistance = gui.FloatField("LightmapDist", QualitySettings.shadowDistance); GUI.BeginHorizontal(); GUI.EndHorizontal(); GUI.BeginHorizontal(); Base.debug = GUI.Toggle(Base.debug, "debug", GUI.ExpandWidth(false)); GUI.EndHorizontal(); foreach (var a in GameObject.FindGameObjectsWithTag("EditorGUI").Where(a => a != Selection.activeGameObject)) { a.GetComponent <bs>().OnEditorGui(); } if (Selection.activeGameObject != null) { var bs2 = Selection.activeGameObject.GetComponent <Base>(); if (bs2 != null) { bs2.OnEditorGui(); } } DrawSearch(); }