Giter Site home page Giter Site logo

uistate's Introduction

项目简介

一个 Cocos Creator 3.x 的插件,能够方便的管理多个UI状态,只需一个在需要记录状态的节点上添加UIState组件,即可记录所有子节点(包含子孙节点)的状态改变

  1. 支持嵌套UIState。子节点(子孙节点)也可以加UIState,维护自己的状态
  2. 数据量小。仅记录修改的节点
  3. 代码逻辑清晰易扩展。可以很方便的扩展记录的组件和属性,支持记录自定义组件

image

安装和使用

  1. 将 extensions 目录下的 uistate-inspector 拷贝到你项目的 extensions 目录下

image

  1. 点击 Creator 工具栏的 扩展->扩展管理器,点击已安装扩展,点击刷新扩展,就可以看到 uistate-inspector 扩展

image

  1. 点击扩展右边的 toggle button,启用扩展
  2. 将 assets\script\component 目录下的 UIState.ts 文件复制到你项目的任意位置

image

  1. 为你需要记录UI状态的节点添加 UIState 组件

测试场景

嵌套UIState ✔ 父UIState节点不会保存子UIState节点的状态

新增节点 ✔ 在切换到其他状态前,所有状态会保持一致,切换过一次状态后,每个状态会保存自己的数据

新增节点并修改属性 ✔ 在切换到其他状态前,所有状态会保持一致,切换过一次状态后,每个状态会保存自己的数据

删除节点 ✔ 所有状态都会删除该节点

新增组件 ✔ 仅对当前状态生效,其他状态会禁用该组件

删除组件 ✔ 所有状态都会删除该组件

禁用组件 ✔ 仅对当前状态生效

组件测试

Label ✔

RichText ✔

Sprite ✔ 特定情况下会出现SpriteFrame没有更新,点击 Creator 能够刷新。使用软刷新场景的接口,编辑器会闪一下,体验不是太好,不过可以保证显示正确

Widget ✔

构建发布测试

Web桌面 ✔

uistate's People

Contributors

cheney2013 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.