2024-07-19 Unity插件 Odin Inspector9 —— Validation Attributes
文章目录
- 1 说明
- 2 验证特性
- 2.1 AssetsOnly / SceneObjectsOnly
- 2.2 ChildGameObjectsOnly
- 2.3 DisallowModificationsIn
- 2.4 FilePath
- 2.5 FolderPath
- 2.6 MaxValue / MinValue
- 2.7 MinMaxSlider
- 2.8 PropertyRange
- 2.9 Required
- 2.10 RequiredIn
- 2.11 RequiredListLength
- 2.12 ValidateInput
1 说明
本文介绍 Odin Inspector 插件中有关验证特性的使用方法。
2 验证特性
2.1 AssetsOnly / SceneObjectsOnly
使目标对象在 Inspector 窗口中只能关联资源 / 场景对象,限制拖拽的资源类型。
![image-20240715004717713](https://img-blog.csdnimg.cn/img_convert/82570ac294b5a545c64d6a54d39f3b1c.png#pic_center)
// SceneAndAssetsOnlyExamplesComponent.csusing Sirenix.OdinInspector;
using System.Collections.Generic;
using UnityEngine;public class SceneAndAssetsOnlyExamplesComponent : MonoBehaviour
{[Title("Assets only")][AssetsOnly]public List<GameObject> OnlyPrefabs;[AssetsOnly]public GameObject SomePrefab;[AssetsOnly]public Material MaterialAsset;[AssetsOnly]public MeshRenderer SomeMeshRendererOnPrefab;[Title("Scene Objects only")][SceneObjectsOnly]public List<GameObject> OnlySceneObjects;[SceneObjectsOnly]public GameObject SomeSceneObject;[SceneObjectsOnly]public MeshRenderer SomeMeshRenderer;
}
2.2 ChildGameObjectsOnly
可用于 Components 和 GameObject,并在对象旁添加小按钮,点击按钮将显示其子物体中所有满足条件的对象。
IncludeSelf = true
是否包含自身。
bool IncludeInactive
是否包含未激活的子物体。
![image-20240718021903335](https://img-blog.csdnimg.cn/img_convert/bd761c8d114e88e74ba954f06c917674.png#pic_center)
// ChildGameObjectsOnlyAttributeExamplesComponent.csusing Sirenix.OdinInspector;
using UnityEngine;public class ChildGameObjectsOnlyAttributeExamplesComponent : MonoBehaviour
{[ChildGameObjectsOnly]public Transform ChildOrSelfTransform;[ChildGameObjectsOnly]public GameObject ChildGameObject;[ChildGameObjectsOnly(IncludeSelf = false)]public Light[] Lights;
}
2.3 DisallowModificationsIn
当该对象所在的脚本挂载在何种预制体上,其修饰的对象将被禁用 / 灰色显示。
PrefabKind prefabKind
预制体的种类。
None
所有预制体,都不满足条件。
InstanceInScene
场景中的预制体实例。
InstanceInPrefab
嵌套在其他预制体中的预制件实例。
Regular
常规预制体。
Variant
预制体资产。
NonPrefabInstance
非预制体或场景中的游戏对象实例。
PrefabInstance = InstanceInPrefab | InstanceInScene
常规预制体的实例,以及场景中或嵌套在其他预制体中的预制体。
PrefabAsset = Variant | Regular
常规预制体和预制体资产。
PrefabInstanceAndNonPrefabInstance = PrefabInstance | NonPrefabInstance
预制体以及非预制实例。
All = PrefabInstanceAndNonPrefabInstance | PrefabAsset
所有预制体。
![image-20240719003134858](https://img-blog.csdnimg.cn/img_convert/bb39cdfe8421a6945857667d38a78c25.png#pic_center)
using System.Collections;
using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEngine;public class Test : MonoBehaviour
{[DisallowModificationsIn(PrefabKind.PrefabAsset)]public GameObject o;
}
2.4 FilePath
用于字符串,为文件路径提供接口。支持下拉选择文件路径和拖拽文件路径。
string ParentFolder
父路径。可以相对于 Unity 项目,也可以是绝对路径。
string Extensions
文件扩展名列表(以逗号分隔)。扩展名中的 “.” 可不写。
bool AbsolutePath
是否为绝对路径。
bool RequireExistingPath
true:若路径不存在,则显示警告提示。
bool UseBackslashes
是否使用反斜杠(默认使用斜杠)。
![image-20240718024034855](https://img-blog.csdnimg.cn/img_convert/cbfae654168cf5c415bcc817c5313224.png#pic_center)
// FilePathExamplesComponent.cs
using Sirenix.OdinInspector;
using UnityEngine;public class FilePathExamplesComponent : MonoBehaviour
{// By default, FolderPath provides a path relative to the Unity project.[FilePath]public string UnityProjectPath;// It is possible to provide custom parent path. Parent paths can be relative to the Unity project, or absolute.[FilePath(ParentFolder = "Assets/Plugins/Sirenix")]public string RelativeToParentPath;// Using parent path, FilePath can also provide a path relative to a resources folder.[FilePath(ParentFolder = "Assets/Resources")]public string ResourcePath;// Provide a comma seperated list of allowed extensions. Dots are optional.[FilePath(Extensions = "cs")][BoxGroup("Conditions")]public string ScriptFiles;// By setting AbsolutePath to true, the FilePath will provide an absolute path instead.[FilePath(AbsolutePath = true)][BoxGroup("Conditions")]public string AbsolutePath;// FilePath can also be configured to show an error, if the provided path is invalid.[FilePath(RequireExistingPath = true)][BoxGroup("Conditions")]public string ExistingPath;// By default, FilePath will enforce the use of forward slashes. It can also be configured to use backslashes instead.[FilePath(UseBackslashes = true)][BoxGroup("Conditions")]public string Backslashes;// FilePath also supports member references with the $ symbol.[FilePath(ParentFolder = "$DynamicParent", Extensions = "$DynamicExtensions")][BoxGroup("Member referencing")]public string DynamicFilePath;[BoxGroup("Member referencing")]public string DynamicParent = "Assets/Plugins/Sirenix";[BoxGroup("Member referencing")]public string DynamicExtensions = "cs, unity, jpg";// FilePath also supports lists and arrays.[FilePath(ParentFolder = "Assets/Plugins/Sirenix/Demos/Odin Inspector")][BoxGroup("Lists")]public string[] ListOfFiles;
}
2.5 FolderPath
用于字符串,为目录路径提供接口。支持下拉选择文件夹目录和拖拽文件夹目录。
string ParentFolder
父路径。可以相对于 Unity 项目,也可以是绝对路径。
bool AbsolutePath
是否为绝对路径。
bool RequireExistingPath
true:若路径不存在,则显示警告提示。
bool UseBackslashes
是否使用反斜杠(默认使用斜杠)。
![image-20240718024439650](https://img-blog.csdnimg.cn/img_convert/bfc5ae496a6eb262b563614aa23fdd04.png#pic_center)
// FolderPathExamplesComponent.csusing Sirenix.OdinInspector;
using UnityEngine;public class FolderPathExamplesComponent : MonoBehaviour
{// By default, FolderPath provides a path relative to the Unity project.[FolderPath]public string UnityProjectPath;// It is possible to provide custom parent path. Parent paths can be relative to the Unity project, or absolute.[FolderPath(ParentFolder = "Assets/Plugins/Sirenix")]public string RelativeToParentPath;// Using parent path, FolderPath can also provide a path relative to a resources folder.[FolderPath(ParentFolder = "Assets/Resources")]public string ResourcePath;// By setting AbsolutePath to true, the FolderPath will provide an absolute path instead.[FolderPath(AbsolutePath = true)][BoxGroup("Conditions")]public string AbsolutePath;// FolderPath can also be configured to show an error, if the provided path is invalid.[FolderPath(RequireExistingPath = true)][BoxGroup("Conditions")]public string ExistingPath;// By default, FolderPath will enforce the use of forward slashes. It can also be configured to use backslashes instead.[FolderPath(UseBackslashes = true)][BoxGroup("Conditions")]public string Backslashes;// FolderPath also supports member references and attribute expressions with the $ symbol.[FolderPath(ParentFolder = "$DynamicParent")][BoxGroup("Member referencing")]public string DynamicFolderPath;[BoxGroup("Member referencing")]public string DynamicParent = "Assets/Plugins/Sirenix";// FolderPath also supports lists and arrays.[FolderPath(ParentFolder = "Assets/Plugins/Sirenix")][BoxGroup("Lists")]public string[] ListOfFolders;
}
2.6 MaxValue / MinValue
在 Inspector 窗口中对象能够被设置的最小 / 大值。超过该范围则会有错误提示。
double maxValue/minValue
最大 / 小值。
string Expression
用于解析最大 / 小值的字符串。可以是字段、属性、方法名或表达式。
![image-20240716045038267](https://img-blog.csdnimg.cn/img_convert/67829eebc1c4084e7ec143a90df9829e.png#pic_center)
// MinMaxValueValueExamplesComponent.csusing Sirenix.OdinInspector;
using UnityEngine;public class MinMaxValueValueExamplesComponent : MonoBehaviour
{// Ints[Title("Int")][MinValue(0)]public int IntMinValue0;[MaxValue(0)]public int IntMaxValue0;// Floats[Title("Float")][MinValue(0)]public float FloatMinValue0;[MaxValue(0)]public float FloatMaxValue0;// Vectors[Title("Vectors")][MinValue(0)]public Vector3 Vector3MinValue0;[MaxValue(0)]public Vector3 Vector3MaxValue0;
}
2.7 MinMaxSlider
将 Vector2 向量表示为 [min, max] 区间,并在 Inspector 窗口中以滑动条方式显示。其中,x 为最小值,y 为最大值。
float minValue/maxValue
最小 / 大值。
string minValueGetter/maxValueGetter
获取最小 / 大值的方法名称。
string minMaxValueGetter
获取最小、大值对的方法名称。
bool showFields = false
是否显示对象名称。
![image-20240716045759075](https://img-blog.csdnimg.cn/img_convert/11ab8d8da6a93abfe3e6f07e5c212632.png#pic_center)
// MinMaxSliderExamplesComponent.csusing Sirenix.OdinInspector;
using UnityEngine;public class MinMaxSliderExamplesComponent : MonoBehaviour
{[MinMaxSlider(-10, 10)]public Vector2 MinMaxValueSlider = new Vector2(-7, -2);[MinMaxSlider(-10, 10, true)]public Vector2 WithFields = new Vector2(-3, 4);[InfoBox("You can also assign the min max values dynamically by referring to members.")][MinMaxSlider("DynamicRange", true)]public Vector2 DynamicMinMax = new Vector2(25, 50);[MinMaxSlider("Min", 10f, true)]public Vector2 DynamicMin = new Vector2(2, 7);[InfoBox("You can also use attribute expressions with the @ symbol.")][MinMaxSlider("@DynamicRange.x", "@DynamicRange.y * 10f", true)]public Vector2 Expressive = new Vector2(0, 450);public Vector2 DynamicRange = new Vector2(0, 50);public float Min { get { return this.DynamicRange.x; } }public float Max { get { return this.DynamicRange.y; } }
}
2.8 PropertyRange
创建滑块控件,将属性的值设置在指定范围之间。
double min/max
最小 / 大值。
string minGetter/maxGetter
获取最小、大值的方法名称。
![image-20240716051249151](https://img-blog.csdnimg.cn/img_convert/86ec8faa49d3a7c004430f537b44ea5a.png#pic_center)
// PropertyRangeExampleComponent.csusing Sirenix.OdinInspector;
using UnityEngine;public class PropertyRangeExampleComponent : MonoBehaviour
{[Range(0, 10)]public int Field = 2;[InfoBox("Odin's PropertyRange attribute is similar to Unity's Range attribute, but also works on properties.")][ShowInInspector, PropertyRange(0, 10)]public int Property { get; set; }[InfoBox("You can also reference member for either or both min and max values.")][PropertyRange(0, "Max"), PropertyOrder(3)]public int Dynamic = 6;[PropertyOrder(4)]public int Max = 100;
}
2.9 Required
如果对象没有被关联,则显示错误信息。
string errorMessage
显示信息。
InfoMessageType messageType
信息类型。
![image-20240715005824011](https://img-blog.csdnimg.cn/img_convert/3576cc4d780f8694c446565da73c7bc2.png#pic_center)
// RequiredExamplesComponent.cs
using Sirenix.OdinInspector;
using UnityEngine;public class RequiredExamplesComponent : MonoBehaviour
{[Required]public GameObject MyGameObject;[Required("Custom error message.")]public Rigidbody MyRigidbody;[InfoBox("Use $ to indicate a member string as message.")][Required("$DynamicMessage")]public GameObject GameObject;public string DynamicMessage = "Dynamic error message";
}
2.10 RequiredIn
当该对象所在的脚本挂载在何种预制体上,其修饰的对象必须被关联,否则显示错误信息。
string errorMessage
显示信息。
PrefabKind prefabKind
预制体的种类。
None
所有预制体,都不满足条件。
InstanceInScene
场景中的预制体实例。
InstanceInPrefab
嵌套在其他预制体中的预制件实例。
Regular
常规预制体。
Variant
预制体资产。
NonPrefabInstance
非预制体或场景中的游戏对象实例。
PrefabInstance = InstanceInPrefab | InstanceInScene
常规预制体的实例,以及场景中或嵌套在其他预制体中的预制体。
PrefabAsset = Variant | Regular
常规预制体和预制体资产。
PrefabInstanceAndNonPrefabInstance = PrefabInstance | NonPrefabInstance
预制体以及非预制实例。
All = PrefabInstanceAndNonPrefabInstance | PrefabAsset
所有预制体。
![image-20240715232923256](https://img-blog.csdnimg.cn/img_convert/5e2e25db1eacc7eaa883c3dfb15776ce.png#pic_center)
using System.Collections;
using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEngine;public class Test : MonoBehaviour
{[RequiredIn(PrefabKind.PrefabAsset)]public GameObject o;
}
2.11 RequiredListLength
将 List 限制为包含指定数量的元素。
int minLength/maxLength
最小 / 大长度。
string minLengthGetter/maxLengthGetter
用于获取集合最小 / 大长度的 C# 表达式,例如“@this.otherList.Count”。
如果设置了 MinLength,则当 MinLengthGetter 返回 null 时,MinLength 将作为回退。
string fixedLengthGetter
用于获取集合长度的 C# 表达式。
PrefabKind PrefabKind
长度限制应用于哪种预制体上。
![image-20240719004053613](https://img-blog.csdnimg.cn/img_convert/a3015efa6687cf6cfb9f5432c3989549.png#pic_center)
// RequiredListLengthExamplesComponent.csusing System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEngine;public class RequiredListLengthExamplesComponent : MonoBehaviour
{[RequiredListLength(10)]public int[] fixedLength;[RequiredListLength(1, null)]public int[] minLength;[RequiredListLength(null, 10, PrefabKind = PrefabKind.InstanceInScene)]public List<int> maxLength;[RequiredListLength(3, 10)]public List<int> minAndMaxLength;public int SomeNumber;[RequiredListLength("@this.SomeNumber")] public List<GameObject> matchLengthOfOther;[RequiredListLength("@this.SomeNumber", null)]public int[] minLengthExpression;[RequiredListLength(null, "@this.SomeNumber")]public List<int> maxLengthExpression;
}
2.12 ValidateInput
允许检查 Inspector 窗口中拖拽关联值是否正确。
string condition
判断是否正确的方法。
string defaultMessage
显示信息。
InfoMessageType messageType
信息类型。
![image-20240715011220919](https://img-blog.csdnimg.cn/img_convert/d31dabad869688a0ab011883fb7573db.png#pic_center)
// ValidateInputExamplesComponent.csusing Sirenix.OdinInspector;
using UnityEngine;#if UNITY_EDITOR // Editor namespaces can only be used in the editor.
using Sirenix.OdinInspector.Editor.Examples;
#endifpublic class ValidateInputExamplesComponent : MonoBehaviour
{
#if UNITY_EDITOR // MyScriptyScriptableObject is an example type and only exists in the editor[HideLabel][Title("Default message", "You can just provide a default message that is always used")][ValidateInput("MustBeNull", "This field should be null.")]public MyScriptyScriptableObject DefaultMessage;
#endif[Space(12), HideLabel][Title("Dynamic message", "Or the validation method can dynamically provide a custom message")][ValidateInput("HasMeshRendererDynamicMessage", "Prefab must have a MeshRenderer component")]public GameObject DynamicMessage;[Space(12), HideLabel][Title("Dynamic message type", "The validation method can also control the type of the message")][ValidateInput("HasMeshRendererDynamicMessageAndType", "Prefab must have a MeshRenderer component")]public GameObject DynamicMessageAndType;[Space(8), HideLabel][InfoBox("Change GameObject value to update message type", InfoMessageType.None)]public InfoMessageType MessageType;[Space(12), HideLabel][Title("Dynamic default message", "Use $ to indicate a member string as default message")][ValidateInput("AlwaysFalse", "$Message", InfoMessageType.Warning)]public string Message = "Dynamic ValidateInput message";#if UNITY_EDITOR // Editor-related code must be excluded from buildsprivate bool AlwaysFalse(string value) {return false;}private bool MustBeNull(MyScriptyScriptableObject scripty) {return scripty == null;}private bool HasMeshRendererDefaultMessage(GameObject gameObject) {if (gameObject == null) return true;return gameObject.GetComponentInChildren<MeshRenderer>() != null;}private bool HasMeshRendererDynamicMessage(GameObject gameObject, ref string errorMessage) {if (gameObject == null) return true;if (gameObject.GetComponentInChildren<MeshRenderer>() == null) {// If errorMessage is left as null, the default error message from the attribute will be usederrorMessage = "\"" + gameObject.name + "\" must have a MeshRenderer component";return false;}return true;}private bool HasMeshRendererDynamicMessageAndType(GameObject gameObject, ref string errorMessage, ref InfoMessageType? messageType) {if (gameObject == null) return true;if (gameObject.GetComponentInChildren<MeshRenderer>() == null) {// If errorMessage is left as null, the default error message from the attribute will be usederrorMessage = "\"" + gameObject.name + "\" should have a MeshRenderer component";// If messageType is left as null, the default message type from the attribute will be usedmessageType = this.MessageType;return false;}return true;}
#endif
}
相关文章:
![](https://img-blog.csdnimg.cn/img_convert/d31dabad869688a0ab011883fb7573db.png#pic_center)
2024-07-19 Unity插件 Odin Inspector9 —— Validation Attributes
文章目录 1 说明2 验证特性2.1 AssetsOnly / SceneObjectsOnly2.2 ChildGameObjectsOnly2.3 DisallowModificationsIn2.4 FilePath2.5 FolderPath2.6 MaxValue / MinValue2.7 MinMaxSlider2.8 PropertyRange2.9 Required2.10 RequiredIn2.11 RequiredListLength2.12 ValidateIn…...
![](https://i-blog.csdnimg.cn/direct/c1411a0851794086b9710d8beac6dd3b.png)
跨平台WPF音乐商店应用程序
目录 一 简介 二 设计思路 三 源码 一 简介 支持在线检索音乐,支持实时浏览当前收藏的音乐及音乐数据的持久化。 二 设计思路 采用MVVM架构,前后端分离,子界面弹出始终位于主界面的中心。 三 源码 视窗引导启动源码: namesp…...
![](https://www.ngui.cc/images/no-images.jpg)
设计模式简述(一)
定义:设计模式指的是在软件开发过程中,经过验证的,用于解决在特定环境下,重复出现的,特定问题的解决方案。创建型设计模式关注对象的创建过程,提供了更灵活、可扩展的对象创建机制。结构型设计模式用于解决…...
![](https://www.ngui.cc/images/no-images.jpg)
OSI参考模型:解析网络通信的七层框架
引言 在现代计算机网络中,OSI(开放式系统互联)参考模型是理解和设计网络通信协议的基础。1978年由国际标准化组织(ISO)提出,OSI模型定义了网络通信的七层结构,每一层都承担着特定的功能&#x…...
![](https://i-blog.csdnimg.cn/direct/c8b21d5996e14ef7bf8e2a85c6c4a5d2.png)
QT通用配置文件库(QPreferences)
QT通用配置文件库(QPreferences) QPreferences项目是基于nlohmann/json的qt可视化配置文件库,将配置保存成json格式,并提供UI查看与修改,可通过cmake可快速添加进项目。默认支持基本类型、stl常用容器、基本类型与stl容器组成的结构体&#…...
![](https://i-blog.csdnimg.cn/direct/187813a2e202437886f69159090f4404.png)
如何搭建一个RADIUS服务器?
1. 系统环境 1.1.操作系统 Ubuntu-20.04.1 (kernel: 5.15.0-58-generic) 1.2.所需软件 FreeRADIUS MariaDB 1.3.注意事项 本文提到的所有操作,都是以root 身份执行; 2. FreeRADIUS的安装 2.1. 安装FreeRADIUS服务器程序 以…...
![](https://i-blog.csdnimg.cn/direct/728bd47bb9554c0ca4965c1d48a6dada.png)
双机热备综合实验
1,对现有网络进行改造升级,将当个防火墙组网改成双机热备的组网形式,做负载分担模式,游客区和DMZ区走FW3,生产区和办公区的流量走FW1 2,办公区上网用户限制流量不超过100M,其中销售部人员在其基…...
![](https://www.ngui.cc/images/no-images.jpg)
Java和Python的图结构如何实现图的深度优先搜索算法
Java和Python的图结构如何实现图的深度优先搜索算法? 在Java和Python中,实现深度优先搜索(DFS)算法的基本思路都是通过递归或栈来探索图的各个节点。 Java实现DFS:Java import java.util.ArrayList; import java.uti…...
![](https://www.ngui.cc/images/no-images.jpg)
Web学习day05
html&css 目录 html&css 文章目录 一、web开发 1.1工作流程 1.2开发技术 二、HTML 2.1HTML规范 2.2基础标签 2.2.1标题 2.2.2水平线 2.2.3段落和换行 2.2.4文字效果 2.2.5超链接 2.2.6图像 2.2.7音频和视频 三、布局标签 3.1列表 3.2容器 3.3表格 3…...
![](https://i-blog.csdnimg.cn/direct/1d844b8e6917460d92e405b4a8036267.png)
LINUX客户端client(socket、connect)实现客户端发送,服务器接收
SERVICE端见前一篇文章 5. 客户端连接函数 connect()(与前面的bind一样) int connect (int sockfd, struct sockaddr * serv_addr, int addrlen) 参数: sockfd: 通过 socket() 函数拿到的 fd addr:struct sockaddr 的结构体变量地址 addr…...
![](https://i-blog.csdnimg.cn/direct/4bcb3bc55d27478fb7c7be7d96e7199b.png)
【网络安全科普】勒索病毒 防护指南
勒索病毒简介 勒索病毒是一种恶意软件,也称为勒索软件(Ransomware),其主要目的是在感染计算机后加密用户文件,并要求用户支付赎金以获取解密密钥。这种类型的恶意软件通常通过电子邮件附件、恶意链接、下载的软件或漏洞…...
![](https://www.ngui.cc/images/no-images.jpg)
TFHE库,fftw和googletest库安装
点个关注吧!本文主要关注于TFHE的安装与常见的问题 1.TFHE的git链接: https://github.com/tfhe/tfhe git clone --recurse-submodules --branchmaster https://github.com/tfhe/tfhe.git 2.安装 mkdir build cd build cmake ../src -DENABLE_TESTSon -D…...
![](https://www.ngui.cc/images/no-images.jpg)
关于Spring Boot IOCDC,看这一篇就够了
一,Spring是什么及常用注解 先说什么是spring,在前面的博客中已经知道了,spring是一个开源框架,为了让我们开发更加简单,那关于ioc呢,一句话概况一下:Spring就是包含了众多工具方法的Ioc容器 …...
![](https://www.ngui.cc/images/no-images.jpg)
Model Import Settings
前言 在可视化3D世界中,模型是3D世界的核心,你可以没有贴图,可以没有特效,甚至可以没有用户交互界面,但必须得有模型来描述世界的基本样貌。 在3D世界中,由点线面构成了模型的轮廓;由UV和纹理&a…...
![](https://i-blog.csdnimg.cn/direct/f7b0cb5c0b6446f4a3376ff5bc02a7cd.png#pic_center)
腾讯云COS托管静态网站,以及如何解决访问出现了下载网页的情况
腾讯云对象存储(Cloud Object Storage,简称COS),与其他云厂商所提供的云对象存储都是面向非结构化数据,只是每个云厂商的叫法有别于他家,或许是更能彰显厂商的品牌吧! 但不管云厂商怎么给云对象…...
![](https://www.ngui.cc/images/no-images.jpg)
软件设计模式: 抽象工厂
抽象工厂 一、解决的问题 抽象工厂模式主要解决了在具有多个产品族的情况下,如何统一管理创建相关产品对象的问题。 当系统需要创建一系列相互关联或相互依赖的对象,并且这些对象可以形成多个不同的产品族时,如果直接由客户端去分别创建这…...
![](https://i-blog.csdnimg.cn/direct/8160198c6c7348568641b221d71e3345.png)
使用Vuepress搭建个人网站
网站地址:bloggo.chat...
![](https://www.ngui.cc/images/no-images.jpg)
lua 写一个 不同时区之间转换日期和时间 函数
这个函数用于调整时间戳以适应不同的时区。它接受五个参数:format、timeStamp、dontFixForTimeOffset、currentServerTimeZone和showLog。返回 os.date,可以转化成指定格式的年月日时间 ### 功能 该函数的主要功能是根据给定的时区偏移量调整时间戳&am…...
![](https://www.ngui.cc/images/no-images.jpg)
谷粒商城——session共享
问题1 一个系统中不同微服务的session共享。 问题1的解决办法 1. session复制的方法:微服务的副本之间通过通信共享session。这样每一个微服务的副本都会保存所有的session。(缺点:造成大量的通信,多处额外的通信开销。&#x…...
![](https://www.ngui.cc/images/no-images.jpg)
Java 语言及其常用集合类的操作,以及反射机制与注解
目录 一、Java 语言概述 二、Java 集合框架 ArrayList 操作示例: HashMap 操作示例: 三、反射机制 1. 反射的示例 五、总结 Java 是一种广泛使用的高级编程语言,因其平台独立性、简洁性及丰富的 API 而备受开发者青睐。 一、Java 语言…...
![](https://img-blog.csdnimg.cn/4a3d2dc909d846f3ade748eb38789629.png#pic_center)
《系统架构设计师教程(第2版)》第12章-信息系统架构设计理论与实践-02-信息系统架构
文章目录 1. 概述1.1 信息系统架构(ISA)1.2 架构风格 2. 信息系统架构分类2.1 信息系统物理结构2.1.1 集中式结构2.1.2 分布式结构 2.2 信息系统的逻辑结构1)横向综合2)纵向综合3)纵横综合 3. 信息系统架构的一般原理4…...
![](https://i-blog.csdnimg.cn/direct/0c6739dd26aa42daa0dd17425f6d8835.png)
用html做python教程01
用html做python教程01 前言开肝构思实操额外修饰更换字体自适应 最后 前言 今天打开csdn的时候,看见csdn给我推荐了一个python技能书。 说实话,做得真不错。再看看我自己,有亿点差距😟。 开肝 先创建一个文件,后缀…...
![](https://www.ngui.cc/images/no-images.jpg)
PHP接口与性状的优雅应用
本文由 ChatMoney团队出品 在PHP编程中,接口是一种定义对象之间交互契约的强大工具。其核心目的不是让一个对象紧耦合地依赖另一个对象的特定身份,而是基于另一对象的能力进行交互。通过接口,我们的代码可以实现与依赖的解耦,从而…...
![](https://www.ngui.cc/images/no-images.jpg)
R语言模型评估网格搜索
### 网格搜索 ### install.packages("gbm") set.seed(1234) library(caret) library(gbm) fitControl <- trainControl(method = repeatedcv,number = 10,repeats = 5) # 设置网格搜索的参数池 gbmGrid <- expand.grid(interaction.depth = c(3,5,9),n.trees =…...
![](https://i-blog.csdnimg.cn/direct/c7d507488bdc461ba8b1c7d3c4904894.png)
Haproxy服务
目录 一.haproxy介绍 1.主要特点和功能 2.haproxy 调度算法 3.haproxy 与nginx 和lvs的区别 二.安装 haproxy 服务 1. yum安装 2.第三方rpm 安装 3.编译安装haproxy 三.配置文件详解 1.官方地址配置文件官方帮助文档 2.HAProxy 的配置文件haproxy.cfg由两大部分组成&…...
Unity VR开发入门:探索虚拟现实世界的无限可能
目录 引言 Unity VR开发基础 1. 安装Unity与VR SDK 2. 创建VR项目 3. 理解VR场景结构 Unity VR开发实战 1. 场景搭建 2. 交互设计 创建C#脚本 编写VRInteractor脚本 应用脚本到场景 注意 修改VRInteractor脚本 3. 用户体验优化 4. 测试与调试 引言 随着科技的飞速…...
![](https://i-blog.csdnimg.cn/direct/3dfa30293ad04346ba65cbc5755882f1.png)
系统架构设计师教程(清华第二版) 第3章 信息系统基础知识-3.2 业务处理系统-解读
教材中,一会儿“业务处理系统”,一会儿“事务处理系统”,语法毛病一堆。真是清华的水平!!! 系统架构设计师教程 第3章 信息系统基础知识-3.2 业务处理系统 3.2.1 业务处理系统的概念3.2.2 业务处理系统的功能3.2.2.1 数据输入3.2.2.2 数据处理3.2.2.2.1 批处理 (Batch …...
![](https://i-blog.csdnimg.cn/direct/e95c6f630a44409c8fe77b68bf683181.png)
32_ConvNeXt网络详解
1.1 简介 ConvNeXt是一种计算机视觉模型,由Meta AI(前Facebook AI)的研究人员在2022年提出,它旨在探索卷积神经网络(CNN)在图像识别任务上的潜力,尤其是在与当时流行的Vision Transformer&…...
![](https://img-blog.csdnimg.cn/img_convert/a8a8728efabb841b93b74ddddec2c686.png)
Langchain[3]:Langchain架构演进与功能扩展:流式事件处理、事件过滤机制、回调传播策略及装饰器应用
Langchain[3]:Langchain架构演进与功能扩展:流式事件处理、事件过滤机制、回调传播策略及装饰器应用 1. Langchain的演变 v0.1: 初始版本,包含基本功能。 从0.1~0.2完成的特性: 通过事件流 API 提供更好的流式支持。标准化工具调用支持Tool…...
![](https://www.ngui.cc/images/no-images.jpg)
java导出PDF详细教程+各种踩坑
直接上代码了 所需依赖: <dependency><groupId>com.itextpdf</groupId><artifactId>itextpdf</artifactId><version>5.4.3</version> </dependency><dependency><groupId>com.itextpdf</groupId><art…...
![](https://img-blog.csdnimg.cn/img_convert/773d81a934a4ba9e44768f29c7328d59.png)
网站做的像会侵权吗/成人短期就业培训班
张小龙在年初微信公开课上曾谈到表情:人们的表情反映出情绪越来越强烈了,像「裂开」这个表情就非常受欢迎。我的想法可能比裂开更暴力。有一天我跟开发同学说,帮我做一个功能,我扔出一个炸弹,对方的屏幕就裂开来。当然…...
![](https://static.oschina.net/uploads/img/201712/12113055_xrkR.png)
东莞建网站公司排名/百度推广登录入口官网网址
为什么80%的码农都做不了架构师?>>> 去下载一些东西 老样子,先废话几句,IntelliJ IDEA,发音大致如此:[in te li dʒei ai di: i: ei],我还是简称之为IntelliJ吧,“Intel”有“智能”…...
![](/images/no-images.jpg)
武汉微信网站建设/千锋教育的口碑怎么样
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼printf("------------------------------------------------------------------------\n");}//列出菜单void List(){printf("------------------------------------------------------------------------\n");…...
![](https://img-blog.csdnimg.cn/20210630175728893.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NDQ0MTI2Mw==,size_16,color_FFFFFF,t_70)
前端开发和后端开发哪个赚钱/seo的基本工作内容
射频加热系统 射频功率发生器 分为传统的功率振荡器的设计和相对较新的50欧姆功率放大器的设计。功率振荡器如图: 射频器和负载是功率发生器电路的一部分。工作电路的电容或者电感的变化会影响负载从谐振回路耦合得到的功率。一般都是通过改变极板的间距或者调整工…...
![](https://img-blog.csdnimg.cn/20210510122235162.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NjM5NjgzMw==,size_16,color_FFFFFF,t_70)
网站内链检测工具/如何开网站呢
登录VMware vSphere的管理界面,注意端口号。 按照下图进行修改即可。...
![](https://img-blog.csdnimg.cn/img_convert/5ec46349935c6fb71005867e767ed0a5.png)
wordpress拼音/百度竞价推广效果好吗
C语言之类型转换 类型之间的转换 1.c语言中的数据类型可以进行转换 —强制类型转换 —隐式类型转换 //示例1 int main() {long l 800;int i (int)l; //强制类型转换return 0; }//示例2 int main() {short s 800;int i s; //隐式类型转换//no error,no warningreturn …...