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

Unity3D仿星露谷物语开发36之锄地动画2

1、目标

当角色锄地之后,地面会显示开垦后的样貌。

2、思路

上一篇中,虽然角色dig了hoe,同时grid属性也改变了,但是没有任何可视化的反馈。我们现在将添加新的功能,动态地将"dug ground"瓷砖添加到"GroundDecoration1"的tilemap上。

将使用如下的tileset进行绘制。

为了设置正确的dug ground tile,我们需要检查下周边的tiles是否被dug,此时存在16种组合方式。

第1、2种组合方式:

第3、4种组合方式:

第5、6种组合方式:

第7、8种组合方式:

第9、10种组合方式:

第11、12种组合方式:

第13、14种组合方式:

第15、16种组合方式:

连接周边grid的情况:

我们将增加"dug ground" tiles到GroundDecoration1 tilemaps。我们将标记GroundDecoration1和GroundDecoration2 tilemap层,以便可以快速定位到他们,这些标记放到Tag.cs脚本中。

修改GridPropertiesManager.cs脚本如下:

修改Player.cs脚本

3、修改Tag.cs脚本

public static class Tags
{public const string BoundsConfiner = "BoundsConfiner";public const string ItemsParentTransform = "ItemsParentTransform";public const string GroundDecoration1 = "GroundDecoration1";public const string GroundDecoration2 = "GroundDecoration2";
}

添加了下面的2个静态变量。

4、修改GridPropertiesManager.cs脚本

// 修改public为private
private Grid grid;// 添加变量
private Tilemap groundDecoration1;
private Tilemap groundDecoration2;
[SerializeField] private Tile[] dugGround = null;// 添加函数private void ClearDisplayGroundDecorations(){// Remove ground decorationsgroundDecoration1.ClearAllTiles();groundDecoration2.ClearAllTiles();}private void ClearDisplayGridPropertyDetails(){ClearDisplayGroundDecorations();}private void ConnectDugGround(GridPropertyDetails gridPropertyDetails)
{// Select tile based on surrounding dug tilesTile dugTile0 = SetDugTile(gridPropertyDetails.gridX, gridPropertyDetails.gridY);groundDecoration1.SetTile(new Vector3Int(gridPropertyDetails.gridX, gridPropertyDetails.gridY, 0), dugTile0);// Set 4 tiles if dug surrounding current tile - up, down, left, right now that this central tile has been dugGridPropertyDetails adjacentGridPropertyDetails;adjacentGridPropertyDetails = GetGridPropertyDetails(gridPropertyDetails.gridX, gridPropertyDetails.gridY + 1);if(adjacentGridPropertyDetails != null && adjacentGridPropertyDetails.daysSinceDug > -1){Tile dugTile1 = SetDugTile(gridPropertyDetails.gridX, gridPropertyDetails.gridY + 1);groundDecoration1.SetTile(new Vector3Int(gridPropertyDetails.gridX, gridPropertyDetails.gridY + 1, 0), dugTile1);}adjacentGridPropertyDetails = GetGridPropertyDetails(gridPropertyDetails.gridX, gridPropertyDetails.gridY - 1);if (adjacentGridPropertyDetails != null && adjacentGridPropertyDetails.daysSinceDug > -1){Tile dugTile2 = SetDugTile(gridPropertyDetails.gridX, gridPropertyDetails.gridY - 1);groundDecoration1.SetTile(new Vector3Int(gridPropertyDetails.gridX, gridPropertyDetails.gridY - 1, 0), dugTile2);}adjacentGridPropertyDetails = GetGridPropertyDetails(gridPropertyDetails.gridX - 1, gridPropertyDetails.gridY);if (adjacentGridPropertyDetails != null && adjacentGridPropertyDetails.daysSinceDug > -1){Tile dugTile3 = SetDugTile(gridPropertyDetails.gridX - 1, gridPropertyDetails.gridY);groundDecoration1.SetTile(new Vector3Int(gridPropertyDetails.gridX - 1, gridPropertyDetails.gridY, 0), dugTile3);}adjacentGridPropertyDetails = GetGridPropertyDetails(gridPropertyDetails.gridX + 1, gridPropertyDetails.gridY);if (adjacentGridPropertyDetails != null && adjacentGridPropertyDetails.daysSinceDug > -1){Tile dugTile4 = SetDugTile(gridPropertyDetails.gridX + 1, gridPropertyDetails.gridY);groundDecoration1.SetTile(new Vector3Int(gridPropertyDetails.gridX + 1, gridPropertyDetails.gridY, 0), dugTile4);}
}private Tile SetDugTile(int xGrid, int yGrid)
{// Get whether surrounding tiles(up,down,left,right) are dug or notbool upDug = IsGridSquareDug(xGrid, yGrid + 1);bool downDug = IsGridSquareDug(xGrid, yGrid - 1);bool leftDug = IsGridSquareDug(xGrid - 1, yGrid);bool rightDug = IsGridSquareDug(xGrid + 1, yGrid);#region Set appropriate tile based on whether surrounding tiles are dug or notif(!upDug && !downDug &&  !rightDug && !leftDug){return dugGround[0];}else if(!upDug && downDug && rightDug && !leftDug){return dugGround[1];}else if(!upDug && downDug && rightDug && leftDug){return dugGround[2];}else if(!upDug && downDug && !rightDug && leftDug){return dugGround[3];}else if(!upDug && downDug && !rightDug && !leftDug){return dugGround[4];}else if(upDug && downDug && rightDug && !leftDug){return dugGround[5];}else if(upDug && downDug && rightDug && leftDug){return dugGround[6];}else if(upDug && downDug && !rightDug && leftDug){return dugGround[7];}else if(upDug && downDug && !rightDug && !leftDug){return dugGround[8];}else if(upDug && !downDug && rightDug && !leftDug){return dugGround[9];}else if(upDug && !downDug && rightDug && leftDug){return dugGround[10];}else if(upDug && !downDug && !rightDug && leftDug){return dugGround[11];}else if(upDug && !downDug && !rightDug && !leftDug){return dugGround[12];}else if(!upDug && !downDug && rightDug && !leftDug){return dugGround[13];}else if(!upDug && !downDug && rightDug && leftDug){return dugGround[14];}else if(!upDug && !downDug && !rightDug && leftDug){return dugGround[15];}return null;#endregion Set appropriate tile based on whether surrounding tiles are dug or not}private bool IsGridSquareDug(int xGrid, int yGrid)
{GridPropertyDetails gridPropertyDetails = GetGridPropertyDetails(xGrid, yGrid);if(gridPropertyDetails == null){return false;}else if(gridPropertyDetails.daysSinceDug > -1){return true;}else{return false;}
}private void DisplayGridPropertyDetails()
{// Loop throught all grid itemsforeach(KeyValuePair<string, GridPropertyDetails> item in gridPropertyDictionary){GridPropertyDetails gridPropertyDetails = item.Value;DisplayDugGround(gridPropertyDetails);}
}// 优化ISaveableRestoreScene函数public void ISaveableRestoreScene(string sceneName){// Get sceneSave for scene - it exists since we created it in initialiseif(GameObjectSave.sceneData.TryGetValue(sceneName, out SceneSave sceneSave)){// get grid property details dictionary - it exists since we created it in initialiseif(sceneSave.gridPropertyDetailsDictionary != null){gridPropertyDictionary = sceneSave.gridPropertyDetailsDictionary;}// If grid properties existif(gridPropertyDictionary.Count > 0){// grid property details found for the current scene destroy existing ground decorationClearDisplayGridPropertyDetails();// Instantiate grid property details for current sceneDisplayGridPropertyDetails();}}}// 优化AfterSceneLoaded函数
private void AfterSceneLoaded()
{// Get Gridgrid = GameObject.FindObjectOfType<Grid>();// Get tilemapsgroundDecoration1 = GameObject.FindGameObjectWithTag(Tags.GroundDecoration1).GetComponent<Tilemap>();groundDecoration2 = GameObject.FindGameObjectWithTag(Tags.GroundDecoration2).GetComponent<Tilemap>();
}

完整的代码如下:

using System.Collections;
using System.Collections.Generic;
using JetBrains.Annotations;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.Tilemaps;[RequireComponent(typeof(GenerateGUID))]
public class GridPropertiesManager : SingletonMonobehaviour<GridPropertiesManager>, ISaveable
{private Tilemap groundDecoration1;private Tilemap groundDecoration2;private Grid grid;private Dictionary<string, GridPropertyDetails> gridPropertyDictionary;[SerializeField] private SO_GridProperties[] so_gridPropertiesArray = null;[SerializeField] private Tile[] dugGround = null;private string _iSaveableUniqueID;private GameObjectSave _gameObjectSave;public string ISaveableUniqueID { get { return _iSaveableUniqueID; } set { _iSaveableUniqueID = value; } }public GameObjectSave GameObjectSave { get { return _gameObjectSave; } set { _gameObjectSave = value; } }protected override void Awake(){base.Awake();ISaveableUniqueID = GetComponent<GenerateGUID>().GUID;GameObjectSave = new GameObjectSave();}private void OnEnable(){ISaveableRegister();EventHandler.AfterSceneLoadEvent += AfterSceneLoaded;}private void OnDisable() {ISaveableDeregister();EventHandler.AfterSceneLoadEvent -= AfterSceneLoaded;}private void AfterSceneLoaded(){// Get Gridgrid = GameObject.FindObjectOfType<Grid>();// Get tilemapsgroundDecoration1 = GameObject.FindGameObjectWithTag(Tags.GroundDecoration1).GetComponent<Tilemap>();groundDecoration2 = GameObject.FindGameObjectWithTag(Tags.GroundDecoration2).GetComponent<Tilemap>();}public void ISaveableDeregister(){SaveLoadManager.Instance.iSaveableObjectList.Remove(this);}public void ISaveableRegister(){SaveLoadManager.Instance.iSaveableObjectList.Add(this);}public void ISaveableRestoreScene(string sceneName){// Get sceneSave for scene - it exists since we created it in initialiseif(GameObjectSave.sceneData.TryGetValue(sceneName, out SceneSave sceneSave)){// get grid property details dictionary - it exists since we created it in initialiseif(sceneSave.gridPropertyDetailsDictionary != null){gridPropertyDictionary = sceneSave.gridPropertyDetailsDictionary;}// If grid properties existif(gridPropertyDictionary.Count > 0){// grid property details found for the current scene destroy existing ground decorationClearDisplayGridPropertyDetails();// Instantiate grid property details for current sceneDisplayGridPropertyDetails();}}}public void ISaveableStoreScene(string sceneName){// Remove sceneSave for sceneGameObjectSave.sceneData.Remove(sceneName);// Create sceneSave for sceneSceneSave sceneSave = new SceneSave();// create & add dict grid property details dictionarysceneSave.gridPropertyDetailsDictionary = gridPropertyDictionary;// Add scene save to game object scene dataGameObjectSave.sceneData.Add(sceneName, sceneSave);}private void Start(){InitialiseGridProperties();}private void ClearDisplayGroundDecorations(){// Remove ground decorationsgroundDecoration1.ClearAllTiles();groundDecoration2.ClearAllTiles();}private void ClearDisplayGridPropertyDetails(){ClearDisplayGroundDecorations();}public void DisplayDugGround(GridPropertyDetails gridPropertyDetails){// Dugif(gridPropertyDetails.daysSinceDug > -1){ConnectDugGround(gridPropertyDetails);}}private void ConnectDugGround(GridPropertyDetails gridPropertyDetails){// Select tile based on surrounding dug tilesTile dugTile0 = SetDugTile(gridPropertyDetails.gridX, gridPropertyDetails.gridY);groundDecoration1.SetTile(new Vector3Int(gridPropertyDetails.gridX, gridPropertyDetails.gridY, 0), dugTile0);// Set 4 tiles if dug surrounding current tile - up, down, left, right now that this central tile has been dugGridPropertyDetails adjacentGridPropertyDetails;adjacentGridPropertyDetails = GetGridPropertyDetails(gridPropertyDetails.gridX, gridPropertyDetails.gridY + 1);if(adjacentGridPropertyDetails != null && adjacentGridPropertyDetails.daysSinceDug > -1){Tile dugTile1 = SetDugTile(gridPropertyDetails.gridX, gridPropertyDetails.gridY + 1);groundDecoration1.SetTile(new Vector3Int(gridPropertyDetails.gridX, gridPropertyDetails.gridY + 1, 0), dugTile1);}adjacentGridPropertyDetails = GetGridPropertyDetails(gridPropertyDetails.gridX, gridPropertyDetails.gridY - 1);if (adjacentGridPropertyDetails != null && adjacentGridPropertyDetails.daysSinceDug > -1){Tile dugTile2 = SetDugTile(gridPropertyDetails.gridX, gridPropertyDetails.gridY - 1);groundDecoration1.SetTile(new Vector3Int(gridPropertyDetails.gridX, gridPropertyDetails.gridY - 1, 0), dugTile2);}adjacentGridPropertyDetails = GetGridPropertyDetails(gridPropertyDetails.gridX - 1, gridPropertyDetails.gridY);if (adjacentGridPropertyDetails != null && adjacentGridPropertyDetails.daysSinceDug > -1){Tile dugTile3 = SetDugTile(gridPropertyDetails.gridX - 1, gridPropertyDetails.gridY);groundDecoration1.SetTile(new Vector3Int(gridPropertyDetails.gridX - 1, gridPropertyDetails.gridY, 0), dugTile3);}adjacentGridPropertyDetails = GetGridPropertyDetails(gridPropertyDetails.gridX + 1, gridPropertyDetails.gridY);if (adjacentGridPropertyDetails != null && adjacentGridPropertyDetails.daysSinceDug > -1){Tile dugTile4 = SetDugTile(gridPropertyDetails.gridX + 1, gridPropertyDetails.gridY);groundDecoration1.SetTile(new Vector3Int(gridPropertyDetails.gridX + 1, gridPropertyDetails.gridY, 0), dugTile4);}}private Tile SetDugTile(int xGrid, int yGrid){// Get whether surrounding tiles(up,down,left,right) are dug or notbool upDug = IsGridSquareDug(xGrid, yGrid + 1);bool downDug = IsGridSquareDug(xGrid, yGrid - 1);bool leftDug = IsGridSquareDug(xGrid - 1, yGrid);bool rightDug = IsGridSquareDug(xGrid + 1, yGrid);#region Set appropriate tile based on whether surrounding tiles are dug or notif(!upDug && !downDug &&  !rightDug && !leftDug){return dugGround[0];}else if(!upDug && downDug && rightDug && !leftDug){return dugGround[1];}else if(!upDug && downDug && rightDug && leftDug){return dugGround[2];}else if(!upDug && downDug && !rightDug && leftDug){return dugGround[3];}else if(!upDug && downDug && !rightDug && !leftDug){return dugGround[4];}else if(upDug && downDug && rightDug && !leftDug){return dugGround[5];}else if(upDug && downDug && rightDug && leftDug){return dugGround[6];}else if(upDug && downDug && !rightDug && leftDug){return dugGround[7];}else if(upDug && downDug && !rightDug && !leftDug){return dugGround[8];}else if(upDug && !downDug && rightDug && !leftDug){return dugGround[9];}else if(upDug && !downDug && rightDug && leftDug){return dugGround[10];}else if(upDug && !downDug && !rightDug && leftDug){return dugGround[11];}else if(upDug && !downDug && !rightDug && !leftDug){return dugGround[12];}else if(!upDug && !downDug && rightDug && !leftDug){return dugGround[13];}else if(!upDug && !downDug && rightDug && leftDug){return dugGround[14];}else if(!upDug && !downDug && !rightDug && leftDug){return dugGround[15];}return null;#endregion Set appropriate tile based on whether surrounding tiles are dug or not}private bool IsGridSquareDug(int xGrid, int yGrid){GridPropertyDetails gridPropertyDetails = GetGridPropertyDetails(xGrid, yGrid);if(gridPropertyDetails == null){return false;}else if(gridPropertyDetails.daysSinceDug > -1){return true;}else{return false;}}private void DisplayGridPropertyDetails(){// Loop throught all grid itemsforeach(KeyValuePair<string, GridPropertyDetails> item in gridPropertyDictionary){GridPropertyDetails gridPropertyDetails = item.Value;DisplayDugGround(gridPropertyDetails);}}/// <summary>/// This initialises the grid property dictionary with the values from the SO_GridProperties assets and stores the values for each scene in/// GameObjectSave sceneData/// </summary>private void InitialiseGridProperties(){// loop through all gridproperties in the arrayforeach(SO_GridProperties so_GridProperties in so_gridPropertiesArray){// Create dictionary of grid property detailsDictionary<string, GridPropertyDetails> gridPropertyDictionary = new Dictionary<string, GridPropertyDetails>();// Populate grid property dictionary - Iterate through all the grid properties in the so gridproperties listforeach(GridProperty gridProperty in so_GridProperties.gridPropertyList){GridPropertyDetails gridPropertyDetails;gridPropertyDetails = GetGridPropertyDetails(gridProperty.gridCoordinate.x, gridProperty.gridCoordinate.y, gridPropertyDictionary);if(gridPropertyDetails == null){gridPropertyDetails = new GridPropertyDetails();}switch (gridProperty.gridBoolProperty){case GridBoolProperty.diggable:gridPropertyDetails.isDiggable = gridProperty.gridBoolValue;break;case GridBoolProperty.canDropItem:gridPropertyDetails.canDropItem = gridProperty.gridBoolValue;break;case GridBoolProperty.canPlaceFurniture:gridPropertyDetails.canPlaceFurniture = gridProperty.gridBoolValue;break;case GridBoolProperty.isPath:gridPropertyDetails.isPath = gridProperty.gridBoolValue;break;case GridBoolProperty.isNPCObstacle:gridPropertyDetails.isNPCObstacle = gridProperty.gridBoolValue;break;default:break; }SetGridPropertyDetails(gridProperty.gridCoordinate.x, gridProperty.gridCoordinate.y, gridPropertyDetails, gridPropertyDictionary);}// Create scene save for this gameobjectSceneSave sceneSave = new SceneSave();// Add grid property dictionary to scene save datasceneSave.gridPropertyDetailsDictionary = gridPropertyDictionary;// If starting scene set the griProertyDictionary member variable to the current iterationif(so_GridProperties.sceneName.ToString() == SceneControllerManager.Instance.startingSceneName.ToString()){this.gridPropertyDictionary = gridPropertyDictionary;}// Add scene save to game object scene dataGameObjectSave.sceneData.Add(so_GridProperties.sceneName.ToString(), sceneSave);}}/// <summary>/// Returns the gridPropertyDetails at the gridlocation fro the supplied dictionary,/// or null if no properties exist at that location/// </summary>/// <param name="gridX"></param>/// <param name="gridY"></param>/// <param name="gridPropertyDictionary"></param>/// <returns></returns>public GridPropertyDetails GetGridPropertyDetails(int gridX, int gridY, Dictionary<string, GridPropertyDetails> gridPropertyDictionary){// Construct key from coordinatestring key = "x" + gridX + "y" + gridY;GridPropertyDetails gridPropertyDetails;// Check if grid property details exist for coordinate and retrieveif (!gridPropertyDictionary.TryGetValue(key, out gridPropertyDetails)){// if not foundreturn null;}else{return gridPropertyDetails;}}public GridPropertyDetails GetGridPropertyDetails(int gridX, int gridY){return GetGridPropertyDetails(gridX, gridY, gridPropertyDictionary);}/// <summary>/// Set the grid property details to gridPropertyDetails fro the tile at (gridX, gridY) for current scene/// </summary>/// <param name="gridX"></param>/// <param name="gridY"></param>/// <param name="gridPropertyDetails"></param>public void SetGridPropertyDetails(int gridX, int gridY, GridPropertyDetails gridPropertyDetails){SetGridPropertyDetails(gridX, gridY, gridPropertyDetails, gridPropertyDictionary);}/// <summary>/// Set the grid property details to gridPropertyDetails for the title at (gridX, gridY) for the gridPropertyDictionary./// </summary>/// <param name="gridX"></param>/// <param name="gridY"></param>/// <param name="gridPropertyDetails"></param>/// <param name="gridPropertyDictionary"></param>public void SetGridPropertyDetails(int gridX, int gridY, GridPropertyDetails gridPropertyDetails, Dictionary<string, GridPropertyDetails> gridPropertyDictionary){// Construct key from coordinatestring key = "x" + gridX + "y" + gridY;gridPropertyDetails.gridX = gridX;gridPropertyDetails.gridY = gridY;// Set value gridPropertyDictionary[key] = gridPropertyDetails;}}

5、修改Player.cs脚本

在HoeGroundAtCursorRoutine函数中添加如下代码:

6、设置绘图

(1)创建新的Palette

Create New Palette,并且命名为DugGround,保存到Assets -> Tilemap -> Tile Palettes下。

(2)创建新的Tiles

在Assets -> Sprites -> Sprite Textures -> Tile Sprites 下找到DugGround.

将DugGround拖到右边的Palette中,弹出的目录选择Assets -> Tilemap -> Tiles,创建新的目录Dug Ground,保存到该目录下。

左边灰色为Dug后的grid图案,右边银色为Water之后的grid图案。

7、配置Tile信息

点击Assets -> Tilemap -> Tiles -> Dug Ground,然后点击Open。

点击PersistentScene -> GridPropertiesManager,将Dug Ground中灰色的图片拖入到Dug Ground的List中。

8、添加Tag

点击GridPropertiesManager,点击Add Tag。

添加GroundDecoration1和GroundDecoration2两个Tag。

然后依次给Scene1/Scene2/Scene3场景Tilemap Grid下的GroundDecoration1和GroundDecoration2对象设置GroundDecoration1和GroundDecoration2两个Tag。

设置Prefabs -> Maps -> Tilemap Grid下的GroundDecoration1和GroundDecoration2对象设置GroundDecoration1和GroundDecoration2两个Tag。

9、运行游戏

相关文章:

Unity3D仿星露谷物语开发36之锄地动画2

1、目标 当角色锄地之后&#xff0c;地面会显示开垦后的样貌。 2、思路 上一篇中&#xff0c;虽然角色dig了hoe&#xff0c;同时grid属性也改变了&#xff0c;但是没有任何可视化的反馈。我们现在将添加新的功能&#xff0c;动态地将"dug ground"瓷砖添加到"…...

【备考高项】模拟预测题(一)案例分析及答案详解

更多内容请见: 备考信息系统项目管理师-专栏介绍和目录 文章目录 试题一【问题 1】(10分)【问题 2】(5分)【问题 3】(4分)【问题 4】(6分)试题二【问题 1】(12分)【问题 2】(3分)【问题 3】(6分)【问题 4】(4分)试题三【问题 1】(4分)【问题 2】(10分)【问题 3】…...

7、sentinel

控制台访问地址&#xff1a;http://localhost:8080/ 依赖 <dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> </dependency>配置文件 spring:cloud:sentinel:transpo…...

状态管理最佳实践:Provider使用技巧与源码分析

状态管理最佳实践&#xff1a;Provider使用技巧与源码分析 前言 Provider是Flutter官方推荐的状态管理解决方案&#xff0c;它简单易用且功能强大。本文将从实战角度深入讲解Provider的使用技巧和源码实现原理&#xff0c;帮助你更好地在项目中应用Provider进行状态管理。 基…...

INFINI Console 系统集群状态异常修复方案

背景介绍 运行 INFINI Console 1.29.0 和 1.29.1 版本 的用户在 新初始化 平台后可能会遇到一个特定问题。如果后台的系统 Easysearch/Elasticsearch 集群&#xff08;存储 Console 元数据的集群&#xff0c;通常名为 .infini_cluster 或类似名称&#xff09;包含超过一个节点…...

Spring Boot自动装配原理(源码详细剖析!)

什么是Spring Boot的自动装配&#xff1f; 自动装配是Spring Boot的核心功能&#xff0c;它能够根据应用程序的依赖和配置自动配置Spring。这意味着我们只需要添加大量的依赖&#xff0c;Spring Boot就能自动完成配置&#xff0c;减少了人工配置的工作量。 自动装配的核心注…...

大数据驱动的高效能量管理:智能优化与实践探索

大数据驱动的高效能量管理:智能优化与实践探索 在全球能源需求不断增长的背景下,如何提高能源利用效率成为各行业关注的焦点。传统的能源管理方式往往依赖固定规则和人工监测,难以适应复杂多变的应用场景。而大数据技术的兴起,为能量管理提供了新的解决方案——通过数据驱…...

《银行数字化风控-业务于实战》读后知识总结

引言 在金融科技高速发展的今天&#xff0c;银行的风控体系正经历从“人工经验驱动”向“数据智能驱动”的深刻变革。《银行数字化风控-业务于实战》一书以实战为导向&#xff0c;系统性地剖析了数字化风控的核心逻辑、技术实现路径及业务落地方法论。作为深耕风控领域多年的从…...

初级达梦dba的技能水准

在x86环境&#xff08;windows、linux&#xff09;安装单机软件&#xff0c;安装客户端创建过至少20套数据库&#xff0c;优化参数并更新过正式许可会用逻辑导出导入以及dmrman备份了解manager工具的使用配置sqllog日志&#xff0c;并能解释输出内容能够分析因磁盘空间不足、内…...

C++初阶-类和对象(中)

目录 1.类的默认成员函数 2.构造函数&#xff08;难度较高&#xff09; ​编辑 ​编辑 ​编辑 3.析构函数 4.拷贝构造函数 5.赋值运算符重载 5.1运算符重载 5.2赋值运算符重载 6.取地址运算符重载 6.1const成员函数 6.2取地址运算符重载 7.总结 1.类的默认成员函数…...

Linux网络UDP与TCP

基础知识 传输层 负责数据能够从发送端传输接收端。 端口号(Port)标识了一个主机上进行通信的不同的应用程序; 在 TCP/IP 协议中, 用 “源 IP”, “源端口号”, “目的 IP”, “目的端口号”, “协议号” 这样一个五元组来标识一个通信(可以通过 netstat -n 查看); 端口号范…...

23、.NET和C#有什么区别?

1、定义与范畴 .NET 定义 .NET 是一个由微软开发的开发平台&#xff08;Platform&#xff09;&#xff0c;它提供了一套完整的工具、库和运行时环境&#xff0c;用于构建各种类型的应用程序。 范畴 包括 .NET Framework、.NET Core&#xff08;现称为 .NET 5 及以上版本&a…...

Qt6离线安装过程

Qt6离线安装过程 说明解决方案联网笔记本安装qt6拷贝到离线电脑修改qtenv2.bat文件 说明 现在qt6已经不能通过离线的方式下载安装包安装了&#xff0c;只能通过登陆的方式在线安装&#xff0c;但是&#xff0c;又有离线安装运行的需求&#xff0c;那么怎么办呢&#xff1f;请跟…...

如何在 Go 中创建和部署 AWS Lambda 函数

AWS Lambda 是一个无服务器计算平台&#xff0c;您可以使用自己喜欢的编程语言编写代码&#xff0c;无需担心设置虚拟机。 您只需为 Lambda 函数的调用次数和运行时间&#xff08;毫秒&#xff09;付费。 我们大多数人都了解 JavaScript 和 Python&#xff0c;但它们的内存效率…...

【后端】【Django】Django 模型中的 `clean()` 方法详解:数据校验的最后防线

Django 模型中的 clean() 方法详解&#xff1a;数据校验的最后防线 在 Django 的模型系统中&#xff0c;我们经常使用字段级别的校验器&#xff08;validators&#xff09;来约束某个字段的取值范围。但当校验逻辑涉及多个字段之间的关系时&#xff0c;字段级别校验就无能为力…...

内存管理详解(曼波脑图超详细版!)

(✪ω✪)曼波来解答三连问啦&#xff01;准备好内存知识大礼包了吗&#xff1f;(≧∇≦)&#xff89; ━━━━━━━━━━━━━ ฅ^•ω•^ฅ ━━━━━━━━━━━ 一、内存分配详解 (๑>ᴗ<๑) (1) 栈内存 → 像便签纸&#x1f4dd; void calculate() {int a …...

【2025最新redis数据结构之Hypeloglog介绍】关于Hypeloglog

HyperLogLog (HLL) 算法深度解析 一、HLL 基本概念 HyperLogLog 是一种用于基数统计&#xff08;distinct counting&#xff09;的概率算法&#xff0c;能够在极小内存占用下&#xff08;通常只需几KB&#xff09;估算巨大数据集的基数&#xff08;不重复元素数量&#xff09…...

软考复习——知识点软件开发

开发模型 瀑布模型 各个活动规定为线性顺序连接的若干阶段的模型。是一种理想的现象开发模型&#xff0c;缺乏灵活性&#xff0c;无法理解软件需求不明确或不准确的问题。适用于需求明确的项目。 演化模型 从初始的原型逐步演化成最终软件产品&#xff0c;特别适用于对软件…...

关于AI:记忆、身份和锁死

作者&#xff1a;John Battelle 当生成式AI迎来投资热潮、产品发布和炒作高峰时&#xff0c;我们大多数人在奔向“下一个大事件”的过程中&#xff0c;忽略了一个深层次的缺陷。我们现在主流的AI产品和服务&#xff08;比如OpenAI、Google和Microsoft的产品&#xff09;都是通过…...

2024新版仿蓝奏云网盘源码,已修复已知BUG,样式风格美化,可正常运营生产

说起网盘源码&#xff0c;网络上出现的也很多&#xff0c;不过可真正正能够用于运营的少之又少。今天将的蓝奏云网盘源码&#xff0c;其实网络上也有&#xff0c;不过是残缺版&#xff0c;bug很多。我今天分享的仿蓝奏云模板是经过长时间测试修复后的源码&#xff0c;源码实测可…...

OJ - 设计循环队列

622. 设计循环队列 - 力扣&#xff08;LeetCode&#xff09; 循环队列是一种线性数据结构&#xff0c;其操作表现基于 FIFO&#xff08;先进先出&#xff09;原则&#xff0c;并且队尾被连接在队首之后以形成一个循环。它也被称为“环形缓冲器”。 循环队列的一个好处是我们可…...

实战指南:封装Faster-Whisper为FastAPI接口并实现高并发处理-附整合包

实战指南&#xff1a;封装Faster-Whisper为FastAPI接口并实现高并发处理-附整合包 「faster-whisper」 链接&#xff1a;https://pan.quark.cn/s/d4ddffb1b196 标题下面提供一个完整的示例&#xff0c;说明如何使用 FastAPI 封装 faster-whisper 接口&#xff0c;对外提供 RES…...

011数论——算法备赛

素数筛 给定n, 求2~n内的所有素数 埃氏筛 利用素数的定义&#xff0c; 输出素数2&#xff0c;然后筛掉2的倍数&#xff0c;得 {2,3,5,7,9,11,13&#xff0c;…}输出素数3&#xff0c;然后筛掉3的倍数&#xff0c;得 {2,3,5,7,11,13&#xff0c;…} 继续上述步骤&#xff0…...

C语言之机房机位预约系统

&#x1f31f; 嗨&#xff0c;我是LucianaiB&#xff01; &#x1f30d; 总有人间一两风&#xff0c;填我十万八千梦。 &#x1f680; 路漫漫其修远兮&#xff0c;吾将上下而求索。 C语言之机房机位预约系统 目录 博客&#xff1a;机房机位预约系统设计与实现 系统功能概述…...

中间件--ClickHouse-14--案例-3-其他案例思路概述

1、广告投放效果分析 案例背景&#xff1a; 一家广告平台需要分析广告的点击、曝光、转化等数据&#xff0c;以优化广告投放策略并提升 ROI&#xff08;投资回报率&#xff09;。 解决方案&#xff1a; 数据接入&#xff1a;将广告投放相关的数据&#xff08;如曝光、点击、…...

saas是什么?它做什么用的。及和Paas和laas有什么区别

Saas是什么&#xff1f;它做什么用的。及和Paas和laas有什么区别 提示&#xff1a;帮帮志会陆续更新非常多的IT技术知识&#xff0c;希望分享的内容对您有用。本章分享的是行业内容。前后每一小节的内容是存在的有&#xff1a;学习and理解的关联性&#xff0c;希望对您有用~ 文…...

Qt基础005(文件操作后续)

文章目录 QFileDialogQFileDialog打开开发案例QFileDialog保存开发案例实现文件打开功能开发流程打开功能优化 QComboBoxQListExtraSelection 简介 QFileDialog QFileDialog打开开发案例 #include <QApplication> #include <QFileDialog> #include <QStringLi…...

松灵Cobot Magic双臂具身遥操机器人(基于ROS的定位建图与协同导航技术)

摘要 本文以CobotMagic可移动协作机器人为研究对象&#xff0c;从硬件架构设计、软件系统架构、多传感器融合定位建图系统、智能导航系统协同机制四个维度&#xff0c;深入解析机器人系统工作原理。重点研究多传感器融合定位建图系统实现原理&#xff0c;结合实测数据验证系统…...

AI——神经网络以及TensorFlow使用

文章目录 一、TensorFlow安装二、张量、变量及其操作1、张量Tensor2、变量 三、tf.keras介绍1、使用tf.keras构建我们的模型2、激活函数1、sigmoid/logistics函数2、tanh函数3、RELU函数4、LeakReLu5、SoftMax6、如何选择激活函数 3、参数初始化1、bias偏置初始化2、weight权重…...

实现对象之间的序列化和反序列化

1.什么是序列化&#xff1f; 在项目的开发中&#xff0c;为了让前端更好的分析后端返回的结果&#xff0c;我们一般会将返回的信息进行序列化&#xff0c;序列化就是将返回对象的状态信息转换为一种标准化的格式&#xff0c;方便在网络中传输也方便打印日志时号观察&#xff0…...

QML中日期处理类

在 QML 中处理日期和时间主要使用 JavaScript 的 Date 对象以及 Qt 提供的一些相关功能。以下是常用的日期处理方式&#xff1a; 1. JavaScript Date 对象 QML 可以直接使用 JavaScript 的 Date 对象&#xff1a; qml // 创建当前日期时间 var currentDate new Date()// 创…...

基于docker-java封装的工具类

基于docker-java封装的工具类 背景环境工具类 背景 写OJ系统时需要用docker作为代码沙箱使用&#xff0c;顺手封装了一个工具类&#xff0c;给自己做个笔记&#xff0c;如果可以的话也希望帮助到其他人。 环境 docker 26.1.4docker-java 3.4.2docker-java-transport-httpcli…...

windows docker desktop 无法访问容器端口映射

为什么使用docker desktop访问映射的端口失败&#xff0c;而其端口对应的服务是正常的&#xff1f; 常见问题&#xff0c;容器的防火墙没有关闭&#xff01;&#xff01;&#xff01; 以centos7为例&#xff0c;默认情况下防火墙处于开启状态&#xff1a; 这下访问就OK了...

ReentrantReadWriteLock读写锁

一、锁的分类 这里不会对Java中大部分的分类都聊清楚&#xff0c;主要把 **互斥&#xff0c;共享** 这种分类聊清楚。 Java中的互斥锁&#xff0c;synchronized&#xff0c;ReentrantLock这种都是互斥锁。一个线程持有锁操作时&#xff0c;其他线程都需要等待前面的线程释放锁…...

Vue.js 入门教程

Vue.js 入门教程 Vue.js 是一款非常流行的前端 JavaScript 框架&#xff0c;适用于构建用户界面。它的设计思想是尽可能简单、灵活&#xff0c;易于与其他库或现有项目整合。本文将从最基础的概念开始&#xff0c;逐步引导你学习 Vue.js。 一、Vue.js 基础概念 1.1 什么是 V…...

解决Docker 配置 daemon.json文件后无法生效

vim /etc/docker/daemon.json 在daemon中配置一下dns {"registry-mirrors": ["https://docker.m.daocloud.io","https://hub-mirror.c.163.com","https://dockerproxy.com","https://docker.mirrors.ustc.edu.cn","ht…...

wpf stylet框架 关于View与viewmodel自动关联绑定的问题

1.1 命名规则 Aview 对应 AVIewModel, 文件夹 views 和 viewmodels 1.2 需要注册服务 //RootViewModel是主窗口 public class Bootstrapper : Bootstrapper<RootViewModel>{/// <summary>/// 配置IoC容器。为数据共享创建服务/// </summary…...

车载测试用例开发-如何平衡用例覆盖度和测试效率的方法论

1 摘要 在进行车载测试用例编写时&#xff0c;会遇到多个条件导致用例排列组合爆炸的情况&#xff0c;但是为了产品测试质量&#xff0c;我们又不得不保证用例设计的需求覆盖度&#xff0c;这样又会使得测试周期非常长。我们如何平衡效率和测试质量&#xff1f;本文进行了一些…...

leetcode(01)森林中的兔子

今天开始记录刷题的过程&#xff0c;每天记录自己刷题的题目和自己的解法&#xff0c;欢迎朋友们给出更多更好的解法。 森林中的兔子 森林中有未知数量的兔子&#xff0c;提问其中若干只兔子“还有多少只兔子与你&#xff08;被提问的兔子&#xff09;颜色相同”。将答案收集到…...

人工智能-机器学习其他技术(决策树,异常检测,主成分分析)

决策树 一种对实例进行分类的树形结构&#xff0c;通过多层判断区分目标所属类别 本质&#xff1a;通过多层判断&#xff0c;从训练数据集中归纳出一组分类规则 优点&#xff1a; 计算量校&#xff0c;运算速度快 易于理解 缺点&#xff1a; 忽略属性间的相关性 样本分布不均时…...

AIGC通信架构深度优化指南

AIGC通信架构深度优化指南 标题&#xff1a;《百亿参数大模型如何高效通信&#xff1f;揭秘AIGC系统的协议层设计艺术》 副标题&#xff1a;从分布式训练到多模态推理&#xff0c;构建高可靠AI通信系统 1. AIGC典型通信场景 1.1 分布式模型训练参数同步 sequenceDiagram训练…...

精益数据分析(7/126):打破创业幻想,拥抱数据驱动

精益数据分析&#xff08;7/126&#xff09;&#xff1a;打破创业幻想&#xff0c;拥抱数据驱动 在创业的道路上&#xff0c;我们都怀揣着梦想&#xff0c;但往往容易陷入自我编织的幻想中。我希望通过和大家一起学习《精益数据分析》&#xff0c;能帮助我们更清醒地认识创业过…...

Android Gradle多渠道打包

目录 1.多渠道打包是什么2.为什么需要多渠道打包3.多渠道配置VariantproductFlavorsbuildTypes 3.构建变体组合关于组合 4.渠道过滤5.渠道资源资源文件资源合并规则代码文件SourceSets 6. 渠道依赖项7.渠道统计meta-dataBuildConfig 8.管理渠道 1.多渠道打包是什么 多聚道打包…...

Day58 | 179. 最大数、316. 去除重复字母、334. 递增的三元子序列

179. 最大数 题目链接&#xff1a;179. 最大数 - 力扣&#xff08;LeetCode&#xff09; 题目难度&#xff1a;中等 代码&#xff1a; class Solution {public String largestNumber(int[] nums) {String[] strsnew String[nums.length];for(int i0;i<nums.length;i)str…...

LabVIEW发电机励磁系统远程诊断

变流器在风电系统中承担电能转换与控制的关键角色。它将发电机输出的低频、可变交流&#xff0c;通过整流、逆变等环节转为频率、电压稳定的交流&#xff0c;以满足电网接入要求&#xff1b;同时&#xff0c;根据实时风速调整发电机转速&#xff0c;实现最大功率追踪。 ​ 在某…...

性能比拼: Go vs Bun

本内容是对知名性能评测博主 Anton Putra Go (Golang) vs. Bun: Performance (Latency - Throughput - Saturation - Availability) 内容的翻译与整理, 有适当删减, 相关指标和结论以原作为准 我对 Bun 在之前的基准测试中的出色表现感到惊讶&#xff0c;因此我决定将它与 Go …...

Kubernetes相关的名词解释Dashboard界面(6)

什么是Kubernetes Dashboard&#xff1f; Kubernetes Dashboard 是一个基于 Web 的用户界面&#xff0c;用于管理 Kubernetes 集群。它是 Kubernetes 官方提供的可视化工具&#xff0c;允许用户通过直观的图形界面而不是命令行来部署、管理和监控集群中的应用程序。 Dashboard…...

Linux网络编程 TCP---并发服务器:多进程架构与端口复用技术实战指南

知识点1【并发服务器—多进程版】 并发服务器&#xff1a;服务器可以同时服务多个客户端 首先复习一下服务器的创建过程&#xff08;如下图&#xff09; 1、监听套接字&#xff08;套接字→绑定→监听&#xff08;连接队列&#xff09;&#xff09; 2、利用accept从连接队列…...

(done) 吴恩达版提示词工程 1. 引言

url: https://www.bilibili.com/video/BV1Z14y1Z7LJ/?spm_id_from333.337.search-card.all.click&vd_source7a1a0bc74158c6993c7355c5490fc600 LLM 有两种&#xff1a; 1.基础 LLM&#xff0c;通过文本训练数据预测后面的内容。 这种 LLM 当你给它提问&#xff1a;What is…...

uniapp微信小程序实现sse

微信小程序实现sse 注&#xff1a;因为微信小程序不支持sse请求&#xff0c;因为后台给的是分包的流&#xff0c;所以我们就使用接受流的方式&#xff0c;一直接受&#xff0c;然后把接受的数据拿取使用。这里还是使用uniapp的原生请求。 上代码 //注意&#xff1a;一定要下…...