Skip to content
forked from iwae/easyMenu

easyMenu is a component to help developers to add menus easily in Cocos Creator

Notifications You must be signed in to change notification settings

shujunqiao/easyMenu

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

easyMenu

easyMenu is a component to help developers to add menus easily in Cocos Creator

image

it presets few functions for 2d/3d game tests.

FPS Monitor

122

Time Scale

133

Overdraw Debug

image

how to use

copy easyMenu to your project, and add EasyMenu to the Canvas

image

add group

image

    const menu = director.getScene().getChildByName('Canvas').getComponentInChildren(eMenu);
    if(!menu) return;
    const group = menu.addGroup("Scene");

add item

    group.addItem("Default",()=>{
          this.defaultScene();
    });

add toggle

  
     group.addToggle("High FPS", (t) => {
           game.frameRate = t ? 60 : 30;
     });

add list

  
     group.addList("Image Memory",
           this.getImageMemory.bind(this)
    );

add slider

  
     group.addSlider("Scale", (v: number) => {
           timeScale.scale = v;
     }, 1);

add editbox

     group.addEdit("edit", "default",((input:string)=>{

     });

add graph

    group.addGraph("FPS", null, 60, 14);

    this.graph = group.node.getChildByName("FPS").getComponent(eGraph);

    this.graph.callback = (() => {
        const output = this.graph.positions.toString();
        console.log("FPS History", output)
        this.copyToClipboard(output);
    })

add multi items

   this.menu
    .addGroup("Debug")
    .addToggle("Profiler", (t) => {
        t ? profiler.showStats() : profiler.hideStats();
    })
    .addSlider("Scale", (v: number) => {
        TimeScale.scale = v;
    }, 1)
    .addItem("Game Time", () => {
        return "GameTime: " + Math.floor(game.totalTime) + " ms";
    })
    .addToggle("High FPS", (t) => {
        game.frameRate = t ? 60 : 30;
    })
    .addItem("Overdraw Test",
        this.testOverdraw.bind(this)
    )
    .addList("Image Memory",
        this.getImageMemory.bind(this)
    )

About

easyMenu is a component to help developers to add menus easily in Cocos Creator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 99.9%
  • JavaScript 0.1%