《游戏-03_3D-开发》之—新输入系统人物移动攻击连击

本次修改unity的新输入输出系统。本次修改unity需要重启,请先保存项目,

点击加号起名为MyCtrl,

点击加号设置为一轴的,

继续设置W键,

保存

生成自动脚本,

修改MyPlayer代码:

using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;
public class MyPlayer : People{
    [Header("==============子类变量==============")]
    public Transform toolPanel;//道具面板
    public Transform skillPanel;//技能面板
    CharacterController contro;
    Controls action;
    float rvalue;
    float spdFast = 1;
    bool isHold;//握刀
    GameObject sword;
    GameObject swordBack;
    public Image imageHp;
    public Image imageMp;
    new void Start(){
        base.Start();
        SetInput();
    }
    void SetInput(){
        action = new Controls();
        action.Enable();
        action.MyCtrl.Move.started += Move;
        action.MyCtrl.Move.performed += Move;
        action.MyCtrl.Move.canceled += StopMove;
    }
    private void StopMove(InputAction.CallbackContext context){
        Anim.SetBool("IsRun", false);
    }
    private void Move(InputAction.CallbackContext context){
        if (GameManager.gameState != GameState.Play)
            return;
        Anim.SetBool("IsRun", true);
    }
}

运行即可实现按键盘w/s键实现跑步松开即停止,

但只能实现动画,不能移动位置,

接下来添加跳跃:

修改MyPlayer代码:

using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;
public class MyPlayer : People{
    [Header("==============子类变量==============")]
    public Transform toolPanel;//道具面板
    public Transform skillPanel;//技能面板
    //public BagPanel bag;//背包
    CharacterController contro;
    Controls action;
    float rvalue;
    float spdFast = 1;
    bool isHold;//握刀
    GameObject sword;
    GameObject swordBack;
    public Image imageHp;
    public Image imageMp;
    new void Start(){
        base.Start();
        SetInput();
    }
    void SetInput(){
        action = new Controls();
        action.Enable();
        action.MyCtrl.Move.started += Move;
        action.MyCtrl.Move.performed += Move;
        action.MyCtrl.Move.canceled += StopMove;
        action.MyCtrl.Jump.started += Jump;
    }
    void Jump(InputAction.CallbackContext obj){
        Anim.SetTrigger("JumpTrigger");
    }
    void StopMove(InputAction.CallbackContext context){
        Anim.SetBool("IsRun", false);
    }
    void Move(InputAction.CallbackContext context){
        if (GameManager.gameState != GameState.Play){
            return;
        }
        Anim.SetBool("IsRun", true);
    }
}

运行即可实现按键盘 空格 键实现跳跃,

但只能实现动画,

接下来设置旋转,

修改MyPlayer代码:

using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;
public class MyPlayer : People{
    [Header("==============子类变量==============")]
    public Transform toolPanel;//道具面板
    public Transform skillPanel;//技能面板
    //public BagPanel bag;//背包
    CharacterController contro;
    Controls action;
    float rvalue;
    float spdFast = 1;
    bool isHold;//握刀
    GameObject sword;
    GameObject swordBack;
    public Image imageHp;
    public Image imageMp;
    new void Start(){
        base.Start();
        SetInput();
    }
    void SetInput(){
        action = new Controls();
        action.Enable();
        action.MyCtrl.Move.started += Move;
        action.MyCtrl.Move.performed += Move;
        action.MyCtrl.Move.canceled += StopMove;
        action.MyCtrl.Jump.started += Jump;
        action.MyCtrl.Rotate.started += Rotate;
        action.MyCtrl.Rotate.performed += Rotate;
    }
    void Rotate(InputAction.CallbackContext obj){
        if (GameManager.gameState != GameState.Play)
            return;
        rvalue = obj.ReadValue<float>();
    }
    void Jump(InputAction.CallbackContext obj){
        Anim.SetTrigger("JumpTrigger");
    }
    void StopMove(InputAction.CallbackContext context){
        Anim.SetBool("IsRun", false);
    }
    void Move(InputAction.CallbackContext context){
        if (GameManager.gameState != GameState.Play){
            return;
        }
        Anim.SetBool("IsRun", true);
    }
}

继续添加新输入系统:


修改MyPlayer代码:

using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;
public class MyPlayer : People{
    [Header("==============子类变量==============")]
    public Transform toolPanel;//道具面板
    public Transform skillPanel;//技能面板
    //public BagPanel bag;//背包
    CharacterController contro;
    Controls action;
    float rvalue;
    float spdFast = 1;
    bool isHold;//握刀
    GameObject sword;
    GameObject swordBack;
    public Image imageHp;
    public Image imageMp;
    new void Start(){
        base.Start();
        SetInput();
    }
    void SetInput(){
        action = new Controls();
        action.Enable();
        action.MyCtrl.Move.started += Move;
        action.MyCtrl.Move.performed += Move;
        action.MyCtrl.Move.canceled += StopMove;
        action.MyCtrl.Jump.started += Jump;
        action.MyCtrl.Rotate.started += Rotate;
        action.MyCtrl.Rotate.performed += Rotate;
        action.MyCtrl.HoldRotate.performed += Hold;
        action.MyCtrl.HoldRotate.canceled += Hold;
    }
    void Hold(InputAction.CallbackContext obj){
        if (GameManager.gameState != GameState.Play)
            return;
        if(obj.phase == InputActionPhase.Canceled)
            isHold = false;
        else
            isHold = true;
    }
    void Rotate(InputAction.CallbackContext obj){
        if (GameManager.gameState != GameState.Play)
            return;
        rvalue = obj.ReadValue<float>();
    }
    void Jump(InputAction.CallbackContext obj){
        Anim.SetTrigger("JumpTrigger");
    }
    void StopMove(InputAction.CallbackContext context){
        Anim.SetBool("IsRun", false);
    }
    void Move(InputAction.CallbackContext context){
        if (GameManager.gameState != GameState.Play){
            return;
        }
        Anim.SetBool("IsRun", true);
    }
}
接下来设置速度,

修改MyPlayer代码:

using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;
public class MyPlayer : People{
    [Header("==============子类变量==============")]
    public Transform toolPanel;//道具面板
    public Transform skillPanel;//技能面板
    //public BagPanel bag;//背包
    CharacterController contro;
    Controls action;
    float rvalue;
    float spdFast = 1;
    bool isHold;//握刀
    GameObject sword;
    GameObject swordBack;
    public Image imageHp;
    public Image imageMp;
    new void Start(){
        base.Start();
        SetInput();
    }
    void SetInput(){
        action = new Controls();
        action.Enable();
        action.MyCtrl.Move.started += Move;
        action.MyCtrl.Move.performed += Move;
        action.MyCtrl.Move.canceled += StopMove;
        action.MyCtrl.Jump.started += Jump;
        action.MyCtrl.Rotate.started += Rotate;
        action.MyCtrl.Rotate.performed += Rotate;
        action.MyCtrl.HoldRotate.performed += Hold;
        action.MyCtrl.HoldRotate.canceled += Hold;
        action.MyCtrl.Fast.started += FastSpeed;
        action.MyCtrl.Fast.performed += FastSpeed;
        action.MyCtrl.Fast.canceled += FastSpeed;
    }
    void FastSpeed(InputAction.CallbackContext obj){
        if (GameManager.gameState != GameState.Play)
            return;
        if (Anim.GetCurrentAnimatorStateInfo(0).IsName("Run_ver_A") ||
           Anim.GetCurrentAnimatorStateInfo(0).IsName("Run_ver_B")){
            if (obj.phase == InputActionPhase.Canceled)
                spdFast = 1;
            else
                spdFast = 0;
        }
    }
    void Hold(InputAction.CallbackContext obj){
        if (GameManager.gameState != GameState.Play)
            return;
        if(obj.phase == InputActionPhase.Canceled)
            isHold = false;
        else
            isHold = true;
    }
    void Rotate(InputAction.CallbackContext obj){
        if (GameManager.gameState != GameState.Play)
            return;
        rvalue = obj.ReadValue<float>();
    }
    void Jump(InputAction.CallbackContext obj){
        Anim.SetTrigger("JumpTrigger");
    }
    void StopMove(InputAction.CallbackContext context){
        Anim.SetBool("IsRun", false);
    }
    void Move(InputAction.CallbackContext context){
        if (GameManager.gameState != GameState.Play){
            return;
        }
        Anim.SetBool("IsRun", true);
    }
}
设置获取道具,

修改MyPlayer代码:

using System;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;
public class MyPlayer : People{
    [Header("==============子类变量==============")]
    public Transform toolPanel;//道具面板
    public Transform skillPanel;//技能面板
    //public BagPanel bag;//背包
    CharacterController contro;
    Controls action;
    float rvalue;
    float spdFast = 1;
    bool isHold;//握刀
    GameObject sword;
    GameObject swordBack;
    public Image imageHp;
    public Image imageMp;
    new void Start(){
        base.Start();
        SetInput();
    }
    void SetInput(){
        action = new Controls();
        action.Enable();
        action.MyCtrl.Move.started += Move;
        action.MyCtrl.Move.performed += Move;
        action.MyCtrl.Move.canceled += StopMove;
        action.MyCtrl.Jump.started += Jump;
        action.MyCtrl.Rotate.started += Rotate;
        action.MyCtrl.Rotate.performed += Rotate;
        action.MyCtrl.HoldRotate.performed += Hold;
        action.MyCtrl.HoldRotate.canceled += Hold;
        action.MyCtrl.Fast.started += FastSpeed;
        action.MyCtrl.Fast.performed += FastSpeed;
        action.MyCtrl.Fast.canceled += FastSpeed;
        action.MyCtrl.GetTool.started += ClickNpcAndTool;
    }
    void ClickNpcAndTool(InputAction.CallbackContext obj){
        //后期拓展
    }

    void FastSpeed(InputAction.CallbackContext obj){
        if (GameManager.gameState != GameState.Play)
            return;
        if (Anim.GetCurrentAnimatorStateInfo(0).IsName("Run_ver_A") ||
           Anim.GetCurrentAnimatorStateInfo(0).IsName("Run_ver_B")){
            if (obj.phase == InputActionPhase.Canceled)
                spdFast = 1;
            else
                spdFast = 0;
        }
    }
    void Hold(InputAction.CallbackContext obj){
        if (GameManager.gameState != GameState.Play)
            return;
        if(obj.phase == InputActionPhase.Canceled)
            isHold = false;
        else
            isHold = true;
    }
    void Rotate(InputAction.CallbackContext obj){
        if (GameManager.gameState != GameState.Play)
            return;
        rvalue = obj.ReadValue<float>();
    }
    void Jump(InputAction.CallbackContext obj){
        Anim.SetTrigger("JumpTrigger");
    }
    void StopMove(InputAction.CallbackContext context){
        Anim.SetBool("IsRun", false);
    }
    void Move(InputAction.CallbackContext context){
        if (GameManager.gameState != GameState.Play){
            return;
        }
        Anim.SetBool("IsRun", true);
    }
}
修改MyPlayer代码:

--------------------------------------------------【添加移动效果】-------------------------------------------------------

using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;
public class MyPlayer : People{
    [Header("==============子类变量==============")]
    public Transform toolPanel;//道具面板
    public Transform skillPanel;//技能面板
    //public BagPanel bag;//背包
    CharacterController contro;
    Controls action;
    float rvalue;
    float spdFast = 1;
    bool isHold;//握刀
    GameObject sword;
    GameObject swordBack;
    public Image imageHp;
    public Image imageMp;
    new void Start(){
        base.Start();
        SetInput();
        //添加角色控制器
        contro = GetComponent<CharacterController>();
    }
    void SetInput(){
        action = new Controls();
        action.Enable();
        action.MyCtrl.Move.started += Move;
        action.MyCtrl.Move.performed += Move;
        action.MyCtrl.Move.canceled += StopMove;
        action.MyCtrl.Jump.started += Jump;
        action.MyCtrl.Rotate.started += Rotate;
        action.MyCtrl.Rotate.performed += Rotate;
        action.MyCtrl.HoldRotate.performed += Hold;
        action.MyCtrl.HoldRotate.canceled += Hold;
        action.MyCtrl.Fast.started += FastSpeed;
        action.MyCtrl.Fast.performed += FastSpeed;
        action.MyCtrl.Fast.canceled += FastSpeed;
        action.MyCtrl.GetTool.started += ClickNpcAndTool;
    }
    void ClickNpcAndTool(InputAction.CallbackContext obj){
        //后期拓展
    }
    void FastSpeed(InputAction.CallbackContext obj){
        if (GameManager.gameState != GameState.Play)
            return;
        if (Anim.GetCurrentAnimatorStateInfo(0).IsName("Run_ver_A") ||
           Anim.GetCurrentAnimatorStateInfo(0).IsName("Run_ver_B")){
            if (obj.phase == InputActionPhase.Canceled)
                spdFast = 1;
            else
                spdFast = 0;
        }
    }
    void Hold(InputAction.CallbackContext obj){
        if (GameManager.gameState != GameState.Play)
            return;
        if(obj.phase == InputActionPhase.Canceled)
            isHold = false;
        else
            isHold = true;
    }
    void Rotate(InputAction.CallbackContext obj){
        if (GameManager.gameState != GameState.Play)
            return;
        rvalue = obj.ReadValue<float>();
    }
    void Jump(InputAction.CallbackContext obj){
        Anim.SetTrigger("JumpTrigger");
    }
    void StopMove(InputAction.CallbackContext context){
        Anim.SetBool("IsRun", false);
    }
    void Move(InputAction.CallbackContext context){
        if (GameManager.gameState != GameState.Play){
            return;
        }
        Anim.SetBool("IsRun", true);
    }
    void Ctrl() {
        if (Anim.GetCurrentAnimatorStateInfo(0).IsName("Run_ver_A") ||
           Anim.GetCurrentAnimatorStateInfo(0).IsName("Run_ver_B") ||
           Anim.GetCurrentAnimatorStateInfo(0).IsName("Idle_ver_A") ||
           Anim.GetCurrentAnimatorStateInfo(0).IsName("Idle_Fight")) {
            float f = action.MyCtrl.Move.ReadValue<float>();
            contro.Move(transform.forward * f * Time.deltaTime * spdFast * Spd);
            contro.Move(transform.up * -9.8f * Time.deltaTime);
            if (isHold)
                transform.Rotate(transform.up * rvalue * 0.3f);
        }
    }
    void Update(){
        if (GameManager.gameState != GameState.Play)
            return;
        Ctrl();
    }
}

在unity场景中对Player添加角色控制器,

运行即可实现移动,

设置拔剑,

设置攻击,

修改MyPlayer代码:

using System;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.InputSystem;
using UnityEngine.UI;
public class MyPlayer : People{
    [Header("==============子类变量==============")]
    public Transform toolPanel;//道具面板
    public Transform skillPanel;//技能面板
    //public BagPanel bag;//背包
    CharacterController contro;
    Controls action;
    float rvalue;
    float spdFast = 1;
    bool isHold;//握刀
    GameObject sword;
    GameObject swordBack;
    public Image imageHp;
    public Image imageMp;
    new void Start(){
        base.Start();
        //添加角色控制器
        contro = GetComponent<CharacterController>();
        SetInput();
    }
    void SetInput(){
        action = new Controls();
        action.Enable();
        action.MyCtrl.Move.started += Move;
        action.MyCtrl.Move.performed += Move;
        action.MyCtrl.Move.canceled += StopMove;
        action.MyCtrl.Jump.started += Jump;
        action.MyCtrl.Rotate.started += Rotate;
        action.MyCtrl.Rotate.performed += Rotate;
        action.MyCtrl.HoldRotate.performed += Hold;
        action.MyCtrl.HoldRotate.canceled += Hold;
        action.MyCtrl.Fast.started += FastSpeed;
        action.MyCtrl.Fast.performed += FastSpeed;
        action.MyCtrl.Fast.canceled += FastSpeed;
        action.MyCtrl.GetTool.started += ClickNpcAndTool;
        action.MyAtt.SwordOut.started += SwordOut;
        action.MyAtt.Att.started += Attack;
    }
    void Attack(InputAction.CallbackContext obj){
        //if (GameManager.gameState != GameState.Play)
        //    return;
        //if (EventSystem.current.IsPointerOverGameObject())
        //    return;
        if (Anim.GetCurrentAnimatorStateInfo(0).IsName("Idle_Fight")){
            Anim.SetInteger("AttackID", 1);
            Anim.SetTrigger("AttackTrigger");
        }
        else {
            int num = Anim.GetInteger("AttackID");
            if (num == 6)
                return;
            if (Anim.GetCurrentAnimatorStateInfo(0).IsName("Attack_" + num))
                Anim.SetInteger("AttackID", num + 1);
        }
    }
    public void PlayerAttack(string hurt) {
        Collider[] cs = Physics.OverlapBox(attPoint.position, Vector3.one * 0.5f,
            attPoint.rotation, LayerMask.GetMask("Enemy"));
        if (cs.Length <= 0)
            return;
        int value = (int)(Att * Anim.GetInteger("AttackID") * 0.5f);
        foreach (Collider c in cs) {
            print(value);
        }
    }
    void SwordOut(InputAction.CallbackContext obj){
        if (GameManager.gameState != GameState.Play)
            return;
        Anim.SetBool("IsSwordOut",!Anim.GetBool("IsSwordOut"));
    }
    void ClickNpcAndTool(InputAction.CallbackContext obj){
        //后期拓展
    }
    void FastSpeed(InputAction.CallbackContext obj){
        if (GameManager.gameState != GameState.Play)
            return;
        if (Anim.GetCurrentAnimatorStateInfo(0).IsName("Run_ver_A") ||
           Anim.GetCurrentAnimatorStateInfo(0).IsName("Run_ver_B")){
            if (obj.phase == InputActionPhase.Canceled)
                spdFast = 1;
            else
                spdFast = 0;
        }
    }
    void Hold(InputAction.CallbackContext obj){
        if (GameManager.gameState != GameState.Play)
            return;
        if(obj.phase == InputActionPhase.Canceled)
            isHold = false;
        else
            isHold = true;
    }
    void Rotate(InputAction.CallbackContext obj){
        if (GameManager.gameState != GameState.Play)
            return;
        rvalue = obj.ReadValue<float>();
    }
    void Jump(InputAction.CallbackContext obj){
        Anim.SetTrigger("JumpTrigger");
    }
    void StopMove(InputAction.CallbackContext context){
        Anim.SetBool("IsRun", false);
    }
    void Move(InputAction.CallbackContext context){
        if (GameManager.gameState != GameState.Play){
            return;
        }
        Anim.SetBool("IsRun", true);
    }
    void Ctrl() {
        if (Anim.GetCurrentAnimatorStateInfo(0).IsName("Run_ver_A") ||
           Anim.GetCurrentAnimatorStateInfo(0).IsName("Run_ver_B") ||
           Anim.GetCurrentAnimatorStateInfo(0).IsName("Idle_ver_A") ||
           Anim.GetCurrentAnimatorStateInfo(0).IsName("Idle_Fight")) {
            float f = action.MyCtrl.Move.ReadValue<float>();
            contro.Move(transform.forward * f * Time.deltaTime * spdFast * Spd);
            contro.Move(transform.up * -9.8f * Time.deltaTime);
            if (isHold)
                transform.Rotate(transform.up * rvalue * 0.3f);
        }
    }
    void Update(){
        if (GameManager.gameState != GameState.Play)
            return;
        Ctrl();
    }
}

运行及实现,

w/s键控制前行后退,空格跳跃,鼠标右键转动视角,按E键进入战斗状态,可以进行攻击,左键连续点击实现连击效果,再按E键进入非战斗状态,不能进行攻击,

End.

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

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

相关文章

设计模式二(工厂模式)

本质&#xff1a;实例化对象不用new&#xff0c;用工厂代替&#xff0c;实现了创建者和调用者分离 满足&#xff1a; 开闭原则&#xff1a;对拓展开放&#xff0c;对修改关闭 依赖倒置原则&#xff1a;要针对接口编程 迪米特原则&#xff1a;最少了解原则&#xff0c;只与自己直…

DDPM的一点笔记

1 Title Denoising Diffusion Probabilistic Models&#xff08;Jonathan Ho、Ajay Jain、Pieter Abbeel&#xff09; 2 Conclusion This paper present high quality image synthesis results using diffusion probabilistic models, a class of latent variable models insp…

【Qt】—— Qt开发环境的搭建

目录 &#xff08;一&#xff09;Qt的开发⼯具概述 1.1 Qt Creator 1.2 Visual Studio 1.3 Eclipse &#xff08;二&#xff09;Qt SDK的下载和安装 2.1 QtSDK的下载 2.2 QtSDK的安装 2.3 验证QtSDK安装是否成功 2.4 Qt环境变量配置 &#xff08;一&#xff09;Qt的…

yolov8 opencv dnn部署 github代码

源码地址 本人使用的opencv c github代码,代码作者非本人 实现推理源码中作者的yolov8s.onnx 推理条件 windows 10 Visual Studio 2019 Nvidia GeForce GTX 1070 opencv4.7.0 (opencv4.5.5在别的地方看到不支持yolov8的推理&#xff0c;所以只使用opencv4.7.0) c部署 先将…

一、防御保护---信息安全概述

一、网络安全防御---信息安全概述 1.信息安全现状及挑战1.1 网络空间安全市场在中国&#xff0c;潜力无穷1.2 数字化时代威胁升级1.3 传统安全防护逐步失效1.4 安全风险能见度不足1.5 缺乏自动化防御手段1.6 网络安全监管标准愈发严苛 2.信息安全概述2.1 简介2.2 常见的网络安全…

分币不花,K哥带你白嫖海外代理 ip!

前言 近来&#xff0c;国内的数据采集环境越来越严峻&#xff0c;不是“非法入侵计算机信息系统”&#xff0c;就是“侵犯公民个人隐私信息”&#xff0c;一个帽子砸下来&#xff0c;直接就“包吃包住”&#xff0c;推荐阅读一下 【K哥爬虫普法专栏】。虽然大伙常说“搏一搏单…

weak_ptr 与 一个难发现的错误(循环依赖问题)笔记

推荐B站视频&#xff1a;7.weak_ptr与一个非常难发现的错误_哔哩哔哩_bilibilihttps://www.bilibili.com/video/BV18B4y187uL/?p7&spm_id_frompageDriver&vd_sourcea934d7fc6f47698a29dac90a922ba5a3一、weak_ptr weak_ptr并不拥有所有权并不能调用 -> 和 解引…

【MySQL】如何使用图形化界面DataGrip操作数据库

&#x1f308;个人主页: Aileen_0v0 &#x1f525;热门专栏: 华为鸿蒙系统学习|计算机网络|数据结构与算法 ​&#x1f4ab;个人格言:“没有罗马,那就自己创造罗马~” #mermaid-svg-W5JDg0WA1tjEP66Y {font-family:"trebuchet ms",verdana,arial,sans-serif;font-siz…

uniapp Android 离线打包之未配置appkey或配置错误

1、去官网申请appKey: 申请Appkey 2、项目中使用appKey: <meta-dataandroid:name"dcloud_appkey"android:value"794534204bbae06989........" />3、参考 官方教程&#xff0c;修改配置&#xff1a; 配置教程 注意&#xff1a; 本地的appId 和 官…

如何解决Flutter应用程序的兼容性问题

随着移动应用开发领域的不断发展&#xff0c;Flutter作为一种跨平台框架&#xff0c;受到了越来越多开发者的青睐。要确保Flutter应用程序能够在不同的设备和操作系统上稳定运行&#xff0c;并提供一致的用户体验&#xff0c;我们需要重视应用程序的兼容性问题。下面将简单的介…

【代码随想录-数组】有序数组的平方

💝💝💝欢迎来到我的博客,很高兴能够在这里和您见面!希望您在这里可以感受到一份轻松愉快的氛围,不仅可以获得有趣的内容和知识,也可以畅所欲言、分享您的想法和见解。 推荐:kwan 的首页,持续学习,不断总结,共同进步,活到老学到老导航 檀越剑指大厂系列:全面总结 jav…

HTML-表单

表单 概念&#xff1a;一个包含交互的区域&#xff0c;用于收集用户提供的数据。 1.基本结构 示例代码&#xff1a; <form action"https://www.baidu.com/s" target"_blank" method"get"><input type"text" name"wd&q…

独立站怎么建设对seo好?

现如今市面上就有不少开源的建站程序可供挑选&#xff0c;哪怕你不懂技术&#xff0c;不懂代码&#xff0c;也能建自己的独立站&#xff0c;效果比不少所谓的用自己技术开发的站都要好&#xff0c;本身做一个网站不难&#xff0c;但你做网站的目的是什么&#xff1f;是为了在搜…

ctf-idea调试jar包

0.拿到jar包并解压 进入解压出来的目录,然后以该目录打开项目 1.设置maven 设不设置都行 2.添加依赖 添加两个依赖, boot-inf下的 classes和lib 3.配置调试器 添加 remote jvm debug 1.根据jdk版本选择调试参数 2.选择module classpath为解压后的文件夹名 如图,运行jar包的…

代码随想录Day31 | 贪心算法 455.分发饼干 376. 摆动序列 53. 最大子序和

代码随想录Day31 | 贪心算法 455.分发饼干 376. 摆动序列 53. 最大子序和 贪心算法455.分发饼干376.摆动序列53.最大子序和 贪心算法 局部最佳 --> 全局最佳 刷题或者面试的时候&#xff0c;手动模拟一下感觉可以局部最优推出整体最优&#xff0c;而且想不到反例&#xff0…

【QT+QGIS跨平台编译】之九:【LZ4+Qt跨平台编译】(一套代码、一套框架,跨平台编译)

文章目录 一、LZ4介绍二、文件下载三、文件分析四、pro文件五、编译实践一、LZ4介绍 LZ4是一种无损压缩算法,压缩速度为每核心400MB/s。 LZ4是目前效率最高的压缩算法,更加侧重于压缩/解压缩速度,压缩比并不突出,本质上就是时间换空间。 LZ4库是使用BSD许可证作为开放源码…

Linux——shell程序的简单实现

shell程序的简单实现 本章思维导图&#xff1a; 注&#xff1a;本章思维导图对应的.xmind和.png文件都已同步导入至资源&#xff0c;可免费查阅 在学习完有关进程的知识后&#xff0c;我们就可以开始尝试自己实现一个简单的shell程序了。 注&#xff1a;在编写简单的shell程…

Linux实现:从倒计时到进度条

文章目录 1.回车与换行2.缓冲区的概念3.倒计时4.进度条(第一版无应用场景)5.进度条(第二版有应用场景) 1.回车与换行 2.缓冲区的概念 强制刷新可以使用冲刷函数fflush #include <stdio.h> #include <unistd.h> int main() {printf("I am a \nhandsome man!&q…

leetcode 第三弹

链表声明&#xff1a; * Definition for singly-linked list.* struct ListNode {* int val;* ListNode *next;* ListNode() : val(0), next(nullptr) {}* ListNode(int x) : val(x), next(nullptr) {}* ListNode(int x, ListNode *next) : val(x), next(n…

【K12】tk窗口+plt图像功能-学习物理中的串并联研究【附源码说明】

程序源码 import tkinter as tk import matplotlib.pyplot as plt# 初始化 matplotlib 的字体设置 plt.rcParams[font.family] SimHei# 计算串联电路的函数 def calculate_series():try:# 获取用户输入的电阻值并转换为浮点数r1 float(entry_r1.get())r2 float(entry_r2.ge…