/**
 * Copyright (c) 2014,www.easygame.org
 * All rights reserved.
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of the easygame.org nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY EASYEGRET.COM AND CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL EGRET-LABS.ORG AND CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
module virus{

    /**
     * <p></p>
     * @date  :2020-02-13 11:46:28
     * @EasyGame.org Tools
     */ 
    export class temp_rank  extends easy.Group{
        public resSpriteSheet:string = "temp_rank";//合并材质资源名称
        public resTexture:Array<string> = [];//单材质资源名称
        public resGroup:Array<string> = ["hall_temp_rank"];//配置文件的Group
        public resFiles:Array<string> = ["hall/temp_rank_loader_200213114628.json"];//需要下载的资源group
        public spriteSheet:egret.SpriteSheet = null;//ui对应的材质集,已经分割好,方便外部读取方便

        public groupBTN:easy.Group = null;
        public group:easy.Group = null;
        public imgra1_0:easy.Image = null;
        public imgra1_1:easy.Image = null;
        public imgra1_2:easy.Image = null;
        public imgra1_3:easy.Image = null;
        public imgra1_4:easy.Image = null;
        public labelid:easy.Label = null;
        public imgicon:easy.Image = null;
        public imgicon2:easy.Image = null;
        public labelname:easy.Label = null;
        public labelnum:easy.Label = null;

        public constructor() {
            super(true);
        }
        /**
         * 初始化主场景的组件,加入场景时,主动调用一次
         * 子类覆写该方法,添加UI逻辑
         */  
        public createChildren():void {
            super.createChildren();
            this.showBg = false;
            this.border = false;
            this.width = 590;
            this.height = 118;
            //groupBTN 
            this.groupBTN = new easy.Group(true);
            this.groupBTN.name = "groupBTN";
            this.addChild(this.groupBTN);
            this.groupBTN.border = false;
            this.groupBTN.width = 590;
            this.groupBTN.height = 118;
            this.groupBTN.topEnabled = true;
            this.groupBTN.bottomEnabled = true;
            this.groupBTN.leftEnabled = true;
            this.groupBTN.rightEnabled = true;
            this.groupBTN.alpha = 0;
            //group 
            this.group = new easy.Group(true);
            this.group.name = "group";
            this.addChild(this.group);
            this.group.showBg = false;
            this.group.border = false;
            this.group.width = 590;
            this.group.height = 118;
            //imgra1_0 
            this.imgra1_0 = new easy.Image(true);
            this.imgra1_0.name = "imgra1_0";
            this.group.addChild(this.imgra1_0);
            this.imgra1_0.x = 13;
            this.imgra1_0.y = 115;
            this.imgra1_0.width = 564;
            this.imgra1_0.height = 3;
            //imgra1_1 
            this.imgra1_1 = new easy.Image(true);
            this.imgra1_1.name = "imgra1_1";
            this.group.addChild(this.imgra1_1);
            this.imgra1_1.x = 2;
            this.imgra1_1.y = 14;
            this.imgra1_1.width = 554;
            this.imgra1_1.height = 93;
            //imgra1_2 
            this.imgra1_2 = new easy.Image(true);
            this.imgra1_2.name = "imgra1_2";
            this.group.addChild(this.imgra1_2);
            this.imgra1_2.x = 8;
            this.imgra1_2.y = 19;
            this.imgra1_2.width = 536;
            this.imgra1_2.height = 83;
            //imgra1_3 
            this.imgra1_3 = new easy.Image(true);
            this.imgra1_3.name = "imgra1_3";
            this.group.addChild(this.imgra1_3);
            this.imgra1_3.x = 13;
            this.imgra1_3.y = 24;
            this.imgra1_3.width = 512;
            this.imgra1_3.height = 67;
            //imgra1_4 
            this.imgra1_4 = new easy.Image(true);
            this.imgra1_4.name = "imgra1_4";
            this.group.addChild(this.imgra1_4);
            this.imgra1_4.x = 100;
            this.imgra1_4.y = 24;
            this.imgra1_4.width = 80;
            this.imgra1_4.height = 81;
            //labelid 
            this.labelid = new easy.Label(true);
            this.labelid.name = "labelid";
            this.group.addChild(this.labelid);
            this.labelid.text = "4";
            this.labelid.fontSize = 30;
            this.labelid.autoSize = false;
            this.labelid.height = 50;
            this.labelid.x = 29;
            this.labelid.y = 36;
            this.labelid.showBg = false;
            //imgicon 
            this.imgicon = new easy.Image(true);
            this.imgicon.name = "imgicon";
            this.group.addChild(this.imgicon);
            this.imgicon.autoSize = true;
            this.imgicon.x = 100;
            this.imgicon.y = 19;
            this.imgicon.width = 80;
            this.imgicon.height = 80;
            //imgicon2 
            this.imgicon2 = new easy.Image(true);
            this.imgicon2.name = "imgicon2";
            this.group.addChild(this.imgicon2);
            this.imgicon2.x = 100;
            this.imgicon2.y = 19;
            this.imgicon2.width = 80;
            this.imgicon2.height = 80;
            //labelname 
            this.labelname = new easy.Label(true);
            this.labelname.name = "labelname";
            this.group.addChild(this.labelname);
            this.labelname.text = "MOMO";
            this.labelname.fontSize = 35;
            this.labelname.autoSize = false;
            this.labelname.width = 200;
            this.labelname.height = 50;
            this.labelname.x = 200;
            this.labelname.y = 34;
            this.labelname.showBg = false;
            //labelnum 
            this.labelnum = new easy.Label(true);
            this.labelnum.name = "labelnum";
            this.group.addChild(this.labelnum);
            this.labelnum.text = "BEST 666";
            this.labelnum.fontSize = 33;
            this.labelnum.color = 0x4456b0;
            this.labelnum.autoSize = false;
            this.labelnum.width = 200;
            this.labelnum.height = 50;
            this.labelnum.x = 429;
            this.labelnum.y = 58;
            this.labelnum.showBg = false;

        }
        /**
         * 获取初始化逻辑,加入场景时,主动调用一次
         * 子类覆写该方法,添加业务逻辑
         */
         public initData():void {
           super.initData();
        }
        /**
         * 进入的逻辑
         * 可以再次根据外部数据情况做一些逻辑处理
         */
        public enter():void {

        }

        /**
         * 退出的逻辑
         * 做一些数据的销毁或者初始化,保证下次进入的时候,不会残留
         */
        public outer():void {

        }
        /**
         * 刷新UI皮肤显示
         */
        public validateNow():void{
            this.drawDelay = false;
            var jsonData:any = RES.getRes("temp_rank_json");
            if (jsonData != null) {
                this.spriteSheet = new egret.SpriteSheet(RES.getRes("temp_rank_img"));
                for (var key in jsonData.texture){
                    this.spriteSheet.createTexture(key, jsonData.texture[key].x, jsonData.texture[key].y, jsonData.texture[key].w, jsonData.texture[key].h);
                }
            }
            this.groupBTN.drawDelay = false;
            this.group.drawDelay = false;
            if (this.spriteSheet) this.imgra1_0.texture = this.spriteSheet.getTexture("4_13");
            this.imgra1_0.drawDelay = false;
            if (this.spriteSheet) this.imgra1_1.texture = this.spriteSheet.getTexture("4_10");
            this.imgra1_1.drawDelay = false;
            if (this.spriteSheet) this.imgra1_2.texture = this.spriteSheet.getTexture("4_11");
            this.imgra1_2.drawDelay = false;
            if (this.spriteSheet) this.imgra1_3.texture = this.spriteSheet.getTexture("4_12");
            this.imgra1_3.drawDelay = false;
            if (this.spriteSheet) this.imgra1_4.texture = this.spriteSheet.getTexture("4_16");
            this.imgra1_4.drawDelay = false;
            this.labelid.drawDelay = false;
            if (this.spriteSheet) this.imgicon.texture = this.spriteSheet.getTexture("4_8");
            this.imgicon.drawDelay = false;
            if (this.spriteSheet) this.imgicon2.texture = this.spriteSheet.getTexture("4_8");
            this.imgicon2.drawDelay = false;
            this.labelname.drawDelay = false;
            this.labelnum.drawDelay = false;

        }
    }
}