Unity类银河恶魔城学习记录12-17 p139 In game UI源代码
Alex教程每一P的教程原代码加上我自己的理解初步理解写的注释,可供学习Alex教程的人参考
此代码仅为较上一P有所改变的代码
【Unity教程】从0编程制作类银河恶魔城游戏_哔哩哔哩_bilibili

UI.cs
using UnityEngine;public class UI : MonoBehaviour
{[SerializeField] private GameObject characterUI;[SerializeField] private GameObject skillTreeUI;[SerializeField] private GameObject craftUI;[SerializeField] private GameObject optionsUI;[SerializeField] private GameObject inGameUI;public UI_itemTooltip itemToolTip;public UI_statToolTip statToopTip;public Ui_SkillToolTip skillToolTip;public UI_CraftWindow craftWindow;public void Awake(){SwitchTo(skillTreeUI);//修复可能出现skill没法加载成功的bug}public void Start(){SwitchTo(inGameUI);itemToolTip.gameObject.SetActive(false);statToopTip.gameObject.SetActive(false);}private void Update(){if(Input.GetKeyDown(KeyCode.C)){SwitchWithKeyTo(characterUI);}if(Input.GetKeyDown(KeyCode.B)){SwitchWithKeyTo(craftUI);}if(Input.GetKeyDown(KeyCode.K)){SwitchWithKeyTo(skillTreeUI);}if(Input.GetKeyDown(KeyCode.O)){SwitchWithKeyTo(optionsUI);} }public void SwitchTo(GameObject _menu)//切换窗口函数{for (int i = 0; i < transform.childCount; i++){transform.GetChild(i).gameObject.SetActive(false);}if (_menu != null){_menu.SetActive(true);}}public void SwitchWithKeyTo(GameObject _menu)//键盘切换窗口函数{if (_menu != null && _menu.activeSelf)//通过判断是否传入mune和mune是否激活来决定使设置为可视或不可使{_menu.SetActive(false);CheckForInGameUI();return;}SwitchTo(_menu);}private void CheckForInGameUI()//当其他UI不在时自动切换值InGameUI函数{for(int i = 0; i < transform.childCount; i++){if (transform.GetChild(i).gameObject.activeSelf)return;}SwitchTo(inGameUI);}
}
UI_InGame.cs
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;public class UI_InGame : MonoBehaviour
{[SerializeField] private PlayerStats playerStats;[SerializeField] Slider slider;[SerializeField] private Image dashImage;[SerializeField] private Image parryImage;[SerializeField] private Image crystalImage;[SerializeField] private Image swordImage;[SerializeField] private Image blackholeImage;[SerializeField] private Image flaskholeImage;[SerializeField] private TextMeshProUGUI currentSouls;private SkillManager skills;void Start() {if(playerStats != null){playerStats.onHealthChanged += UpdateHealthUI;}skills = SkillManager.instance;}// Update is called once per framevoid Update(){currentSouls.text = PlayerManager.instance.GetCurrency().ToString("#,#");if(Input.GetKeyDown(KeyCode.LeftShift) && skills.dash.dashUnlocked)//使用技能后图标变黑{SetCoolDownOf(dashImage);}if (Input.GetKeyDown(KeyCode.Q) && skills.parry.parryUnlocked){SetCoolDownOf(parryImage);}if (Input.GetKeyDown(KeyCode.F) && skills.crystal.crystalUnlocked){SetCoolDownOf(crystalImage);}if (Input.GetKeyDown(KeyCode.Mouse1)&& skills.sword.swordUnlocked){SetCoolDownOf(swordImage);}if (Input.GetKeyDown(KeyCode.R) && skills.blackhole.blackholeUnlocked){SetCoolDownOf(blackholeImage);}if (Input.GetKeyDown(KeyCode.Alpha1) && Inventory.instance.GetEquipment(EquipmentType.Flask) != null){SetCoolDownOf(flaskholeImage);}CheckCooldown(dashImage, skills.dash.cooldown);CheckCooldown(parryImage, skills.parry.cooldown);CheckCooldown(crystalImage, skills.crystal.cooldown);CheckCooldown(swordImage, skills.sword.cooldown);CheckCooldown(blackholeImage, skills.blackhole.cooldown);CheckCooldown(flaskholeImage, Inventory.instance.flaskCooldown);}private void UpdateHealthUI()//更新血量条函数,此函数由Event触发{slider.maxValue = playerStats.GetMaxHealthValue();slider.value = playerStats.currentHealth;}private void SetCoolDownOf(Image _image)//使用技能后使图标变黑的函数{if (_image.fillAmount <= 0)_image.fillAmount = 1;}private void CheckCooldown(Image _image,float _cooldown)//使图标根据cd逐渐变白的函数{if(_image.fillAmount > 0){_image.fillAmount -= 1 / _cooldown * Time.deltaTime;}}
}
Inventory.cs
using System.Collections.Generic;
using UnityEngine;public class Inventory : MonoBehaviour
{public static Inventory instance;public List<ItemData> startingItem;public List<InventoryItem> equipment;//inventoryItems类型的列表public Dictionary<ItemData_Equipment, InventoryItem> equipmentDictionary;//以ItemData为Key寻找InventoryItem的字典public List<InventoryItem> inventory;//inventoryItems类型的列表public Dictionary<ItemData, InventoryItem> inventoryDictionary;//以ItemData为Key寻找InventoryItem的字典public List<InventoryItem> stash;public Dictionary<ItemData, InventoryItem> stashDictionary;[Header("Inventory UI")][SerializeField] private Transform inventorySlotParent;[SerializeField] private Transform stashSlotParent;[SerializeField] private Transform equipmentSlotParent;[SerializeField] private Transform statSlotParent;private UI_itemSlot[] inventoryItemSlot;//UI Slot的数组private UI_itemSlot[] stashItemSlot;private UI_equipementSlots[] equipmentSlot;private UI_statslot[] statSlot;[Header("Items cooldown")]private float lastTimeUsedFlask;private float lastTimeUsedArmor;public float flaskCooldown { get; private set; }private float armorCooldown;private void Awake(){if (instance == null)instance = this;elseDestroy(gameObject);//防止多次创建Inventory}public void Start(){inventory = new List<InventoryItem>();inventoryDictionary = new Dictionary<ItemData, InventoryItem>();stash = new List<InventoryItem>();stashDictionary = new Dictionary<ItemData, InventoryItem>();equipment = new List<InventoryItem>();equipmentDictionary = new Dictionary<ItemData_Equipment, InventoryItem>();inventoryItemSlot = inventorySlotParent.GetComponentsInChildren<UI_itemSlot>();//拿到的方式有点绕,显示拿到Canvas 里的 Inventory 然后通过GetComponentsInChildren拿到其下的使用UISlotstashItemSlot = stashSlotParent.GetComponentsInChildren<UI_itemSlot>();equipmentSlot = equipmentSlotParent.GetComponentsInChildren<UI_equipementSlots>();statSlot = statSlotParent.GetComponentsInChildren<UI_statslot>();AddStartingItems();}private void AddStartingItems(){for (int i = 0; i < startingItem.Count; i++){AddItem(startingItem[i]);}}//设置初始物品public void EquipItem(ItemData _item){//解决在itemdata里拿不到子类equipment里的enum的问题ItemData_Equipment newEquipment = _item as ItemData_Equipment;//https://www.bilibili.com/read/cv15551811///将父类转换为子类InventoryItem newItem = new InventoryItem(newEquipment);ItemData_Equipment oldEquipment = null;foreach (KeyValuePair<ItemData_Equipment, InventoryItem> item in equipmentDictionary)//这种方法可以同时拿到key和value保存到item里面{if (item.Key.equipmentType == newEquipment.equipmentType)//将拿到的key与转换成itemdata_equipment类型的_item的type对比拿到存在的key{oldEquipment = item.Key;//此key需保存在外部的data类型里//equipment.Remove(item.Value);//equipmentDictionary.Remove(item.Key);}}//好像用foreach里的value和key无法对外部的list和字典进行操作if (oldEquipment != null){AddItem(oldEquipment);Unequipment(oldEquipment);}equipment.Add(newItem);equipmentDictionary.Add(newEquipment, newItem);RemoveItem(_item);newEquipment.AddModifiers();UpdateSlotUI();}//装备装备的函数public void Unequipment(ItemData_Equipment itemToRemove)//装备其他同类型的装备时。去除已装备的装备{if (equipmentDictionary.TryGetValue(itemToRemove, out InventoryItem value)){equipment.Remove(value);equipmentDictionary.Remove(itemToRemove);itemToRemove.RemoveModifiers();UpdateSlotUI();}}private void UpdateSlotUI()//更新槽UI的函数{for (int i = 0; i < equipmentSlot.Length; i++){//此步骤用于将对应类型的武器插入对应的槽内foreach (KeyValuePair<ItemData_Equipment, InventoryItem> item in equipmentDictionary)//这种方法可以同时拿到key和value保存到item里面{if (item.Key.equipmentType == equipmentSlot[i].slotType){equipmentSlot[i].UpdateSlots(item.Value);}}}//解决出现UI没有跟着Inventory变化的bugfor (int i = 0; i < inventoryItemSlot.Length; i++){inventoryItemSlot[i].CleanUpSlot();}for (int i = 0; i < stashItemSlot.Length; i++){stashItemSlot[i].CleanUpSlot();}for (int i = 0; i < inventory.Count; i++){inventoryItemSlot[i].UpdateSlots(inventory[i]);}for (int i = 0; i < stash.Count; i++){stashItemSlot[i].UpdateSlots(stash[i]);}UpdateStatsUI();}public void UpdateStatsUI()//更新状态UI函数{for (int i = 0; i < statSlot.Length; i++){statSlot[i].UpdateStatValueUI();}}public void AddItem(ItemData _item)//添加物体的函数{if (_item.itemType == ItemType.Equipment && CanAddItem())//修复Inventory数量大于Slot能存放的数量时报错的Bug{AddToInventory(_item);}else if (_item.itemType == ItemType.Material){AddToStash(_item);}UpdateSlotUI();}private void AddToStash(ItemData _item)//向stash加物体的函数{if (stashDictionary.TryGetValue(_item, out InventoryItem value))//只有这种方法才能在查找到是否存在key对应value是否存在的同时,能够同时拿到value,其他方法的拿不到value{value.AddStack();}//字典的使用,通过ItemData类型的数据找到InventoryItem里的与之对应的同样类型的数据else//初始时由于没有相同类型的物体,故调用else是为了初始化库存,使其中含有一个基本的值{InventoryItem newItem = new InventoryItem(_item);stash.Add(newItem);//填进列表里只有一次stashDictionary.Add(_item, newItem);//同上}UpdateSlotUI();}private void AddToInventory(ItemData _item){if (inventoryDictionary.TryGetValue(_item, out InventoryItem value))//只有这种方法才能在查找到是否存在key对应value是否存在的同时,能够同时拿到value,其他方法的拿不到value{value.AddStack();}//字典的使用,通过ItemData类型的数据找到InventoryItem里的与之对应的同样类型的数据else//初始时由于没有相同类型的物体,故调用else是为了初始化库存,使其中含有一个基本的值{InventoryItem newItem = new InventoryItem(_item);inventory.Add(newItem);//填进列表里只有一次inventoryDictionary.Add(_item, newItem);//同上}}//将物体存入Inventory的函数public void RemoveItem(ItemData _item)//修复Inventory数量大于Slot能存放的数量时报错的Bug{if (inventoryDictionary.TryGetValue(_item, out InventoryItem value)){if (value.stackSize <= 1){inventory.Remove(value);inventoryDictionary.Remove(_item);}elsevalue.RemoveStack();}if (stashDictionary.TryGetValue(_item, out InventoryItem stashValue)){if (stashValue.stackSize <= 1){stash.Remove(stashValue);stashDictionary.Remove(_item);}elsestashValue.RemoveStack();}UpdateSlotUI();}public bool CanAddItem()//通过Inventory数量和Slot能存放的数量进行对比,确定是否可以添加新的装备到装备槽{if (inventory.Count >= inventoryItemSlot.Length){return false;}return true;}public List<InventoryItem> GetEquipmentList() => equipment;public List<InventoryItem> GetStashList() => stash;public ItemData_Equipment GetEquipment(EquipmentType _Type)//通过Type找到对应的已装备装备的函数{ItemData_Equipment equipedItem = null;foreach (KeyValuePair<ItemData_Equipment, InventoryItem> item in equipmentDictionary)if (item.Key.equipmentType == _Type){equipedItem = item.Key;}return equipedItem;}public void UseFlask()//使用药瓶设置冷却时间{ItemData_Equipment currentFlask = GetEquipment(EquipmentType.Flask);if (currentFlask == null)return;//使用药瓶设置冷却时间bool canUseFlask = Time.time > lastTimeUsedFlask + flaskCooldown;if (canUseFlask){flaskCooldown = currentFlask.itemCooldown;currentFlask.Effect(null);lastTimeUsedFlask = Time.time;}else{Debug.Log("Flask is Cooldown");}}//使用药瓶函数public bool CanUseArmor(){ItemData_Equipment currentArmor = GetEquipment(EquipmentType.Armor);if (Time.time > lastTimeUsedArmor + armorCooldown){lastTimeUsedArmor = Time.time;armorCooldown = currentArmor.itemCooldown;return true;}Debug.Log("Armor on cooldown");return false;}public bool CanCraft(ItemData_Equipment _itemToCraft, List<InventoryItem> _requiredMaterials){List<InventoryItem> materialsToRemove = new List<InventoryItem>();for (int i = 0; i < _requiredMaterials.Count; i++){if (stashDictionary.TryGetValue(_requiredMaterials[i].data, out InventoryItem stashValue))//判断数量是否足够{if (stashValue.stackSize < _requiredMaterials[i].stackSize){Debug.Log("not enough materials");return false;}else{materialsToRemove.Add(stashValue);}}else{Debug.Log("not enough materials");return false;}}for (int i = 0; i < materialsToRemove.Count; i++){RemoveItem(materialsToRemove[i].data);}AddItem(_itemToCraft);Debug.Log("Here is your item " + _itemToCraft.name);return true;}//检测材料足够制造对应装备的函数
}
Skill.cs
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;public class Skill : MonoBehaviour
{public float cooldown;protected float cooldownTimer;protected Player player;//拿到playerprotected virtual void Start(){player = PlayerManager.instance.player;//拿到player}protected virtual void Update(){cooldownTimer -= Time.deltaTime;}public virtual bool CanUseSkill(){if (cooldownTimer < 0){UseSkill();cooldownTimer = cooldown;return true;}else{Debug.Log("Skill is on cooldown");return false;}}public virtual void UseSkill(){// do some skill thing}//整理能返回最近敌人位置的函数protected virtual Transform FindClosestEnemy(Transform _checkTransform){Collider2D[] colliders = Physics2D.OverlapCircleAll(_checkTransform.position, 25);//找到环绕自己的所有碰撞器float closestDistance = Mathf.Infinity;//正无穷大的表示形式(只读)Transform closestEnemy = null;//https://docs.unity3d.com/cn/current/ScriptReference/Mathf.Infinity.htmlforeach (var hit in colliders){if (hit.GetComponent<Enemy>() != null){float distanceToEnemy = Vector2.Distance(_checkTransform.position, hit.transform.position);//拿到与敌人之间的距离if (distanceToEnemy < closestDistance)//比较距离,如果离得更近,保存这个敌人的位置,更改最近距离{closestDistance = distanceToEnemy;closestEnemy = hit.transform;}}}return closestEnemy;}}
PlayerManager.cs
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;public class PlayerManager : MonoBehaviour
{public static PlayerManager instance;public Player player;//这是通过在外部设置了一个组件,让这个组件能够直接把Player找到,从而减少FInd的方式所带来的高负载public int currency;private void Awake(){if(instance != null){Destroy(instance.gameObject);}elseinstance = this;}public bool HaveEnoughMoney(int _price){if(_price > currency){Debug.Log("Not enough money");return false;}currency -= _price;return true;}public int GetCurrency() => currency;
}
相关文章:
Unity类银河恶魔城学习记录12-17 p139 In game UI源代码
Alex教程每一P的教程原代码加上我自己的理解初步理解写的注释,可供学习Alex教程的人参考 此代码仅为较上一P有所改变的代码 【Unity教程】从0编程制作类银河恶魔城游戏_哔哩哔哩_bilibili UI.cs using UnityEngine;public class UI : MonoBehaviour {[SerializeFie…...
MongoDB学习【一】MongoDB简介和部署
MongoDB简介 MongoDB是一种开源的、面向文档的、分布式的NoSQL数据库系统,由C语言编写而成。它的设计目标是为了适应现代Web应用和大数据处理场景的需求,提供高可用性、横向扩展能力和灵活的数据模型。 主要特点: 文档模型: Mon…...
html 引入vue Element ui 的方式
第一种:使用CDN的方式引入 <!--引入 element-ui 的样式,--> <link rel"stylesheet" href"https://unpkg.com/element-ui/lib/theme-chalk/index.css"> <!-- 必须先引入vue, 后使用element-ui --> <…...
曾经备受追捧的海景房,为何如今却没人要了?
独家首发 ------------ 全国多地的海景房如威海乳山、惠州大亚湾、北海银滩等多地的海景房如今大跌也难以卖出,与当初各地对海景房的追捧形成了鲜明对比,为何这些海景房变成如此样子,在于现实与宣传存在着很大的区别。 曾几何时面朝大海鸟语花…...
[docker] 镜像部分补充
[docker] 镜像部分补充 这里补充一下比较少用的,关于镜像的内容 检查镜像 ❯ docker images REPOSITORY TAG IMAGE ID CREATED SIZE <none> <none> ca61c1748170 2 hours ago 1.11GB node latest 5212d…...
Android(Kotlin) 委托(by) 封装 SharedPreferences
在 Kotlin 中,委托是一种通过将自身的某个功能交给另一个对象来实现代码重用的技术。通过委托,我们可以将某个属性或方法的实现委托给另一个对象,从而减少重复代码的编写。委托可以用于实现多重继承、代码复用和扩展现有类的功能。 Kotlin 中…...
2022年蓝桥杯省赛软件类C/C++B组----积木画
想借着这一个题回顾一下动态规划问题的基本解法,让解题方法清晰有条理,希望更多的人可以更轻松的理解动态规划! 目录 【题目】 【本题解题思路】 【DP模版】 总体方针: 具体解题时的套路: 【题目】 【本题解题思…...
Python数据挖掘项目开发实战:使用朴素贝叶斯进行社会媒体挖掘
注意:本文下载的资源,与以下文章的思路有相同点,也有不同点,最终目标只是让读者从多维度去熟练掌握本知识点。 Python数据挖掘项目开发实战:使用朴素贝叶斯进行社会媒体挖掘 一、项目背景与目标 在社交媒体时代&…...
【DM8】ET SQL性能分析工具
通过统计SQL每个操作符的时间花费,从而定位到有性能问题的操作,指导用户去优化。 开启ET工具 INI参数: ENABLE_MONITOR1 MONITOR_SQL_EXEC1 查看参数 select * FROM v$dm_ini WHERE PARA_NAMEMONITOR_SQL_EXEC;SELECT * FROM v$dm_ini WH…...
001-谷粒商城-微服务剖析
1、架构图 还是很强的,该有的都有 2、微服务模块 SpringCloudAlibaba组件包括 SentinelNacosRocketMQSeata 搭配SpringCloudAlibaba组件 OpenFeignGateWayRibbn gateway使用了SpringWebFlux,前几天研究到,为什么springboot不直接使用Spri…...
vue实现前端打印效果
如图效果所示(以下演示代码) <template><div><el-button v-print"printObj" type"primary" plain click"handle">{{ text }}</el-button><div style"display: none"><div id…...
android wifi直连 wifip2pmanager
android wifi直连 wifip2pmanager;使用WiFi 直连,然后通过udp进行通讯。 Android WiFi 直连(Wi-Fi Direct,也称为Wi-Fi P2P)是一种让两台或多台设备通过Wi-Fi技术直接进行点对点连接的技术,无需借助传统的无…...
伸缩应用程序和执行滚动更新
📕作者简介: 过去日记,致力于Java、GoLang,Rust等多种编程语言,热爱技术,喜欢游戏的博主。 📘相关专栏Rust初阶教程、go语言基础系列、spring教程等,大家有兴趣的可以看一看 📙Jav…...
解决WPS右键菜单冗余选项,去除WPS右键菜单选项
问题描述 安装WPS后,右键菜单会多出许多无用的选项,如何去除? 解决方法 按下WindowsS打开搜索栏,搜索配置工具打开 勾选所有的关闭和隐藏选项...
部署ELFK+zookeeper+kafka架构
目录 前言 一、环境部署 二、部署ELFK 1、ELFK ElasticSearch 集群部署 1.1 配置本地hosts文件 1.2 安装 elasticsearch-rpm 包并加载系统服务 1.3 修改 elasticsearch 主配置文件 1.4 创建数据存放路径并授权 1.5 启动elasticsearch是否成功开启 1.6 查看节点信息 …...
ActiveMQ 任意文件上传漏洞复现
一、使用弱口令登陆 访问 http://ip:8161/admin/ 进入admin登陆页面,使用弱口令登陆,账号密码皆为 admin,登陆成功后,headers中会出现验证信息 如: Authorization: Basic YWRtaW46YWRtaW4 # 二、利用PUT协议上…...
k8s实践总结
一、pod常用操作: 1、如何重启pod? 1.1 删除并重新创建Pod 这是最直接的方法。你可以通过kubectl命令行工具删除Pod,然后Kubernetes将基于其对应的Deployment、ReplicaSet或其他控制器自动重新创建它。 不建议并行删除全部pod,…...
前端从零到一搭建脚手架并发布到npm
这里写自定义目录标题 为什么需要脚手架?前置-第三方工具的使用1. 创建demo并运行-4步新建文件夹 zyfcli,并初始化npm init -y配置入口文件 2.commander-命令行指令3. chalk-命令行美化工具4. inquirer-命令行交互工具5. figlet-艺术字6. ora-loading工具…...
使用 git 提交项目到 github
文章推荐:https://zhuanlan.zhihu.com/p/193140870 连接失败:https://zhuanlan.zhihu.com/p/521340971 分支出错:https://blog.csdn.net/gongdamrgao/article/details/115032436...
SRE 与传统 IT 运营有何不同?
软件开发和部署方法的发展要求组织管理和维护 IT 基础设施的方式发生转变。站点可靠性工程(SRE) 是一门将软件工程的各个方面融入 IT 运营的学科,处于这一变革的前沿。随着专业人士和组织都寻求适应,对 SRE 认证和培训计划的需求激增。本博客探讨了 SRE …...
uniapp 对接腾讯云IM群组成员管理(增删改查)
UniApp 实战:腾讯云IM群组成员管理(增删改查) 一、前言 在社交类App开发中,群组成员管理是核心功能之一。本文将基于UniApp框架,结合腾讯云IM SDK,详细讲解如何实现群组成员的增删改查全流程。 权限校验…...
Matlab | matlab常用命令总结
常用命令 一、 基础操作与环境二、 矩阵与数组操作(核心)三、 绘图与可视化四、 编程与控制流五、 符号计算 (Symbolic Math Toolbox)六、 文件与数据 I/O七、 常用函数类别重要提示这是一份 MATLAB 常用命令和功能的总结,涵盖了基础操作、矩阵运算、绘图、编程和文件处理等…...
css3笔记 (1) 自用
outline: none 用于移除元素获得焦点时默认的轮廓线 broder:0 用于移除边框 font-size:0 用于设置字体不显示 list-style: none 消除<li> 标签默认样式 margin: xx auto 版心居中 width:100% 通栏 vertical-align 作用于行内元素 / 表格单元格ÿ…...
项目部署到Linux上时遇到的错误(Redis,MySQL,无法正确连接,地址占用问题)
Redis无法正确连接 在运行jar包时出现了这样的错误 查询得知问题核心在于Redis连接失败,具体原因是客户端发送了密码认证请求,但Redis服务器未设置密码 1.为Redis设置密码(匹配客户端配置) 步骤: 1).修…...
C# 求圆面积的程序(Program to find area of a circle)
给定半径r,求圆的面积。圆的面积应精确到小数点后5位。 例子: 输入:r 5 输出:78.53982 解释:由于面积 PI * r * r 3.14159265358979323846 * 5 * 5 78.53982,因为我们只保留小数点后 5 位数字。 输…...
无人机侦测与反制技术的进展与应用
国家电网无人机侦测与反制技术的进展与应用 引言 随着无人机(无人驾驶飞行器,UAV)技术的快速发展,其在商业、娱乐和军事领域的广泛应用带来了新的安全挑战。特别是对于关键基础设施如电力系统,无人机的“黑飞”&…...
接口自动化测试:HttpRunner基础
相关文档 HttpRunner V3.x中文文档 HttpRunner 用户指南 使用HttpRunner 3.x实现接口自动化测试 HttpRunner介绍 HttpRunner 是一个开源的 API 测试工具,支持 HTTP(S)/HTTP2/WebSocket/RPC 等网络协议,涵盖接口测试、性能测试、数字体验监测等测试类型…...
Golang——6、指针和结构体
指针和结构体 1、指针1.1、指针地址和指针类型1.2、指针取值1.3、new和make 2、结构体2.1、type关键字的使用2.2、结构体的定义和初始化2.3、结构体方法和接收者2.4、给任意类型添加方法2.5、结构体的匿名字段2.6、嵌套结构体2.7、嵌套匿名结构体2.8、结构体的继承 3、结构体与…...
HTML前端开发:JavaScript 获取元素方法详解
作为前端开发者,高效获取 DOM 元素是必备技能。以下是 JS 中核心的获取元素方法,分为两大系列: 一、getElementBy... 系列 传统方法,直接通过 DOM 接口访问,返回动态集合(元素变化会实时更新)。…...
c# 局部函数 定义、功能与示例
C# 局部函数:定义、功能与示例 1. 定义与功能 局部函数(Local Function)是嵌套在另一个方法内部的私有方法,仅在包含它的方法内可见。 • 作用:封装仅用于当前方法的逻辑,避免污染类作用域,提升…...
