mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2024-12-26 11:48:29 +00:00
17 lines
28 KiB
HTML
17 lines
28 KiB
HTML
<!doctype html>
|
||
<html lang="zh" dir="ltr" class="docs-wrapper docs-doc-page docs-version-2.1.0 plugin-docs plugin-id-default docs-doc-id-intro">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||
<meta name="generator" content="Docusaurus v2.0.0-beta.20">
|
||
<title data-rh="true">介绍 | Cocos Enhance Kit</title><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:url" content="https://smallmain.github.io/cocos-enhance-kit/docs/2.1.0/intro"><meta data-rh="true" name="docusaurus_locale" content="zh"><meta data-rh="true" name="docsearch:language" content="zh"><meta data-rh="true" name="docusaurus_version" content="2.1.0"><meta data-rh="true" name="docusaurus_tag" content="docs-default-2.1.0"><meta data-rh="true" name="docsearch:version" content="2.1.0"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-2.1.0"><meta data-rh="true" property="og:title" content="介绍 | Cocos Enhance Kit"><meta data-rh="true" name="description" content="logo"><meta data-rh="true" property="og:description" content="logo"><link data-rh="true" rel="icon" href="/cocos-enhance-kit/img/favicon.ico"><link data-rh="true" rel="canonical" href="https://smallmain.github.io/cocos-enhance-kit/docs/2.1.0/intro"><link data-rh="true" rel="alternate" href="https://smallmain.github.io/cocos-enhance-kit/docs/2.1.0/intro" hreflang="zh"><link data-rh="true" rel="alternate" href="https://smallmain.github.io/cocos-enhance-kit/docs/2.1.0/intro" hreflang="x-default"><link rel="stylesheet" href="/cocos-enhance-kit/assets/css/styles.22998370.css">
|
||
<link rel="preload" href="/cocos-enhance-kit/assets/js/runtime~main.e047e124.js" as="script">
|
||
<link rel="preload" href="/cocos-enhance-kit/assets/js/main.a7d7118a.js" as="script">
|
||
</head>
|
||
<body class="navigation-with-keyboard">
|
||
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus">
|
||
<div role="region"><a href="#" class="skipToContent_ZgBM">跳到主要内容</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Navigation bar toggle" class="navbar__toggle clean-btn" type="button" tabindex="0"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/cocos-enhance-kit/"><b class="navbar__title text--truncate">Cocos Enhance Kit</b></a></div><div class="navbar__items navbar__items--right"><a class="navbar__item navbar__link" href="/cocos-enhance-kit/">首页</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/cocos-enhance-kit/docs/2.1.0/intro">文档</a><a href="https://smallmain.github.io/cocos-enhance-kit/demo/v1.0.0/web-desktop/index.html" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">演示</a><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a class="navbar__link" aria-haspopup="true" aria-expanded="false" role="button" href="/cocos-enhance-kit/docs/2.1.0/intro">2.1.0</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/cocos-enhance-kit/docs/next/intro">Next</a></li><li><a class="dropdown__link" href="/cocos-enhance-kit/docs/intro">3.0.0</a></li><li><a class="dropdown__link" href="/cocos-enhance-kit/docs/2.4.0/intro">2.4.0</a></li><li><a class="dropdown__link" href="/cocos-enhance-kit/docs/2.3.0/intro">2.3.0</a></li><li><a class="dropdown__link" href="/cocos-enhance-kit/docs/2.2.0/intro">2.2.0</a></li><li><a aria-current="page" class="dropdown__link dropdown__link--active" href="/cocos-enhance-kit/docs/2.1.0/intro">2.1.0</a></li><li><a class="dropdown__link" href="/cocos-enhance-kit/docs/2.0.0/intro">2.0.0</a></li><li><a class="dropdown__link" href="/cocos-enhance-kit/docs/1.2.0/intro">1.2.0</a></li><li><a class="dropdown__link" href="/cocos-enhance-kit/docs/1.1.0/intro">1.1.0</a></li><li><a class="dropdown__link" href="/cocos-enhance-kit/docs/1.0.0/intro">1.0.0</a></li></ul></div><a href="https://github.com/smallmain/cocos-enhance-kit" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link header-github-link">Github</a><div class="searchBox_dLyj"><div class="navbar__search searchBarContainer_NW3z"><input placeholder="搜索" aria-label="Search" class="navbar__search-input"><div class="loadingRing_RJI3 searchBarLoadingRing_YnHq"><div></div><div></div><div></div><div></div></div><div class="searchHintContainer_Pkmr"><kbd class="searchHint_iIMx">ctrl</kbd><kbd class="searchHint_iIMx">K</kbd></div></div></div><div class="toggle_S7eR colorModeToggle_vKtC"><button class="clean-btn toggleButton_rCf9 toggleButtonDisabled_Pu9x" type="button" disabled="" title="切换浅色/暗黑模式(当前为浅色模式)" aria-label="切换浅色/暗黑模式(当前为浅色模式)"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_v35p"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_nQuB"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div class="main-wrapper docsWrapper_mKqt"><button aria-label="回到顶部" class="clean-btn theme-back-to-top-button backToTopButton_RiI4" type="button"></button><div class="docPage_ualW"><aside class="theme-doc-sidebar-container docSidebarContainer_UQUJ"><div class="sidebar_RiAD"><nav class="menu thin-scrollbar menu_izAj"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" href="/cocos-enhance-kit/docs/2.1.0/intro">介绍</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="true" href="/cocos-enhance-kit/docs/2.1.0/installation/installation-auto">安装</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/cocos-enhance-kit/docs/2.1.0/installation/installation-auto">一键安装</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/cocos-enhance-kit/docs/2.1.0/installation/installation-manual">手动安装</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="true" href="/cocos-enhance-kit/docs/2.1.0/best-practices/performance-guide">最佳实践</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/cocos-enhance-kit/docs/2.1.0/best-practices/performance-guide">提升游戏性能</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/cocos-enhance-kit/docs/2.1.0/best-practices/quality-guide">提升游戏质量</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/cocos-enhance-kit/docs/2.1.0/best-practices/new-features">新引擎特性</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" aria-expanded="true" href="/cocos-enhance-kit/docs/2.1.0/user-guide/multi-render/multi-render-intro">使用指南</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/cocos-enhance-kit/docs/2.1.0/user-guide/multi-render/multi-render-intro">多纹理渲染</a><button aria-label="打开/收起侧边栏菜单「多纹理渲染」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/cocos-enhance-kit/docs/2.1.0/user-guide/text-render/text-render-intro">文本渲染</a><button aria-label="打开/收起侧边栏菜单「文本渲染」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/cocos-enhance-kit/docs/2.1.0/user-guide/dynamic-batcher/dynamic-batcher-intro">动态合图</a><button aria-label="打开/收起侧边栏菜单「动态合图」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/cocos-enhance-kit/docs/2.1.0/user-guide/spine/spine-intro">Spine</a><button aria-label="打开/收起侧边栏菜单「Spine」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/cocos-enhance-kit/docs/2.1.0/user-guide/tiledmap/tiledmap-intro">TiledMap</a><button aria-label="打开/收起侧边栏菜单「TiledMap」" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" aria-expanded="false" tabindex="0" href="/cocos-enhance-kit/docs/2.1.0/user-guide/multithread/thread-intro">多线程支持</a><button aria-label="打开/收起侧边栏菜单「多线程支持」" type="button" class="clean-btn menu__caret"></button></div></li></ul></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/cocos-enhance-kit/docs/2.1.0/breaking-change">破坏性变更</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/cocos-enhance-kit/docs/2.1.0/uninstall-guide">卸载</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/cocos-enhance-kit/docs/2.1.0/update-log">更新日志</a></li></ul></nav></div></aside><main class="docMainContainer_uL0j"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_DM6M"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>此为 <!-- -->Cocos Enhance Kit<!-- --> <b>2.1.0</b> 版的文档,现已不再积极维护。</div><div class="margin-top--md">最新的文档请参阅 <b><a href="/cocos-enhance-kit/docs/intro">最新版本</a></b> (<!-- -->3.0.0<!-- -->)。</div></div><div class="docItemContainer_vinB"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Xlws" aria-label="页面路径"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="主页面" class="breadcrumbs__link" href="/cocos-enhance-kit/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_kU5B"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">介绍</span><meta itemprop="position" content="1"></li></ul></nav><span class="theme-doc-version-badge badge badge--secondary">版本:2.1.0</span><div class="tocCollapsible_bZGK theme-doc-toc-mobile tocMobile_TmEX"><button type="button" class="clean-btn tocCollapsibleButton_l22C">本页总览</button></div><div class="theme-doc-markdown markdown"><br><p><img loading="lazy" alt="logo" src="/cocos-enhance-kit/assets/images/logo2-a1b6b635bf67fdaee31973e360250e69.png" width="208" height="304" class="img_E7b_"></p><p>这是 <a href="https://www.cocos.com/creator" target="_blank" rel="noopener noreferrer">Cocos Creator</a> v2.x 社区分叉版本,<strong>提供了大量的新特性、性能改进与修复</strong>。</p><p>未来将继续秉持着<strong>完全开源、完全兼容</strong>的理念提供新特性、优化与修复。</p><p>非常欢迎你能和我们一起来完善这个项目!</p><h2 class="anchor anchorWithStickyNavbar_mojV" id="主要特性">主要特性<a class="hash-link" href="#主要特性" title="标题的直接链接"></a></h2><h3 class="anchor anchorWithStickyNavbar_mojV" id="完全兼容">完全兼容<a class="hash-link" href="#完全兼容" title="标题的直接链接"></a></h3><p>社区版的现在乃至未来都会做到以下几点:</p><ul><li>兼容旧项目,无需改动项目代码即可切换到社区版。</li><li>不会对项目本身进行任何改动,随时可以切换回官方版。</li><li>任何特性都可以选择性开启,保证项目的可控性。</li></ul><p>并且全平台兼容!</p><h3 class="anchor anchorWithStickyNavbar_mojV" id="支持多纹理渲染">支持多纹理渲染<a class="hash-link" href="#支持多纹理渲染" title="标题的直接链接"></a></h3><p>在之前,每个相邻的节点使用不同的纹理渲染时会打断合批,我们一般通过调节节点顺序、合并图集的方式来避免这个问题。</p><p>但是实际应用起来情况复杂,且操作麻烦,无法优化到极致,而较高的 DrawCall 数量会导致设备性能下降、发热的问题。</p><p>现在,由于支持了多纹理渲染,可允许多达 8 张不同纹理进行渲染时也不会打断合批,<strong>在最坏的情况下,也能将项目的 DrawCall 数量减少至 1/8</strong>!</p><p>并且,该特性在使用动态合图时会自动启用,无需任何改动即可得到优化效果。</p><p><img loading="lazy" alt="demo1" src="/cocos-enhance-kit/assets/images/demo1-458cc9beda63cfd491b25de86bf2593c.png" width="1918" height="1198" class="img_E7b_"></p><h3 class="anchor anchorWithStickyNavbar_mojV" id="支持高清文本渲染">支持高清文本渲染<a class="hash-link" href="#支持高清文本渲染" title="标题的直接链接"></a></h3><p>在之前,Cocos Creator 引擎默认以 1x 的分辨率渲染字体,所以有时候在某些 <code>Retina</code> 设备上会感觉到字体很模糊。</p><p>由于引擎本身不支持对其进行调节,我们会通过将 Label 的 <code>fontSize</code> 放大一倍,然后将 <code>scale</code> 缩小一倍的方式解决字体渲染模糊的问题。</p><p>现在,增加了高清文本渲染的支持,你只需要通过一句代码:</p><div class="language-ts codeBlockContainer_MPoW theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_B9tL"><pre tabindex="0" class="prism-code language-ts codeBlock__0OG thin-scrollbar"><code class="codeBlockLines_gEuF"><span class="token-line" style="color:#393A34"><span class="token plain">cc</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">sp</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">labelRetinaScale </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token number" style="color:#36acaa">2</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup_hRr1"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_W9eQ" aria-hidden="true"><svg class="copyButtonIcon_XEyF" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_i9w9" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>即可调整引擎文本渲染的分辨率,获得高清的文本渲染效果。</p><p><img loading="lazy" alt="demo4" src="/cocos-enhance-kit/assets/images/demo4-5a9ef2c1b76818302f5c5e2d745ede2a.png" width="1924" height="1200" class="img_E7b_"></p><h3 class="anchor anchorWithStickyNavbar_mojV" id="动态合图增强">动态合图增强<a class="hash-link" href="#动态合图增强" title="标题的直接链接"></a></h3><p>除了上面提到将动态合图支持了自动多纹理渲染之外,我们其实几乎重构了整个动态合图模块。</p><p>现在的动态合图即优化了算法,还<strong>支持废弃空间复用</strong>,这对于项目的性能优化空间的提升是巨大的。</p><p>并且,<strong>Spine 现在也可以参与动态合图</strong>了!</p><p><img loading="lazy" alt="demo2" src="/cocos-enhance-kit/assets/images/demo2-b23bb05bb434ce25ef290d2f30cc028c.png" width="1894" height="1200" class="img_E7b_"></p><h3 class="anchor anchorWithStickyNavbar_mojV" id="label-组件增强">Label 组件增强<a class="hash-link" href="#label-组件增强" title="标题的直接链接"></a></h3><p>Label 一直是项目优化的最难点,因为它完全不能和其它的渲染组件进行合批,甚至大部分情况下也不能和其它 Label 组件合批。</p><p>在之前,使用 <code>Bitmap</code> 模式可以加入动态合图,以达到合批的目的,但受引擎动态合图不能复用废弃空间的限制,导致项目越运行,可以动态合图的空间就越小,很容易就会将动态图集塞满,所以基本不会在实际的项目中使用。</p><p><code>Char</code> 模式也有类似的问题,内部的字符纹理即不支持复用,还最高仅支持 1 张纹理,纹理很容易就被填满导致无法渲染文本,不会在实际项目中使用。</p><p>但是现在,Label 得到了以下重大的改进:</p><ul><li>重构后的动态合图支持复用,<code>Bitmap</code> 模式的使用不再受限!</li><li><code>Char</code> 模式得到重构,<strong>支持废弃空间复用,支持最多 8 张字符纹理,支持自动多纹理合批</strong>!</li><li>RichText 也得到同样的所有改进,并且开放了自定义材质的设置。</li></ul><p><img loading="lazy" alt="demo3" src="/cocos-enhance-kit/assets/images/demo3-e616d6a6d0bd2bfbceb2db57b38fec91.png" width="1918" height="1200" class="img_E7b_"></p><h3 class="anchor anchorWithStickyNavbar_mojV" id="spine-组件增强">Spine 组件增强<a class="hash-link" href="#spine-组件增强" title="标题的直接链接"></a></h3><p>除了 Label 之外,如果你的项目用到了 Spine 组件,那么它大概率会成为项目第二个优化难点。</p><p>现在,Spine 也得到了重大改进,<strong>支持与其它组件合批,支持参与动态合图,还能无缝使用 SpriteFrame 进行换装</strong>!</p><p><img loading="lazy" alt="demo5" src="/cocos-enhance-kit/assets/images/demo5-7588adeef99924536d52fb590a4c2813.png" width="1922" height="1202" class="img_E7b_"></p><h3 class="anchor anchorWithStickyNavbar_mojV" id="tiledmap-组件优化">TiledMap 组件优化<a class="hash-link" href="#tiledmap-组件优化" title="标题的直接链接"></a></h3><p>单个 TiledMap 组件可能存在多个 TiledLayer,启用 Culling 特性后,每个 Layer 都需要单独计算 Culling 数据。</p><p>现在在满足条件的情况下可以复用 Culling 数据,以减少项目 CPU 的性能消耗。</p><h3 class="anchor anchorWithStickyNavbar_mojV" id="多线程支持">多线程支持<a class="hash-link" href="#多线程支持" title="标题的直接链接"></a></h3><p>现在,以下引擎的部分增加了多线程支持:</p><ul><li>资源管线(下载与缓存部分)</li><li>音频系统</li></ul><p>启用后可以释放其对主线程的占用,减少卡顿现象。</p><p>并且在微信小游戏平台下还有以下改进:</p><ul><li>默认启用网络接口和音频接口的高性能模式</li><li>网络接口支持 HTTP/2、HTTP/3(QUIC) 协议</li></ul><h2 class="anchor anchorWithStickyNavbar_mojV" id="使用方法">使用方法<a class="hash-link" href="#使用方法" title="标题的直接链接"></a></h2><p>请阅读文档的 <a href="/cocos-enhance-kit/docs/2.1.0/installation/installation-auto">一键安装</a>。</p><h2 class="anchor anchorWithStickyNavbar_mojV" id="贡献指南">贡献指南<a class="hash-link" href="#贡献指南" title="标题的直接链接"></a></h2><ul><li>如果你有任何问题或者想法请建立新的 <code>Issues</code>,我们会尽自己所能帮助你!</li><li>如果你有新的代码提交,请建立新的 <code>Pull requests</code> 以完成合并。</li></ul><h2 class="anchor anchorWithStickyNavbar_mojV" id="常见问题">常见问题<a class="hash-link" href="#常见问题" title="标题的直接链接"></a></h2><p><strong>为什么要直接修改引擎?</strong></p><p>官方对 2.x 版本已经停止了更新(仅做一些维护工作),修改引擎不会遇到在官方新版本发布后需要用大量时间去适配,或者特性冲突的问题。</p><p>如果不自定义引擎,则无法兼容原生平台,即使不兼容,使用 Hack 的方式,某些特性的实现需要大量拷贝代码,包体会增大,可维护性会降低。</p><p>最后,我们希望它接近 “原生” 的使用体验,就像只是一次引擎的无痛升级。</p><p><strong>启动 Cocos Creator 报 Error: Can not parse this input:undefined 错误</strong></p><p>你可能忘记安装配套的引擎扩展,所以没有找到社区版的内置资源,导致报错,请仔细阅读文档。</p><p><strong>原生平台或模拟器报错:Assertion failed: (_type == Type::String), function toString, file Value.cpp, line 496.</strong></p><p>你可能没有替换引擎的 <code>jsb-adapter</code> 部分,或者说没有重启以使替换生效。</p><p>并且原生平台需额外注意,升级后的首次构建可能需先删除原有的构建工程才会生效。</p><p><strong>使用模拟器预览时出现各种问题</strong></p><p>可能是因为模拟器没有重新编译导致的,请按照官方的 <a href="https://docs.cocos.com/creator/2.4/manual/zh/advanced-topics/engine-customization.html#25-%E7%BC%96%E8%AF%91%E6%A8%A1%E6%8B%9F%E5%99%A8" target="_blank" rel="noopener noreferrer">引擎定制文档</a> 重新编译原生模拟器即可。</p><p><strong>Spine 组件出现 Uncaught TypeError: Cannot read property ‘load’ of null, location: src/cocos2d-jsb.b5158.js 等问题</strong></p><p>这是引擎自身的问题,由于释放 Spine 资源,然后再次加载相同 Spine 资源时导致,具体请看:</p><p><a href="https://forum.cocos.org/t/topic/137649/148" target="_blank" rel="noopener noreferrer">问题讨论</a></p><p>截止 v2.4.12,引擎仍未修复此问题,暂时的解决方案有三种:</p><ol><li>引擎已经有一个修复此问题的 PR,但还未合入,可自行合入:<a href="https://github.com/cocos/engine-native/pull/4307" target="_blank" rel="noopener noreferrer">PR #4307</a></li><li>需要进行释放的 spine 资源,不让其参与动态合图(通过控制 Spine 组件的合图开关)。</li><li>不释放需要参与动态合图的 spine 资源。</li></ol><p>该问题已在 v2.4.13 版本修复,请升级社区版至 v2.0.0 以上。</p><h2 class="anchor anchorWithStickyNavbar_mojV" id="支持我们">支持我们<a class="hash-link" href="#支持我们" title="标题的直接链接"></a></h2><p>社区版的开发需要大量的工作来进行,你的支持是我们最大的动力:</p><ul><li>请给我们的项目仓库一个 <a href="https://github.com/smallmain/cocos-enhance-kit" target="_blank" rel="noopener noreferrer">Star</a>!</li><li>购买可有可无的 <a href="https://store.cocos.com/app/detail/3824" target="_blank" rel="noopener noreferrer">一键安装扩展</a> 赞助我们!</li></ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="文档分页导航"><a class="pagination-nav__link pagination-nav__link--next" href="/cocos-enhance-kit/docs/2.1.0/installation/installation-auto"><div class="pagination-nav__sublabel">下一页</div><div class="pagination-nav__label">一键安装</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_cNA8 thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#主要特性" class="table-of-contents__link toc-highlight">主要特性</a><ul><li><a href="#完全兼容" class="table-of-contents__link toc-highlight">完全兼容</a></li><li><a href="#支持多纹理渲染" class="table-of-contents__link toc-highlight">支持多纹理渲染</a></li><li><a href="#支持高清文本渲染" class="table-of-contents__link toc-highlight">支持高清文本渲染</a></li><li><a href="#动态合图增强" class="table-of-contents__link toc-highlight">动态合图增强</a></li><li><a href="#label-组件增强" class="table-of-contents__link toc-highlight">Label 组件增强</a></li><li><a href="#spine-组件增强" class="table-of-contents__link toc-highlight">Spine 组件增强</a></li><li><a href="#tiledmap-组件优化" class="table-of-contents__link toc-highlight">TiledMap 组件优化</a></li><li><a href="#多线程支持" class="table-of-contents__link toc-highlight">多线程支持</a></li></ul></li><li><a href="#使用方法" class="table-of-contents__link toc-highlight">使用方法</a></li><li><a href="#贡献指南" class="table-of-contents__link toc-highlight">贡献指南</a></li><li><a href="#常见问题" class="table-of-contents__link toc-highlight">常见问题</a></li><li><a href="#支持我们" class="table-of-contents__link toc-highlight">支持我们</a></li></ul></div></div></div></div></main></div></div></div>
|
||
<script src="/cocos-enhance-kit/assets/js/runtime~main.e047e124.js"></script>
|
||
<script src="/cocos-enhance-kit/assets/js/main.a7d7118a.js"></script>
|
||
</body>
|
||
</html> |