Giter Site home page Giter Site logo

Comments (2)

WithLithum avatar WithLithum commented on September 4, 2024

Explanation

The NativeMenu.Next() and NativeMenu.Previous() methods are used to navigate to the Next or Previous items in a NativeMenu. (Note: these methods are publicly callable, so if you call one of them in this situation the game hangs as well) Two methods works the exact same way other than one moves forwards and the other one moves backwards.

The Next and Previous item logic is ran inside a while loop:

  1. It peeks the next item by moving nextIndex forwards or backwards by one - we call it cursor.
  2. If the cursor encounters a separator, it skips to the next item, and goes back to step 1.
  3. If the cursor goes beyond (before) all of the items, it returns to the beginning (end), and goes back to step 1.
  4. If the cursor hits the current item (if there are only one valid item, step 2 and 3 will cause cursor to eventually go back to the only valid item), the loop is broken and the method returns.
  5. If the cursor hits another item than the current item, the loop is broken and the method returns.

This way it works fine as long as the menu have at least one valid item among all items. However, when there is a menu consisted entirely of separators, as the logic is completely unaware about the menu is entirely consisted of separators, the code will keep going back and forth between step 1 and step 2, completely blocking the "game thread" and not allowing the game engine and other scripts to execute.

Hince, the game hangs, until the script ticking the offending menu is aborted.

from lemonui.

justalemon avatar justalemon commented on September 4, 2024

I'm aware of that. I just remembered to push the fix as it's already fixed on my local repo.

from lemonui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.