UE5数字孪生系列笔记(三)

C++创建Pawn类玩家

  • 创建一个GameMode蓝图用来加载我们自定义的游戏Mode
  • 新建一个Pawn的C++,MyCharacter类作为玩家,新建一个相机组件与相机臂组件,box组件作为根组件
// Fill out your copyright notice in the Description page of Project Settings.#pragma once#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
#include "MyCharacter.generated.h"UCLASS()
class CITYTWIN_API AMyCharacter : public APawn
{GENERATED_BODY()public:// Sets default values for this pawn's propertiesAMyCharacter();//box作为根组件UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Camera")class UBoxComponent* CollisionBox;//相机组件UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Camera")class UCameraComponent* FollowCamera;//相机臂组件UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Camera")class USpringArmComponent* CameraBoom;protected:// Called when the game starts or when spawnedvirtual void BeginPlay() override;public:	// Called every framevirtual void Tick(float DeltaTime) override;// Called to bind functionality to inputvirtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;};
  • 声明创建组件,硬编码一些基本属性
// Fill out your copyright notice in the Description page of Project Settings.#include "MyCharacter.h"
#include "Components/BoxComponent.h"
#include "Camera/CameraComponent.h"
#include "GameFramework/SpringArmComponent.h"// Sets default values
AMyCharacter::AMyCharacter()
{// Set this pawn to call Tick() every frame.  You can turn this off to improve performance if you don't need it.PrimaryActorTick.bCanEverTick = true;CollisionBox = CreateDefaultSubobject<UBoxComponent>(TEXT("CollisionBox"));CollisionBox->SetupAttachment(GetRootComponent());CameraBoom = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraBoom"));CameraBoom->SetupAttachment(CollisionBox);CameraBoom->TargetArmLength = 1500.f;CameraBoom->bUsePawnControlRotation = false;CameraBoom->bEnableCameraLag = true;//摄像机臂平滑CameraBoom->bEnableCameraRotationLag = true;//启用相机旋转延迟CameraBoom->bDoCollisionTest = false;//关闭摄像机臂碰撞FollowCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("FollowCamera"));FollowCamera->SetupAttachment(CameraBoom);FollowCamera->bUsePawnControlRotation = false;
}// Called when the game starts or when spawned
void AMyCharacter::BeginPlay()
{Super::BeginPlay();}// Called every frame
void AMyCharacter::Tick(float DeltaTime)
{Super::Tick(DeltaTime);}// Called to bind functionality to input
void AMyCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{Super::SetupPlayerInputComponent(PlayerInputComponent);}
  • 创建这个Pawn类的蓝图进行之前登录页面动画的视角旋转方向问题的解决
  • 首先将蓝图生成对齐到视角
    在这里插入图片描述
  • 将Pawn类自动接收玩家0
    在这里插入图片描述
  • 然后删除PlayerStart
    在这里插入图片描述
  • 运行结果
    请添加图片描述

移动增强输入系统

  • 在项目建立.cs文件中添加这个模块
    在这里插入图片描述
  • 绑定增强输入系统操作
  • MyCharacter.h
// Fill out your copyright notice in the Description page of Project Settings.#pragma once#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
#include "../../../../UE_5.2.1/UE_5.2/Engine/Plugins/EnhancedInput/Source/EnhancedInput/Public/InputActionValue.h"
#include "MyCharacter.generated.h"UCLASS()
class CITYTWIN_API AMyCharacter : public APawn
{GENERATED_BODY()public:// Sets default values for this pawn's propertiesAMyCharacter();//box作为根组件UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Camera")class UBoxComponent* CollisionBox;//相机组件UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Camera")class UCameraComponent* FollowCamera;//相机臂组件UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Camera")class USpringArmComponent* CameraBoom;//绑定映射UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")class UInputMappingContext* MappingContext;//移动绑定UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")class UInputAction* LeftButtonAction;protected:// Called when the game starts or when spawnedvirtual void BeginPlay() override;//鼠标按下操作事件void LeftMouseDown(const FInputActionValue& value);void LeftMouseUp(const FInputActionValue& value);public:	// Called every framevirtual void Tick(float DeltaTime) override;// Called to bind functionality to inputvirtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;};
  • MyCharacter.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "MyCharacter.h"
#include "Components/BoxComponent.h"
#include "Camera/CameraComponent.h"
#include "GameFramework/SpringArmComponent.h"
#include "EnhancedInputSubsystems.h"
#include "EnhancedInputComponent.h"// Sets default values
AMyCharacter::AMyCharacter()
{// Set this pawn to call Tick() every frame.  You can turn this off to improve performance if you don't need it.PrimaryActorTick.bCanEverTick = true;CollisionBox = CreateDefaultSubobject<UBoxComponent>(TEXT("CollisionBox"));CollisionBox->SetupAttachment(GetRootComponent());CameraBoom = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraBoom"));CameraBoom->SetupAttachment(CollisionBox);CameraBoom->TargetArmLength = 1500.f;CameraBoom->bUsePawnControlRotation = false;CameraBoom->bEnableCameraLag = true;//摄像机臂平滑CameraBoom->bEnableCameraRotationLag = true;//启用相机旋转延迟CameraBoom->bDoCollisionTest = false;//关闭摄像机臂碰撞FollowCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("FollowCamera"));FollowCamera->SetupAttachment(CameraBoom);FollowCamera->bUsePawnControlRotation = false;
}
// Called when the game starts or when spawned
void AMyCharacter::BeginPlay()
{Super::BeginPlay();APlayerController* PlayerController = Cast<APlayerController>(Controller);if (PlayerController){UEnhancedInputLocalPlayerSubsystem* Subsystem =ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(PlayerController->GetLocalPlayer());if (Subsystem){Subsystem->AddMappingContext(MappingContext, 0);}}
}
void AMyCharacter::LeftMouseDown(const FInputActionValue& value)
{
}void AMyCharacter::LeftMouseUp(const FInputActionValue& value)
{
}
// Called every frame
void AMyCharacter::Tick(float DeltaTime)
{Super::Tick(DeltaTime);}
// Called to bind functionality to input
void AMyCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{Super::SetupPlayerInputComponent(PlayerInputComponent);UEnhancedInputComponent* EnhancedInputConponent = Cast<UEnhancedInputComponent>(PlayerInputComponent);if (EnhancedInputConponent){EnhancedInputConponent->BindAction(LeftButtonAction, ETriggerEvent::Started, this, &AMyCharacter::LeftMouseDown);EnhancedInputConponent->BindAction(LeftButtonAction, ETriggerEvent::Completed, this, &AMyCharacter::LeftMouseUp);}
}

获取鼠标位置坐标与鼠标移动后的差量

  • 使用GetMousePosition函数来获取鼠标的坐标点
  • MyCharacter.h中新建一个函数专门用来获取鼠标的坐标点的函数
	//鼠标的坐标点FVector2D MousePos = FVector2D::ZeroVector;void GetMousePosition();
  • MyCharacter.cpp中实现此方法
void AMyCharacter::GetMousePosition()
{GetWorld()->GetFirstPlayerController()->GetMousePosition(MousePos.X, MousePos.Y);//打印鼠标信息到屏幕GEngine->AddOnScreenDebugMessage(-1, 1, FColor::Red, FString::Printf(TEXT("%f,%f"), MousePos.X, MousePos.Y));
}
  • 获取鼠标变化差量,当我们鼠标变化时,我们要获取到这个变化的差量值,我们可以定义两个变量,一个变量存储用来作为变化之前的绝对位置减去变化之后的当前绝对位置,然后另外两个变量来存储变化之后当前的绝对位置
	//鼠标的坐标点FVector2D MousePos = FVector2D::ZeroVector;//记录的鼠标变化差量FVector2D MouseVariationDifference = FVector2D::ZeroVector;//记录变化之后的鼠标坐标float MouseX = 0.f;float MouseY = 0.f;void AMyCharacter::GetMousePosition()
{//获取当前鼠标移动坐标GetWorld()->GetFirstPlayerController()->GetMousePosition(MousePos.X, MousePos.Y);//记录的鼠标变化差量MouseVariationDifference = MousePos - FVector2D(MouseX, MouseY);//记录变化后的鼠标位置MouseX = MousePos.X;MouseY = MousePos.Y;//打印鼠标信息到屏幕GEngine->AddOnScreenDebugMessage(1, 1, FColor::Red, FString::Printf(TEXT("%f,%f"), MousePos.X, MousePos.Y));GEngine->AddOnScreenDebugMessage(2, 1, FColor::Yellow, FString::Printf(TEXT("%f,%f"), MouseVariationDifference.X, MouseVariationDifference.Y));
}

设置滑动鼠标实现旋转视角效果

  • 通过获取的移动的鼠标差量进行鼠标滑动移动视角
  • 新建一个鼠标视角移动速度变量,用来控制鼠标实现视角旋转的移动速度
	//鼠标视角移动速度float MouseSpeed = 0.1f;
  • 新建一个鼠标视角移动函数,函数逻辑
  • ActorRotator.Pitch + (MouseVariationDifference.Y * MouseSpeed):Pitch是虚幻中的抬头与低头,在直角坐标系中用来Y来描述
  • ActorRotator.Yaw + (MouseVariationDifference.X * MouseSpeed * -1.f):Yaw是摇头转向,在直角坐标系中用来X来描述,实践中得乘以-1使用,估计是因为虚幻默认以右方向为正方向的原因
	//鼠标移动视角移动事件void MouseMove();void AMyCharacter::MouseMove()
{FRotator ActorRotator = GetActorRotation();FRotator NewActorRotator = FRotator(ActorRotator.Pitch + (MouseVariationDifference.Y * MouseSpeed),ActorRotator.Yaw + (MouseVariationDifference.X * MouseSpeed * -1.f), ActorRotator.Roll);SetActorRotation(NewActorRotator);
}
  • 调用函数
// Called every frame
void AMyCharacter::Tick(float DeltaTime)
{Super::Tick(DeltaTime);//获取鼠标坐标GetMousePosition();//鼠标移动视角MouseMove();}
  • 运行结果
    请添加图片描述

鼠标左键视觉拖动效果

  • 将滑动鼠标实现旋转视角效果设置为鼠标左键按下后才能实现
  • 添加一个布尔变量用来标识是否要开启鼠标旋转视角事情
	//标识鼠标左键是否按下bool bIsMouseLeftDown = false;void AMyCharacter::MouseMove()
{if (bIsMouseLeftDown){FRotator ActorRotator = GetActorRotation();//限制一下视角度数带来的错误FRotator NewActorRotator = FRotator(FMath::Clamp((ActorRotator.Pitch + (MouseVariationDifference.Y * MouseSpeed)),-80.f,-10.f),ActorRotator.Yaw + (MouseVariationDifference.X * MouseSpeed * -1.f), ActorRotator.Roll);SetActorRotation(NewActorRotator);}
}void AMyCharacter::LeftMouseDown(const FInputActionValue& value)
{bIsMouseLeftDown = true;
}void AMyCharacter::LeftMouseUp(const FInputActionValue& value)
{bIsMouseLeftDown = false;
}

鼠标右键视角移动效果

  • 添加右键的输入操作
    在这里插入图片描述
  • 新建右键是否按下的标识布尔变量,创建右键操作的输入行为,即绑定函数
	//移动绑定UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")class UInputAction* RightButtonAction;//标识鼠标右键是否按下bool bIsMouseRightDown = false;// Called to bind functionality to input
void AMyCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{Super::SetupPlayerInputComponent(PlayerInputComponent);UEnhancedInputComponent* EnhancedInputConponent = Cast<UEnhancedInputComponent>(PlayerInputComponent);if (EnhancedInputConponent){EnhancedInputConponent->BindAction(LeftButtonAction, ETriggerEvent::Started, this, &AMyCharacter::LeftMouseDown);EnhancedInputConponent->BindAction(LeftButtonAction, ETriggerEvent::Completed, this, &AMyCharacter::LeftMouseUp);EnhancedInputConponent->BindAction(RightButtonAction, ETriggerEvent::Started, this, &AMyCharacter::RightMouseDown);EnhancedInputConponent->BindAction(RightButtonAction, ETriggerEvent::Completed, this, &AMyCharacter::RightMouseUp);}
}void AMyCharacter::RightMouseDown(const FInputActionValue& value)
{bIsMouseRightDown = true;
}void AMyCharacter::RightMouseUp(const FInputActionValue& value)
{bIsMouseRightDown = false;
}
  • 新建鼠标右键移动速度变量,编写鼠标右键移动逻辑
	//鼠标右键移动速度float MouseRightSpeed = 100.f;void AMyCharacter::MouseMove()
{if (bIsMouseLeftDown){FRotator ActorRotator = GetActorRotation();//限制一下视角度数带来的错误FRotator NewActorRotator = FRotator(FMath::Clamp((ActorRotator.Pitch + (MouseVariationDifference.Y * MouseSpeed)),-80.f,-10.f),ActorRotator.Yaw + (MouseVariationDifference.X * MouseSpeed * -1.f), ActorRotator.Roll);SetActorRotation(NewActorRotator);}if (bIsMouseRightDown){FVector SpeedMove = FVector(MouseVariationDifference.Y * MouseRightSpeed,-1.0 * MouseRightSpeed * MouseVariationDifference.X, 0);AddActorLocalOffset(SpeedMove);//限制z轴FVector Location = GetActorLocation();FVector NewLocation = FVector(Location.X, Location.Y, 4520);SetActorLocation(NewLocation);}
}

鼠标中键控制摄像机臂长度,缩放地图效果

  • 新建鼠标中键的操作行为,添加一个鼠标中键移动速度变量,然后在鼠标中键操作事件中完成逻辑,逻辑是获取相机臂的长度,用获取鼠标滚轮的量值乘以鼠标中键移动速度变量被获取的相机臂原长度减去
	//移动绑定UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")class UInputAction* MiddleButtonAction;//鼠标中键移动速度float MouseMiddleSpeed = 1000.f;void AMyCharacter::MiddleMouseSlide(const FInputActionValue& value)
{float Axis = value.Get<float>();float CameraArm = CameraBoom->TargetArmLength;//限制相机臂长度CameraBoom->TargetArmLength = FMath::Clamp((CameraArm - Axis * MouseMiddleSpeed), 1000.f, 30000.f);
}
  • 运行结果
    请添加图片描述

源码

MyCharacter.h

// Fill out your copyright notice in the Description page of Project Settings.#pragma once#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
#include "../../../../UE_5.2.1/UE_5.2/Engine/Plugins/EnhancedInput/Source/EnhancedInput/Public/InputActionValue.h"
#include "MyCharacter.generated.h"UCLASS()
class CITYTWIN_API AMyCharacter : public APawn
{GENERATED_BODY()public:// Sets default values for this pawn's propertiesAMyCharacter();//box作为根组件UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Camera")class UBoxComponent* CollisionBox;//相机组件UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Camera")class UCameraComponent* FollowCamera;//相机臂组件UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Camera")class USpringArmComponent* CameraBoom;//绑定映射UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")class UInputMappingContext* MappingContext;//移动绑定UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")class UInputAction* LeftButtonAction;//移动绑定UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")class UInputAction* RightButtonAction;//移动绑定UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")class UInputAction* MiddleButtonAction;//鼠标的坐标点FVector2D MousePos = FVector2D::ZeroVector;//记录的鼠标变化差量FVector2D MouseVariationDifference = FVector2D::ZeroVector;//记录变化之后的鼠标坐标float MouseX = 0.f;float MouseY = 0.f;//鼠标视角移动速度float MouseSpeed = 0.1f;//鼠标右键移动速度float MouseRightSpeed = 100.f;//鼠标中键移动速度float MouseMiddleSpeed = 1000.f;//标识鼠标左键是否按下bool bIsMouseLeftDown = false;//标识鼠标右键是否按下bool bIsMouseRightDown = false;protected:// Called when the game starts or when spawnedvirtual void BeginPlay() override;//鼠标按下操作事件void LeftMouseDown(const FInputActionValue& value);void LeftMouseUp(const FInputActionValue& value);void RightMouseDown(const FInputActionValue& value);void RightMouseUp(const FInputActionValue& value);void MiddleMouseSlide(const FInputActionValue& value);//鼠标移动视角移动事件void MouseMove();public:	// Called every framevirtual void Tick(float DeltaTime) override;// Called to bind functionality to inputvirtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;void GetMousePosition();
};

MyCharacter.cpp

// Fill out your copyright notice in the Description page of Project Settings.#include "MyCharacter.h"
#include "Components/BoxComponent.h"
#include "Camera/CameraComponent.h"
#include "GameFramework/SpringArmComponent.h"
#include "EnhancedInputSubsystems.h"
#include "EnhancedInputComponent.h"
#include "Engine/Engine.h"// Sets default values
AMyCharacter::AMyCharacter()
{// Set this pawn to call Tick() every frame.  You can turn this off to improve performance if you don't need it.PrimaryActorTick.bCanEverTick = true;CollisionBox = CreateDefaultSubobject<UBoxComponent>(TEXT("CollisionBox"));CollisionBox->SetupAttachment(GetRootComponent());CameraBoom = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraBoom"));CameraBoom->SetupAttachment(CollisionBox);CameraBoom->TargetArmLength = 1500.f;CameraBoom->bUsePawnControlRotation = false;CameraBoom->bEnableCameraLag = true;//摄像机臂平滑CameraBoom->bEnableCameraRotationLag = true;//启用相机旋转延迟CameraBoom->bDoCollisionTest = false;//关闭摄像机臂碰撞FollowCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("FollowCamera"));FollowCamera->SetupAttachment(CameraBoom);FollowCamera->bUsePawnControlRotation = false;
}// Called when the game starts or when spawned
void AMyCharacter::BeginPlay()
{Super::BeginPlay();APlayerController* PlayerController = Cast<APlayerController>(Controller);if (PlayerController){UEnhancedInputLocalPlayerSubsystem* Subsystem =ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(PlayerController->GetLocalPlayer());if (Subsystem){Subsystem->AddMappingContext(MappingContext, 0);}}
}void AMyCharacter::LeftMouseDown(const FInputActionValue& value)
{bIsMouseLeftDown = true;
}void AMyCharacter::LeftMouseUp(const FInputActionValue& value)
{bIsMouseLeftDown = false;
}void AMyCharacter::RightMouseDown(const FInputActionValue& value)
{bIsMouseRightDown = true;
}void AMyCharacter::RightMouseUp(const FInputActionValue& value)
{bIsMouseRightDown = false;
}void AMyCharacter::MiddleMouseSlide(const FInputActionValue& value)
{float Axis = value.Get<float>();float CameraArm = CameraBoom->TargetArmLength;//限制相机臂长度CameraBoom->TargetArmLength = FMath::Clamp((CameraArm - Axis * MouseMiddleSpeed), 1000.f, 30000.f);
}void AMyCharacter::MouseMove()
{if (bIsMouseLeftDown){FRotator ActorRotator = GetActorRotation();//限制一下视角度数带来的错误FRotator NewActorRotator = FRotator(FMath::Clamp((ActorRotator.Pitch + (MouseVariationDifference.Y * MouseSpeed)),-80.f,-10.f),ActorRotator.Yaw + (MouseVariationDifference.X * MouseSpeed * -1.f), ActorRotator.Roll);SetActorRotation(NewActorRotator);}if (bIsMouseRightDown){FVector SpeedMove = FVector(MouseVariationDifference.Y * MouseRightSpeed,-1.0 * MouseRightSpeed * MouseVariationDifference.X, 0);AddActorLocalOffset(SpeedMove);//限制z轴FVector Location = GetActorLocation();FVector NewLocation = FVector(Location.X, Location.Y, 4520);SetActorLocation(NewLocation);}
}// Called every frame
void AMyCharacter::Tick(float DeltaTime)
{Super::Tick(DeltaTime);//获取鼠标坐标GetMousePosition();//鼠标移动视角MouseMove();}// Called to bind functionality to input
void AMyCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{Super::SetupPlayerInputComponent(PlayerInputComponent);UEnhancedInputComponent* EnhancedInputConponent = Cast<UEnhancedInputComponent>(PlayerInputComponent);if (EnhancedInputConponent){EnhancedInputConponent->BindAction(LeftButtonAction, ETriggerEvent::Started, this, &AMyCharacter::LeftMouseDown);EnhancedInputConponent->BindAction(LeftButtonAction, ETriggerEvent::Completed, this, &AMyCharacter::LeftMouseUp);EnhancedInputConponent->BindAction(RightButtonAction, ETriggerEvent::Started, this, &AMyCharacter::RightMouseDown);EnhancedInputConponent->BindAction(RightButtonAction, ETriggerEvent::Completed, this, &AMyCharacter::RightMouseUp);EnhancedInputConponent->BindAction(MiddleButtonAction, ETriggerEvent::Triggered, this, &AMyCharacter::MiddleMouseSlide);}
}void AMyCharacter::GetMousePosition()
{//获取当前鼠标移动坐标GetWorld()->GetFirstPlayerController()->GetMousePosition(MousePos.X, MousePos.Y);//记录的鼠标变化差量MouseVariationDifference = MousePos - FVector2D(MouseX, MouseY);//记录变化后的鼠标位置MouseX = MousePos.X;MouseY = MousePos.Y;//打印鼠标信息到屏幕/*GEngine->AddOnScreenDebugMessage(1, 1, FColor::Red, FString::Printf(TEXT("%f,%f"), MousePos.X, MousePos.Y));GEngine->AddOnScreenDebugMessage(2, 1, FColor::Yellow, FString::Printf(TEXT("%f,%f"), MouseVariationDifference.X, MouseVariationDifference.Y));*/
}

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

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

相关文章

Solidity Uniswap V2 Router swapTokensForExactTokens

最初的router合约实现了许多不同的交换方式。我们不会实现所有的方式&#xff0c;但我想向大家展示如何实现倒置交换&#xff1a;用未知量的输入Token交换精确量的输出代币。这是一个有趣的用例&#xff0c;可能并不常用&#xff0c;但仍有可能实现。 GitHub - XuHugo/solidit…

Golang实战:深入hash/crc64标准库的应用与技巧

Golang实战&#xff1a;深入hash/crc64标准库的应用与技巧 引言hash/crc64简介基本原理核心功能 环境准备安装Golang创建一个新的Golang项目引入hash/crc64包测试环境配置 hash/crc64的基本使用计算字符串的CRC64校验和计算文件的CRC64校验和 高级技巧与应用数据流和分块处理网…

Jmeter 配置说明之线程组

一、线程组介绍&#xff1a; 线程组元件是任何一个测试计划的开始点。在一个测试计划中的所有元件都必须在某个线程组下。所有的任务都是基于线程组&#xff1a; 通俗理解&#xff1a; 线程组&#xff1a;就是一个线程组&#xff0c;里面有若干个请求&#xff1b; 线程&am…

vue3.0 + ts + eslint报错:error Parsing error: ‘>‘ expected

eslint报错 这里加上对应的 eslint配置即可&#xff1a; parser: vue-eslint-parser, parserOptions: {parser: "typescript-eslint/parser",ecmaVersion: 2020,sourceType: module, }具体如下&#xff1a; module.exports {parser: vue-eslint-parser,parserOpti…

​马来语翻译中文去哪比较好?

据了解&#xff0c;马来语是马来西亚、文莱的官方语言&#xff0c;也是新加坡的官方语言之一&#xff0c;马来语跟印尼语是同一种语言&#xff0c;它在整个东南亚有着极大的影响力。如今在国内市场上&#xff0c;马来语翻译的需求也是供不应求&#xff0c;那么&#xff0c;如何…

【Go】三、Go指针

文章目录 1、指针2、说明 1、指针 &符号变量 就可以获取这个变量内存的地址*int 是一个指针类型 &#xff08;可以理解为 指向int类型的指针&#xff09; package main import("fmt" ) func main(){var age int 18//&符号变量 就可以获取这个变量内存的地…

第十五章 Nginx

一、Nginx 1.1 Nginx 相关概念 1.1.1 正向代理 正向代理类似一个跳板机&#xff0c;代理访问外部资源。 比如我们国内访问谷歌&#xff0c;直接访问访问不到&#xff0c;我们可以通过一个正向代理服务器&#xff0c;请求发到代理服&#xff0c;代理服务器能够访问谷歌&am…

TBSI模型论文解读及代码分析

前往我的主页以获得更好的阅读体验 简介 论文来源: Bridging Search Region Interaction With Template for RGB-T Tracking 现有的搜索算法通常会直接连接 RGB 和 T 模态搜索区域, 该方法存在大量冗余背景噪声. 而另一些方法从搜索帧中采样候选框, 对孤立的 RGB 框和 T 框进…

TongWeb7.0-8.0Java代码使用JMX获取应用通道端口

以下通过java代码实现获取TongWeb7.0/8.0应用通道端口使用到的JMX均为TongWeb自带的JMX功能。 一、TongWeb7.0 1、使用本地JMX获取应用通道端口 public String getTw7PortByLocalJmx() { try { MBeanServer beanServer ManagementFactory.getPlatformMBeanServer(); Set&l…

SOLIDWORKS二次开发参数化设计软件 慧德敏学

SOLIDWORKS参数化设计软件-SolidKits.AutoWorks专为规格变化多、变化规律强的产品开发&#xff0c;将变化规律集成到三维设计软件&#xff0c;通过一键点击实现自动化产品再设计&#xff0c;如智能选型、自动化修改产品属性、产品参数、产品状态、图纸更新、重命名、并自动打包…

LeetCode:300最长递增子序列 C语言

300. 最长递增子序列 给你一个整数数组 nums &#xff0c;找到其中最长严格递增子序列的长度。 子序列 是由数组派生而来的序列&#xff0c;删除&#xff08;或不删除&#xff09;数组中的元素而不改变其余元素的顺序。例如&#xff0c;[3,6,2,7] 是数组 [0,3,1,6,2,2,7] 的子…

小程序中使用less

在vscode中安装插件 找到左下角齿轮的设置&#xff0c;点击右边图标&#xff0c;进入“settings.json” 加上以下代码配置 "less.compile":{"outExt": ".wxss"}

Mysql数据库:日志管理、备份与恢复

目录 前言 一、MySQL日志管理 1、存放日志和数据文件的目录 2、日志的分类 2.1 错误日志 2.2 通用查询日志 2.3 二进制日志 2.4 慢查询日志 2.5 中继日志 3、日志综合配置 4、查询日志是否开启 二、数据备份概述 1、数据备份的重要性 2、备份类型 2.1 从物理与…

镜舟普元揭秘数据中台新范式,引领企业数智化转型与创新实践

在当前数字化浪潮中&#xff0c;数据中台的角色越发重要&#xff0c;承担着将一切业务数据化的重任。近日&#xff0c;北京镜舟科技有限公司&#xff08;简称“镜舟”&#xff09;与普元信息技术股份有限公司&#xff08;简称“普元”&#xff09;联合举办“数据中台新范式”云…

matplotlib 绘图

matplotlib 绘图 方便设置legend图例的位置 ax1.legend(loc‘upper center’, bbox_to_anchor(0.3, -0.1)) ax2.legend(loc‘upper center’, bbox_to_anchor(0.6, -0.1)) import numpy as np import matplotlib.pyplot as plt from scipy.stats import norm from scipy.inter…

【SpringCloud】Ribbon负载均衡

&#x1f3e1;浩泽学编程&#xff1a;个人主页 &#x1f525; 推荐专栏&#xff1a;《深入浅出SpringBoot》《java对AI的调用开发》 《RabbitMQ》《Spring》《SpringMVC》《项目实战》 &#x1f6f8;学无止境&#xff0c;不骄不躁&#xff0c;知行合一 文章目录 …

解决Chrome浏览器打开flags页面时出现黑屏问题的方法

当我们在使用Chrome浏览器并尝试访问flags页面时&#xff0c;遇到屏幕短暂闪烁或变黑的情况&#xff0c;这可能与启用的硬件加速功能有关。硬件加速是Chrome浏览器的一个功能&#xff0c;旨在利用计算设备的GPU来提高视频播放和图形渲染的性能。然而&#xff0c;在某些情况下&a…

类的成员之三:构造器(Constructor)

类的成员之一&#xff1a;成员变量 (field) 类的成员之二&#xff1a;方法 (method) 我们 new 完对象时&#xff0c;所有成员变量都是默认值&#xff0c;如果我们需要赋别的值&#xff0c;需要挨个为它们再赋值&#xff0c;太麻 烦了。我们能不能在new 对象时&#xff0c;直接…

MySql实战--全局锁和表锁 :给表加个字段怎么有这么多阻碍

今天我要跟你聊聊MySQL的锁。数据库锁设计的初衷是处理并发问题。作为多用户共享的资源&#xff0c;当出现并发访问的时候&#xff0c;数据库需要合理地控制资源的访问规则。而锁就是用来实现这些访问规则的重要数据结构。 根据加锁的范围&#xff0c;MySQL里面的锁大致可以分成…

三元组数据模型:构建知识图谱的基石

目录 前言1. 三元组数据模型概述1.1 定义与结构1.2 特点 2. 三元组在知识图谱中的应用2.1 知识表示2.2 知识推理2.3 数据整合 3 三元组的数据格式3.1 N-Triples &#xff1a;3.2 RDF/XML &#xff1a;3.3 Turtle &#xff08;又称为 Terse RDF Triple Language&#xff09;&…