Unity组件开发--AB包打包工具

1.项目工程路径下创建文件夹:ABundles

2.AB包打包脚本:

using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.SceneManagement;

public class AssetBundlePackage {


    static string[] GetBuildScenes() {
        List<string> sceneArray = new List<string>();
        foreach (EditorBuildSettingsScene e in EditorBuildSettings.scenes) {
            if (e == null) continue;
            if (e.enabled) sceneArray.Add(e.path);
        }
        return sceneArray.ToArray();
    }


    [MenuItem("BuildScene/Build")]
    public static void BuildScene() {
        //BundleAssetsBundle_Webgl();

        string folderPath = EditorUtility.OpenFolderPanel("Select Folder", "", "");
        Debug.Log("Selected Folder: " + folderPath);

        BuildPipeline.BuildPlayer(new string[] { "Assets/GameStart.unity" }, folderPath, BuildTarget.WebGL, BuildOptions.AutoRunPlayer);
    }

    [MenuItem("BuildScene/BuildForMobile")]
    public static void BuildSceneForMobile()
    {
        //BundleAssetsBundle_Webgl();

        string folderPath = EditorUtility.OpenFolderPanel("Select Folder", "", "");
        Debug.Log("Selected Folder: " + folderPath);

        BuildPipeline.BuildPlayer(new string[] { "Assets/GameStartMoibile.unity" }, folderPath, BuildTarget.WebGL, BuildOptions.AutoRunPlayer);
    }

    [MenuItem("SceneAsset/BuildCurrent")]
    public static void BuildCurrentScene() {
        string rootPath = Application.dataPath.ToLower().Replace("assets", "") + "ABundles/webgl/scenes";
        string scenePath = EditorSceneManager.GetActiveScene().path;
        string sceneName = System.IO.Path.GetFileNameWithoutExtension(scenePath).ToLower();

        AssetBundleBuild assetBundleBuild = new AssetBundleBuild();
        assetBundleBuild.assetNames = new []{ scenePath };
        assetBundleBuild.assetBundleName = sceneName + ".bundle";
        BuildPipeline.BuildAssetBundles(rootPath, new AssetBundleBuild[] { assetBundleBuild}, BuildAssetBundleOptions.None, BuildTarget.WebGL);
    }

    [MenuItem("SceneAsset/BuildAllScene")]
    public static void BuildAllScene() {
        bool isOk = EditorUtility.DisplayDialog("确认框", "是否将所有场景打成AB包", "确认", "取消");
        if (!isOk) {
            return;
        }

        //AB包路径是ABundles
        string rootPath = Application.dataPath.ToLower().Replace("assets","") + "ABundles/webgl/scenes";
        var allScenesPath = GetBuildScenes();
        foreach (var scenePath in allScenesPath) {
            string sceneName = System.IO.Path.GetFileNameWithoutExtension(scenePath).ToLower();
            AssetBundleBuild assetBundleBuild = new AssetBundleBuild();
            assetBundleBuild.assetNames = new[] { scenePath };
            assetBundleBuild.assetBundleName = sceneName + ".bundle";
            Debug.Log(sceneName + scenePath);
            BuildPipeline.BuildAssetBundles(rootPath, new AssetBundleBuild[] { assetBundleBuild }, BuildAssetBundleOptions.None, BuildTarget.WebGL);
        }
    }


    [MenuItem("AssetBundle/BuildWebGL")]
    public static void BundleAssetsBundle_Webgl() {
        Debug.Log("BundleAssetsBundle WebGL");
        BuildAllAssetBundles();
    }
    private static void BuildAssetsBundle(BuildTarget target) {
        //string packagePath = Application.streamingAssetsPath;
        //if (packagePath.Length <= 0 && !Directory.Exists(packagePath))
        //{
        //    return;
        //}
        //BuildPipeline.BuildAssetBundles(packagePath, BuildAssetBundleOptions.UncompressedAssetBundle, target);
    }
    //Asset/BundleAsset/Prefab/Com/a.bundle  Prefab/Com/a
    public static string RemovePrefix(string inputString) {
        inputString = inputString.Replace("\\", "/");
        string prefix = "Assets/BundleAsset/";
        string result = inputString.Replace(prefix, "");
        return result.Replace(".bundle", "");
    }
    static void BuildAllAssetBundles() {
        string prefabsFolderPath = "Assets/BundleAsset/Prefab";

        if (!Directory.Exists(prefabsFolderPath)) {
            Debug.LogError($"Folder {prefabsFolderPath} does not exist!");
            return;
        }

        //AB包路径是ABundles
        string rootPath = Application.dataPath.ToLower().Replace("assets", "") + "ABundles/webgl";
        if (!Directory.Exists(rootPath)) {
            Debug.LogError($"Folder {rootPath} does not exist!");
            return;
        }

        string[] prefabGUIDs = AssetDatabase.FindAssets("t:Prefab", new[] { prefabsFolderPath });
        foreach (var prefabGUID in prefabGUIDs) {
            string prefabPath = AssetDatabase.GUIDToAssetPath(prefabGUID);
            GameObject prefab = AssetDatabase.LoadAssetAtPath<GameObject>(prefabPath);
            if (prefab == null) {
                continue;
            }
            var assetPath = AssetDatabase.GetAssetPath(prefab);
            var dependencies = GetAllDependencies(assetPath).ToArray();

            var withoutEx = Path.GetFileNameWithoutExtension(prefabPath);

            AssetBundleBuild assetBundleBuild = new AssetBundleBuild();
            assetBundleBuild.assetBundleName = RemovePrefix(withoutEx).ToLower() + ".bundle";
            assetBundleBuild.assetNames = dependencies;
            var directName = Path.GetDirectoryName(assetPath);
            var outPackagePath = $"{rootPath}/{RemovePrefix(directName).ToLower()}";

            Debug.Log($"prefabPath {prefabPath}");
            if (!Directory.Exists(outPackagePath)) {
                Directory.CreateDirectory(outPackagePath);
            }

            BuildPipeline.BuildAssetBundles(outPackagePath, new AssetBundleBuild[] { assetBundleBuild }, BuildAssetBundleOptions.None, BuildTarget.WebGL);
        }

        Debug.Log("BuildAssetBundles ok");
    }

    public static List<string> GetAllDependencies(string assetPath) {
        var list = new List<string>();
        var dependencies = AssetDatabase.GetDependencies(assetPath, false);
        foreach (var dependency in dependencies) {
            if (Path.GetExtension(dependency) == ".cs" || Path.GetExtension(dependency) == ".meta" || Path.GetExtension(dependency) == ".DS_Store") {
                continue;
            }
            list.Add(dependency);
        }
        list.Add(assetPath);
        return list;
    }


}

3.需要打包的场景添加到打包配置:

4.unity编辑器生成菜单:

5.场景加载AB包管理器:

using Cysharp.Threading.Tasks;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine.SceneManagement;
using System.IO;
using UnityEngine.Networking;
using GLTFast;
using LitJson;
using System.Web;

public class SceneLoader : MonoBehaviour {
    
    public int TemplateId;

    public bool useBundle;

    public bool isDeBug;

    public bool isShowCase;

    public bool isMobileTest;

    [Header("天空盒材质球")]
    public UnityEngine.Material skyboxMaterial;

    bool sceneIsLoaded = false;
    [DllImport("__Internal")]
    private static extern string GetUA();

    public virtual void Awake() {

#if !UNITY_EDITOR && UNITY_WEBGL
          string a = GetUA();
          if (a == "1")
            {
                //PC端
                Debug.Log("当前运行环境在PC端");
                PlayerData.Instance.isRunningPC = true;
            }
            if (a == "2")
            {
                //移动端
                Debug.Log("当前运行环境在移动端");
                PlayerData.Instance.isRunningPC = false;
            }
#endif



#if UNITY_EDITOR

        AppConst.UseAssetBundle = useBundle;

#endif

        AppConst.useShowBundlePath = isShowCase;

        DontDestroyOnLoad(gameObject);
        EventManager.Instance.AddListener(EventName.LoadSceneAction, OnSceneLoad);
        EventManager.Instance.AddListener(EventName.OnSceneCfgLoadEnd, RemoveUnuse);



    }

    public virtual void Start() {

        var fps = transform.Find("FPS");
        if (fps) {
            fps.gameObject.SetActive(isDeBug);
        }

        if (isMobileTest) LoadNetCofig();



    }


    void LoadNetCofig() {
        var configPath = Application.dataPath;

#if UNITY_EDITOR
        var filepath = Path.Combine(Application.dataPath.Replace("Assets", ""), "config.txt");
#else
        var filepath = Path.Combine(Application.dataPath, "config.txt");
#endif
        Debug.Log("configPath" + filepath);
        filepath = filepath.Replace("\\", "/");
        StartCoroutine(LoadFileSetNetwork(filepath));
    }

    IEnumerator LoadFileSetNetwork(string filepath) {
        UnityWebRequest www = UnityWebRequest.Get(filepath);


        yield return www.SendWebRequest();


        if (www.result == UnityWebRequest.Result.ConnectionError || www.result == UnityWebRequest.Result.ProtocolError) {
            Debug.LogError(www.error);
        }
        else {
            string json = www.downloadHandler.text;
            var data = LitJson.JsonMapper.ToObject(json);

            if ((string)data["AssetBundleIP"] != string.Empty) {
                Host.AssetBundleIP = (string)data["AssetBundleIP"];
            }
            Host.gameServer = (string)data["local"];
            Host.ApiHost = (string)data["ApiHost"];
            Host.remote = (string)data["remote"];

            Debug.Log("url config:" + json);
            StartCoroutine(tempLoad());

        }
    }

    public IEnumerator tempLoad() {
        Debug.Log("OnBaelogin" + TemplateId);
        var SceneName = TemplateId.ToString();
#if UNITY_EDITOR
        if (AppConst.UseAssetBundle) {
            yield return AssetBundleManager.Instance.LoadSceneSync(SceneName);
        }
        else {
            yield return SceneManager.LoadSceneAsync(SceneName);
        }
#else
        yield return AssetBundleManager.Instance.LoadSceneSync(SceneName);
#endif

        EventManager.Instance.TriggerEvent(EventName.OnSceneLoaded);
        UIManager.Instance.PushPanel(UIPanelType.MAIN_PANEL); //这里有个坑, 如果把界面放在场景加载之前添加,会出现各种错误乱象
        UIManager.Instance.PushPanel(UIPanelType.HUD_PANEL);
        Debug.Log("DownLoadScenConfig");
        if (HttpHelper.Instance != null) {
            HttpHelper.Instance.GetDefaultSpaceImg();
            HttpHelper.Instance.DownLoadScenConfig();
        }
    }


    private void RemoveUnuse(object sender, EventArgs e) {
        RemoveSceneUnUseDefault();

        ResetSkyBox();
    }


    public void ResetSkyBox() {
        JsonData sceneJson = JsonMapper.ToObject(SceneModel.Instance.sceneJsonInitData);
        if (sceneJson["skyBox"] != null) {

            string imgdata = sceneJson["skyBox"]["body"].ToString();
            string decodedString = HttpUtility.UrlDecode(JsonMapper.ToObject(imgdata)["imgDatas"].ToString());
            StartCoroutine(LoadTexturesAndGenerateCubemap(JsonMapper.ToObject<List<skyImgData>>(decodedString)));
        }

    }

    private IEnumerator LoadTexturesAndGenerateCubemap(List<skyImgData> skyImgDataList) {
        Texture2D[] textures = new Texture2D[skyImgDataList.Count];
        Cubemap cubemap;

        for (int i = 0; i < skyImgDataList.Count; i++) {
            using (UnityWebRequest www = UnityWebRequestTexture.GetTexture(skyImgDataList[i].url)) {
                yield return www.SendWebRequest();

                if (www.result == UnityWebRequest.Result.Success) {
                    Texture2D texture = DownloadHandlerTexture.GetContent(www);
                    textures[i] = texture;
                }
                else {
                    Debug.LogError("Failed to load image: " + www.error);
                    yield break;
                }
            }
        }

        Material material = new Material(skyboxMaterial);

        material.SetTexture("_FrontTex", textures[0]);
        material.SetTexture("_BackTex", textures[1]);
        material.SetTexture("_LeftTex", textures[2]);
        material.SetTexture("_RightTex", textures[3]);
        material.SetTexture("_UpTex", textures[4]);
        material.SetTexture("_DownTex", textures[5]);

        RenderSettings.skybox = material;

    }



    /// <summary>
    /// 移除场景默认设置的那些被删除的板
    /// </summary>
    public void RemoveSceneUnUseDefault() {
        var comVOs = SceneModel.Instance.rootCfg.comCfg.comVOs;
        var scene = SceneManager.GetActiveScene();
        GameObject[] roots = scene.GetRootGameObjects();
        foreach (GameObject root in roots) {
            var loaders = root.GetComponentsInChildren<ComLoader>();
            foreach (var loader in loaders) {
                if (comVOs.TryGetValue(loader.instanceName, out _) == false) {
                    StartCoroutine(waitSeconds(loader.gameObject));
                }
            }
        }
    }

    IEnumerator waitSeconds(GameObject go) {
        yield return new WaitForEndOfFrame();
        GameObject.Destroy(go);
    }






    IEnumerator coLoadSceneAsync() {

        if (PlayerData.Instance.isRunningPC == false) {
            yield return new WaitForSeconds(1f);
        }

#if UNITY_EDITOR
        if (SceneModel.Instance.useGlb == false) {
            PlayerData.Instance.TemplateId = TemplateId;
        }
#endif
        var SceneName = "";

        if (SceneModel.Instance.useGlb == true) {
            SceneName = "1000";
        }
        else {
            if (PlayerData.Instance.isRunningPC) {
                SceneName = PlayerData.Instance.TemplateId.ToString();
            }
            else {
                SceneName = PlayerData.Instance.TemplateId.ToString() + "_mobile";
            }
        }

        Debug.Log("SceneName TemplateId:" + SceneName);
#if UNITY_EDITOR
        if (AppConst.UseAssetBundle) {
            yield return AssetBundleManager.Instance.LoadSceneSync(SceneName);
        }
        else {
            yield return SceneManager.LoadSceneAsync(SceneName);
        }

#else
        yield return AssetBundleManager.Instance.LoadSceneSync(SceneName);
#endif

    }

    /// <summary>
    /// 发布态场景加载完成
    /// </summary>
    /// <param name="arg0"></param>
    /// <param name="arg1"></param>
    private void OnPublishModeSceneLoadSuccess(Scene arg0, LoadSceneMode arg1) {
        UIManager.Instance.PushPanel(UIPanelType.EDITOR_MODE_PANEL);
        UIManager.Instance.PushPanel(UIPanelType.HUD_PANEL);
        EventManager.Instance.TriggerEvent(EventName.OnSceneLoaded);
        HttpHelper.Instance.GetDefaultSpaceImg();
        SceneModel.Instance.setDefaultSceneConfig();

        if (PlayerController.Instance.gameObject.GetComponent<RoleInfoUICtr>()) {
            PlayerController.Instance.gameObject.GetComponent<RoleInfoUICtr>().publicModeForName();
            PlayerController.Instance.gameObject.GetComponent<RoleInfoUICtr>().isShowOwnerObj(true);
        }

        if (SceneModel.Instance.useGlb) {
            EventManager.Instance.TriggerEvent(EventName.onGlbSceneLoad, new GlbLoadEvenArg { url = SceneModel.Instance.glbPath });
        }
    }

    public void OnSceneLoad(object sender, EventArgs e) {

        if (sceneIsLoaded == true) {
            return;
        }
        sceneIsLoaded = true;
        var arg = e as SceneLoadActionArgs;
        Debug.Log("OnSceneLoad:" + arg.state);
        if (arg.state == AppConst.PublicMode) //创建态
        {
            SceneManager.sceneLoaded += OnPublishModeSceneLoadSuccess;
        }
        else { //浏览态

            SceneManager.sceneLoaded += OnViewSceneLoadOk;
        }
        StartCoroutine(coLoadSceneAsync());
    }



    /// <summary>
    /// 浏览态场景加载完成
    /// </summary>
    /// <param name="arg0"></param>
    /// <param name="arg1"></param>
    private void OnViewSceneLoadOk(Scene arg0, LoadSceneMode arg1) {
        EventManager.Instance.TriggerEvent(EventName.OnSceneLoaded);
        if (PlayerData.Instance.isRunningPC == true) {
            UIManager.Instance.PushPanel(UIPanelType.HUD_PANEL);
        }
        //ToastPanel.Show("OnViewSceneLoadOk");
        //AlertPanel.Show("OnViewSceneLoadOk", null);
        //Debug.Log("DownLoadScenConfig");
        //if (HttpHelper.Instance != null)
        //{
        //    HttpHelper.Instance.GetDefaultSpaceImg();
        //    //HttpHelper.Instance.DownLoadScenConfig(); //挪到登陆的时候请求场景数据
        //}


        if (SceneModel.Instance.useGlb) {
            EventManager.Instance.TriggerEvent(EventName.onGlbSceneLoad, new GlbLoadEvenArg { url = SceneModel.Instance.glbPath });
        }


        if (PlayerData.Instance.isRunningPC) {
            SceneModel.Instance.ImplementComLoder();
            UIManager.Instance.PushPanel(UIPanelType.MAIN_PANEL);

        }
        else {
            if (SceneModel.Instance.useGlb) {

                EventManager.Instance.AddListener(EventName.onGlbSceneLoadOK, (s, e) => {

                    StartCoroutine(waitSeconds(1, () => {
                        UIManager.Instance.PushPanel(UIPanelType.MAIN_PANEL);
                    }));

                });

                StartCoroutine(waitSeconds(1, () => {

                    if (SceneModel.Instance.useGlb) {
                        EventManager.Instance.TriggerEvent(EventName.onGlbSceneLoad, new GlbLoadEvenArg { url = SceneModel.Instance.glbPath });
                    }
                }));
            }
            else {

                StartCoroutine(waitSeconds(1, () => {
                    UIManager.Instance.PushPanel(UIPanelType.MAIN_PANEL);
                }));

            }


        }
    }

    private IEnumerator waitSeconds(float scecond, Action call) {
        yield return new WaitForSeconds(scecond);
        call();


    }

    public virtual void Onlogin() {



    }

}

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

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

相关文章

MySQL进阶篇(三) 索引

一、插入数据 1. insert &#xff08;1&#xff09;优化方案一&#xff0c;批量插入数据 Insert into tb_test values(1,Tom),(2,Cat),(3,Jerry);&#xff08;2&#xff09;优化方案二&#xff0c;手动控制事务 start transaction; insert into tb_test values(1,Tom),(2,Cat…

windows10 装docker和docker compose

一.windows环境准备 开启过程中的问题&#xff0c;进入bios修复 二.docker下载安装 1.下载 Docker Desktop: The #1 Containerization Tool for Developers | Docker 下载最新版有问题&#xff0c;下载老版本试试 Docker Desktop release notes | Docker Docs 2.安装 三.do…

【HashMap】结构和底层原理

文章目录 HashMap结构和底层原理 HashMap 结构和底层原理 ​ HashMap 是我们非常常用到数据结构&#xff0c;由数组和链表构成的数据结构&#xff0c;数组里面每个地方都存了 key-value 这样的实例&#xff0c;在Java7叫 Entry 在 Java8 中叫 Node ​ 因为他本身所有的位置都…

如何查看一篇论文是期刊还是会议?

如何查看一篇论文是期刊还是会议&#xff1f;这是大家看论文的时候比较关注的事情&#xff0c;还有这篇论文是什么等级的&#xff1f; 1、如何查看一篇论文是期刊还是会议&#xff1f; 从论文的封面可以直接看出来&#xff0c;比如下面这种&#xff1a; conference就是会议的意…

【AI】AI和医疗大数据(1/3)

目录 一、医疗大数据有哪些 二、医疗大数据的特性 1. 隐私性 2. 复杂性 3. 不均衡性 4. 时序性 三、医疗大数据的目标和挑战 博主曾经在医疗智能设备领域创业&#xff0c;由于当时选择的模式过于复杂&#xff0c;包括了机械硬件、智能终端软硬件、院后微信生态做随访服务…

开启Android学习之旅-2-架构组件实现数据列表及添加(kotlin)

Android Jetpack 体验-官方codelab 1. 实现功能 使用 Jetpack 架构组件 Room、ViewModel 和 LiveData 设计应用&#xff1b;从sqlite获取、保存、删除数据&#xff1b;sqlite数据预填充功能&#xff1b;使用 RecyclerView 展示数据列表&#xff1b; 2. 使用架构组件 架构组…

Untiy HTC Vive VRTK 开发记录

目录 一.概述 二.功能实现 1.模型抓取 1&#xff09;基础抓取脚本 2&#xff09;抓取物体在手柄上的角度 2.模型放置区域高亮并吸附 1&#xff09;VRTK_SnapDropZone 2&#xff09;VRTK_PolicyList 3&#xff09;VRTK_SnapDropZone_UnityEvents 3.交互滑动条 4.交互旋…

cpp_10_多重继承_钻石继承_虚继承

1 多重继承 一个类可以同时从多个基类继承实现代码。 1.1 多重继承的内存布局 子类对象内部包含多个基类子对象。 按照继承表的顺序依次被构造&#xff0c;析构的顺序与构造严格相反。 各个基类子对象按照从低地址到高地址排列。 // miorder.cpp 多重继承&#xff1a;一个子…

Rust类型之字符串

字符串 Rust 中的字符串类型是String。虽然字符串只是比字符多了一个“串”字&#xff0c;但是在Rust中这两者的存储方式完全不一样&#xff0c;字符串不是字符的数组&#xff0c;String内部存储的是Unicode字符串的UTF8编码&#xff0c;而char直接存的是Unicode Scalar Value…

大模型学习之书生·浦语大模型4——基于Xtuner大模型微调实战

基于Xtuner大模型微调实战 Fintune简介 海量数据训练的base model指令微调Instructed LLM 增量预训练微调 增量数据不需要问题&#xff0c;只需要答案&#xff0c;只需要陈述类的数据 指令跟随微调 指定角色指定问题给对应的user指定答案给assistant LIaMa2InternLM 不同的模…

什么是Modbus协议?

Modbus协议是一种在工业自动化领域广泛应用的通信协议&#xff0c;它允许不同设备之间进行可靠的数据交换和控制。该协议最初由Modicon公司于1979年创建&#xff0c;旨在提供一种简单而有效的方法&#xff0c;使PLC&#xff08;可编程逻辑控制器&#xff09;和其他自动化设备能…

前端绕过无限Debug

1.准备 burp : https://pan.baidu.com/s/1aqCywnF_S-HzIWVGLjiW-A 提取码: mpen BurpLoaderKeygen:链接: https://pan.baidu.com/s/1Vck_hFMT2YXP1cbmYfFqsA 提取码: qggp 点击Next后把Request粘贴到LoaderKeygen中&#xff0c;然后把Response粘贴到Burp Suite中 注&#xff1…

2024年【熔化焊接与热切割】考试内容及熔化焊接与热切割免费试题

题库来源&#xff1a;安全生产模拟考试一点通公众号小程序 熔化焊接与热切割考试内容是安全生产模拟考试一点通总题库中生成的一套熔化焊接与热切割免费试题&#xff0c;安全生产模拟考试一点通上熔化焊接与热切割作业手机同步练习。2024年【熔化焊接与热切割】考试内容及熔化…

in <module> input = brower.find_element(‘kw‘)

1. 概念名称&#xff1a; in <module> input brower.find_element(kw) 2. 概念定义&#xff1a; 这行代码使用了Selenium WebDriver的find_element方法来定位页面上的一个元素 3. 我对概念的理解&#xff1a; find_element方法用于查找页面上的元素&#xff0c;但这里的…

Mysql是怎样运行的--下

文章目录 Mysql是怎样运行的--下查询优化explainoptimizer_trace InnoDB的Buffer Pool&#xff08;缓冲池&#xff09;Buffer Pool的存储结构空闲页存储--free链表脏页&#xff08;修改后的数据&#xff09;存储--flush链表 使用Buffer PoolLRU链表的管理 事务ACID事务的状态事…

Triumphcore FPGA调测试记录

FPGA采用Xilinx pynq Z2开发板。基于V2.5版本开发 OverView uart端口映射 BUG调试记录 2024.1.7 复位状态导致取指时序错误 错误波形&#xff1a; 正确波形 问题代码&#xff1a; 2024.1.9 clock_wizard设置输入时钟是输出时钟的2^n倍&#xff0c;输出时钟的占空比才…

电能质量Python实现全家桶——全网最低价

往期精彩内容&#xff1a; 电能质量扰动信号数据介绍与分类-Python实现-CSDN博客 Python电能质量扰动信号分类(一)基于LSTM模型的一维信号分类-CSDN博客 Python电能质量扰动信号分类(二)基于CNN模型的一维信号分类-CSDN博客 Python电能质量扰动信号分类(三)基于Transformer…

数据结构之单调栈、单调队列

今天学习了单调栈还有单调队列的概念和使用&#xff0c;接下来我将对其定义并配合几道习题进行讲解&#xff1a; 首先先来复习一下栈与队列&#xff1a; 然后我们来看一下单调栈的定义&#xff1a; 单调栈中的元素从栈底到栈顶的元素的大小是按照单调递增或者单调递减的关系进…

Spring之整合Mybatis底层源码

文章目录 一、整体核心思路1 . 简介2. 整合思路 二、源码分析1. 环境准备2. 源码分析 一、整体核心思路 1 . 简介 有很多框架需要与Spring进行整合&#xff0c;而整合的核心思路就是把其他框架所产生的对象放到Spring容器中&#xff0c;让其成为一个bean。比如Mybatis&#x…

使用requests库测试post请求 操作流程

第一步 谷歌f12或其他抓包工具抓包&#xff0c;这里随机抓一个post请求 url&#xff1a;https://eva2.csdn.net/v3/06981375190026432f77c01bfca33e32/lts/groups/dadde766-b087-42da-8e67-d2499a520ee7/streams/a0119567-bf91-4314-ab75-f683ba6c0c0a/logs 第二步 导包 impo…