Editor工具开发实用篇:EditorGUI/EditorGUILayout的区别和EditorGUILayout的方法介绍

news/2024/4/20 18:57:43/文章来源:https://blog.csdn.net/SmillCool/article/details/129258562

目录

一:EditorGUI和EditorGUILayout区别

二:EditorGUILayout

1.EditorGUILayout.BeginFadeGroup(float value);

2.EditorGUILayout.BeginHorizontal  EditorGUILayout.BeginVertical

3.EditorGUILayout.BeginScrollView

4.EditorGUILayout.BeginToggleGroup&&EditorGUILayout.Toggle

5.EditorGUILayout.BoundsField  EditorGUILayout.BoundsIntField  public static Color ColorField   等等等....

6.EditorGUILayout.DropdownButton

7.EditorGUILayout.BeginBuildTargetSelectionGrouping

8.EditorGUILayout.EnumFlagsField

9.EditorGUILayout.EnumPopup

10.EditorGUILayout.Foldout

11.EditorGUILayout.GetControlRect

12.EditorGUILayout.GradientField

13.EditorGUILayout.HelpBox

14.EditorGUILayout.IntSlider||EditorGUILayout.Slider

15.EditorGUILayout.ObjectField

16.EditorGUILayout.PrefixLabel

17.EditorGUILayout.PropertyField

18.EditorGUILayout.SelectableLabel

19.EditorGUILayout.Space();

三.所有代码:


一:EditorGUI和EditorGUILayout区别

官方的api给出的是EditorGUILayout是EditorGUI的自动布局版本

什么意思呢?

如果我们进入到EditorGUI和EditorGUILayout的代码里可以看到EditorGUI类里有的方法 基本在EditorGUILayout类里都有相对应的方法 

区别就是:
EditorGUI类的方法基本上都要传入一个参数Rect包含了位置和大小而EditorGUILayout不需要

这样看的话我们着重了解一下EditorGUILayout

二:EditorGUILayout

常用方法:

1.EditorGUILayout.BeginFadeGroup(float value);

解释: 开始一个可隐藏/显示的组,并且过渡将生成动画。

eg:

private void OnGUI() {if(EditorGUILayout.BeginFadeGroup(0)) {GUILayout.TextArea("1\n2\n3\n4\n");}EditorGUILayout.EndFadeGroup();}

效果:

修改值为0.5f

private void OnGUI() {if(EditorGUILayout.BeginFadeGroup(0.5f)) {GUILayout.TextArea("1\n2\n3\n4\n");}EditorGUILayout.EndFadeGroup();}

效果:

 

修改为1

private void OnGUI() {if(EditorGUILayout.BeginFadeGroup(1)) {GUILayout.TextArea("1\n2\n3\n4\n");}EditorGUILayout.EndFadeGroup();}

效果:

 

2.EditorGUILayout.BeginHorizontal
  EditorGUILayout.BeginVertical

解释:开始一个水平组/垂直组
eg:

        EditorGUILayout.BeginHorizontal();GUILayout.Button("H_Btn1");GUILayout.Button("H_Btn2");EditorGUILayout.EndHorizontal();EditorGUILayout.BeginVertical();GUILayout.Button("V_Btn1");GUILayout.Button("V_Btn1");EditorGUILayout.EndVertical();

效果:

3.EditorGUILayout.BeginScrollView

解释:开始一个自动布局的滚动视图。
eg:

scrolpos = EditorGUILayout.BeginScrollView(scrolpos, GUILayout.Width(80), GUILayout.Height(80));GUILayout.Label("item1111111111111");GUILayout.Label("item2");GUILayout.Label("item3");GUILayout.Label("item4");GUILayout.Label("item5");EditorGUILayout.EndScrollView();

效果:

 

4.EditorGUILayout.BeginToggleGroup&&EditorGUILayout.Toggle

BeginToggleGroup  解释:开始一个垂直组,带有可一次性启用或禁用所有控件的开关
Toggle                       解释:创建一个开关
eg:

bool showToggle;private void OnGUI() {showToggle =  EditorGUILayout.BeginToggleGroup("toggleGroup", showToggle);EditorGUILayout.Toggle("toggle1", showToggle);EditorGUILayout.Toggle("toggle2", !showToggle);EditorGUILayout.EndToggleGroup();}

效果:

 

5.EditorGUILayout.BoundsField
  EditorGUILayout.BoundsIntField
  public static Color ColorField   等等等....

unity的api 或者C# api 的一些类型的展示
eg:

    Bounds Bounds;BoundsInt boundsInt;Color color;private void OnGUI() {EditorGUILayout.BeginVertical();Bounds = EditorGUILayout.BoundsField(Bounds);boundsInt = EditorGUILayout.BoundsIntField(boundsInt);color = EditorGUILayout.ColorField(color);EditorGUILayout.EndVertical();}

效果:

6.EditorGUILayout.DropdownButton

解释:创建一个能够对鼠标按下做出反应的按钮,用于显示您自己的下拉菜单内容
eg:

private void OnGUI() {
EditorGUILayout.BeginVertical();GUIContent dropDown = new GUIContent("菜单");if(EditorGUILayout.DropdownButton(dropDown, FocusType.Keyboard)) {GenericMenu genericMenu = new GenericMenu();genericMenu.AddItem(new GUIContent("文件"), true, Select);genericMenu.AddItem(new GUIContent("工具"), false, Select);genericMenu.AddSeparator("");genericMenu.AddItem(new GUIContent("设置/设置1"), true, Select);genericMenu.AddItem(new GUIContent("设置/设置2"), false, Select);genericMenu.AddItem(new GUIContent("主题/1"), true, Select);genericMenu.AddSeparator("主题/");genericMenu.AddItem(new GUIContent("主题/2"), false, Select);genericMenu.AddDisabledItem(new GUIContent("不可更改"));Rect rect = GUILayoutUtility.GetLastRect();genericMenu.DropDown(rect);}EditorGUILayout.EndVertical();
}private void Select() {Debug.Log("Select");}

效果:

修改:
            Rect rect = GUILayoutUtility.GetLastRect();
            genericMenu.DropDown(rect);

为:
            genericMenu.ShowAsContext();

效果:

拓展:GenericMenu 创建自定义上下文菜单和下拉菜单。

变量
allowDuplicateNames
允许菜单具有多个同名的菜单项。


公共函数
AddDisabledItem
向菜单添加已禁用的项。
AddItem
向菜单添加一个项。
AddSeparator
向菜单添加一个分隔符项。
DropDown
在给定屏幕矩形中显示菜单。
GetItemCount
获取菜单中的项数。
ShowAsContext
右键单击时在鼠标下显示菜单。


委托
MenuFunction
回调函数,菜单项选中时调用。
MenuFunction2
带有用户数据的回调函数,菜单项选中时调用。

7.EditorGUILayout.BeginBuildTargetSelectionGrouping

解释:开始构建目标组并返回所选 BuildTargetGroup
eg:

BuildTargetGroup buildTargetGroup = EditorGUILayout.BeginBuildTargetSelectionGrouping();if(buildTargetGroup == BuildTargetGroup.Android) {GUILayout.Button("A_Btn1");GUILayout.Button("A_Btn2");} else if(buildTargetGroup == BuildTargetGroup.iOS) {GUILayout.Button("I_Btn1");GUILayout.Button("I_Btn2");} else if(buildTargetGroup == BuildTargetGroup.Standalone) {GUILayout.Button("S_Btn1");GUILayout.Button("S_Btn2");} else if(buildTargetGroup == BuildTargetGroup.WebGL) {GUILayout.Button("W_Btn1");GUILayout.Button("W_Btn2");}EditorGUILayout.EndBuildTargetSelectionGrouping();

效果:

 

 

 

8.EditorGUILayout.EnumFlagsField

解释:单击后,系统会为枚举类型每个值显示带有选项的菜单
eg:

public enum CONENUM {NONE = 1 << 0,NORMAL = 1 << 2,SPE = 1 << 3,OTHER = 1 << 4,ALL = 1 << 5,
}
CONENUM cONENUM;private void OnGUI() {EditorGUILayout.BeginVertical();cONENUM = (CONENUM)EditorGUILayout.EnumFlagsField(cONENUM);EditorGUILayout.EndVertical();
}

效果:

 

9.EditorGUILayout.EnumPopup

解释:创建一个枚举弹出选择字段
eg:

public enum CONENUM {NONE = 1 << 0,NORMAL = 1 << 2,SPE = 1 << 3,OTHER = 1 << 4,ALL = 1 << 5,
}
CONENUM cONENUM;private void OnGUI() {EditorGUILayout.BeginVertical();cONENUM = (CONENUM)EditorGUILayout.EnumPopup("ENUM", cONENUM);EditorGUILayout.EndVertical();
}

效果:

10.EditorGUILayout.Foldout

解释:创建一个左侧带有折叠箭头的标签
eg:

 bool foldout = false;private void OnGUI() {EditorGUILayout.BeginVertical();foldout = EditorGUILayout.Foldout(foldout, "这个是什么意思,带折叠箭头的标签???");if(foldout) {GUILayout.Label("来吧展示!");}EditorGUILayout.EndVertical();
}

效果:

 

 

11.EditorGUILayout.GetControlRect

解释:获取编辑器控件的矩形。
eg:    

Rect controlRect;string selectPath;private void OnGUI() {EditorGUILayout.BeginVertical();controlRect = EditorGUILayout.GetControlRect(true, 100);selectPath = EditorGUI.TextField(controlRect, selectPath);EditorGUILayout.EndVertical();
}

效果:

12.EditorGUILayout.GradientField

解释:创建一个用于编辑 Gradient 的字段。
eg: 

Gradient gradient = new Gradient();private void OnGUI() {EditorGUILayout.BeginVertical();gradient = EditorGUILayout.GradientField(gradient);EditorGUILayout.EndVertical();}

效果:

 

 

13.EditorGUILayout.HelpBox

解释:创建一个带有发送给用户的消息的帮助框。
eg:

private void OnGUI() {EditorGUILayout.BeginVertical();EditorGUILayout.HelpBox("一个带有发送给用户消息的帮助框?", MessageType.Error);EditorGUILayout.EndVertical();}

效果:

 

14.EditorGUILayout.IntSlider||EditorGUILayout.Slider

解释:创建一个滑动条,用户可以进行拖动以在最小值和最大值之间更改整数值。
eg:

int sliderValue = 0;private void OnGUI() {EditorGUILayout.BeginVertical();sliderValue = EditorGUILayout.IntSlider(sliderValue, 0, 100);EditorGUILayout.EndVertical();}

效果:

 

注: EditorGUILayout.Slider 区别是支持浮点类型

15.EditorGUILayout.ObjectField

解释:生成一个可接收任何对象类型的字段。
eg:

UnityEngine.Object obj;private void OnGUI() {EditorGUILayout.BeginVertical();obj = EditorGUILayout.ObjectField(obj, typeof(UnityEngine.Object), true);EditorGUILayout.EndVertical();}

效果:

16.EditorGUILayout.PrefixLabel

解释:创建一个显示在特定控件前标签
eg:

Color color;
private void OnGUI() {EditorGUILayout.BeginVertical();EditorGUILayout.PrefixLabel("Color");color = EditorGUILayout.ColorField(color);EditorGUILayout.EndVertical();}

效果:

 

17.EditorGUILayout.PropertyField

解释:为 SerializedProperty 生成一个字段
eg:

public class TestBtn: MonoBehaviour {[HideInInspector]public string _name;private void OnGUI() {EditorGUILayout.BeginHorizontal();if(GUILayout.Button(_name)) {}EditorGUILayout.EndHorizontal();}
}
[CustomEditor(typeof(TestBtn))]
public class TestBtnTool : Editor {SerializedProperty serializedProperty;GUIContent gUIContent;private void Awake() {//反射拿到_name 赋值给serializedPropertyif(serializedObject.FindProperty("_name") != null) {serializedProperty = serializedObject.FindProperty("_name");}gUIContent = new GUIContent("L_Name");}public override void OnInspectorGUI() {base.OnInspectorGUI();if(serializedProperty != null) {EditorGUILayout.PropertyField(serializedProperty, gUIContent);//保存 serializedObject  serializedObject是TestBtn 的序列化serializedObject.ApplyModifiedProperties();}}
}

效果:

 

修改L_Name

 

 

18.EditorGUILayout.SelectableLabel

解释:生成一个可选择标签字段。(用于显示可复制粘贴的只读信息。)
eg:

private void OnGUI() {EditorGUILayout.BeginVertical();EditorGUILayout.SelectableLabel("1");EditorGUILayout.SelectableLabel("2");EditorGUILayout.SelectableLabel("3");EditorGUILayout.EndVertical();
}

修改:

 注:1 2 3 可复制

19.EditorGUILayout.Space();

用在两个控件中间 会有一个空格
eg:      

EditorGUILayout.BeginVertical();GUILayout.Button("V_Btn1");//EditorGUILayout.Space();GUILayout.Button("V_Btn1");EditorGUILayout.EndVertical();

效果:

 

使用后:

 

三.所有代码:

using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.AnimatedValues;
using UnityEngine;public class EditorToolWindowOne: EditorWindow {public static EditorToolWindowOne inst;float progress;[MenuItem("EditorTool/OpenWindowOne")]public static void CreateWindow() {inst = GetWindow<EditorToolWindowOne>(true, "这是一个浮动窗口");inst.Show();}private void Awake() {}Vector2 scrolpos = new Vector2(100, 100);bool showToggle;Bounds Bounds;BoundsInt boundsInt;Color color;CONENUM cONENUM;bool foldout = false;Rect controlRect;string selectPath;Gradient gradient = new Gradient();int sliderValue = 0;UnityEngine.Object obj;private void OnGUI() {BuildTargetGroup buildTargetGroup = EditorGUILayout.BeginBuildTargetSelectionGrouping();if(buildTargetGroup == BuildTargetGroup.Android) {GUILayout.Button("A_Btn1");GUILayout.Button("A_Btn2");} else if(buildTargetGroup == BuildTargetGroup.iOS) {GUILayout.Button("I_Btn1");GUILayout.Button("I_Btn2");} else if(buildTargetGroup == BuildTargetGroup.Standalone) {GUILayout.Button("S_Btn1");GUILayout.Button("S_Btn2");} else if(buildTargetGroup == BuildTargetGroup.WebGL) {GUILayout.Button("W_Btn1");GUILayout.Button("W_Btn2");}EditorGUILayout.EndBuildTargetSelectionGrouping();if(EditorGUILayout.BeginFadeGroup(1)) {GUILayout.TextArea("1\n2\n3\n4\n");}EditorGUILayout.EndFadeGroup();EditorGUILayout.BeginVertical();GUILayout.Button("V_Btn1");EditorGUILayout.Space();GUILayout.Button("V_Btn1");EditorGUILayout.EndVertical();scrolpos = EditorGUILayout.BeginScrollView(scrolpos, GUILayout.Width(80), GUILayout.Height(80));GUILayout.Label("item1111111111111");GUILayout.Label("item2");GUILayout.Label("item3");GUILayout.Label("item4");GUILayout.Label("item5");EditorGUILayout.EndScrollView();showToggle =  EditorGUILayout.BeginToggleGroup("toggleGroup", showToggle);EditorGUILayout.Toggle("toggle1", showToggle);EditorGUILayout.Toggle("toggle2", !showToggle);EditorGUILayout.EndToggleGroup();EditorGUILayout.BeginVertical();Bounds = EditorGUILayout.BoundsField(Bounds);boundsInt = EditorGUILayout.BoundsIntField(boundsInt);color = EditorGUILayout.ColorField(color);GUIContent dropDown = new GUIContent("菜单");if(EditorGUILayout.DropdownButton(dropDown, FocusType.Keyboard)) {GenericMenu genericMenu = new GenericMenu();genericMenu.AddItem(new GUIContent("文件"), true, Select);genericMenu.AddItem(new GUIContent("工具"), false, Select);genericMenu.AddSeparator("");genericMenu.AddItem(new GUIContent("设置/设置1"), true, Select);genericMenu.AddItem(new GUIContent("设置/设置2"), false, Select);genericMenu.AddItem(new GUIContent("主题/1"), true, Select);genericMenu.AddSeparator("主题/");genericMenu.AddItem(new GUIContent("主题/2"), false, Select);genericMenu.AddDisabledItem(new GUIContent("不可更改"));genericMenu.ShowAsContext();//Rect rect = GUILayoutUtility.GetLastRect();//genericMenu.DropDown(rect);}EditorGUILayout.EndVertical();EditorGUILayout.BeginVertical();cONENUM = (CONENUM)EditorGUILayout.EnumFlagsField("enum", cONENUM);EditorGUILayout.EndVertical();EditorGUILayout.BeginVertical();cONENUM = (CONENUM)EditorGUILayout.EnumPopup("ENUM", cONENUM);EditorGUILayout.EndVertical();EditorGUILayout.BeginVertical();foldout = EditorGUILayout.Foldout(foldout, "这个是什么意思,带折叠箭头的标签???");if(foldout) {GUILayout.Label("来吧展示!");}EditorGUILayout.EndVertical();EditorGUILayout.BeginVertical();controlRect = EditorGUILayout.GetControlRect(true, 100);selectPath = EditorGUI.TextField(controlRect, selectPath);EditorGUILayout.EndVertical();EditorGUILayout.BeginVertical();gradient = EditorGUILayout.GradientField(gradient);EditorGUILayout.EndVertical();EditorGUILayout.BeginVertical();EditorGUILayout.HelpBox("一个带有发送给用户消息的帮助框?", MessageType.Error);EditorGUILayout.EndVertical();EditorGUILayout.BeginVertical();sliderValue = EditorGUILayout.IntSlider(sliderValue, 0, 100);EditorGUILayout.EndVertical();EditorGUILayout.BeginVertical();obj = EditorGUILayout.ObjectField(obj, typeof(UnityEngine.Object), true);EditorGUILayout.EndVertical();EditorGUILayout.BeginVertical();EditorGUILayout.PrefixLabel("Color");color = EditorGUILayout.ColorField(color);EditorGUILayout.EndVertical();EditorGUILayout.BeginVertical();EditorGUILayout.SelectableLabel("1");EditorGUILayout.SelectableLabel("2");EditorGUILayout.SelectableLabel("3");EditorGUILayout.EndVertical();}private void Select() {Debug.Log("Select");}
}
public enum CONENUM {NONE = 1 << 0,NORMAL = 1 << 2,SPE = 1 << 3,OTHER = 1 << 4,ALL = 1 << 5,
}

 效果:

如果有不对的地方希望能指出来 感激不尽。
另外,不熟悉的代码一定要写一下加深记忆 只用看的记不了太久。 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.luyixian.cn/news_show_75212.aspx

如若内容造成侵权/违法违规/事实不符,请联系dt猫网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

sql-labs-Less1

靶场搭建好了&#xff0c;访问题目路径 http://127.0.0.1/sqli-labs-master/Less-1/ 我最开始在做sql-labs靶场的时候很迷茫&#xff0c;不知道最后到底要得到些什么&#xff0c;而现在我很清楚&#xff0c;sql注入可以获取数据库中的信息&#xff0c;而获取信息就是我们的目标…

概念+示例+横向对比+难点解析征服八大react hooks

8大hooks概念、使用场景 前言 对不同阶段的react开发者会有不同的效果&#xff0c;最终目的是能够对8大react hooks&#xff0c;完全理解&#xff0c;游刃有余。对比useState和useReducer&#xff0c;什么时候使用useMemo和useCallback&#xff0c;useEffect的参数… … use…

文献阅读笔记 # 面向大规模多版本软件系统的代码克隆检测加速技术

面向大规模多版本软件系统的代码克隆检测加速技术&#xff0c;方维康 吴毅坚 赵文耘&#xff0c;《计算机应用与软件》复旦大学软件学院、复旦大学上海市数据科学重点实验室2022 April 面向大规模多版本软件系统的代码克隆检测加速技术 摘要 很多代码克隆检测方法主要针对软…

【博学谷学习记录】超强总结,用心分享丨人工智能 多场景实战 常用英文缩写概念总结

目录PV(Page View)UV(Unique Visitor)CPM(Cost Per Mille)CPC(Cost Per Click)CPA(Cost Per Action)CPI(Cost Per Install)ACU(Average concurrent users)PCU(Peak concurrent users)ARPU(Average Revenue Per User)ARPPU(Average Revenue Per Paying User)LTV(Life Time Value…

Linux命令之lz4命令

一、lz4命令简介 LZ4是一种压缩格式&#xff0c;特点是压缩/解压缩速度超快(压缩率不如gzip)&#xff0c;如果你特别在意压缩速度&#xff0c;或者当前环境的CPU资源紧缺&#xff0c;可以考虑这种格式。lz4是一种非常快速的无损压缩算法&#xff0c;基于字节对齐LZ77系列压缩方…

西电计算机通信与网络(计网)简答题计算题核心考点汇总(期末真题+核心考点)

文章目录前言一、简答计算题真题概览二、网桥&#xff0c;交换机和路由器三、ARQ协议四、曼彻斯特编码和差分曼彻斯特编码五、CRC六、ARP协议七、LAN相关协议计算前言 主要针对西安电子科技大学《计算机通信与网络》的核心考点进行汇总&#xff0c;包含总共26章的核心简答。 【…

【Linux】Linux根文件系统扩容

场景&#xff1a;根文件系统需要至少100GB的剩余空间&#xff0c;但是目前就剩余91GB。因此&#xff0c;我们需要对根文件系统进行扩容。# df -h 文件系统 容量 已用 可用 已用% 挂载点 devtmpfs 3.9G 0 3.9G 0% /dev tmpfs …

密码暴力破解

密码的暴力破解准备工具功能简介Burp Intruder工作原理Intruder应用场景爆破实操准备工具 首先准备好BurpSuite和Dvwa作为测试工具和实验对象。 功能简介 Burp Intruder工作原理 Intruder在原始请求数据的基础上&#xff0c;通过修改各种请求参数&#xff0c;以获取不同的请…

flutter 微信聊天输入框

高仿微信聊天输入框&#xff0c;效果图如下&#xff08;目前都是静态展示&#xff0c;服务还没开始开发&#xff09;&#xff1a; 大家如果观察仔细的话 应该会发现&#xff0c;他输入框下面的高度 刚好就是 软键盘的高度&#xff1b;所以在这里就需要监听软键盘的高度。还要配…

Hbase资源隔离操作指南

1.检查集群的环境配置 1.1 HBase版本号确认> 5.11.0 引入rsgroup的Patch&#xff1a; [HBASE-6721] RegionServer Group based Assignment - ASF JIRA RegionServer Group based Assignment 社区支持版本&#xff1a;2.0.0 引入rsgroup的CDH版本 5.11.0 https://www.…

购买运动耳机应该考虑什么问题、运动达人必备的爆款运动耳机

喜欢运动的小伙伴都知道&#xff0c;运动和音乐是最配的&#xff0c;在运动中伴随着节奏感的音乐能够让自己更兴奋&#xff0c;锻炼的更加起劲儿。在运动耳机方面我也一直都有所研究&#xff0c;购买运动耳机最重要的就是要满足我们运动时候听音乐的需求&#xff0c;从佩戴舒适…

《C++ Primer Plus》(第6版)第5章编程练习

《C Primer Plus》&#xff08;第6版&#xff09;第5章编程练习《C Primer Plus》&#xff08;第6版&#xff09;第5章编程练习1. 计算闭区间内的整数和2. 重新编写程序清单5.43. 累加4. 投资价值5. 销售情况6. 销售情况27. 汽车8. 销售情况29. 销售情况210. 销售情况2《C Prim…

【技术美术图形部分】简述主流及新的抗锯齿技术

电脑的世界里没有曲线&#xff0c;都是三角面组成一个个模型的&#xff0c;因此一定会出现走样&#xff08;锯齿&#xff09;的情况&#xff0c;只是严重与否的问题&#xff0c;而AA也是实时渲染最难解决的问题之一。 Sampling&Artifacts Lecture 06 Rasterization 2 (An…

MAML算法详解(元学习)

文章目录回顾元学习MAML算法MAML和预训练模型的区别数学推导MAML实施细节总结回顾元学习 元学习的基本知识参考这篇博客元学习和机器学习的对比 MAML算法 学习初始化参数&#xff0c;所有任务的初始化的参数都是一样的 MAML和预训练模型的区别 MAML使用的是ϕ\phiϕ…

阶段十:总结专题(第六章:缓存篇)

阶段十&#xff1a;总结专题&#xff08;第六章&#xff1a;缓存篇&#xff09;Day-第六章&#xff1a;缓存篇1. Redis 数据类型**String****List****Hash****Sorted Set**2. keys 命令问题3. 过期 key 的删除策略4. Redis 持久化**AOF 持久化****AOF 重写****RDB 持久化****混…

Python 中 openpyxl 模块封装,读写 Excel 文件中自动化测试用例数据

只有测试数据和错误提示信息不同&#xff0c;其他代码都是一样的&#xff0c;不这样不易修改数据和维护&#xff0c;会有两点痛点 1.代码冗余极其严重, 程序可读性不佳 2.程序拓展性很差 往往我们在自动化测试汇总&#xff0c;会将数据放在 Excel 文件、CSV文件、数据库 Py…

Python-scatter散点图及颜色大全

# -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as pltplt.rcParams[font.sans-serif][SimHei] plt.rcParams[axes.unicode_minus] False #matplotlib画图中中文显示会有问题&#xff0c;需要这两行设置默认字体plt.xlabel(X) plt.ylabel(Y) plt.xlim…

【IP技术】ipv4和ipv6是什么?

IPv4和IPv6是两种互联网协议&#xff0c;用于在互联网上标识和寻址设备。IPv4&#xff08;Internet Protocol version 4&#xff09;是互联网协议的第四个版本&#xff0c;是当前广泛使用的互联网协议。IPv4地址由32位二进制数构成&#xff0c;通常表示为4个十进制数&#xff0…

大数据技术之Hive(四)分区表和分桶表、文件格式和压缩

一、分区表和分桶表1.1 分区表partitionhive中的分区就是把一张大表的数据按照业务需要分散的存储到多个目录&#xff0c;每个目录就称为该表的一个分区。在查询时通过where子句中的表达式选择式选择查询所需要的分区&#xff0c;这样的查询效率辉提高很多。1.1.1 分区表基本语…

2023年蜂巢科技最新面试题

2023年蜂巢科技最新面试题 bio与nio的区别 bio同步阻塞io&#xff1a;在此种⽅式下&#xff0c;⽤户进程在发起⼀个IO操作以后&#xff0c;必须等待IO操作的完成&#xff0c;只有当真正完成了IO操作以后&#xff0c;⽤户进程才能运⾏。JAVA传统的IO模型属于此种⽅式&#xff0…