Knowhow-dm2
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Egret UI開發的疑難雜症 ### 雜症目錄 [雜症1:使用 eui.List 進行排序時,發生 item 排序位置不符合預期](https://hackmd.io/aVPfckLQQ6-CzDMC82s7Jg#%E9%9B%9C%E7%97%871) [雜症2:UI元件在大尺寸的螢幕下,呈現全黑的畫面](https://hackmd.io/aVPfckLQQ6-CzDMC82s7Jg#%E9%9B%9C%E7%97%872) [雜症3:新增 **Skin** 和 **Component code** 後,啟動遊戲會出現 **Component** 初始化錯誤訊息](https://hackmd.io/aVPfckLQQ6-CzDMC82s7Jg#%E9%9B%9C%E7%97%873) ## 雜症1 ### 問題描述 :::danger **使用 eui.List 進行排序時,發生 item 排序位置不符合預期** ::: 問題範例圖片 ![](https://i.imgur.com/VreyOry.png) 圖中的籌碼應該要對齊凹槽,但是位置偏移了 ### 發生原因 在 ItemRenderSkin 裡面,除了籌碼本身外,還有放置一個大於籌碼大小的發光圖片 ![](https://i.imgur.com/Tj7S2Nb.png) 雖然 Skin 和籌碼有設定固定長寬,但是在 eui.List 的 Item 初始排序時,不知為什麼會參考到發光圖片的長寬,而不是設定的固定長寬,因此最終的排序結果就不如預期 但是在點擊按鈕之後,籌碼的長寬就會恢復原狀,因此判斷是初始排序才會發生的問題 ![](https://i.imgur.com/x7stxc6.png) ### 解決 只要在發光圖片上,將 includeInLayout 設定為 false,將發光圖片排除在 Layout 之外就能解決問題 ![](https://i.imgur.com/vfIUuYY.png) :::info 題外話:後來發現可能是 **core.AutoScaleButton** 機制的問題,如果 **AutoScaleButton** 的 **skin** 裡面沒有使用 **Group** 將內容包起來時,高機率發生按鈕圖片位移問題 ::: ## 雜症2 ### 問題描述 :::danger **UI元件在大尺寸的螢幕下,呈現全黑的畫面** ::: ![](https://i.imgur.com/38AsSLk.png) 圖中可以看到背景的畫面是全黑的,並且在 console 出現錯誤訊息 ![](https://i.imgur.com/PPha2o9.jpg) ### 發生原因 目前不是非常確定發生的原由,但根據以下列討論判斷,可能是擴展的圖片長或寬超過 2048 所導致 [https://bbs.egret.com/thread-48503-1-1.html](https://bbs.egret.com/thread-48503-1-1.html) [https://stackoverflow.com/questions/46109392/how-to-find-out-max-texture-size-for-webgl-on-my-system](https://stackoverflow.com/questions/46109392/how-to-find-out-max-texture-size-for-webgl-on-my-system) 以下對猜測進行了測試 ``` 模擬器寬度 2400,遊戲畫面寬度 2134,有出現錯誤訊息 模擬器寬度 2100,遊戲畫面寬度 1828,沒有出現錯誤訊息 模擬器寬度 2300,遊戲畫面寬度 2046,沒有出現錯誤訊息 模擬器寬度 2350,遊戲畫面寬度 2090,有出現錯誤訊息 ``` 測試結果發現,只要遊戲畫面寬度超過 2048 時,就會發生畫面全黑的情況,也稍微證明圖片超過 2048 時,的確會造成某些異常狀況發生 ### 解決 目前畫面全黑的現象大多是發生在背景,而背景通常是使用以下兩個 UI 元件來呈現 **eui.Image** **eui.Rect** 在 **eui.Image** 作為背景的情況下 :::info 只要 **cacheAsBitmap** 屬性不為 **true** 的話,即使長寬超過 **2048** 也不會變成全黑狀態 ::: 猜測 **eui.Image** 或許有特別處理過(?) 因此若元件為 **eui.Image**,但是長或寬超過 **2048** 卻會造成畫面全黑時,可以檢查 **cacheAsBitmap** 屬性是否為 **true** ![](https://i.imgur.com/hslKRkb.png) 在 **eui.Rect** 這裡就不怎麼幸運了,**eui.Rect** 只要長或寬超過 **2048** 就一定會變成全黑,因此目前唯一的解決辦法是 :::info 若要全屏擴展時,不要使用 **eui.Rect** 來實現,改為使用 **eui.Image** 來實現 ::: ## 雜症3 ### 問題描述 :::danger 新增 **Skin** 和 **Component code** 後,啟動遊戲會出現 **Component** 初始化錯誤訊息 ::: ![](https://i.imgur.com/GeuwNs2.png) ### 發生原因 目前猜測可能是 **Skin** 的 **class** 與 **Component** 的 **class** 的在 **runtime** 中的排序出現問題,導致 **Component** 初始化的時候無法辨識 **Skin** 而出現錯誤 ### 解決 將出現問題的 **SkinName** 改名,把原先預設的 **skin.** 加回去,這樣錯誤就沒有再次出現 ![](https://i.imgur.com/1T9LW8J.png) :::warning 目前遇到的案例只有一次,尚無法保證是 100% 的解決方式 ::: ###### tags: `遊戲筆記`

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully