当前位置: 首页 > news >正文

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包路径是ABundlesstring 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/apublic 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包路径是ABundlesstring 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_WEBGLstring 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_EDITORAppConst.UseAssetBundle = useBundle;#endifAppConst.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_EDITORvar filepath = Path.Combine(Application.dataPath.Replace("Assets", ""), "config.txt");
#elsevar filepath = Path.Combine(Application.dataPath, "config.txt");
#endifDebug.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_EDITORif (AppConst.UseAssetBundle) {yield return AssetBundleManager.Instance.LoadSceneSync(SceneName);}else {yield return SceneManager.LoadSceneAsync(SceneName);}
#elseyield return AssetBundleManager.Instance.LoadSceneSync(SceneName);
#endifEventManager.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_EDITORif (SceneModel.Instance.useGlb == false) {PlayerData.Instance.TemplateId = TemplateId;}
#endifvar 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_EDITORif (AppConst.UseAssetBundle) {yield return AssetBundleManager.Instance.LoadSceneSync(SceneName);}else {yield return SceneManager.LoadSceneAsync(SceneName);}#elseyield 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() {}}

相关文章:

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

1.项目工程路径下创建文件夹&#xff1a;ABundles 2.AB包打包脚本&#xff1a; using System.Collections.Generic; using System.IO; using UnityEditor; using UnityEditor.SceneManagement; using UnityEngine; using UnityEngine.SceneManagement;public class AssetBundle…...

毕业设计:基于python微博舆情分析系统+可视化+Django框架 K-means聚类算法(源码)✅

毕业设计&#xff1a;2023-2024年计算机专业毕业设计选题汇总&#xff08;建议收藏&#xff09; 毕业设计&#xff1a;2023-2024年最新最全计算机专业毕设选题推荐汇总 &#x1f345;感兴趣的可以先收藏起来&#xff0c;点赞、关注不迷路&#xff0c;大家在毕设选题&#xff…...

xbox如何提升下载速度?

提高Xbox的下载速度可以通过以下几种方法&#xff1a; 连接稳定的网络&#xff1a;使用有线以太网连接而不是无线连接&#xff0c;因为有线连接通常更稳定且速度更快。 关闭正在运行的游戏和应用程序&#xff1a;运行游戏或应用程序会消耗网络资源和处理能力&#xff0c;关闭它…...

day13 滑动窗口最大值 前K个高频元素

题目1&#xff1a;239 滑动窗口最大值 题目链接&#xff1a;239 滑动窗口最大值 题意 长度为K的滑动窗口从整数数组的最左侧移动到最右侧&#xff0c;每次只移动1位&#xff0c;求滑动窗口中的最大值 不能使用优先级队列&#xff0c;如果使用大顶堆&#xff0c;最终要pop的…...

Unity——VContainer的依赖注入

一、IOC控制反转和DI依赖倒置 1、IOC框架核心原理是依赖倒置原则 C#设计模式的六大原则 使用这种思想方式&#xff0c;可以让我们无需关心对象的生成方式&#xff0c;只需要告诉容器我需要的对象即可&#xff0c;而告诉容器我需要对象的方式就叫做DI&#xff08;依赖注入&…...

【面试突击】Spring 面试实战

&#x1f308;&#x1f308;&#x1f308;&#x1f308;&#x1f308;&#x1f308;&#x1f308;&#x1f308; 欢迎关注公众号&#xff08;通过文章导读关注&#xff1a;【11来了】&#xff09;&#xff0c;及时收到 AI 前沿项目工具及新技术 的推送 发送 资料 可领取 深入理…...

【Linux】Ubuntu 22.04 上安装最新版 Nextcloud Hub 7 (28.0.1)

在 Ubuntu 22.04 上安装 PHP 版本 安装多个 PHP 版本的最简单方法是使用来自 Debian 开发人员 Ondřej Sur 的 PPA。要添加此 PPA,请在终端中运行以下命令。如果要从 PPA 安装软件,则需要 software-properties-common 包。它会自动安装在 Ubuntu 桌面上,但可能会在您的 Ubuntu…...

PHP项目如何自动化测试

开发和测试 测试和开发具有同等重要的作用 从一开始&#xff0c;测试和开发就是相向而行的。测试是开发团队的一支独立的、重要的支柱力量。 测试要具备独立性 独立分析业务需求&#xff0c;独立配置测试环境&#xff0c;独立编写测试脚本&#xff0c;独立开发测试工具。没有…...

WEB 3D技术 three.js 3D贺卡(1) 搭建基本项目环境

好 今天 我也是在网上学的 带着大家一起来做个3D贺卡 首先 我们要创建一个vue3的项目、 先创建一个文件夹 装我们的项目 终端执行 vue create 项目名称 例如 我的名字想叫 greetingCards 就是 vue create greetingcards因为这个名录 里面是全部都小写的 然后 下面选择 vue3 …...

短视频IP运营流程架构SOP模板PPT

【干货资料持续更新&#xff0c;以防走丢】 短视频IP运营流程架构SOP模板PPT 部分资料预览 资料部分是网络整理&#xff0c;仅供学习参考。 抖音运营资料合集&#xff08;完整资料包含以下内容&#xff09; 目录 抖音15秒短视频剧本创作公式 在抖音这个短视频平台上&#…...

python爬虫之线程与多进程知识点记录

一、线程 1、概念 线程 在一个进程的内部&#xff0c;要同时干多件事&#xff0c;就需要同时运行多个“子任务”&#xff0c;我们把进程内的这些“子任务”叫做线程 是操作系统能够进行运算调度的最小单位。它被包含在进程之中&#xff0c;是进程中的实际运作单位。一条线程指…...

基于Java (spring-boot)的停车场管理系统

一、项目介绍 基于Java (spring-boot)的停车场管理系统、预订车位系统、停车缴费系统功能&#xff1a; 登录、注册、后台首页、用户信息管理、车辆信息管理、新增车辆、车位费用设置、停泊车辆查询、车辆进出管理、登录日志查询、个人中心、预定停车位、缴费信息。 适用人群&…...

微软Office 2019 批量授权版

软件介绍 微软办公软件套件Microsoft Office 2019 专业增强版2024年1月批量许可版更新推送&#xff01;Office2019正式版2018年10月份推出&#xff0c;主要为多人跨平台办公与团队协作打造。Office2019整合对过去三年在Office365里所有功能&#xff0c;包括对Word、Excel、Pow…...

ChatGLM2-6B 大语言模型本地搭建

ChatGLM模型介绍&#xff1a; ChatGLM2-6B 是清华 NLP 团队于不久前发布的中英双语对话模型&#xff0c;它具备了强大的问答和对话功能。拥有最大32K上下文&#xff0c;并且在授权后可免费商用&#xff01; ChatGLM2-6B的6B代表了训练参数量为60亿&#xff0c;同时运用了模型…...

WindowsServer安装mysql最新版

安装 下载相应mysql安装包&#xff1a; MySQL :: Download MySQL Installer 选择不登陆下载 双击运行下载好的mysql-installer-community-*.*.*.msi 进入类型选择页面&#xff0c;本人需要mysql云服务就选择了server only server only&#xff08;服务器&#xff09;&#x…...

gin切片表单验证

在Gin中对切片进行表单验证的步骤与对其他类型的字段进行验证类似。以下是一些基本步骤&#xff0c;我们可以根据具体的需求进行调整&#xff1a; 定义结构体&#xff1a; 创建一个结构体&#xff0c;用于存储表单数据。确保结构体中的字段类型与你预期的表单数据类型一致。 使…...

openssl3.2 - 官方demo学习 - certs

文章目录 openssl3.2 - 官方demo学习 - certs概述笔记官方的实验流程mkcerts.sh - 整理ocsprun.sh - 整理ocspquery.sh - 整理从mkcerts.sh整理出来的27个.bata1_create_certificate_directly.cmda2_Intermediate_CA_request_first.cmda3_Sign_request_CA_extensions.cmda4_Ser…...

Datawhale 大模型基础理论 Day1 引言

开源链接如下&#xff1a;https://github.com/datawhalechina/so-large-lm/blob/main/docs/content/ch01.md 语言模型的概念&#xff1a;即能够赋予每个有意义的词&#xff08;token&#xff09;以一定的概率的一个函数的集合。 语言模型可以被用来评估输入的质量&#xff0c…...

HarmonyOS应用开发学习笔记 UIAbility组件与UI的数据同步 EventHub、globalThis

1、 HarmoryOS Ability页面的生命周期 2、 Component自定义组件 3、HarmonyOS 应用开发学习笔记 ets组件生命周期 4、HarmonyOS 应用开发学习笔记 ets组件样式定义 Styles装饰器&#xff1a;定义组件重用样式 Extend装饰器&#xff1a;定义扩展组件样式 5、HarmonyOS 应用开发…...

leetcode每日一题44

130. 被围绕的区域 图论 dfs/bfs dfs代码框架 void dfs(参数) {if (终止条件) {存放结果;return;}for (选择&#xff1a;本节点所连接的其他节点) {处理节点;dfs(图&#xff0c;选择的节点); // 递归回溯&#xff0c;撤销处理结果} }思路&#xff1a;本题要求找到被x围绕的陆…...

挑战杯推荐项目

“人工智能”创意赛 - 智能艺术创作助手&#xff1a;借助大模型技术&#xff0c;开发能根据用户输入的主题、风格等要求&#xff0c;生成绘画、音乐、文学作品等多种形式艺术创作灵感或初稿的应用&#xff0c;帮助艺术家和创意爱好者激发创意、提高创作效率。 ​ - 个性化梦境…...

【Python】 -- 趣味代码 - 小恐龙游戏

文章目录 文章目录 00 小恐龙游戏程序设计框架代码结构和功能游戏流程总结01 小恐龙游戏程序设计02 百度网盘地址00 小恐龙游戏程序设计框架 这段代码是一个基于 Pygame 的简易跑酷游戏的完整实现,玩家控制一个角色(龙)躲避障碍物(仙人掌和乌鸦)。以下是代码的详细介绍:…...

基于距离变化能量开销动态调整的WSN低功耗拓扑控制开销算法matlab仿真

目录 1.程序功能描述 2.测试软件版本以及运行结果展示 3.核心程序 4.算法仿真参数 5.算法理论概述 6.参考文献 7.完整程序 1.程序功能描述 通过动态调整节点通信的能量开销&#xff0c;平衡网络负载&#xff0c;延长WSN生命周期。具体通过建立基于距离的能量消耗模型&am…...

centos 7 部署awstats 网站访问检测

一、基础环境准备&#xff08;两种安装方式都要做&#xff09; bash # 安装必要依赖 yum install -y httpd perl mod_perl perl-Time-HiRes perl-DateTime systemctl enable httpd # 设置 Apache 开机自启 systemctl start httpd # 启动 Apache二、安装 AWStats&#xff0…...

Objective-C常用命名规范总结

【OC】常用命名规范总结 文章目录 【OC】常用命名规范总结1.类名&#xff08;Class Name)2.协议名&#xff08;Protocol Name)3.方法名&#xff08;Method Name)4.属性名&#xff08;Property Name&#xff09;5.局部变量/实例变量&#xff08;Local / Instance Variables&…...

从零开始打造 OpenSTLinux 6.6 Yocto 系统(基于STM32CubeMX)(九)

设备树移植 和uboot设备树修改的内容同步到kernel将设备树stm32mp157d-stm32mp157daa1-mx.dts复制到内核源码目录下 源码修改及编译 修改arch/arm/boot/dts/st/Makefile&#xff0c;新增设备树编译 stm32mp157f-ev1-m4-examples.dtb \stm32mp157d-stm32mp157daa1-mx.dtb修改…...

全面解析各类VPN技术:GRE、IPsec、L2TP、SSL与MPLS VPN对比

目录 引言 VPN技术概述 GRE VPN 3.1 GRE封装结构 3.2 GRE的应用场景 GRE over IPsec 4.1 GRE over IPsec封装结构 4.2 为什么使用GRE over IPsec&#xff1f; IPsec VPN 5.1 IPsec传输模式&#xff08;Transport Mode&#xff09; 5.2 IPsec隧道模式&#xff08;Tunne…...

均衡后的SNRSINR

本文主要摘自参考文献中的前两篇&#xff0c;相关文献中经常会出现MIMO检测后的SINR不过一直没有找到相关数学推到过程&#xff0c;其中文献[1]中给出了相关原理在此仅做记录。 1. 系统模型 复信道模型 n t n_t nt​ 根发送天线&#xff0c; n r n_r nr​ 根接收天线的 MIMO 系…...

Java线上CPU飙高问题排查全指南

一、引言 在Java应用的线上运行环境中&#xff0c;CPU飙高是一个常见且棘手的性能问题。当系统出现CPU飙高时&#xff0c;通常会导致应用响应缓慢&#xff0c;甚至服务不可用&#xff0c;严重影响用户体验和业务运行。因此&#xff0c;掌握一套科学有效的CPU飙高问题排查方法&…...

【Android】Android 开发 ADB 常用指令

查看当前连接的设备 adb devices 连接设备 adb connect 设备IP 断开已连接的设备 adb disconnect 设备IP 安装应用 adb install 安装包的路径 卸载应用 adb uninstall 应用包名 查看已安装的应用包名 adb shell pm list packages 查看已安装的第三方应用包名 adb shell pm list…...