public override void onClosed()
 {
     A3_SlayDragonProxy.getInstance().removeEventListener(A3_SlayDragonProxy.END_TIME, OnRefreshTime);
     OnDragonLineClick(rootDragonList.GetChild(0).gameObject);
     CancelInvoke("RunTimer");
     isFrstdrgnInit = false;
     Instance       = null;
 }
 public override void onShowed()
 {
     Instance = this;
     A3_SlayDragonProxy.getInstance().addEventListener(A3_SlayDragonProxy.END_TIME, OnRefreshTime);
     if (!IsInvoking("RunTimer"))
     {
         InvokeRepeating("RunTimer", 0f, 1f);
     }
     // if (!PlayerModel.getInstance().inFb) //副本中不发送协议
     Invoke("ShowFirstDragon", 0.2f);
     A3_SlayDragonProxy.getInstance().SendGetData();
 }
        public override void init()
        {
            #region 初始化汉字
            getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1201").text            = ContMgr.getCont("A3_SlayDragon_0");
            getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1201/title_text").text = ContMgr.getCont("A3_SlayDragon_1");
            getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1202").text            = ContMgr.getCont("A3_SlayDragon_2");
            getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1202/title_text").text = ContMgr.getCont("A3_SlayDragon_3");
            getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1203").text            = ContMgr.getCont("A3_SlayDragon_4");
            getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1203/title_text").text = ContMgr.getCont("A3_SlayDragon_5");
            getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1204").text            = ContMgr.getCont("A3_SlayDragon_6");
            getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1204/title_text").text = ContMgr.getCont("A3_SlayDragon_7");
            getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1205").text            = ContMgr.getCont("A3_SlayDragon_8");
            getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1205/title_text").text = ContMgr.getCont("A3_SlayDragon_9");
            getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1206").text            = ContMgr.getCont("A3_SlayDragon_10");
            getComponentByPath <Text>("bg/dragon_opt/descBg/desc/1206/title_text").text = ContMgr.getCont("A3_SlayDragon_11");
            getComponentByPath <Text>("bg/dragon_opt/proc_unlock/proc_desc").text       = ContMgr.getCont("A3_SlayDragon_12");
            getComponentByPath <Text>("bg/dragon_opt/timer/desc").text                  = ContMgr.getCont("A3_SlayDragon_13");
            getComponentByPath <Text>("bg/dragon_opt/reward/text").text                 = ContMgr.getCont("A3_SlayDragon_14");
            getComponentByPath <Text>("bg/dragon_opt/btn_do/Go/text_img/Text").text     = ContMgr.getCont("A3_SlayDragon_15");
            getComponentByPath <Text>("bg/dragon_opt/btn_do/Create/text_img/Text").text = ContMgr.getCont("A3_SlayDragon_15");
            getComponentByPath <Text>("bg/dragon_opt/btn_do/Unlock/text_img/Text").text = ContMgr.getCont("A3_SlayDragon_16");
            getComponentByPath <Text>("hp/help_txt/desc/title").text = ContMgr.getCont("A3_SlayDragon_17");
            getComponentByPath <Text>("hp/help_txt/desc/dc").text    = ContMgr.getCont("A3_SlayDragon_18");
            #endregion


            Instance       = this;
            rootDragonList = transform.FindChild("bg/dragon_list/rect_mask/rect_scroll");
            for (int i = 0; i < rootDragonList.childCount; i++)
            {
                Transform tfDragonLine = rootDragonList.GetChild(i);
                A3_SlayDragonModel.getInstance().dicDragonName[i] = tfDragonLine.name;
                new BaseButton(tfDragonLine).onClick = OnDragonLineClick;
            }
            goDragonHelpTxt = transform.FindChild("hp/help_txt").gameObject;
            goTimer         = transform.FindChild("bg/dragon_opt/timer").gameObject;
            txtTimer        = goTimer.transform.FindChild("time").GetComponent <Text>();
            new BaseButton(transform.FindChild("bg/dragon_opt/btn_do/Go")).onClick            = OnGoToSlayDragon;
            new BaseButton(transform.FindChild("bg/dragon_opt/btn_do/Unlock")).onClick        = OnUnlockDragon;
            new BaseButton(transform.FindChild("bg/dragon_opt/btn_do/Create")).onClick        = (go) => { OnCreateDragon(go); OnGoToSlayDragon(go); };
            new BaseButton(transform.FindChild("bg/dragon_opt/proc_unlock/btn_give")).onClick = OnGive;
            new BaseButton(transform.FindChild("close")).onClick = (go) => InterfaceMgr.getInstance().close(InterfaceMgr.A3_SLAY_DRAGON);
            new BaseButton(transform.FindChild("hp")).onClick    = (go) => goDragonHelpTxt.SetActive(true);
            new BaseButton(goDragonHelpTxt.transform.FindChild("close_area")).onClick = (go) => goDragonHelpTxt.SetActive(false);
            rootDragonOpt = transform.FindChild("bg/dragon_opt");
            new BaseButton(rootDragonOpt.FindChild("reward/reward_icon")).onClick = (go) =>
            {
                uint dragonId = A3_SlayDragonModel.getInstance().dicDragonData[currentSelectedDragonName].dragonId;
                uint itemId   = A3_SlayDragonModel.getInstance().GetRewardIdByDragonId(dragonId);
                if (itemId == 0)
                {
                    return;
                }
                ArrayList arr = new ArrayList();
                arr.Add(itemId);
                arr.Add(1);
                InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_MINITIP, arr);
            };

            A3_SlayDragonProxy.getInstance().addEventListener(A3_SlayDragonProxy.REFRESH, OnRefresh);
            A3_SlayDragonProxy.getInstance().addEventListener(A3_SlayDragonProxy.OPEN_LVL, OnOpenLvl);
        }