/**
 * 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-14 11:11:14
     * @EasyGame.org Tools
     */ 
    export class temp_game  extends easy.Group{
        public resSpriteSheet:string = "temp_game";//合并材质资源名称
        public resTexture:Array<string> = [];//单材质资源名称
        public resGroup:Array<string> = ["hall_temp_game"];//配置文件的Group
        public resFiles:Array<string> = ["hall/temp_game_loader_200214111114.json"];//需要下载的资源group
        public spriteSheet:egret.SpriteSheet = null;//ui对应的材质集,已经分割好,方便外部读取方便

        public group:easy.Group = null;
        public imgtemp0_1:easy.Image = null;
        public imgtemp0_2:easy.Image = null;
        public imgtemp1:easy.Image = null;
        public imgtemp2:easy.Image = null;
        public imgtemp3:easy.Image = null;
        public grouptemp1:easy.Group = null;
        public imgtemp1_1:easy.Image = null;
        public imgtemp1_2:easy.Image = null;
        public imgtemp1_3:easy.Image = null;
        public grouptemp2:easy.Group = null;
        public imgtemp2_1:easy.Image = null;
        public imgtemp2_2:easy.Image = null;
        public imgtemp2_3:easy.Image = null;
        public grouptemp3:easy.Group = null;
        public imgtemp3_1:easy.Image = null;
        public imgtemp3_2:easy.Image = null;
        public imgtemp3_3:easy.Image = null;

        public constructor() {
            super(true);
        }
        /**
         * 初始化主场景的组件,加入场景时,主动调用一次
         * 子类覆写该方法,添加UI逻辑
         */  
        public createChildren():void {
            super.createChildren();
            this.showBg = false;
            this.border = false;
            this.width = 174;
            this.height = 184;
            //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 = 174;
            this.group.height = 184;
            this.group.topEnabled = true;
            this.group.bottomEnabled = true;
            this.group.leftEnabled = true;
            this.group.rightEnabled = true;
            //imgtemp0_1 
            this.imgtemp0_1 = new easy.Image(true);
            this.imgtemp0_1.name = "imgtemp0_1";
            this.group.addChild(this.imgtemp0_1);
            this.imgtemp0_1.width = 174;
            this.imgtemp0_1.height = 184;
            //imgtemp0_2 
            this.imgtemp0_2 = new easy.Image(true);
            this.imgtemp0_2.name = "imgtemp0_2";
            this.group.addChild(this.imgtemp0_2);
            this.imgtemp0_2.x = 174;
            this.imgtemp0_2.width = 174;
            this.imgtemp0_2.height = 184;
            this.imgtemp0_2.scaleX = -1;
            //imgtemp1 
            this.imgtemp1 = new easy.Image(true);
            this.imgtemp1.name = "imgtemp1";
            this.group.addChild(this.imgtemp1);
            this.imgtemp1.autoSize = true;
            this.imgtemp1.x = 47;
            this.imgtemp1.y = 9;
            this.imgtemp1.width = 20;
            this.imgtemp1.height = 20;
            //imgtemp2 
            this.imgtemp2 = new easy.Image(true);
            this.imgtemp2.name = "imgtemp2";
            this.group.addChild(this.imgtemp2);
            this.imgtemp2.autoSize = true;
            this.imgtemp2.x = 77;
            this.imgtemp2.y = 9;
            this.imgtemp2.width = 20;
            this.imgtemp2.height = 20;
            //imgtemp3 
            this.imgtemp3 = new easy.Image(true);
            this.imgtemp3.name = "imgtemp3";
            this.group.addChild(this.imgtemp3);
            this.imgtemp3.autoSize = true;
            this.imgtemp3.x = 107;
            this.imgtemp3.y = 9;
            this.imgtemp3.width = 20;
            this.imgtemp3.height = 20;
            //grouptemp1 
            this.grouptemp1 = new easy.Group(true);
            this.grouptemp1.name = "grouptemp1";
            this.group.addChild(this.grouptemp1);
            this.grouptemp1.showBg = false;
            this.grouptemp1.border = false;
            this.grouptemp1.x = 32;
            this.grouptemp1.y = 9;
            this.grouptemp1.width = 30;
            this.grouptemp1.height = 30;
            //imgtemp1_1 
            this.imgtemp1_1 = new easy.Image(true);
            this.imgtemp1_1.name = "imgtemp1_1";
            this.grouptemp1.addChild(this.imgtemp1_1);
            this.imgtemp1_1.width = 30;
            this.imgtemp1_1.height = 30;
            //imgtemp1_2 
            this.imgtemp1_2 = new easy.Image(true);
            this.imgtemp1_2.name = "imgtemp1_2";
            this.grouptemp1.addChild(this.imgtemp1_2);
            this.imgtemp1_2.x = 3;
            this.imgtemp1_2.y = 3;
            this.imgtemp1_2.width = 24;
            this.imgtemp1_2.height = 24;
            //imgtemp1_3 
            this.imgtemp1_3 = new easy.Image(true);
            this.imgtemp1_3.name = "imgtemp1_3";
            this.grouptemp1.addChild(this.imgtemp1_3);
            this.imgtemp1_3.x = 7;
            this.imgtemp1_3.y = 7;
            this.imgtemp1_3.width = 16;
            this.imgtemp1_3.height = 16;
            //grouptemp2 
            this.grouptemp2 = new easy.Group(true);
            this.grouptemp2.name = "grouptemp2";
            this.group.addChild(this.grouptemp2);
            this.grouptemp2.showBg = false;
            this.grouptemp2.border = false;
            this.grouptemp2.x = 72;
            this.grouptemp2.y = 9;
            this.grouptemp2.width = 30;
            this.grouptemp2.height = 30;
            //imgtemp2_1 
            this.imgtemp2_1 = new easy.Image(true);
            this.imgtemp2_1.name = "imgtemp2_1";
            this.grouptemp2.addChild(this.imgtemp2_1);
            this.imgtemp2_1.width = 30;
            this.imgtemp2_1.height = 30;
            //imgtemp2_2 
            this.imgtemp2_2 = new easy.Image(true);
            this.imgtemp2_2.name = "imgtemp2_2";
            this.grouptemp2.addChild(this.imgtemp2_2);
            this.imgtemp2_2.x = 3;
            this.imgtemp2_2.y = 3;
            this.imgtemp2_2.width = 24;
            this.imgtemp2_2.height = 24;
            //imgtemp2_3 
            this.imgtemp2_3 = new easy.Image(true);
            this.imgtemp2_3.name = "imgtemp2_3";
            this.grouptemp2.addChild(this.imgtemp2_3);
            this.imgtemp2_3.x = 7;
            this.imgtemp2_3.y = 7;
            this.imgtemp2_3.width = 16;
            this.imgtemp2_3.height = 16;
            //grouptemp3 
            this.grouptemp3 = new easy.Group(true);
            this.grouptemp3.name = "grouptemp3";
            this.group.addChild(this.grouptemp3);
            this.grouptemp3.showBg = false;
            this.grouptemp3.border = false;
            this.grouptemp3.x = 112;
            this.grouptemp3.y = 9;
            this.grouptemp3.width = 30;
            this.grouptemp3.height = 30;
            //imgtemp3_1 
            this.imgtemp3_1 = new easy.Image(true);
            this.imgtemp3_1.name = "imgtemp3_1";
            this.grouptemp3.addChild(this.imgtemp3_1);
            this.imgtemp3_1.width = 30;
            this.imgtemp3_1.height = 30;
            //imgtemp3_2 
            this.imgtemp3_2 = new easy.Image(true);
            this.imgtemp3_2.name = "imgtemp3_2";
            this.grouptemp3.addChild(this.imgtemp3_2);
            this.imgtemp3_2.x = 3;
            this.imgtemp3_2.y = 3;
            this.imgtemp3_2.width = 24;
            this.imgtemp3_2.height = 24;
            //imgtemp3_3 
            this.imgtemp3_3 = new easy.Image(true);
            this.imgtemp3_3.name = "imgtemp3_3";
            this.grouptemp3.addChild(this.imgtemp3_3);
            this.imgtemp3_3.x = 7;
            this.imgtemp3_3.y = 7;
            this.imgtemp3_3.width = 16;
            this.imgtemp3_3.height = 16;

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

        }

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

        }
        /**
         * 刷新UI皮肤显示
         */
        public validateNow():void{
            this.drawDelay = false;
            var jsonData:any = RES.getRes("temp_game_json");
            if (jsonData != null) {
                this.spriteSheet = new egret.SpriteSheet(RES.getRes("temp_game_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.group.drawDelay = false;
            if (this.spriteSheet) this.imgtemp0_1.texture = this.spriteSheet.getTexture("3_3");
            this.imgtemp0_1.drawDelay = false;
            if (this.spriteSheet) this.imgtemp0_2.texture = this.spriteSheet.getTexture("3_3");
            this.imgtemp0_2.drawDelay = false;
            this.imgtemp1.drawDelay = false;
            this.imgtemp2.drawDelay = false;
            this.imgtemp3.drawDelay = false;
            this.grouptemp1.drawDelay = false;
            if (this.spriteSheet) this.imgtemp1_1.texture = this.spriteSheet.getTexture("dian1_3");
            this.imgtemp1_1.drawDelay = false;
            if (this.spriteSheet) this.imgtemp1_2.texture = this.spriteSheet.getTexture("dian1_2");
            this.imgtemp1_2.drawDelay = false;
            if (this.spriteSheet) this.imgtemp1_3.texture = this.spriteSheet.getTexture("dian1_1");
            this.imgtemp1_3.drawDelay = false;
            this.grouptemp2.drawDelay = false;
            if (this.spriteSheet) this.imgtemp2_1.texture = this.spriteSheet.getTexture("dian2_3");
            this.imgtemp2_1.drawDelay = false;
            if (this.spriteSheet) this.imgtemp2_2.texture = this.spriteSheet.getTexture("dian2_2");
            this.imgtemp2_2.drawDelay = false;
            if (this.spriteSheet) this.imgtemp2_3.texture = this.spriteSheet.getTexture("dian2_1");
            this.imgtemp2_3.drawDelay = false;
            this.grouptemp3.drawDelay = false;
            if (this.spriteSheet) this.imgtemp3_1.texture = this.spriteSheet.getTexture("dian3_3");
            this.imgtemp3_1.drawDelay = false;
            if (this.spriteSheet) this.imgtemp3_2.texture = this.spriteSheet.getTexture("dian3_2");
            this.imgtemp3_2.drawDelay = false;
            if (this.spriteSheet) this.imgtemp3_3.texture = this.spriteSheet.getTexture("dian3_1");
            this.imgtemp3_3.drawDelay = false;

        }
    }
}