Egret GUI and Egret Wing is the most slag-h5 design I've seen.

Source: Internet
Author: User

A copy of the flexlite copy of their own thoughts are not, the essence of others do not understand the garbage framework. Do not learn Mornui, at least a bit of their own ideas.

Let's start with a minimum available set:

1. Egret Create Legogame--type GUI. Build a project with a GUI.

2. Open this stupid project with Webstorm.

3. Modify Theme.thm:

{    "skins":    {        "Egret.gui.Button": "Skins.simple.ButtonSkin"    }}

4. Modify Resource.json

{    "Groups":[    {        "Keys": "Button_disabled_png,button_down_png,button_normal_png,bgimage",        "Name": "Preload"    }],    "Resources":[    {        "Name": "Button_disabled_png",        "Scale9grid": "3,4,14,13",        ' type ': ' Image ',        "url": "Assets/simple/normalbutton/button_disabled.png"    },    {        "Name": "Button_down_png",        "Scale9grid": "4,3,13,14",        ' type ': ' Image ',        "url": "Assets/simple/normalbutton/button_down.png"    },    {        "Name": "Button_normal_png",        "Scale9grid": "4,3,13,15",        ' type ': ' Image ',        "url": "Assets/simple/normalbutton/button_normal.png"    },    {        "Name": "Bgimage",        ' type ': ' Image ',        "url": "Assets/bg.jpg"    }    ]}

5. Enter the Resource/assets/simple directory, keep the Normalbutton, and delete the other. Enter src/skins/simple/except Buttonskin.exml, others to delete.

6. Go to Showcaseskin.exml, delete list, get:

<?XML version= ' 1.0 ' encoding= ' utf-8 '?><E:skinwidth= "480"Height= "$"xmlns:e= "Http://ns.egret-labs.org/egret"xmlns:w= "Http://ns.egret-labs.org/wing">    <w:hostcomponentname= "Egret.gui.SkinnableComponent"/>    <w:declarations/>    <e:states>        <e:statename= "normal"/>        <e:statename= "Disabled"/>a</e:states>    <E:buttonID= "Btnshowmessage"label= "click"y= " the"Horizontalcenter= "0"/></E:skin>

7. Enter Showcase.ts, except button, all other delete:

class Showcase extends Egret.gui.SkinnableComponent {public    constructor () {        super ();         this. Skinname = "Skins.scene.ShowcaseSkin";    }    public BtnShowMessage:egret.gui.Button;    Public partadded (Partname:string, Instance:any):void  {        super.partadded (PartName, instance) ;    }}

8. Under the Legogame directory, Run Egret build, Egret startserver. Get the result with only one button.

This is the minimum available set: Mininum available set.

It is not superfluous to continue studying Resource.json and theme.thm. and the Buttonskin.exml file.

Egret GUI and Egret Wing is the most slag-h5 design I've seen.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.