【Unity3D】無限循環列表(擴展版)

??基礎版:【Unity技術分享】UGUI之ScrollRect優化_ugui scrollrect 優化-CSDN博客

using UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;public delegate void OnBaseLoopListItemCallback(GameObject cell, int index);
public class BaseLoopList : MonoBehaviour
{public int m_Row = 1; //排public bool m_IsVertical = true;public float m_SpacingX = 0f; //間距public float m_SpacingY = 0f; //間距public GameObject m_CellGameObject; //指定的cellprivate Dictionary<GameObject, int> m_GameObjectNumDict;//-> 回調相關        public event OnBaseLoopListItemCallback onItemShow; //Lua 回調public event OnBaseLoopListItemCallback onItemHide; //Lua 回調protected RectTransform rectTrans;protected float m_PlaneWidth;protected float m_PlaneHeight;protected float m_ContentWidth;protected float m_ContentHeight;protected float m_CellObjectWidth;protected float m_CellObjectHeight;protected GameObject m_Content;protected RectTransform m_ContentRectTrans;private bool m_isInited = false;//記錄 物體的坐標 和 物體 protected struct CellInfo{public Vector3 pos;public GameObject obj;};protected CellInfo[] m_CellInfos;protected bool m_IsInited = false;protected ScrollRect m_ScrollRect;protected int m_MaxCount = -1; //列表數量protected int m_MinIndex = -1;protected int m_MaxIndex = -1;protected bool m_IsClearList = false; //是否清空列表protected Vector4 m_Padding = Vector4.zero; //(left,top,right,bottom) 左,上 偏移Item(左上角為錨點) 右,下 擴大Content(寬度和高度)//c# 初始化public virtual void Init(){if (m_isInited)return;m_isInited = true;m_GameObjectNumDict = new Dictionary<GameObject, int>();m_Content = this.GetComponent<ScrollRect>().content.gameObject;if (m_CellGameObject == null){//m_CellGameObject = m_Content.transform.GetChild(0).gameObject;Debug.LogError("m_CellGameObject 不能為 null");}/* Cell 處理 *///m_CellGameObject.transform.SetParent(m_Content.transform.parent, false);//SetPoolsObj(m_CellGameObject);RectTransform cellRectTrans = m_CellGameObject.GetComponent<RectTransform>();cellRectTrans.pivot = new Vector2(0f, 1f);CheckAnchor(cellRectTrans);cellRectTrans.anchoredPosition = Vector2.zero;//記錄 Cell 信息m_CellObjectHeight = cellRectTrans.rect.height;m_CellObjectWidth = cellRectTrans.rect.width;//記錄 Plane 信息rectTrans = GetComponent<RectTransform>();Rect planeRect = rectTrans.rect;m_PlaneHeight = planeRect.height;m_PlaneWidth = planeRect.width;//記錄 Content 信息m_ContentRectTrans = m_Content.GetComponent<RectTransform>();Rect contentRect = m_ContentRectTrans.rect;SetContentHeight(contentRect.height);SetContentWidth(contentRect.width);m_ContentRectTrans.pivot = new Vector2(0f, 1f);//m_ContentRectTrans.sizeDelta = new Vector2 (planeRect.width, planeRect.height);//m_ContentRectTrans.anchoredPosition = Vector2.zero;CheckAnchor(m_ContentRectTrans);m_ScrollRect = this.GetComponent<ScrollRect>();m_ScrollRect.onValueChanged.RemoveAllListeners();//添加滑動事件m_ScrollRect.onValueChanged.AddListener(delegate (Vector2 value) { ScrollRectListener(value); });}public virtual void Destroy(){if (m_CellInfos != null){for (int i = 0; i < m_CellInfos.Length; i++){SetPoolsObj(m_CellInfos[i].obj);m_CellInfos[i].obj = null;}}m_GameObjectNumDict.Clear();}private void DisposeAll(){m_Padding = Vector4.zero;onItemShow = null;onItemHide = null;if (poolsObj != null){foreach (var v in poolsObj){if (v != null){GameObject.Destroy(v);}}poolsObj = null;}if (m_CellInfos != null){foreach (var v in m_CellInfos){if (v.obj != null){GameObject.Destroy(v.obj);}}m_CellInfos = null;}}//檢查 Anchor 是否正確private void CheckAnchor(RectTransform rectTrans){if (m_IsVertical){if (!((rectTrans.anchorMin == new Vector2(0, 1) && rectTrans.anchorMax == new Vector2(0, 1)) ||(rectTrans.anchorMin == new Vector2(0, 1) && rectTrans.anchorMax == new Vector2(1, 1)))){rectTrans.anchorMin = new Vector2(0, 1);rectTrans.anchorMax = new Vector2(1, 1);}}else{if (!((rectTrans.anchorMin == new Vector2(0, 1) && rectTrans.anchorMax == new Vector2(0, 1)) ||(rectTrans.anchorMin == new Vector2(0, 0) && rectTrans.anchorMax == new Vector2(0, 1)))){rectTrans.anchorMin = new Vector2(0, 0);rectTrans.anchorMax = new Vector2(0, 1);}}}public void SetPadding(float left, float top, float right, float bottom){m_Padding = new Vector4(left, top, right, bottom);SetContentWidth(m_ContentWidth);SetContentHeight(m_ContentHeight);}private float GetPaddingX(){return m_Padding.x;}private float GetPaddingY(){return m_Padding.y;}private float GetExpandWidth(){return m_Padding.z;}private float GetExpandHeight(){return m_Padding.w;}public void SetContentWidth(float value){m_ContentWidth = value + GetPaddingX() + GetExpandWidth();m_ContentWidth = m_ContentWidth < rectTrans.rect.width ? rectTrans.rect.width : m_ContentWidth;}public void SetContentHeight(float value){m_ContentHeight = value + GetPaddingY() + GetExpandHeight();m_ContentHeight = m_ContentHeight < rectTrans.rect.height ? rectTrans.rect.height : m_ContentHeight;}public virtual void SetCount(int num){m_MinIndex = -1;m_MaxIndex = -1;//-> 計算 Content 尺寸if (m_IsVertical){float contentSize = (m_SpacingY + m_CellObjectHeight) * Mathf.CeilToInt((float)num / m_Row);SetContentHeight(contentSize);SetContentWidth(m_ContentRectTrans.rect.width);m_ContentRectTrans.sizeDelta = new Vector2(m_ContentWidth, m_ContentHeight);if (num != m_MaxCount){m_ContentRectTrans.anchoredPosition = new Vector2(m_ContentRectTrans.anchoredPosition.x, 0);}}else{float contentSize = (m_SpacingX + m_CellObjectWidth) * Mathf.CeilToInt((float)num / m_Row);SetContentWidth(contentSize);SetContentHeight(m_ContentRectTrans.rect.height);m_ContentRectTrans.sizeDelta = new Vector2(m_ContentWidth, m_ContentHeight);if (num != m_MaxCount){m_ContentRectTrans.anchoredPosition = new Vector2(0, m_ContentRectTrans.anchoredPosition.y);}}//-> 計算 開始索引int lastEndIndex = 0;//-> 過多的物體 扔到對象池 ( 首次調 ShowList函數時 則無效 )if (m_IsInited){lastEndIndex = num - m_MaxCount > 0 ? m_MaxCount : num;lastEndIndex = m_IsClearList ? 0 : lastEndIndex;int count = m_IsClearList ? m_CellInfos.Length : m_MaxCount;for (int i = lastEndIndex; i < count; i++){if (m_CellInfos[i].obj != null){SetPoolsObj(m_CellInfos[i].obj);if (onItemHide != null){int objNum = 0;m_GameObjectNumDict.TryGetValue(m_CellInfos[i].obj, out objNum);onItemHide.Invoke(m_CellInfos[i].obj, objNum);}m_CellInfos[i].obj = null;}}}//-> 以下四行代碼 在for循環所用CellInfo[] tempCellInfos = m_CellInfos;m_CellInfos = new CellInfo[num];//-> 1: 計算 每個Cell坐標并存儲 2: 顯示范圍內的 Cellfor (int i = 0; i < num; i++){// * -> 存儲 已有的數據 ( 首次調 ShowList函數時 則無效 )if (m_MaxCount != -1 && i < lastEndIndex){CellInfo tempCellInfo = tempCellInfos[i];//-> 計算是否超出范圍float rPos = m_IsVertical ? tempCellInfo.pos.y : tempCellInfo.pos.x;if (!IsOutRange(rPos)){//-> 記錄顯示范圍中的 首位index 和 末尾indexm_MinIndex = m_MinIndex == -1 ? i : m_MinIndex; //首位indexm_MaxIndex = i; // 末尾indexif (tempCellInfo.obj == null){tempCellInfo.obj = GetPoolsObj();}tempCellInfo.obj.transform.GetComponent<RectTransform>().anchoredPosition = tempCellInfo.pos;if (!m_GameObjectNumDict.ContainsKey(tempCellInfo.obj)){m_GameObjectNumDict.Add(tempCellInfo.obj, i);}else{m_GameObjectNumDict[tempCellInfo.obj] = i;}tempCellInfo.obj.SetActive(true);//-> 回調 Lua 函數Func(tempCellInfo.obj);}else{if (tempCellInfo.obj != null){SetPoolsObj(tempCellInfo.obj);if (onItemHide != null){int objNum = 0;m_GameObjectNumDict.TryGetValue(tempCellInfo.obj, out objNum);onItemHide.Invoke(tempCellInfo.obj, objNum);}tempCellInfo.obj = null;}}m_CellInfos[i] = tempCellInfo;continue;}CellInfo cellInfo = new CellInfo();float pos = 0;  //坐標( isVertical ? 記錄Y : 記錄X )float rowPos = 0; //計算每排里面的cell 坐標// * -> 計算每個Cell坐標if (m_IsVertical){pos = m_CellObjectHeight * Mathf.FloorToInt(i / m_Row) + m_SpacingY * Mathf.FloorToInt(i / m_Row);rowPos = m_CellObjectWidth * (i % m_Row) + m_SpacingX * (i % m_Row);cellInfo.pos = new Vector3(rowPos + GetPaddingX(), -pos - GetPaddingY(), 0);}else{pos = m_CellObjectWidth * Mathf.FloorToInt(i / m_Row) + m_SpacingX * Mathf.FloorToInt(i / m_Row);rowPos = m_CellObjectHeight * (i % m_Row) + m_SpacingY * (i % m_Row);cellInfo.pos = new Vector3(pos + GetPaddingX(), -rowPos - GetPaddingY(), 0);}//-> 計算是否超出范圍float cellPos = m_IsVertical ? cellInfo.pos.y : cellInfo.pos.x;if (IsOutRange(cellPos)){cellInfo.obj = null;m_CellInfos[i] = cellInfo;continue;}//-> 記錄顯示范圍中的 首位index 和 末尾indexm_MinIndex = m_MinIndex == -1 ? i : m_MinIndex; //首位indexm_MaxIndex = i; // 末尾index//-> 取或創建 CellGameObject cell = GetPoolsObj();cell.transform.GetComponent<RectTransform>().anchoredPosition = cellInfo.pos;if (!m_GameObjectNumDict.ContainsKey(cell.gameObject)){m_GameObjectNumDict.Add(cell.gameObject, i);}else{m_GameObjectNumDict[cell.gameObject] = i;}//-> 存數據cellInfo.obj = cell;m_CellInfos[i] = cellInfo;//-> 回調 Lua 函數Func(cell);}m_MaxCount = num;m_IsInited = true;}//實時刷新列表時用public virtual void UpdateList(){NormalPerformanceMode();}//刷新某一項public void UpdateCell(int index){CellInfo cellInfo = m_CellInfos[index - 1];if (cellInfo.obj != null){float rangePos = m_IsVertical ? cellInfo.pos.y : cellInfo.pos.x;if (!IsOutRange(rangePos)){Func(cellInfo.obj);}}}// 更新滾動區域的大小public void UpdateSize(){Rect rect = GetComponent<RectTransform>().rect;m_PlaneHeight = rect.height;m_PlaneWidth = rect.width;}//滑動事件protected virtual void ScrollRectListener(Vector2 value){NormalPerformanceMode(); //普通性能模式}//普通性能模式private void NormalPerformanceMode(){if (m_CellInfos == null)return;//檢查超出范圍for (int i = 0, length = m_CellInfos.Length; i < length; i++){CellInfo cellInfo = m_CellInfos[i];GameObject obj = cellInfo.obj;Vector3 pos = cellInfo.pos;float rangePos = m_IsVertical ? pos.y : pos.x;//判斷是否超出顯示范圍if (IsOutRange(rangePos)){//把超出范圍的cell 扔進 poolsObj里if (obj != null){SetPoolsObj(obj);if (onItemHide != null){int objNum = 0;m_GameObjectNumDict.TryGetValue(obj, out objNum);onItemHide.Invoke(obj, objNum);}m_CellInfos[i].obj = null;}}else{if (obj == null){//優先從 poolsObj中 取出 (poolsObj為空則返回 實例化的cell)GameObject cell = GetPoolsObj();cell.transform.localPosition = pos;if (!m_GameObjectNumDict.ContainsKey(cell.gameObject)){m_GameObjectNumDict.Add(cell.gameObject, i);}else{m_GameObjectNumDict[cell.gameObject] = i;}m_CellInfos[i].obj = cell;Func(cell);}}}}//判斷是否超出顯示范圍protected bool IsOutRange(float pos){Vector3 listP = m_ContentRectTrans.anchoredPosition;if (m_IsVertical){if (pos + listP.y > m_CellObjectHeight || pos + listP.y < -rectTrans.rect.height){return true;}}else{if (pos + listP.x < -m_CellObjectWidth || pos + listP.x > rectTrans.rect.width){return true;}}return false;}//對象池 機制  (存入, 取出) cellprotected Stack<GameObject> poolsObj = new Stack<GameObject>();//取出 cellprotected virtual GameObject GetPoolsObj(){GameObject cell = null;if (poolsObj.Count > 0){cell = poolsObj.Pop();}if (cell == null){cell = Instantiate(m_CellGameObject) as GameObject;}cell.transform.SetParent(m_Content.transform);cell.transform.localScale = Vector3.one;SetActive(cell, true);return cell;}//存入 cellprotected virtual void SetPoolsObj(GameObject cell){if (cell != null){poolsObj.Push(cell);SetActive(cell, false);}}//回調protected void Func(GameObject selectObject){int num = 0;m_GameObjectNumDict.TryGetValue(selectObject, out num);onItemShow?.Invoke(selectObject, num);}void SetActive(GameObject cell, bool isShow){cell.SetActive(isShow);}protected void OnDestroy(){DisposeAll();}
}

其他2個使用案例C#腳本代碼:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class LoopListManager : MonoBehaviour
{public BaseLoopList baseLoopList;private Dictionary<int, BaseLoopListItem> loopListItemDict;void Start(){baseLoopList.onItemShow += OnShow;baseLoopList.onItemHide += OnHide;loopListItemDict = new Dictionary<int, BaseLoopListItem>();baseLoopList.Init();//baseLoopList.SetPadding(20, 30, 0, 0);//支持Padding四個方向的偏移baseLoopList.SetCount(50);}private BaseLoopListItem GetItem(GameObject cell, int index){BaseLoopListItem item;loopListItemDict.TryGetValue(index, out item);if (item == null){item = cell.GetComponent<BaseLoopListItem>();loopListItemDict.Add(index, item);}return item;}public void OnShow(GameObject cell, int index){Debug.Log("Show:" + index);BaseLoopListItem item = GetItem(cell, index);item.OnShow(index);}public void OnHide(GameObject cell, int index){Debug.Log("Hide:" + index);BaseLoopListItem item = GetItem(cell, index);item.OnHide(index);//注意: 無限循環列表的Item是重復利用的物體,邏輯上Hide之后必須從緩存中移除,否則會一定會出現Item刷新異常;//原因: 若不移除會出現Show(index物體)時會拿到一個不正確位置的物體, 甚至很大可能是一個已顯示中的物體(形成覆蓋效果)loopListItemDict.Remove(index);}
}
using UnityEngine;
using TMPro;
public class BaseLoopListItem : MonoBehaviour
{public TextMeshProUGUI text;public void OnShow(int index){text.text = index.ToString();}public void OnHide(int index){text.text = "";}
}

注意事項:無限循環列表的Item物體是重復利用的,因此OnHide回調后必須將傳遞進來的物體所有相關的緩存引用清空,例如案例是將其從字典移除loopListItemDict.Remove(index);

Content選擇左上角錨點(看情況可選其他,但不要用自適應stretch)?以及不要掛任何自動控制布局組件,如:VerticalLayoutGroup、HorizontalLayoutGroup、GridLayoutGroup、ContentSizeFitter等...(因為會破壞無限循環列表對Content的控制)

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/web/63391.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/63391.shtml
英文地址,請注明出處:http://en.pswp.cn/web/63391.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

MSSQL AlwaysOn 可用性組(Availability Group)中的所有副本均不健康排查步驟和解決方法

當遇到 MSSQL AlwaysOn 可用性組(Availability Group)中的所有副本均不健康的情況時(MSSQL AG 副本名稱: All replicas unhealthy),這通常意味著可用性組無法正常工作,數據同步和故障轉移功能可能受到影響。以下是一些可能的原因及相應的排查步驟和解決方法: 1. 檢查副本…

springboot檢測配置是否存在,如果存在則返回,不存在則提示新增

我這里是以七牛為例子 在yml中添加七牛的相關配置 qiniu: #七牛的相關配置accessKey: your_access_keysecretKey: your_secret_keybucket: your_bucket_namedomain: your_domain 對應在給配置文件來一個相應的實體類QiniuConfig Component ConfigurationProperties(prefix &…

[NOIP2016 普及組] 海港 -STL-隊列queue

[NOIP2016 普及組] 海港 題目背景 NOIP2016 普及組 T3 題目描述 小 K 是一個海港的海關工作人員&#xff0c;每天都有許多船只到達海港&#xff0c;船上通常有很多來自不同國家的乘客。 小 K 對這些到達海港的船只非常感興趣&#xff0c;他按照時間記錄下了到達海港的每一…

【Vulkan入門】16-IndexBuffer

TOC 先叨叨 上篇介紹了如何使用VertexBuffer傳入頂點信息。兩個多星期了我們一直在玩三個點&#xff0c;本篇介紹如何渲染更多的點。 在渲染前考慮一個問題&#xff0c;渲染一個三角形需要三個點&#xff0c;渲染兩個相接的三角形需要幾個點&#xff1f; 答案是6個點&#xf…

IDEA 打包普通JAVA項目為jar包

需求&#xff1a;普通java項目&#xff08;有添加依賴的jar包&#xff09;&#xff0c;沒有用maven管理依賴和打包&#xff0c;要打成jar包&#xff0c;包可以用“java -jar 包名” 啟動程序。 講如何打包前&#xff0c;先記錄下普通項目的目錄結構和怎么添加依賴包 1.目錄結…

python的流程控制語句之制作空氣質量評估系統

&#x1f468;?&#x1f4bb;個人主頁&#xff1a;開發者-曼億點 &#x1f468;?&#x1f4bb; hallo 歡迎 點贊&#x1f44d; 收藏? 留言&#x1f4dd; 加關注?! &#x1f468;?&#x1f4bb; 本文由 曼億點 原創 &#x1f468;?&#x1f4bb; 收錄于專欄&#xff1a…

Docker Compose 多應用部署 一鍵部署

介紹 Docker Compose通過一個單獨的docker-compose.yml模板文件(YAML格式)來定義一組相關聯的應用容器&#xff0c;幫助我們實現多個相互關聯的Docker容器的快速部署。 如&#xff1a;springbootmysqlnginx 如果一個個去部署他會非常的麻煩&#xff0c;這時候可以選擇Docker …

【數據結構——線性表】單鏈表的基本運算(頭歌實踐教學平臺習題)【合集】

目錄&#x1f60b; 任務描述 相關知識 測試說明 我的通關代碼: 測試結果&#xff1a; 任務描述 本關任務&#xff1a;編寫一個程序實現單鏈表的基本運算。 相關知識 為了完成本關任務&#xff0c;你需要掌握&#xff1a;初始化線性表、銷毀線性表、判定是否為空表、求線性…

git branch -r(--remotes )顯示你本地倉庫知道的所有 遠程分支 的列表

好的&#xff0c;git branch -r 這個命令用于列出遠程分支。讓我詳細解釋一下&#xff1a; 命令&#xff1a; git branch -rdgqdgqdeMac-mini ProductAuthentication % git branch -rorigin/main作用&#xff1a; 這個命令會顯示你本地倉庫知道的所有 遠程分支 的列表。它不…

【AI熱點】小型語言模型(SLM)的崛起:如何在AI時代中找到你的“左膀右臂”?

人工智能模型的演變 多年來&#xff0c;谷歌等科技巨頭和OpenAI等初創公司&#xff0c;一直在不遺余力地利用海量在線數據&#xff0c;打造更大、更昂貴的人工智能&#xff08;AI&#xff09;模型。這些大型語言模型&#xff08;LLM&#xff09;被廣泛應用于ChatGPT等聊天機器…

【昇騰】NPU ID:物理ID、邏輯ID、芯片映射關系

起因&#xff1a; https://www.hiascend.com/document/detail/zh/Atlas%20200I%20A2/23.0.0/re/npu/npusmi_013.html npu-smi info -l查詢所有NPU設備&#xff1a; [naienotebook-npu-bd130045-55bbffd786-lr6t8 DCNN]$ npu-smi info -lTotal Count : 1NPU…

Elasticsearch-DSL高級查詢操作

一、禁用元數據和過濾數據 1、禁用元數據_source GET product/_search {"_source": false, "query": {"match_all": {}} }查詢結果不顯示元數據 禁用之前: {"took" : 0,"timed_out" : false,"_shards" : {&quo…

基于Spring Boot的體育商品推薦系統

一、系統背景與目的 隨著電子商務的快速發展和人們健康意識的提高&#xff0c;體育商品市場呈現出蓬勃發展的態勢。然而&#xff0c;傳統的體育商品銷售方式存在商品種類繁多、用戶選擇困難、個性化需求無法滿足等問題。為了解決這些問題&#xff0c;基于Spring Boot的體育商品…

【Java Nio Netty】基于TCP的簡單Netty自定義協議實現(萬字,全篇例子)

基于TCP的簡單Netty自定義協議實現&#xff08;萬字&#xff0c;全篇例子&#xff09; 前言 有一陣子沒寫博客了&#xff0c;最近在學習Netty寫一個實時聊天軟件&#xff0c;一個高性能異步事件驅動的網絡應用框架&#xff0c;我們常用的SpringBoot一般基于Http協議&#xff0…

【2025最新計算機畢業設計】基于SSM校園歌手賽事管理系統【提供源碼+答辯PPT+文檔+項目部署】

作者簡介&#xff1a;?CSDN新星計劃導師、Java領域優質創作者、掘金/華為云/阿里云/InfoQ等平臺優質作者、專注于Java技術領域和學生畢業項目實戰,高校老師/講師/同行前輩交流。? 主要內容&#xff1a;&#x1f31f;Java項目、Python項目、前端項目、PHP、ASP.NET、人工智能…

Visual Studio 使用 GitHub Copilot 協助調試

&#x1f380;&#x1f380;&#x1f380;【AI輔助編程系列】&#x1f380;&#x1f380;&#x1f380; Visual Studio 使用 GitHub Copilot 與 IntelliCode 輔助編碼Visual Studio 安裝和管理 GitHub CopilotVisual Studio 使用 GitHub Copilot 擴展Visual Studio 使用 GitHu…

了解ARM的千兆以太網——RK3588

1. 簡介 本文并不重點講解調試內容&#xff0c;重點了解以太網在ARM設計中的框架以及在設備樹以及驅動的一個整體框架。了解作為一個驅動開發人員當拿到一款未開發過的ARM板卡應該怎么去把網卡配置使用起來。 2. 基礎知識介紹 在嵌入式ARM中實現以太網的解決方案通常有以下兩種…

Springboot家政服務管理系統

摘 要 科技進步的飛速發展引起人們日常生活的巨大變化&#xff0c;電子信息技術的飛速發展使得電子信息技術的各個領域的應用水平得到普及和應用。信息時代的到來已成為不可阻擋的時尚潮流&#xff0c;人類發展的歷史正進入一個新時代。在現實運用中&#xff0c;應用軟件的工作…

DC-9筆記

靶機信息 官網:DC: 9 ~ VulnHub 只有一個flag,官網上沒給其他提示 信息收集 nmap 192.168.66.2-254nmap 192.168.66.146 -A -p-開放了80端口,22端口是filtered的,被過濾? NMAP 六種端口狀態解讀_nmap filtered-CSDN博客 那來看看http服務吧 http(80) 頁腳是空白的,插件也…

STM32-筆記3-驅動蜂鳴器

1、復制03項目&#xff0c;重命名為04項目 打開04項目的Drivers/BSP/led文件夾&#xff0c;把led文件夾更改為beep文件夾&#xff0c;改文件夾內部的.c和.h文件更改為beep.c和beep.h文件&#xff0c;如下圖所示。 2、打開工程文件 出現彈窗&#xff0c;顯示找不到xx文件&#…