/**
 * 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 modules{

    /**
     * <p></p>
     * @date  :2020-03-27 17:57:59
     * @EasyGame.org Tools
     */ 
    export class index3  extends easy.Group{
        public resourceRoot:string = "";
        public resSpriteSheet:string = "index3";//合并材质资源名称
        public resTexture:Array<string> = ["3"];//单材质资源名称
        public resGroup:Array<string> = ["courseware_index3"];//配置文件的Group
        public resFiles:Array<string> = ["courseware/index3_loader_200327175759.json"];//需要下载的资源group
        public spriteSheet:egret.SpriteSheet = null;//ui对应的材质集,已经分割好,方便外部读取方便

        public group:easy.Group = null;
        public imgas:easy.Image = null;
        public groupAll:easy.Group = null;
        public imgBg:easy.Image = null;
        public img1:easy.Image = null;
        public img2:easy.Image = null;
        public img3:easy.Image = null;
        public imgWord1:easy.Image = null;
        public imgShow1:easy.Image = null;
        public imgShow2:easy.Image = null;
        public imgShow3:easy.Image = null;
        public imgShow4:easy.Image = null;
        public imgShow5:easy.Image = null;
        public imgShow6:easy.Image = null;
        public imgShow7:easy.Image = null;
        public imgShow8:easy.Image = null;
        public imgShow9:easy.Image = null;
        public imgShow10:easy.Image = null;
        public imgShow11:easy.Image = null;
        public imgShow12:easy.Image = null;
        public imgShow13:easy.Image = null;
        public imgShow14:easy.Image = null;
        public imgShow15:easy.Image = null;
        public imgShow16:easy.Image = null;
        public imgShow17:easy.Image = null;
        public imgShow18:easy.Image = null;
        public imgShow19:easy.Image = null;
        public imgShow20:easy.Image = null;
        public imgShow21:easy.Image = null;
        public imgShow22:easy.Image = null;
        public imgShow23:easy.Image = null;
        public imgShow24:easy.Image = null;
        public btnAgain:easy.Button = null;
        public btnPage:easy.Button = null;
        public temp:tempTemplate = null;

        public constructor() {
            super(true);
        }
        /**
         * 初始化主场景的组件,加入场景时,主动调用一次
         * 子类覆写该方法,添加UI逻辑
         */  
        public createChildren():void {
            super.createChildren();
            this.showBg = false;
            this.border = false;
            this.width = 640;
            this.height = 960;
            //group 
            this.group = new easy.Group(true);
            this.group.name = "group";
            this.addChild(this.group);
            this.group.bgColor = 0xffffff;
            this.group.border = false;
            this.group.width = 640;
            this.group.height = 960;
            //imgas 
            this.imgas = new easy.Image(true);
            this.imgas.name = "imgas";
            this.addChild(this.imgas);
            this.imgas.x = -0.5;
            this.imgas.width = 641;
            this.imgas.height = 927;
            this.imgas.visible = false;
            //groupAll 
            this.groupAll = new easy.Group(true);
            this.groupAll.name = "groupAll";
            this.addChild(this.groupAll);
            this.groupAll.showBg = false;
            this.groupAll.border = false;
            this.groupAll.width = 640;
            this.groupAll.height = 960;
            this.groupAll.horizontalEnabled = true;
            this.groupAll.verticalEnabled = true;
            //imgBg 
            this.imgBg = new easy.Image(true);
            this.imgBg.name = "imgBg";
            this.groupAll.addChild(this.imgBg);
            this.imgBg.x = -230;
            this.imgBg.y = -114;
            this.imgBg.width = 1100;
            this.imgBg.height = 1188;
            //img1 
            this.img1 = new easy.Image(true);
            this.img1.name = "img1";
            this.groupAll.addChild(this.img1);
            this.img1.width = 154;
            this.img1.height = 21;
            //img2 
            this.img2 = new easy.Image(true);
            this.img2.name = "img2";
            this.groupAll.addChild(this.img2);
            this.img2.x = 153;
            this.img2.width = 487;
            this.img2.height = 21;
            //img3 
            this.img3 = new easy.Image(true);
            this.img3.name = "img3";
            this.groupAll.addChild(this.img3);
            this.img3.x = 10;
            this.img3.y = 60;
            this.img3.width = 33;
            this.img3.height = 20;
            //imgWord1 
            this.imgWord1 = new easy.Image(true);
            this.imgWord1.name = "imgWord1";
            this.groupAll.addChild(this.imgWord1);
            this.imgWord1.x = 140;
            this.imgWord1.y = 56;
            this.imgWord1.width = 387;
            this.imgWord1.height = 50;
            //imgShow1 
            this.imgShow1 = new easy.Image(true);
            this.imgShow1.name = "imgShow1";
            this.groupAll.addChild(this.imgShow1);
            this.imgShow1.x = 40;
            this.imgShow1.y = 147;
            this.imgShow1.width = 150;
            this.imgShow1.height = 75;
            //imgShow2 
            this.imgShow2 = new easy.Image(true);
            this.imgShow2.name = "imgShow2";
            this.groupAll.addChild(this.imgShow2);
            this.imgShow2.x = 30;
            this.imgShow2.y = 233;
            this.imgShow2.width = 173;
            this.imgShow2.height = 87;
            //imgShow3 
            this.imgShow3 = new easy.Image(true);
            this.imgShow3.name = "imgShow3";
            this.groupAll.addChild(this.imgShow3);
            this.imgShow3.x = 201;
            this.imgShow3.y = 271;
            this.imgShow3.width = 35;
            this.imgShow3.height = 10;
            //imgShow4 
            this.imgShow4 = new easy.Image(true);
            this.imgShow4.name = "imgShow4";
            this.groupAll.addChild(this.imgShow4);
            this.imgShow4.x = 238;
            this.imgShow4.y = 230;
            this.imgShow4.width = 173;
            this.imgShow4.height = 87;
            //imgShow5 
            this.imgShow5 = new easy.Image(true);
            this.imgShow5.name = "imgShow5";
            this.groupAll.addChild(this.imgShow5);
            this.imgShow5.x = 407;
            this.imgShow5.y = 272;
            this.imgShow5.width = 35;
            this.imgShow5.height = 10;
            //imgShow6 
            this.imgShow6 = new easy.Image(true);
            this.imgShow6.name = "imgShow6";
            this.groupAll.addChild(this.imgShow6);
            this.imgShow6.x = 498;
            this.imgShow6.y = 147;
            this.imgShow6.width = 73;
            this.imgShow6.height = 75;
            //imgShow7 
            this.imgShow7 = new easy.Image(true);
            this.imgShow7.name = "imgShow7";
            this.groupAll.addChild(this.imgShow7);
            this.imgShow7.x = 439;
            this.imgShow7.y = 230;
            this.imgShow7.width = 173;
            this.imgShow7.height = 87;
            //imgShow8 
            this.imgShow8 = new easy.Image(true);
            this.imgShow8.name = "imgShow8";
            this.groupAll.addChild(this.imgShow8);
            this.imgShow8.x = 18;
            this.imgShow8.y = 320;
            this.imgShow8.width = 519;
            this.imgShow8.height = 141;
            //imgShow9 
            this.imgShow9 = new easy.Image(true);
            this.imgShow9.name = "imgShow9";
            this.groupAll.addChild(this.imgShow9);
            this.imgShow9.x = 38;
            this.imgShow9.y = 328;
            this.imgShow9.width = 155;
            this.imgShow9.height = 74;
            //imgShow10 
            this.imgShow10 = new easy.Image(true);
            this.imgShow10.name = "imgShow10";
            this.groupAll.addChild(this.imgShow10);
            this.imgShow10.x = 29;
            this.imgShow10.y = 410;
            this.imgShow10.width = 173;
            this.imgShow10.height = 86;
            //imgShow11 
            this.imgShow11 = new easy.Image(true);
            this.imgShow11.name = "imgShow11";
            this.groupAll.addChild(this.imgShow11);
            this.imgShow11.x = 201;
            this.imgShow11.y = 447;
            this.imgShow11.width = 35;
            this.imgShow11.height = 10;
            //imgShow12 
            this.imgShow12 = new easy.Image(true);
            this.imgShow12.name = "imgShow12";
            this.groupAll.addChild(this.imgShow12);
            this.imgShow12.x = 238;
            this.imgShow12.y = 411;
            this.imgShow12.width = 173;
            this.imgShow12.height = 86;
            //imgShow13 
            this.imgShow13 = new easy.Image(true);
            this.imgShow13.name = "imgShow13";
            this.groupAll.addChild(this.imgShow13);
            this.imgShow13.x = 407;
            this.imgShow13.y = 447;
            this.imgShow13.width = 35;
            this.imgShow13.height = 10;
            //imgShow14 
            this.imgShow14 = new easy.Image(true);
            this.imgShow14.name = "imgShow14";
            this.groupAll.addChild(this.imgShow14);
            this.imgShow14.x = 441;
            this.imgShow14.y = 412;
            this.imgShow14.width = 173;
            this.imgShow14.height = 86;
            //imgShow15 
            this.imgShow15 = new easy.Image(true);
            this.imgShow15.name = "imgShow15";
            this.groupAll.addChild(this.imgShow15);
            this.imgShow15.x = 18;
            this.imgShow15.y = 497;
            this.imgShow15.width = 519;
            this.imgShow15.height = 141;
            //imgShow16 
            this.imgShow16 = new easy.Image(true);
            this.imgShow16.name = "imgShow16";
            this.groupAll.addChild(this.imgShow16);
            this.imgShow16.x = 29;
            this.imgShow16.y = 589;
            this.imgShow16.width = 173;
            this.imgShow16.height = 87;
            //imgShow17 
            this.imgShow17 = new easy.Image(true);
            this.imgShow17.name = "imgShow17";
            this.groupAll.addChild(this.imgShow17);
            this.imgShow17.x = 81;
            this.imgShow17.y = 685;
            this.imgShow17.width = 69;
            this.imgShow17.height = 72;
            //imgShow18 
            this.imgShow18 = new easy.Image(true);
            this.imgShow18.name = "imgShow18";
            this.groupAll.addChild(this.imgShow18);
            this.imgShow18.x = 201;
            this.imgShow18.y = 628;
            this.imgShow18.width = 35;
            this.imgShow18.height = 10;
            //imgShow19 
            this.imgShow19 = new easy.Image(true);
            this.imgShow19.name = "imgShow19";
            this.groupAll.addChild(this.imgShow19);
            this.imgShow19.x = 238;
            this.imgShow19.y = 590;
            this.imgShow19.width = 173;
            this.imgShow19.height = 87;
            //imgShow20 
            this.imgShow20 = new easy.Image(true);
            this.imgShow20.name = "imgShow20";
            this.groupAll.addChild(this.imgShow20);
            this.imgShow20.x = 301;
            this.imgShow20.y = 684;
            this.imgShow20.width = 41;
            this.imgShow20.height = 72;
            //imgShow21 
            this.imgShow21 = new easy.Image(true);
            this.imgShow21.name = "imgShow21";
            this.groupAll.addChild(this.imgShow21);
            this.imgShow21.x = 407;
            this.imgShow21.y = 628;
            this.imgShow21.width = 35;
            this.imgShow21.height = 10;
            //imgShow22 
            this.imgShow22 = new easy.Image(true);
            this.imgShow22.name = "imgShow22";
            this.groupAll.addChild(this.imgShow22);
            this.imgShow22.x = 440;
            this.imgShow22.y = 590;
            this.imgShow22.width = 173;
            this.imgShow22.height = 87;
            //imgShow23 
            this.imgShow23 = new easy.Image(true);
            this.imgShow23.name = "imgShow23";
            this.groupAll.addChild(this.imgShow23);
            this.imgShow23.x = 494;
            this.imgShow23.y = 686;
            this.imgShow23.width = 82;
            this.imgShow23.height = 71;
            //imgShow24 
            this.imgShow24 = new easy.Image(true);
            this.imgShow24.name = "imgShow24";
            this.groupAll.addChild(this.imgShow24);
            this.imgShow24.x = 108;
            this.imgShow24.y = 789;
            this.imgShow24.width = 447;
            this.imgShow24.height = 66;
            //btnAgain 
            this.btnAgain = new easy.Button(true);
            this.btnAgain.name = "btnAgain";
            this.groupAll.addChild(this.btnAgain);
            this.btnAgain.width = 133;
            this.btnAgain.height = 47;
            this.btnAgain.x = 467;
            this.btnAgain.y = 883;
            //btnPage 
            this.btnPage = new easy.Button(true);
            this.btnPage.name = "btnPage";
            this.groupAll.addChild(this.btnPage);
            this.btnPage.width = 133;
            this.btnPage.height = 47;
            this.btnPage.x = 27;
            this.btnPage.y = 883;
            //temp 
            this.temp = new modules.tempTemplate();
            this.temp.name = "temp";
            this.addChild(this.temp);
            if (this.temp.ui["resFiles"]) this.resFiles = this.resFiles.concat(this.temp.ui.resFiles);
            if (this.temp.ui["resGroup"]) this.resGroup = this.resGroup.concat(this.temp.ui.resGroup);
            this.temp.x = 540;
            this.temp.rightEnabled = true;
            this.temp.ui.rightEnabled = true;

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

        }

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

        }
        /**
         * 刷新UI皮肤显示
         */
        public validateNow():void{
            this.drawDelay = false;
            var jsonData:any = RES.getRes("index3_json");
            if (jsonData != null) {
                this.spriteSheet = new egret.SpriteSheet(RES.getRes("index3_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;
            this.imgas.texture = RES.getRes("3");
            this.imgas.drawDelay = false;
            this.groupAll.drawDelay = false;
            if (this.spriteSheet) this.imgBg.texture = this.spriteSheet.getTexture("page08-03");
            this.imgBg.drawDelay = false;
            if (this.spriteSheet) this.img1.texture = this.spriteSheet.getTexture("page03-01");
            this.img1.drawDelay = false;
            if (this.spriteSheet) this.img2.texture = this.spriteSheet.getTexture("page03-02");
            this.img2.drawDelay = false;
            if (this.spriteSheet) this.img3.texture = this.spriteSheet.getTexture("page3-01");
            this.img3.drawDelay = false;
            if (this.spriteSheet) this.imgWord1.texture = this.spriteSheet.getTexture("page3-02");
            this.imgWord1.drawDelay = false;
            if (this.spriteSheet) this.imgShow1.texture = this.spriteSheet.getTexture("page3-03");
            this.imgShow1.drawDelay = false;
            if (this.spriteSheet) this.imgShow2.texture = this.spriteSheet.getTexture("page3-05");
            this.imgShow2.drawDelay = false;
            if (this.spriteSheet) this.imgShow3.texture = this.spriteSheet.getTexture("page3-06");
            this.imgShow3.drawDelay = false;
            if (this.spriteSheet) this.imgShow4.texture = this.spriteSheet.getTexture("page3-07");
            this.imgShow4.drawDelay = false;
            if (this.spriteSheet) this.imgShow5.texture = this.spriteSheet.getTexture("page3-06");
            this.imgShow5.drawDelay = false;
            if (this.spriteSheet) this.imgShow6.texture = this.spriteSheet.getTexture("page3-04");
            this.imgShow6.drawDelay = false;
            if (this.spriteSheet) this.imgShow7.texture = this.spriteSheet.getTexture("page3-09");
            this.imgShow7.drawDelay = false;
            if (this.spriteSheet) this.imgShow8.texture = this.spriteSheet.getTexture("page3-10");
            this.imgShow8.drawDelay = false;
            if (this.spriteSheet) this.imgShow9.texture = this.spriteSheet.getTexture("page3-12");
            this.imgShow9.drawDelay = false;
            if (this.spriteSheet) this.imgShow10.texture = this.spriteSheet.getTexture("page3-11");
            this.imgShow10.drawDelay = false;
            if (this.spriteSheet) this.imgShow11.texture = this.spriteSheet.getTexture("page3-06");
            this.imgShow11.drawDelay = false;
            if (this.spriteSheet) this.imgShow12.texture = this.spriteSheet.getTexture("page3-13");
            this.imgShow12.drawDelay = false;
            if (this.spriteSheet) this.imgShow13.texture = this.spriteSheet.getTexture("page3-06");
            this.imgShow13.drawDelay = false;
            if (this.spriteSheet) this.imgShow14.texture = this.spriteSheet.getTexture("page3-14");
            this.imgShow14.drawDelay = false;
            if (this.spriteSheet) this.imgShow15.texture = this.spriteSheet.getTexture("page3-10");
            this.imgShow15.drawDelay = false;
            if (this.spriteSheet) this.imgShow16.texture = this.spriteSheet.getTexture("page3-15");
            this.imgShow16.drawDelay = false;
            if (this.spriteSheet) this.imgShow17.texture = this.spriteSheet.getTexture("page3-16");
            this.imgShow17.drawDelay = false;
            if (this.spriteSheet) this.imgShow18.texture = this.spriteSheet.getTexture("page3-06");
            this.imgShow18.drawDelay = false;
            if (this.spriteSheet) this.imgShow19.texture = this.spriteSheet.getTexture("page3-17");
            this.imgShow19.drawDelay = false;
            if (this.spriteSheet) this.imgShow20.texture = this.spriteSheet.getTexture("page3-18");
            this.imgShow20.drawDelay = false;
            if (this.spriteSheet) this.imgShow21.texture = this.spriteSheet.getTexture("page3-06");
            this.imgShow21.drawDelay = false;
            if (this.spriteSheet) this.imgShow22.texture = this.spriteSheet.getTexture("page3-19");
            this.imgShow22.drawDelay = false;
            if (this.spriteSheet) this.imgShow23.texture = this.spriteSheet.getTexture("page3-20");
            this.imgShow23.drawDelay = false;
            if (this.spriteSheet) this.imgShow24.texture = this.spriteSheet.getTexture("page3-21");
            this.imgShow24.drawDelay = false;
            if (this.spriteSheet) this.btnAgain.texture = this.spriteSheet.getTexture("page02-12");
            this.btnAgain.drawDelay = false;
            if (this.spriteSheet) this.btnPage.texture = this.spriteSheet.getTexture("page02-11");
            this.btnPage.drawDelay = false;
            //模板temp
            this.temp.validateNow();

        }
    }
}