protected void Method(string str1, //方法(caiShu) + 说明 + 返回值 +Action string caiShu, string str2, string str3, ref bool isShow, Action action) { bool tmp = isShow; MyCreate.Heng(() => { m_Tools.TextText_LW(str1.AddYellow() + " " + caiShu, str2, ref tmp, null); MyCreate.AddSpace(); if (!string.IsNullOrEmpty(str3)) { MyCreate.Text(str3.AddYellow()); } }); if (tmp && action != null) { MyCreate.Box(action); } MyCreate.AddSpace(4); isShow = tmp; }
protected override void OnEditorGUI() { switch (m_FenLie) { case UGongJuType.其他: DrawKey(); break; case UGongJuType.调整UI: DrawTiaoZhen(); break; case UGongJuType.电脑加载图片: DrawTieXu(); break; case UGongJuType.图片变成精灵: DrawChangeSprite(); break; } MyCreate.AddSpace(); }
protected void AddToggleButton(string biaoTi, string actionStr1, string actionStr2, [NotNull] Action action1, [NotNull] Action action2) { MyCreate.Heng(() => { MyCreate.AddSpace(); if (QUI.GhostButton(biaoTi, QColors.Color.Orange, 80, 20, editStats.target)) { editStats.target = !editStats.target; } if (editStats.faded > 0.05f) { if (QUI.GhostButton(actionStr1, QColors.Color.Green, PS.databaseClearStatisticsButtonWidth * editStats.faded, 20)) { action1(); } if (QUI.GhostButton(actionStr2, QColors.Color.Blue, PS.databaseDeleteButtonWidth * editStats.faded, 20)) { action2(); } } }); }
private void DrawChongZhuang() // 重装记录 { m_Tools.BiaoTi_O("ReSharper 重装与破解"); MyCreate.Box(() => { m_Tools.GuangFangWenDan("https://www.cnblogs.com/djd66/p/8005678.html", "详情看这个"); m_Tools.Text_Y("1. 安装 JetBrains.ReSharperUltimate.2017.2.2"); m_Tools.Text_Y("2. 直接对 dvt-jb_licsrv.amd64.exe 目录 cmd"); m_Tools.TextSelectText_Y("3. 输入", "dvt-jb_licsrv.amd64.exe -mode install", -80); m_Tools.Text_Y("3. 打开 ReSharper 的密钥设置第三个 Server address"); m_Tools.TextSelectText_Y("3. 输入", "http://127.0.0.1:1337", -80); }); MyCreate.AddSpace(10); m_Tools.BiaoTi_O("VS 快捷键设置"); MyCreate.Box(() => { m_Tools.TextText_BL("Ctrl + 1", "编辑,折叠到定义", -30); m_Tools.TextText_BL("Ctrl + 2", "编辑:展开所有大纲显示", -30); m_Tools.TextText_BL("Ctrl + Y", "编辑:删除行", -30); m_Tools.TextText_BL("Ctrl + Alt + L", "编辑:设置选定内容的格式", -30); }); }
protected void AddSearch(ref string input, //加个搜索框,搜索第一个Text,不关下面GUI逻辑事 List <SearchText> allText, Action action) { input = m_Tools.TextString("【 搜索 】".AddGreen().AddBold(), input, () => { if (null != action) { action(); } }, -50); bool tmpIsNone = true; if (!string.IsNullOrEmpty(input)) { if (null != action) { action(); } for (int i = 0; i < allText.Count; i++) { if (allText[i].Text1.ToLower().Contains(input.ToLower())) { tmpIsNone = false; break; } } } else { tmpIsNone = false; } if (tmpIsNone) { m_Tools.Text_G("没有这个 " + input); } MyCreate.AddSpace(10); }
protected override void OnEditorGUI() { m_Tools.TextUnityObject <R>(m_Script == null ? m_ScriptName.AddRed() : m_ScriptName.AddGreen(), ref m_Script, ref m_IsShow, () => { MyCreate.AddSpace(6); OnDrawScriptGUI(m_Script); }, OnScriptCloseGUI); if (null == m_Script) { if (l_Rs.Count > 0) { for (int i = 0; i < l_Rs.Count; i++) { R r = l_Rs[i]; MyCreate.Button("GameObject 名:".AddGreen() + r.name, () => { m_Script = r; }); } MyCreate.AddSpace(20); } OnNoScriptGUI(); } }
protected void AddSpace_15() { MyCreate.AddSpace(15); }
protected void AddSpace_3() { MyCreate.AddSpace(3); }
//方法---------------------------------------------------------------------------------- protected void AddSpace() { MyCreate.AddSpace(8); }
protected void TextText1(string str1, string str2, string str3, int changeJianGe = AddJianGe) { m_Tools.TextText_BW(str1 + (" (" + str2 + ")").AddLightBlue(), str3, changeJianGe); MyCreate.AddSpace(4); }
//——————————————————结构体—————————————————— private void DrawQuaternion() // Quaternion { m_Tools.BiaoTi_O("Quaternion " + "(旋转值)".AddGreen()); m_Tools.GuangFangWenDan("https://docs.unity3d.com/ScriptReference/Quaternion.html"); MyCreate.StaticPropertiesWindow(() => { m_Tools.Method_BY("identity", " 只读 ", "不旋转,对齐世界或父物体方向", "Quaternion", -30); }); MyCreate.StaticMethodWindow(() => { m_Tools.Method_BY("LookRotation", "Vector3,V3", "根据" + "向前和向上方向".AddGreen() + "得出旋转值", "Quaternion", ref isLookRotation, () => { MyCreate.Box(() => { MyCreate.Text(("LookRotation(Vector3 " + "forward".AddBlue() + " , Vector3 " + "upwards".AddBlue() + " = Vector3.up)").AddWhite()); m_Tools.TextText_BG(" forward", "向前的方向"); m_Tools.TextText_BG(" upwards", "向上的方向"); MyCreate.Box(() => { m_Tools.Text_H("例子 :实现立刻转向目标,而且 y 轴不动:"); m_Tools.Text_G("// 指向目标的向量"); m_Tools.Text_W("Vector3 v = t_Target.position - transform.position"); m_Tools.Text_G("// y 轴不动"); m_Tools.Text_W("v.y = 0"); m_Tools.Text_G("// 转向始终跟着v向量"); m_Tools.Text_W("transform.rotation=Quaternion.LookRotation(v)"); }); }); }); m_Tools.Method_BY("Slerp", "Q1,Q2,t", "旋转值的" + "插值".AddGreen(), "Quaternion", ref isSlerp, () => { MyCreate.Box(() => { MyCreate.Text(("Slerp( Quaternion " + "from".AddBlue() + " , Quaternion " + "to".AddBlue() + " , float" + " time ".AddBlue() + ")").AddWhite()); m_Tools.TextText_BL(" from", "开始的旋转"); m_Tools.TextText_BL(" to", "结束的旋转"); m_Tools.TextText_BL(" time", "速度 Time.deltaTime * Speed"); m_Tools.Text_Y("1.Quaternion.Slerp 与 Quaternion.Lerp区别", ref isDescription2, () => { MyCreate.Box(() => { m_Tools.TextText_LW("Quaternion.Slerp", "是以每段角度来作插值"); m_Tools.TextText_LW("Quaternion.Lerp", "是以距离长度来作插值"); m_Tools.Text_G("旋转时,距离长度会不规则变化,使用固定每段角度 Slerp 才是最好的"); }); }); m_Tools.Text_Y("2.例子 :实现平滑地转向目标,而且 y 轴不动:", ref isEx2, () => { MyCreate.Box(() => { m_Tools.Text_G("// 指向目标的向量"); m_Tools.Text_W("Vector3 v = t_Target.position - transform.position"); m_Tools.Text_G("// y 轴不动"); m_Tools.Text_W("v.y = 0"); m_Tools.Text_G("// 得到面向目标的转向"); m_Tools.Text_W("Quaternion to=Quaternion.LookRotation(v)"); m_Tools.Text_G("// 以插值的形式赋值给 transform 旋转值"); m_Tools.Text_W("transform.rotation=Quaternion.Slerp(transform.rotation,to,Time.deltaTime)"); }); }); }); }); m_Tools.Method_BY("FromToRotation", "V3 a,V3 b", "从" + " a 点到 b 点".AddGreen() + "的旋转值", "Quaternion"); m_Tools.Method_BY("Euler", "f x ,f y , f z", "将一个向量转成旋转值", "Quaternion"); m_Tools.Method_BY("Angle", "Q1,Q2", "两个旋转值的" + "角度".AddGreen(), "float"); m_Tools.Method_BY("Dot", "Q1,Q2", "两次旋转值的" + "点积".AddGreen(), "float"); }); MyCreate.AddSpace(15); MyCreate.Window("四元数 " + "(旋转值)".AddYellow() + " 与 欧拉角 " + "(旋转后的向量)".AddYellow() + "说明", () => { m_Tools.TextText_OW("• 四元数" + " [ Quaternion ]".AddYellow(), "transform.rotation"); m_Tools.TextText_OW("▪ 欧拉角" + " [ Vector3 ]".AddYellow(), "transform.eulerAngles"); m_Tools.Text_O("▪ 欧拉角 —— > 四元数:"); m_Tools.Text_W(" transform.rotation = Quaternion.Euler( x,y,z )"); m_Tools.Text_O("▪ 四元数 —— > 欧拉角:"); m_Tools.Text_W(" transform.rotation.eulerAngles"); }); }
private void DrawTu() // 图形与物理 { m_Tools.BiaoTi_B("♦ 美术资源" + "(Mesh/Material/Shader/粒子)"); MyCreate.AddSpace(12); MyCreate.Window("Mesh", () => { MyCreate.Text("Statistics面板看:Tris 面数" + "(移动 推荐60K↓)".AddGreen() + " Verts 顶点数"); m_Tools.Text_Y("LOD ".AddRed(), "技术:模型离相机 ", "近中远 ".AddGreen(), "分别使用不同面数的模型"); m_Tools.Text_L(" 1. 美术来创造,然后使用 ", "LOD Group".AddWhite(), " 组件"); m_Tools.Text_L(" 2. 通过程序自动生成", "(插件全自动完全: Simple LOD)".AddRed()); }); MyCreate.AddSpace(12); MyCreate.Window("Material", () => { MyCreate.Text("Statistics面板看:SetPass Calls " + "不同材质越少,该值越少".AddWhite() + "(移动60↓)".AddGreen()); m_Tools.Text_Y("1. 图片标记 Pcking Tag,使用 Sprite Packer"); m_Tools.Text_Y("2. 尽量引用同一 Material"); }); MyCreate.AddSpace(12); MyCreate.Window("Shader", () => { m_Tools.Text_L("1. 尽量小引用图/使用Moblie Shader"); m_Tools.Text_H("2. 插件: Shader Forge (图形化编辑,如不需要直接删除)"); }); MyCreate.AddSpace(12); MyCreate.Window("粒子", () => { m_Tools.Text_Y("数量、透明", "(能停止就不要全透明隐藏那种)".AddGreen(), "、材质"); }); AddSpace(); m_Tools.BiaoTi_B("♦ 物理效果(镜头、光照、碰撞、CheckList)"); MyCreate.AddSpace(12); MyCreate.Window("镜头" + "(Camera看不到就剔除)".AddGreen(), () => { m_Tools.Text_L("1. Camera 范围不必要就减小"); m_Tools.Text_L("2. Camera 上的 ", "Occlusion Culling".AddWhite(), "(操作与导航相同)".AddGreen()); MyCreate.Box_Hei(() => { m_Tools.Text_H("◘ 把静态的物体标记成", " Occluder Static".AddWhite()); m_Tools.Text_H("◘ 打开 Window -> Lighting -> Bake 烘焙"); }); }); MyCreate.AddSpace(12); MyCreate.Window("光照" + "(Bake And Probes)", () => { m_Tools.Text_L("1. 减少实时光"); m_Tools.Text_L("2. 光源选择 Baked 烘焙光", "(同样操作与导航相同)".AddGreen()); MyCreate.Box_Hei(() => { m_Tools.Text_H("◘ 把静态的物体标记成", " Lightmap Static".AddWhite()); }); m_Tools.Text_H(" 缺点:增加文件大小、不能照射动态的物体", "(所以用到第3点)".AddLightGreen()); m_Tools.Text_L("3. 使用Light Probo Group", "(放球球)".AddLightGreen()); }); MyCreate.AddSpace(12); MyCreate.Window("碰撞", () => { m_Tools.Text_L("1. 尽可能用Box/Sphere/Capsule Collider 代替 Mesh Collider"); m_Tools.Text_L("2. 控制 rigidbody 刚体数量"); }); MyCreate.AddSpace(12); MyCreate.Window("CheckList 官方提供的优化列表", () => { m_Tools.TextUrl("Simple checklist to make your game faster ( 打开官方文档 )", "https://docs.unity3d.com/Manual/OptimizingGraphicsPerformance.html"); }); }
private void DrawRenGenXin() // 热更新 { m_Tools.BiaoTi_O("Lua 的执行顺序", ref isXu, () => { MyCreate.Heng(() => { MyCreate.Box(() => { m_Tools.TextText_BG(" Main", "// 主入口", -50); Donw(); m_Tools.TextText_BG(" Network." + "Start".AddLightBlue(), "// 网络开始", -50); Donw(); m_Tools.TextText_BG(" Game." + "OnInitOk".AddLightBlue(), "// 在这里写逻辑", -50); Donw(); m_Tools.TextText_BG(" Ctrl 控制类", "// New、Awake、OnCreate", -50); Donw(); m_Tools.TextText_BG(" xxxPanel 视图类", "// Awake、Start", -50); }); AddSpace_3(); MyCreate.Shu(() => { AddSpace(); AddSpace(); MyCreate.Window("Ctrl 与 视图的顺序", () => { AddSpace(); MyCreate.Text("xxCtrl.New".AddHui()); Donw(); MyCreate.Text("xxCtrl.Awake".AddHui()); Donw(); MyCreate.Text("xxxPanel.Awake"); Donw(); MyCreate.Text("xxCtrl.OnCreate".AddHui()); Donw(); MyCreate.Text("xxPanel.OnCreate"); AddSpace(); }); }); }); }); AddSpace(); m_Tools.BiaoTi_O("1. 一个C# 类能让 Lua 调用:" + "(以 Ctrl_Audio 播放音乐为例)".AddLightGreen(), true); MyCreate.Box(() => { m_Tools.TextButton_Open("1. 写上" + " _GT(typeof(Ctrl_Audio)).SetNameSpace(\"PSPUtil\")".AddHui(), () => { // Application.OpenURL(MyComputePath.CustomSettingsPath).; }); m_Tools.TextButton_Open("2. 注入脚本", () => { }); m_Tools.TextButton_Open("3. 在 StaticFunctions 中写好方法 " + "( . 普通方法/ : Ctrl)".AddGreen(), () => { // Application.OpenURL(MyComputePath.StaticFunctionsPath); }); MyCreate.Box_Hei(() => { m_Tools.Text_H("Ctrl_Audio".AddWhite(), " = PSPUtil.Ctrl_Audio;"); AddSpace(); m_Tools.Text_H("function", " Static_PlayBackground".AddBlue(), "(bgName)"); m_Tools.Text_H(" Ctrl_Audio".AddWhite(), ".".AddGreen(), "Instance", ":".AddGreen(), "PlayBackground(bgName)"); m_Tools.Text_H("end"); }); MyCreate.TextCenter("之后在任意 Lua 中都可以调用播放背景音乐方法:"); MyCreate.Box_Hei(() => { m_Tools.Text_H("Static_PlayBackground".AddBlue(), "(\"Audio / FadeOut\");"); }); }); AddSpace(); m_Tools.BiaoTi_O("2. 调用 ulua 自带这的方法", true); MyCreate.AddSpace(15); MyCreate.Window("启动协程下载 txt", () => { MyCreate.Box_Hei(() => { m_Tools.TextText_HG("coroutine.start(Test_Coroutine)", "// 开始协程"); }); MyCreate.Box_Hei(() => { m_Tools.Text_H("function Test_Coroutine()"); m_Tools.TextText_HG(" coroutine.wait(1)", "// yield return 1 秒", 15); m_Tools.TextText_HG(" local www = WWW(“网址”)", "// WWW www =new WWW", 15); m_Tools.TextText_HG(" coroutine.www(www)", "// yield return www", 15); m_Tools.TextText_HG(" print(www.text)", "// 获得返回的结果", 15); m_Tools.Text_H("end"); }); }); }
private void DrawProjector() // Projector投影 { m_Tools.Text_G("图例", ref isProjectorTu, () => { ShowImage("https://images2018.cnblogs.com/blog/959112/201807/959112-20180711202938433-628627248.png"); }); MyCreate.AddSpace(12); MyCreate.Window("Projector投影仪作用:", () => { m_Tools.Text_W("1. 创建 阴影"); m_Tools.Text_W("2. 使得现实世界与投影处相交的地方使用 " + "渲染纹理".AddGreen()); m_Tools.Text_W("3. 枪弹 痕迹 的 形成"); m_Tools.Text_W("4. 时髦 的 照明 效果"); }); MyCreate.AddSpace(12); MyCreate.Window("面板", () => { m_Tools.TextText_BL("Ignore Layers", "那个层会被忽略", -50); m_Tools.TextText_BL("Near Clip Plane", "近切面", -50); m_Tools.TextText_BL("Far Clip Plane", "远近面", -50); m_Tools.TextText_BL("Field Of View", "透视投影情况下的角度大小", -50); m_Tools.TextText_BL("Aspect Ratio", "长宽比", -50); m_Tools.TextText_BL("Orthographic", "是否正交投影", -50); m_Tools.TextText_BL("Orthographic Size", "正交投影的大小", -50); m_Tools.TextText_BL("Material", "必填的特定Shader材质,否则没效果", -50); }); MyCreate.TextCenter("使用的 Shader"); MyCreate.Box_Hei(() => { MyCreate.Text("Properties =>"); m_Tools.Text_H("_Color (\"投影颜色\", Color) = (1,1,1,1)"); m_Tools.Text_H("_Attenuation (\"透明度\", Range(0.0, 1.0)) = 1.0"); m_Tools.Text_H("_ShadowTex (\"图片\", 2D) = \"gray\" {}"); AddSpace_3(); MyCreate.Text("Subshader =>"); m_Tools.Text_H("Tags {\"Queue\"=\"Transparents\"}"); m_Tools.Text_H("Pass {"); m_Tools.Text_H(" ZWrite Off"); m_Tools.Text_H(" ColorMask RGB"); m_Tools.Text_H(" Blend SrcAlpha One"); m_Tools.Text_H(" Offset -1, -1"); m_Tools.Text_H(" "); m_Tools.Text_H(" CGPROGRAM"); m_Tools.Text_H(" #pragma vertex vert"); m_Tools.Text_H(" #pragma fragment frag"); m_Tools.Text_H(" #include \"UnityCG.cginc\""); m_Tools.Text_H(" "); m_Tools.Text_H(" sampler2D _ShadowTex;"); m_Tools.Text_H(" fixed4 _Color;"); m_Tools.Text_H(" float _Attenuation;"); m_Tools.TextText_HG(" float4x4 unity_Projector;", " // 系统提供的投影参数"); m_Tools.TextText_HG(" float4x4 unity_ProjectorClip;", "// 这个也是,但是下面没用到"); m_Tools.Text_H(" "); m_Tools.Text_H(" struct v2f "); m_Tools.Text_H(" {"); m_Tools.Text_H(" float4 uvShadow : TEXCOORD0;"); m_Tools.Text_H(" float4 pos : SV_POSITION;"); m_Tools.Text_H(" };"); m_Tools.Text_H(" "); m_Tools.Text_H(" v2f vert (float4 vertex : POSITION)"); m_Tools.Text_H(" {"); m_Tools.Text_H(" v2f o;"); m_Tools.Text_H(" o.pos = UnityObjectToClipPos (vertex);"); m_Tools.Text_H(" o.uvShadow = mul (unity_Projector, vertex);"); m_Tools.Text_H(" return o;"); m_Tools.Text_H(" }"); m_Tools.Text_H(" "); m_Tools.Text_H(" fixed4 frag (v2f i) : SV_Target"); m_Tools.Text_H(" {"); m_Tools.Text_H(" fixed4 texCookie = tex2Dproj"); m_Tools.Text_H(" (_ShadowTex, UNITY_PROJ_COORD(i.uvShadow));"); m_Tools.Text_H(" fixed4 outColor = _Color * texCookie.a;"); m_Tools.Text_H(" float depth = i.uvShadow.z;"); m_Tools.Text_H(" return outColor * clamp"); m_Tools.Text_H(" (1.0 - abs(depth) + _Attenuation, 0.0, 1.0);"); m_Tools.Text_H(" }"); m_Tools.Text_H(" ENDCG"); m_Tools.Text_H("}"); }); }
protected override void DrawLeft() { tempLabel = mWindowSettings.sidebarIsExpanded.faded < 0.6f ? "" : " [识英文]".AddSize(16); if (QUI.Button(tempLabel, EZStyles.GetStyle(type == EType.LiZiPro2 ? EZStyles.General.SideButtonSelected1 : EZStyles.General.SideButton1), mWindowSettings.SidebarCurrentWidth, mWindowSettings.sidebarButtonHeight)) { SetTheSame(EType.LiZiPro2); } AddSpace_3(); tempLabel = mWindowSettings.sidebarIsExpanded.faded < 0.6f ? "" : " 粒子总结"; if (QUI.Button(tempLabel, EZStyles.GetStyle(type == EType.ZhongJie ? EZStyles.General.SideButtonSelected2 : EZStyles.General.SideButton2), mWindowSettings.SidebarCurrentWidth, mWindowSettings.sidebarButtonHeight)) { SetTheSame(EType.ZhongJie); } AddSpace_3(); bool tmpOther = (type == EType.LiZi || type == EType.LiZi1 || type == EType.LiZi2 || type == EType.LiZi3 || type == EType.LiZi4 || type == EType.LiZi5 || type == EType.LiZi6); tempLabel = mWindowSettings.sidebarIsExpanded.faded < 0.6f ? "" : "粒子系统"; if (QUI.Button(tempLabel, EZStyles.GetStyle(type == EType.LiZi ? EZStyles.General.SideButtonSelected3 : EZStyles.General.SideButton3), mWindowSettings.SidebarCurrentWidth, mWindowSettings.sidebarButtonHeight)) { SetTheSame(EType.LiZi); } if (tmpOther) { tempLabel = mWindowSettings.sidebarIsExpanded.faded < 0.6f ? "" : (type == EType.LiZi1 ? "Emission(发射模块)".AddBlue() : "Emission(发射模块)"); if (QUI.Button(tempLabel, EZStyles.GetStyle(EZStyles.General.SideButtonBlue), mWindowSettings.SidebarCurrentWidth, mWindowSettings.sidebarButtonHeight)) { SetTheSame(EType.LiZi1); } tempLabel = mWindowSettings.sidebarIsExpanded.faded < 0.6f ? "" : (type == EType.LiZi2 ? "Shape(形状模块)".AddBlue() : "Shape(形状模块)"); if (QUI.Button(tempLabel, EZStyles.GetStyle(EZStyles.General.SideButtonBlue), mWindowSettings.SidebarCurrentWidth, mWindowSettings.sidebarButtonHeight)) { SetTheSame(EType.LiZi2); } tempLabel = mWindowSettings.sidebarIsExpanded.faded < 0.6f ? "" : (type == EType.LiZi3 ? "Collision(碰撞)".AddBlue() : "Collision(碰撞)"); if (QUI.Button(tempLabel, EZStyles.GetStyle(EZStyles.General.SideButtonBlue), mWindowSettings.SidebarCurrentWidth, mWindowSettings.sidebarButtonHeight)) { SetTheSame(EType.LiZi3); } tempLabel = mWindowSettings.sidebarIsExpanded.faded < 0.6f ? "" : (type == EType.LiZi4 ? "其他模块".AddBlue() : "其他模块"); if (QUI.Button(tempLabel, EZStyles.GetStyle(EZStyles.General.SideButtonBlue), mWindowSettings.SidebarCurrentWidth, mWindowSettings.sidebarButtonHeight)) { SetTheSame(EType.LiZi4); } tempLabel = mWindowSettings.sidebarIsExpanded.faded < 0.6f ? "" : (type == EType.LiZi5 ? "TextureSA(序列图模块)".AddBlue() : "TextureSA(序列图模块)"); if (QUI.Button(tempLabel, EZStyles.GetStyle(EZStyles.General.SideButtonBlue), mWindowSettings.SidebarCurrentWidth, mWindowSettings.sidebarButtonHeight)) { SetTheSame(EType.LiZi5); } tempLabel = mWindowSettings.sidebarIsExpanded.faded < 0.6f ? "" : (type == EType.LiZi6 ? "Renderer(渲染模块)".AddBlue() : "Renderer(渲染模块)"); if (QUI.Button(tempLabel, EZStyles.GetStyle(EZStyles.General.SideButtonBlue), mWindowSettings.SidebarCurrentWidth, mWindowSettings.sidebarButtonHeight)) { SetTheSame(EType.LiZi6); } } MyCreate.AddSpace(20); bool tmpProfiler = (type == EType.Profiler || type == EType.Profiler1 || type == EType.Profiler2); tempLabel = mWindowSettings.sidebarIsExpanded.faded < 0.6f ? "" : "Profiler"; if (QUI.Button(tempLabel, EZStyles.GetStyle(type == EType.Profiler ? EZStyles.General.SideButtonSelected5 : EZStyles.General.SideButton5), mWindowSettings.SidebarCurrentWidth, mWindowSettings.sidebarButtonHeight)) { SetTheSame(EType.Profiler); } if (tmpProfiler) { tempLabel = mWindowSettings.sidebarIsExpanded.faded < 0.6f ? "" : (type == EType.Profiler1 ? " 其他模块".AddBlue() : " 其他模块"); if (QUI.Button(tempLabel, EZStyles.GetStyle(EZStyles.General.SideButtonBlue), mWindowSettings.SidebarCurrentWidth, mWindowSettings.sidebarButtonHeight)) { SetTheSame(EType.Profiler1); } tempLabel = mWindowSettings.sidebarIsExpanded.faded < 0.6f ? "" : (type == EType.Profiler2 ? " Tip".AddBlue() : " Tip"); if (QUI.Button(tempLabel, EZStyles.GetStyle(EZStyles.General.SideButtonBlue), mWindowSettings.SidebarCurrentWidth, mWindowSettings.sidebarButtonHeight)) { SetTheSame(EType.Profiler2); } } }
private void DrawUniwebview() // Uniwebview { m_Tools.BiaoTi_B("Uniwebview " + "-> 浏览网页".AddGreen()); MyCreate.Heng(() => { m_Tools.BiaoTi_O("1. 添加包" + "(版本 2_9_1)".AddLightGreen() + " (AndroidManifest.xml 说明)".AddYellow(), ref _isOne, null); MyCreate.Button("导入包", () => { Application.OpenURL("F:/ZiLiao/使用其它插件的包"); }); }); if (_isOne) { MyCreate.Box(() => { MyCreate.Text("▪ 获得使用" + "网络的许可".AddGreen()); MyCreate.Box_Hei(() => { m_Tools.Text_H("<uses-permission android:name=\"android.permission.INTERNET\"/>"); }); AddSpace_3(); MyCreate.Text("▪ 这个 activity 是" + "必须要的".AddRed()); MyCreate.Box_Hei(() => { m_Tools.Text_H("<activity android:name=\"com.unity3d.player.UnityPlayerActivity\""); m_Tools.Text_H(" android:label=\"@string / app_name\""); m_Tools.Text_H(" android:hardwareAccelerated=\"true\">\""); m_Tools.Text_G("// UniWebView 的 Web 页面和视频加速"); m_Tools.Text_H(" <intent-filter>"); m_Tools.Text_H(" ..."); m_Tools.Text_H(" </intent-filter>"); m_Tools.Text_H(" ..."); m_Tools.Text_H("</activity>"); }); AddSpace_3(); MyCreate.Text("▪ 需要额外活动: " + "(如需要 上传 一张 照片)".AddGreen() + "这个 activity 就需要"); MyCreate.Box_Hei(() => { m_Tools.Text_H("<activity android:name=\"com.onevcat.uniwebview."); m_Tools.Text_H(" UniWebViewFileChooserActivity\"/>"); m_Tools.Text_G("// 图像文件选择器的 activity"); }); AddSpace_3(); MyCreate.Text("▪ 其他权限"); MyCreate.Box(() => { m_Tools.TextText_HG("ACCESS_FINE_LOCATION", "如:想使用 Web 服务的位置", 20); m_Tools.TextText_HG("WRITE_EXTERNAL_STORAGE", "如:想选择或捕获照片上传", 20); }); }); } else { AddSpace(); } m_Tools.BiaoTi_O("2. 使用 " + "UniWebView ".AddWhite() + "组件(即可使用浏览器浏览网页)", true); MyCreate.PropertiesWindow(() => { m_Tools.Method_BL("Insets", "", "插入网页大小" + "(默认全屏(0, 0, 0, 0))".AddGreen(), "UniWebViewEdgeInsets", -110); }); MyCreate.AddSpace(12); MyCreate.Window("[ 委托 ]", () => { m_Tools.Method_BY("OnLoadComplete+=", "UniWebView,bool 是否成功,string 错误信息", "加载完成"); }); MyCreate.MethodWindow(() => { m_Tools.Method_YL("Load", "string url", "加载网页" + "(不会显示)".AddGreen()); m_Tools.Method_YL("Show", "4个已赋值参数", "显示", "", ref _isShow, () => { MyCreate.Box(() => { m_Tools.TextText_BL("fade = false", ""); m_Tools.TextText_BL("UniWebViewTransitionEdge = None", ""); m_Tools.TextText_BL("float = 0.4f", ""); m_Tools.TextText_BL("Action = null", "显示完成回调"); }); }); }); m_Tools.BiaoTi_O("3.使用 " + "UniWebViewEdgeInsets".AddWhite() + " 类来调整浏览器大小", true); MyCreate.Box(() => { MyCreate.Text("UniWebView:Insets 属性"); MyCreate.Box_Hei(() => { m_Tools.Text_H("▪ 面板设置 Insets"); m_Tools.Text_H("▪ uniwebView.insets = new UniWebViewEdgeInsets(0, 0, 0, 0)"); }); MyCreate.Text("UniWebView:InsetsForScreenOreitation " + "使用自动旋转,调整大小"); MyCreate.Box_Hei(() => { m_Tools.Text_H("uniWebView.InsetsForScreenOreitation += (webView,方向)=>"); m_Tools.Text_H("{"); m_Tools.TextText_HG(" if (方向 == UniWebViewOrientation.Portrait)", "// 竖"); m_Tools.Text_H(" return new UniWebViewEdgeInsets(0, 0, 0, 0);"); m_Tools.Text_H(" else ..."); m_Tools.Text_H("}"); }); }); }
private void OneLine(string str, string des, MyEnumColor color, params string[] strs) { StringBuilder sb = new StringBuilder(); sb.Append(" ── ").Append(str.AddColor(color, false)).Append(" (").Append(des.AddGreen()).Append(")"); MyCreate.Text(sb.ToString()); MyCreate.Heng(() => { MyCreate.AddSpace(18); MyCreate.Box(() => { sb.Length = 0; sb.Append(" "); if (strs.Length <= 5) { for (int i = 0; i < strs.Length; i++) { if (i % 2 == 0) { sb.Append(strs[i].AddBlue()); } else { sb.Append(strs[i].AddLightBlue()); } if (i != strs.Length - 1) { sb.Append(Point); } } MyCreate.Text(sb.ToString()); } else { for (int i = 0; i < 5; i++) { if (i % 2 == 0) { sb.Append(strs[i].AddBlue()); } else { sb.Append(strs[i].AddLightBlue()); } if (i != strs.Length - 1) { sb.Append(Point); } } MyCreate.Text(sb.ToString()); sb.Length = 0; sb.Append(" "); for (int i = 5; i < strs.Length; i++) { if (i % 2 == 0) { sb.Append(strs[i].AddBlue()); } else { sb.Append(strs[i].AddLightBlue()); } if (i != strs.Length - 1) { sb.Append(Point); } } MyCreate.Text(sb.ToString()); } }); }); }
private void DrawSetting() // Setting { m_Tools.BiaoTi_B("说明"); MyCreate.Box_Hei(() => { m_Tools.TextText_WL("ES3.Save<T>(string key ,T value)", "调用下面设置", 140); m_Tools.TextText_WL("ES3.Save<T>(string key ,T value ," + "ES3Settings".AddGreen() + ")", "使用新设置", 140); }); AddSpace(); m_Tools.BiaoTi_O("默认运行时的" + "设置".AddYellow()); MyCreate.Box(() => { settings.location = (ES3.Location)m_Tools.TextEnum_B("位置" + "(location)".AddWhite(), settings.location, ref isLocation, () => { MyCreate.Box_Hei(() => { m_Tools.Text_L("数据应存储和加载的位置"); m_Tools.Text_L("Resources 只允许加载,当然不能存储" + "(所以 Resources 作用不大)".AddGreen()); m_Tools.Text_G("感觉这个就默认 File 文件即可"); }); }); if (settings.location == ES3.Location.File) { settings.directory = (ES3.Directory)m_Tools.TextEnum_B("文件保存目录" + "(directory)".AddWhite(), settings.directory); } settings.path = m_Tools.TextString_B("文件名" + "(path)".AddWhite(), settings.path); MyCreate.AddSpace(5); settings.encryptionType = (ES3.EncryptionType)m_Tools.TextEnum_B("加密类型" + "(encryptionType)".AddWhite(), settings.encryptionType, ref isencryptionType, () => { MyCreate.Box_Hei(() => { m_Tools.Text_L("目前支持易保存AES 加密利用 128 位密钥 "); m_Tools.Text_L("不需要加密就 None"); }); }); if (settings.encryptionType == ES3.EncryptionType.AES) { settings.encryptionPassword = m_Tools.TextString("加密密码" + "(encryptionPassword)".AddWhite(), settings.encryptionPassword); } settings.format = (ES3.Format)m_Tools.TextEnum_B("文件格式" + "(format)".AddWhite(), settings.format); settings.bufferSize = m_Tools.TextInt_B("缓存长度" + "(bufferSize)".AddWhite(), settings.bufferSize, ref isbufferSize, () => { MyCreate.Box_Hei(() => { m_Tools.Text_L("任何流缓冲区都将设置为此长度(以字节为单位)"); m_Tools.Text_L(" 通常使用更大的缓冲区会提高性能但也会增加内存使用量,"); m_Tools.Text_L(" 但有些系统会执行优化,这会使性能下降得不那么明显"); m_Tools.Text_G("如果不确定,请将其保留为默认值 2048"); }); }); }); AddSpace(); m_Tools.BiaoTi_O("Editor" + "设置".AddYellow()); MyCreate.Box(() => { editorSettings.addMgrToSceneAutomatically = m_Tools.TextBool_H("自动将 Manager 添加到场景", editorSettings.addMgrToSceneAutomatically); editorSettings.autoUpdateReferences = m_Tools.TextBool_H("自动更新 References", editorSettings.autoUpdateReferences); // Show Assembly names array. SerializedObject so = new SerializedObject(editorSettings); SerializedProperty settingsProperty = so.FindProperty("settings"); SerializedProperty assemblyNamesProperty = settingsProperty.FindPropertyRelative("assemblyNames"); EditorGUILayout.PropertyField(assemblyNamesProperty, new GUIContent("包含ES3Types的程序集", "我们要从中加载ES3Types的程序集的名称"), true); // True means show children so.ApplyModifiedProperties(); }); AddSpace(); m_Tools.BiaoTi_Y("工具"); MyCreate.Box(() => { MyCreate.Heng(() => { m_Tools.Text_B("Open persistentDataPath 文件夹"); MyCreate.AddSpace(); MyCreate.Button(" 打开 ", () => { Application.OpenURL(Application.persistentDataPath); }); }); MyCreate.Heng(() => { m_Tools.Text_B("Clear persistentDataPath" + "(删除文件夹下所有)".AddGreen()); MyCreate.AddSpace(); MyCreate.Button(" 清理 ", () => { if (EditorUtility.DisplayDialog("清理 persistentDataPath", "确定全部删除?\n 操作不可销毁.", "删除", "取消")) { System.IO.DirectoryInfo di = new DirectoryInfo(Application.persistentDataPath); foreach (FileInfo file in di.GetFiles()) { file.Delete(); } foreach (DirectoryInfo dir in di.GetDirectories()) { dir.Delete(true); } } }); }); MyCreate.Heng(() => { m_Tools.Text_B("Clear PlayerPrefs"); MyCreate.AddSpace(); MyCreate.Button(" 清理 ", () => { if (EditorUtility.DisplayDialog("清理 PlayerPrefs", "确定全部清理?", "清理", "取消")) { PlayerPrefs.DeleteAll(); } }); }); }); }