Pular para o conteúdo
Kitbay
Skill

data-manager

MITAtualizado em 21 de ago. de 202640.693Estrelas no GitHub

A reference skill published in the Phaser game framework's own repository for Phaser 4's data manager, a key-value store that sends events when values change so game systems can react without being tied together.

O que a skill ensina

A reference skill published in the Phaser game framework's own repository for Phaser 4's data manager, a key-value store that sends events when values change so game systems can react without being tied together. It covers the three levels, per game object, per scene and the game-wide registry, the methods for setting, reading, incrementing, toggling, querying, merging, resetting and freezing data, the values proxy, the event names and their arguments, and patterns such as sharing state across scenes and saving to local storage. Twelve pitfalls explain, for example, that changing a stored object in place sends no event, that registry listeners outlive a scene restart and that frozen managers fail silently.

O que faz

  • Store data on game objects, scenes or the registry
  • Listen for data change events
  • Share state across scenes
  • Save and load game state