当前位置: 首页 > article >正文

在Scene里面绘制编辑工具

功能要求
  • 策划要在scene模式下编辑棋子摆放。
  • 用handle.GUI绘制来解决了。
问题
  • 在scene模式下编辑产生的数据,进入游戏模式后就全不见了。
  • 改为executeAlways也没用。
  • 我的解决办法是把编辑数据序列化保存到本地。
  • 在OnEnable的时候再读取。
  • 但是我忽然想到,直接把这些数据暴露在Inspector面板上,让unity帮我来序列化不就好了。这样就实现scene和play的数据通用,不会丢失数据了。
  • 第二个事情
  • 就是Scene模式下进行位置判断也很麻烦。因为他没有play模式下的那个相机。
  • 所以我这边是用射线检测来做的。
  • 第三个事情
  • 按键检测也很麻烦。和play模式下不一样
  • 第四事情
  • 按键必须要在合适的时机进行Use,不然事件会传递给unity的工具本身。
  • 下面是所有代码
using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
using System;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEditor.Rendering;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Pool;
using static PieceEditor;
using static UnityEngine.GridBrushBase;//[Serializable]
//class EditContext
//{
//    public int currLayMode;
//    public int currSelectRank;
//    public Vector2 scrollPos;
//    public string levelName;
//    public int mode;
//    public bool isNewFile;
//    public List<string> dataNames = new List<string>();
//    public List<string> levelTools = new List<string>();
//}
[ExecuteInEditMode]
public class SpecialLevelEditor : MonoBehaviour
{public List<Color> pieceColor;public SpriteRenderer SpriteRenderer;public Piece LayItemPrefab;public Transform PoolObj;Dictionary<Vector2Int, Piece> allPieces = new Dictionary<Vector2Int, Piece>();int currWidth => currLevelData.currWidth;int currHeight => currLevelData.currHeight;#region Property[HideInInspector] public int currLayMode;// { get { return editContext.currLayMode; } set { editContext.currLayMode = value; } }[HideInInspector] public int currSelectRank;// { get { return editContext.currSelectRank; } set { editContext.currSelectRank = value; } }[HideInInspector] public int mode;//{ get { return editContext.mode; } set { editContext.mode = value; } }[HideInInspector] public Vector2 scrollPos;// { get { return editContext.scrollPos; } set { editContext.scrollPos = value; } }[HideInInspector] public string levelName;// { get { return editContext.levelName; } set { editContext.levelName = value; } }[HideInInspector] public bool isNewFile;//{ get { return editContext.isNewFile; } set { editContext.isNewFile = value; } }#endregion[HideInInspector] public SpecialLevelData currLevelData;GUILayoutOption widthSetting => GUILayout.Width(120);GUILayoutOption heightSetting => GUILayout.Height(30);//Dictionary<string, path> allData = new Dictionary<string, SpecialLevelData>();List<string> dataNames = new List<string>();//=> editContext.dataNames;List<string> levelTools = new List<string>();//=> editContext.levelTools;private void Start(){}private void OnDestroy(){}// EditContext editContext;private void OnEnable(){SpriteRenderer.enabled = !Application.isPlaying;allPieces.Clear();if (currLevelData != null){var allData = currLevelData.GetComponentsInChildren<Piece>();foreach (var item in allData){allPieces.Add(item.PieceData.LayPos, item);}}dataNames.Clear();levelTools.Clear();ReadAllData(dataNames, "Assets/Resources/ShowLevels");ReadAllData(levelTools, "Assets/Resources/LevelTool");Debug.Log("编辑器启用");SceneView.duringSceneGui += DrawSceneGUI;pool = new ObjectPool<Piece>(CreateFunc, OnGet, OnRelease);}private void OnDisable(){// 移除每帧更新的回调SceneView.duringSceneGui -= DrawSceneGUI;//if(editContext != null)//{//    string projectPath = Application.dataPath;//    string filePath = Path.Combine(projectPath, "TempEditData.txt");//    File.WriteAllText(filePath, JsonUtility.ToJson(editContext));//    editContext = null;//}Debug.Log("禁用编辑器");}string GetPath(string prefabName){return $"Assets/Resources/ShowLevels/{prefabName}.prefab";}string GetToolPath(string prefabName){return $"Assets/Resources/LevelTool/{prefabName}.prefab";}void ReadAllData(List<string> container, string folder){// 目标文件夹路径string folderPath = folder;// 获取文件夹中的所有资源的 GUID(包括子文件夹)string[] guids = AssetDatabase.FindAssets("", new[] { folderPath });// 遍历 GUID,并打印出文件路径和文件名foreach (string guid in guids){// 将 GUID 转换为资源路径string path = AssetDatabase.GUIDToAssetPath(guid);// 获取文件名(通过路径)string fileName = System.IO.Path.GetFileNameWithoutExtension(path);container.Add(fileName);}}void SetColliderSize(){SpriteRenderer.GetComponent<BoxCollider>().size = new Vector3(currWidth, currHeight, 1);}private void DrawSceneGUI(SceneView sceneView){ 通过 Handles 绘制一个按钮Handles.BeginGUI();GUILayout.BeginVertical();DrawFile();DrawLevelData(sceneView);GUILayout.EndVertical();DrawRightBottom(sceneView);DrawRightUp(sceneView);if (mode == 1){Selection.activeObject = null;}Handles.EndGUI();}void DrawLine(){GUI.color = Color.red;GUILayout.Button("", GUILayout.Width(125), GUILayout.Height(5));GUI.color = Color.white;}void InstBorder(int index, Vector3 pos, Vector3 scale){GameObject obj = null;BoxCollider collider = null;if (currLevelData.BoxColliders == null || currLevelData.BoxColliders.Count < index + 1){obj = new GameObject();collider = obj.AddComponent<BoxCollider>();currLevelData.BoxColliders.Add(collider);}else{collider = currLevelData.BoxColliders[index];obj = collider.gameObject;}if (index == 2 || index == 3){obj.tag = UIManager.Ground;}obj.transform.position = pos;obj.transform.localScale = scale;obj.transform.SetParent(currLevelData.transform);}void AddBorder(){InstBorder(0, new Vector3(currWidth / 2f, 0, 0), new Vector3(0.1f, currHeight, 1));InstBorder(1, new Vector3(-currWidth / 2f, 0, 0), new Vector3(0.1f, currHeight, 1));//InstBorder(2, new Vector3(0, currHeight / 2f, 0), new Vector3(currWidth, 0.1f, 1));InstBorder(2, new Vector3(0, -currHeight / 2f, 0), new Vector3(currWidth, 0.1f, 1));}void Save(){if (currLevelData != null){AddBorder();using (ListPool<Vector2Int>.Get(out var keys)){keys.AddRange(allPieces.Keys);foreach (var item in keys){if (allPieces[item] == null){Debug.Log("检测到丢失");allPieces.Remove(item);}}}currLevelData.Pieces.Clear();foreach (var item in allPieces){currLevelData.Pieces.Add(item.Value.PieceData);}ResetPiece();// 将修改应用到预制体(保存实例修改)if (isNewFile){dataNames.Add(levelName);PrefabUtility.SaveAsPrefabAsset(currLevelData.gameObject, GetPath(levelName));}else{PrefabUtility.ApplyPrefabInstance(currLevelData.gameObject, InteractionMode.UserAction);}ClearObj();}}void ClearObj(){//ResetPiece();DestroyImmediate(currLevelData.gameObject);currLevelData = null;levelName = null;allPieces.Clear();}void DrawLevelData(SceneView sceneView){if (currLevelData != null){GUILayout.BeginHorizontal(widthSetting, heightSetting);GUILayout.Button("宽");var val = EditorGUILayout.IntField(currWidth);if (currLevelData.currWidth != val){currLevelData.currWidth = val;ResetPiece();}GUILayout.EndHorizontal();GUILayout.BeginHorizontal(widthSetting, heightSetting);GUILayout.Button("高");var hVal = EditorGUILayout.IntField(currHeight);if (currLevelData.currHeight != hVal){currLevelData.currHeight = hVal;ResetPiece();}GUILayout.EndHorizontal();SetColliderSize();SpriteRenderer.size = new Vector2(currWidth, currHeight);HandleClick(sceneView);foreach (var item in levelTools){if (GUILayout.Button(item, widthSetting, heightSetting)){var obj = PrefabUtility.InstantiatePrefab(AssetDatabase.LoadAssetAtPath<GameObject>(GetToolPath(item))) as GameObject;obj.transform.parent = currLevelData.transform;obj.transform.position = Vector3.zero;Selection.activeGameObject = obj;mode = 0;}}}}public void ResetPiece(){foreach (var item in allPieces){pool.Release(item.Value);}allPieces.Clear();}void DrawFile(){scrollPos = GUILayout.BeginScrollView(scrollPos, widthSetting, GUILayout.Height(200));for (int i = dataNames.Count - 1; i >= 0; i--){var item = dataNames[i];GUILayout.BeginHorizontal();if (currLevelData != null && currLevelData.name == item){GUI.backgroundColor = Color.green;}if (GUILayout.Button(item)){if (currLevelData != null){if (item == currLevelData.name){return;}else{ClearObj();}}levelName = item;isNewFile = false;// 加载预制体并实例化var obj = PrefabUtility.InstantiatePrefab(AssetDatabase.LoadAssetAtPath<GameObject>(GetPath(item))) as GameObject;currLevelData = obj.GetComponent<SpecialLevelData>();var childs = currLevelData.Pieces;foreach (var child in childs){InnerLay(child);}}GUI.backgroundColor = Color.white;if (GUILayout.Button("删除")){// 检查文件是否存在// 删除预制体文件if (item == levelName){ClearObj();}bool success = AssetDatabase.DeleteAsset(GetPath(item));if (success){Debug.Log($"Prefab at {item} deleted successfully.");dataNames.Remove(item);}else{Debug.LogError($"Failed to delete prefab at {item}.");}}GUILayout.EndHorizontal();}GUILayout.EndScrollView();levelName = GUILayout.TextField(levelName, widthSetting, heightSetting);GUILayout.BeginHorizontal(widthSetting, heightSetting);if (GUILayout.Button("新建文件")){if (string.IsNullOrEmpty(levelName)) return;Save();var obj = new GameObject();currLevelData = obj.AddComponent<SpecialLevelData>();obj.name = levelName;isNewFile = true;//            var prefabPath = GetPath(levelName);//#if UNITY_EDITOR//           //#endif}if (GUILayout.Button("保存文件")){Save();}GUILayout.EndHorizontal();}void DrawRightUp(SceneView sceneView){// 动态计算右上角的位置Vector2 windowSize = new Vector2(sceneView.position.width, sceneView.position.height);Vector2 padding = new Vector2(10, 10); // 边距Vector2 size = new Vector2(150, 40 * 9);  // UI 的宽高Rect rect = new Rect(windowSize.x - size.x - padding.x, // X 坐标:窗口宽度 - UI 宽度 - 边距padding.y,                         // Y 坐标:直接使用顶部边距size.x,size.y);// 绘制背景框GUI.Box(rect, GUIContent.none);// 使用 GUILayout 自动布局内部内容GUILayout.BeginArea(rect);GUILayout.Label("数字棋子", EditorStyles.boldLabel);currSelectRank = GUILayout.SelectionGrid(currSelectRank, new string[] { "1", "2", "3", "4", "5", "6", "7", "8", "9" }, 1, GUILayout.Width(120));GUILayout.Space(20);currLayMode = GUILayout.SelectionGrid(currLayMode, new string[] { "正常棋子", "墙壁", "冰封", }, 1, GUILayout.Width(120));GUILayout.EndArea();}public void DestroyItem(Vector2Int pos){//   lineRenderer.gameObject.SetActive(false);//那就进行一个移除var curSlot = allPieces[pos];allPieces.Remove(pos);pool.Release(curSlot);}void InnerLay(PieceData data){var normalize = data.LayPos;if (allPieces.ContainsKey(normalize)){//那就进行一个移除var curSlot = allPieces[normalize];allPieces.Remove(normalize);pool.Release(curSlot);}var obj = pool.Get();obj.transform.SetParent(currLevelData.transform);obj.transform.position = TransferCenterPos(data.LayPos);obj.SetRankEditor(data);allPieces.Add(data.LayPos, obj);}public void SpecialLay(PieceData data){switch ((LayMode)currLayMode){case LayMode.NormalPiece:if (currSelectRank == null) return;data.PieceType = PieceType.Piece;InnerLay(data);break;case LayMode.Wall:data.PieceType = PieceType.Wall;InnerLay(data);break;case LayMode.Ice://如果是冰就要先判断是否存在棋子,如果有棋子就赋予其状态。if (allPieces.ContainsKey(data.LayPos)){var piece = allPieces[data.LayPos];if (piece.PieceData.PieceType != PieceType.Wall){allPieces[data.LayPos].SetIceState();}}break;default:break;}}#region 对象池ObjectPool<Piece> pool;Piece CreateFunc(){var obj = GameObject.Instantiate<Piece>(LayItemPrefab, PoolObj);return obj;}void OnRelease(Piece obj){obj.transform.parent = PoolObj;obj.gameObject.SetActive(false);}void OnGet(Piece obj){obj.gameObject.SetActive(true);}#endregionpublic bool Transfer(Vector2 clickPos, out Vector2Int normalize){normalize = Vector2Int.zero;var originPosX = -(float)currWidth / 2;var originPosY = -(float)currHeight / 2;var localPos = SpriteRenderer.transform.InverseTransformPoint(clickPos);var offsetX = localPos.x - originPosX;var offsetY = localPos.y - originPosY;//获得相对于左下角的坐标之后再来进行判断var cellX = Mathf.FloorToInt(offsetX);var cellY = Mathf.FloorToInt(offsetY);var realX = cellX + 0.5f;var realY = cellY + 0.5f;if (cellX >= currWidth || cellX < 0) { return false; }if (cellY >= currHeight || cellY < 0) { return false; }normalize = new Vector2Int(cellX, cellY);return true;}public Vector3 TransferCenterPos(Vector2Int centerPos){var originPosX = -(float)currWidth / 2;var originPosY = -(float)currHeight / 2;var realX = centerPos.x + 0.5f;var realY = centerPos.y + 0.5f;// Debug.Log($"{realX}_{realY}");var temp = new Vector2(realX + originPosX, realY + originPosY);//判断完成之后再转回世界坐标var pos = SpriteRenderer.transform.TransformPoint(temp);return pos;}void DrawRightBottom(SceneView sceneView){// 计算 UI 的位置(右下角)int width = 120; // UI 宽度int height = 180; // UI 高度int padding = 20; // 边距Rect rect = new Rect(sceneView.position.width - width - padding,sceneView.position.height - height - padding,width,height);// 绘制背景框GUI.Box(rect, GUIContent.none);// 绘制内容GUILayout.BeginArea(rect);GUILayout.Label("模式转换", EditorStyles.boldLabel);var val = GUILayout.SelectionGrid(mode, new string[] { "自由模式", "棋子模式", }, 1, widthSetting, GUILayout.Height(60));mode = val;if (GUILayout.Button("清空棋盘")){ClearObj();}// DrawSpecialTool();GUILayout.EndArea();}private void HandleClick(SceneView sceneView){if (mode != 1) return;Event e = Event.current;if (e.type == EventType.MouseDown && e.button == 0) // 左键点击{// 获取鼠标点击的屏幕坐标,转换为世界空间中的射线Ray ray = HandleUtility.GUIPointToWorldRay(e.mousePosition);RaycastHit hit;// 使用射线检测场景中的物体if (Physics.Raycast(ray, out hit)){if (hit.collider.gameObject != SpriteRenderer.gameObject) { return; }// 打印点击的位置(世界空间坐标)Debug.Log("Clicked on object at position: " + hit.point);if (Transfer(hit.point, out var normalize)){var data = new PieceData() { LayPos = normalize, Rank = currSelectRank + 1 };SpecialLay(data);Selection.activeGameObject = null;e.Use();}}else{Debug.Log("No hit detected.");}}if (e.type == EventType.MouseDown && e.button == 1) // 左键点击{// 获取鼠标点击的屏幕坐标,转换为世界空间中的射线Ray ray = HandleUtility.GUIPointToWorldRay(e.mousePosition);RaycastHit hit;// 使用射线检测场景中的物体if (Physics.Raycast(ray, out hit)){if (hit.collider.gameObject == SpriteRenderer.gameObject){// 打印点击的位置(世界空间坐标)Debug.Log("Clicked on object at position: " + hit.point);if (Transfer(hit.point, out var normalize)){if (allPieces.ContainsKey(normalize)){DestroyItem(normalize);e.Use();}}}}else{Debug.Log("No hit detected.");}}}
}

相关文章:

在Scene里面绘制编辑工具

功能要求 策划要在scene模式下编辑棋子摆放。用handle.GUI绘制来解决了。 问题 在scene模式下编辑产生的数据&#xff0c;进入游戏模式后就全不见了。改为executeAlways也没用。我的解决办法是把编辑数据序列化保存到本地。在OnEnable的时候再读取。但是我忽然想到&#xff…...

UbuntuWindows双系统安装

做系统盘&#xff1a; Ubuntu20.04双系统安装详解&#xff08;内容详细&#xff0c;一文通关&#xff01;&#xff09;_ubuntu 20.04-CSDN博客 ubuntu系统调整大小&#xff1a; 调整指南&#xff1a; 虚拟机中的Ubuntu扩容及重新分区方法_ubuntu重新分配磁盘空间-CSDN博客 …...

[Linux]如何將腳本(shell script)轉換到系統管理服務器(systemd service)來運行?

[InfluxDB]Monitor Tem. and Volt of RaspberryPi and Send Message by Line Notify 在Linux中&#xff0c;shell腳本(shell script)常用於運行各種自動化的流程&#xff0c;包含API串接&#xff0c;設置和啟動應用服務等等&#xff0c;腳本語法也相對易學易讀&#xff0c;因此…...

【leetcode详解】T598 区间加法

598. 区间加法 II - 力扣&#xff08;LeetCode&#xff09; 思路分析 核心在于将问题转化&#xff0c; 题目不是要求最大整数本身&#xff0c;而是要求解最大整数的个数 结合矩阵元素的增加原理&#xff0c;我们将抽象问题转为可操作的方法&#xff0c;其实就是再找每组ops中…...

分层多维度应急管理系统的设计

一、系统总体架构设计 1. 六层体系架构 #mermaid-svg-QOXtM1MnbrwUopPb {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-QOXtM1MnbrwUopPb .error-icon{fill:#552222;}#mermaid-svg-QOXtM1MnbrwUopPb .error-text{f…...

稀疏进化训练:机器学习优化算法中的高效解决方案

稀疏进化训练&#xff1a;机器学习优化算法中的高效解决方案 稀疏进化训练&#xff1a;机器学习优化算法中的高效解决方案引言第一部分&#xff1a;背景与动机1.1 传统优化算法的局限性1.2 进化策略的优势1.3 稀疏性的重要性 第二部分&#xff1a;稀疏进化训练的核心思想2.1 稀…...

实战:如何利用网站日志诊断并解决收录问题?

本文转自&#xff1a;百万收录网 原文链接&#xff1a;https://www.baiwanshoulu.com/50.html 利用网站日志诊断并解决收录问题是一种非常有效的方法。以下是一个实战指南&#xff0c;帮助你如何利用网站日志来诊断并解决网站的收录问题&#xff1a; 一、获取并分析网站日志 …...

群晖搭建Gitea教程(使用系统自带的postgresql)

基于群晖7.2.2&#xff0c;使用套件中心的gitea&#xff0c;和系统自带的postgresql postgresql: 切换到postgres用户 sudo -I -u postgres 在想要保存数据库的磁盘路径下创建PostgreSql文件夹 初始化数据库文件夹配置 initdb -D ./PostgreSql 备份./PostgreSql路径下的post…...

备考蓝桥杯嵌入式2:使用LCD完成显示

LCD LCD&#xff08;液晶显示器&#xff0c;Liquid Crystal Display&#xff09;是一种常见的平面显示技术&#xff0c;广泛应用于电视、电脑显示器、手机屏幕等设备。蓝桥杯中&#xff0c;也有涉及到使用LCD来完成字符串显示的要求和操作。 考场上会给予LCD的驱动包&#xf…...

网络爬虫学习:应用selenium获取Edge浏览器版本号,自动下载对应版本msedgedriver,确保Edge浏览器顺利打开。

一、前言 我从24年11月份开始学习网络爬虫应用开发&#xff0c;经过2个来月的努力&#xff0c;于1月下旬完成了开发一款网络爬虫软件的学习目标。这里对本次学习及应用开发进行一下回顾总结。 前几天我已经发了一篇日志&#xff08;网络爬虫学习&#xff1a;应用selenium从搜…...

Elasticsearch的索引生命周期管理

目录 说明零、参考一、ILM的基本概念二、ILM的实践步骤Elasticsearch ILM策略中的“最小年龄”是如何计算的&#xff1f;如何监控和调整Elasticsearch ILM策略的性能&#xff1f; 1. **监控性能**使用/_cat/thread_pool API基本请求格式请求特定线程池的信息响应内容 2. **调整…...

Observability:实现 OpenTelemetry 原生可观察性的商业价值

作者&#xff1a;来自 Elastic David Hope 利用开放标准和简化的数据收集转变组织的可观察性策略。 现代组织面临着前所未有的可观察性挑战。随着系统变得越来越复杂和分散&#xff0c;传统的监控方法难以跟上步伐。由于数据量每两年翻一番&#xff0c;系统跨越多个云和技术&am…...

C语言中的线程本地变量

这处线程本地变量可不是简单的函数中的本地变量。线程除了可以共享存在于进程内的全局变量外&#xff0c;还可以有属于自己的线程本地变量。线程本地变量的值只能够在某个具体线程的生存期内可用。变量的实际存储空间会在线程开始时分配&#xff0c;线程结束时回收。线程不会对…...

Zabbix 推送告警 消息模板 美化(钉钉Webhook机器人、邮件)

目前网络上已经有很多关于Zabbix如何推送告警信息到钉钉机器人、到邮件等文章。 但是在搜索下来&#xff0c;发现缺少了对告警信息的美化的文章。 本文不赘述如何对Zabbix对接钉钉、对接邮件&#xff0c;仅介绍我采用的美化消息模板的内容。 活用AI工具可以减轻很多学习、脑力负…...

罗格斯大学:通过输入嵌入对齐选择agent

&#x1f4d6;标题&#xff1a;AgentRec: Agent Recommendation Using Sentence Embeddings Aligned to Human Feedback &#x1f310;来源&#xff1a;arXiv, 2501.13333 &#x1f31f;摘要 &#x1f538;多代理系统必须决定哪个代理最适合给定的任务。我们提出了一种新的架…...

机器学习7-全连接神经网络3-过拟合与超参数

机器学习6-全连接神经网络3-过拟合欠拟合 过拟合应对过拟合-最优方案&#xff1a;获取更多的训练数据应对过拟合-次优方案&#xff1a;正则化应对过拟合-次优方案2&#xff1a;随机失活综合考量 超参数超参数优化方法 过拟合 机器学习的根本问题是优化和泛化的问题。优化——是…...

【PyTorch】7.自动微分模块:开启神经网络 “进化之门” 的魔法钥匙

目录 1. 梯度基本计算 2. 控制梯度计算 3. 梯度计算注意 4. 小节 个人主页&#xff1a;Icomi 专栏地址&#xff1a;PyTorch入门 在深度学习蓬勃发展的当下&#xff0c;PyTorch 是不可或缺的工具。它作为强大的深度学习框架&#xff0c;为构建和训练神经网络提供了高效且灵活…...

11 3D变换模块(transform3d.rs)

transform3d.rs代码定义了一个名为 Transform3D 的 Rust 结构体&#xff0c;它用于表示一个3D变换矩阵。这个结构体是泛型的&#xff0c;包含三个类型参数&#xff1a;T、Src 和 Dst。其中&#xff0c;T 用于矩阵元素的数据类型&#xff0c;Src 和 Dst 用于表示变换的源和目标类…...

MATLAB基础应用精讲-【数模应用】梯度直方图(HOG)(附C++和python代码实现)(二)

目录 前言 几个高频面试题目 HOG与SIFT区别 边缘特征与梯度方向直方图的关系 算法原理 什么是HOG 图像中像素点的梯度计算 为每个cell构造梯度方向直方图HOG 数学模型 方向梯度直方图计算步骤 第一步:预处理 第二步:计算梯度图像 第三步:在8*8的网格中计算梯度…...

pytorch生成对抗网络

人工智能例子汇总&#xff1a;AI常见的算法和例子-CSDN博客 生成对抗网络&#xff08;GAN&#xff0c;Generative Adversarial Network&#xff09;是一种深度学习模型&#xff0c;由两个神经网络组成&#xff1a;生成器&#xff08;Generator&#xff09;和判别器&#xff0…...

Baklib在企业知识管理领域的领先地位与三款竞品的深度剖析

内容概要 在现代企业中&#xff0c;知识管理已成为提高工作效率和推动创新的重要手段。Baklib作为一款领先的知识中台&#xff0c;以其集成化和智能化的特性&#xff0c;帮助企业在这一领域取得了显著成就。该平台具备强大的知识收集、整理、存储和共享功能&#xff0c;通过构…...

2 MapReduce

2 MapReduce 1. MapReduce 介绍1.1 MapReduce 设计构思 2. MapReduce 编程规范3. Mapper以及Reducer抽象类介绍1.Mapper抽象类的基本介绍2.Reducer抽象类基本介绍 4. WordCount示例编写5. MapReduce程序运行模式6. MapReduce的运行机制详解6.1 MapTask 工作机制6.2 ReduceTask …...

人工智能学习(四)之机器学习基本概念

机器学习基本概念详细解析&#xff1a;从生活实例轻松入门 在当今数字化时代&#xff0c;机器学习作为人工智能领域的核心技术之一&#xff0c;正深刻地改变着我们的生活和工作方式。从智能语音助手到图像识别系统&#xff0c;从个性化推荐引擎到自动驾驶汽车&#xff0c;机器…...

大模型openai范式接口调用方法

本文将介绍如下内容&#xff1a; 一、为什么选择 OpenAI 范式接口&#xff1f;二、调用 Openai 接口官方调用 Demo 示例三、自定义调用 Openai 接口 一、为什么选择 OpenAI 范式接口&#xff1f; OpenAI 范式接口因其简洁、统一和高效的设计&#xff0c;成为了与大型语言模型…...

DeepSeek API接口中的openAI是什么意思?

老六哥的小提示&#xff1a;我们可能不会被AI轻易淘汰&#xff0c;但是会被“会使用AI的人”淘汰。 DeepSeek是一款基于先进推理技术的大型语言模型&#xff0c;能够根据用户提供的简洁提示词生成高质 曾经有外媒评价说&#xff1a;DeepSeek盗用了openAI的技术&#xff0c;或者…...

重构字符串(767)

767. 重构字符串 - 力扣&#xff08;LeetCode&#xff09; 解法&#xff1a; class Solution { public:string reorganizeString(string s){string res;//因为1 < s.length < 500 &#xff0c; uint64_t 类型足够uint16_t n s.size();if (n 0) {return res;}unordere…...

测压表压力表计量表针头针尾检测数据集VOC+YOLO格式4862张4类别

数据集格式&#xff1a;Pascal VOC格式YOLO格式(不包含分割路径的txt文件&#xff0c;仅仅包含jpg图片以及对应的VOC格式xml文件和yolo格式txt文件) 图片数量(jpg文件个数)&#xff1a;4862 标注数量(xml文件个数)&#xff1a;4862 标注数量(txt文件个数)&#xff1a;4862 …...

【C++语言】卡码网语言基础课系列----12. 位置互换

文章目录 练习题目位置互换具体代码实现 小白寄语诗词共勉 练习题目 位置互换 题目描述&#xff1a; 给定一个长度为偶数位的字符串&#xff0c;请编程实现字符串的奇偶位互换。 输入描述&#xff1a; 输入包含多组测试数据。 输入的第一行是一个整数n&#xff0c;表示有测试…...

[权限提升] Windows 提权 维持 — 系统错误配置提权 - PATH 环境变量提权

关注这个专栏的其他相关笔记:[内网安全] 内网渗透 - 学习手册-CSDN博客 0x01:PATH 环境变量提权原理 在 Windows 操作系统中,Path 环境变量是一个包含多个目录路径的列表,系统通过这些路径来查找可执行文件(如 .exe、.bat 等)。当你在命令提示符或运行对话框中输入命令时…...

吴恩达深度学习——优化神经网络

本文来自https://www.bilibili.com/video/BV1FT4y1E74V&#xff0c;仅为本人学习所用。 文章目录 优化样本大小mini-batch 优化梯度下降法动量梯度下降法指数加权平均概念偏差纠正 动量梯度下降法 RMSpropAdam优化算法 优化学习率局部最优问题&#xff08;了解&#xff09; 优…...