Example #1
0
        public override void init()
        {
            a3_pet_skin.instan = this;
            this.petmodel      = ModelBase <A3_PetModel> .getInstance();

            this.feedid       = this.petmodel.GetFeedItemTpid();
            this.levelid      = this.petmodel.GetLevelItemTpid();
            this.stageid      = this.petmodel.GetStageItemTpid();
            this.currentLevel = this.petmodel.CurrentLevelConf();
            this.currentStage = this.petmodel.CurrentStageConf();
            this.stagestep    = this.currentStage.getUint("crystal_step");
            BaseButton baseButton = new BaseButton(base.getTransformByPath("exp_con/upgrade"), 1, 1);

            baseButton.onClick = new Action <GameObject>(this.OnUpgrade);
            BaseButton baseButton2 = new BaseButton(base.getTransformByPath("exp_con/onekey"), 1, 1);

            baseButton2.onClick = new Action <GameObject>(this.OnOnekey);
            BaseButton baseButton3 = new BaseButton(base.getTransformByPath("lampoil"), 1, 1);

            baseButton3.onClick = new Action <GameObject>(this.OnFeed);
            BaseButton baseButton4 = new BaseButton(base.getTransformByPath("stage_con/improve"), 1, 1);

            baseButton4.onClick = new Action <GameObject>(this.OnStage);
            BaseButton baseButton5 = new BaseButton(base.getTransformByPath("title/help"), 1, 1);

            baseButton5.onClick = new Action <GameObject>(this.OnHelp);
            BaseButton baseButton6 = new BaseButton(base.getTransformByPath("close"), 1, 1);

            baseButton6.onClick = new Action <GameObject>(this.onclose);
            this.autofeed       = base.getComponentByPath <Toggle>("light_hint/toggle");
            this.autofeed.onValueChanged.AddListener(new UnityAction <bool>(this.OnAutoFeedToggleChange));
            this.autobuy = base.getComponentByPath <Toggle>("light_hint/toggle2");
            this.autobuy.onValueChanged.AddListener(new UnityAction <bool>(this.OnAutoBuyToggleChange));
            this.prefab = base.getGameObjectByPath("att/a3_pet_att");
        }
Example #2
0
        public override void onShowed()
        {
            BaseProxy <A3_PetProxy> .getInstance().GetPets();

            A3_PetModel expr_12 = this.petmodel;

            expr_12.OnExpChange = (Action)Delegate.Combine(expr_12.OnExpChange, new Action(this.OnExpChange));
            A3_PetModel expr_39 = this.petmodel;

            expr_39.OnAutoFeedChange = (Action)Delegate.Remove(expr_39.OnAutoFeedChange, new Action(this.OnAutoBuyChange));
            A3_PetModel expr_60 = this.petmodel;

            expr_60.OnLevelChange = (Action)Delegate.Combine(expr_60.OnLevelChange, new Action(this.OnLevelChange));
            A3_PetModel expr_87 = this.petmodel;

            expr_87.OnStageChange = (Action)Delegate.Combine(expr_87.OnStageChange, new Action(this.OnStageChange));
            this.OnExpChange();
            this.OnStarvationChange();
            this.OnAutoFeedChange();
            this.OnAutoBuyChange();
            this.OnLevelChange();
            this.OnStageChange();
            this.OnPetItemChange(null);
            BaseProxy <BagProxy> .getInstance().addEventListener(BagProxy.EVENT_ITEM_CHANGE, new Action <GameEvent>(this.OnPetItemChange));
        }
        private void OnSwitch(TabControl t)
        {
            int index = t.getSeletedIndex();

            if (current != null)
            {
                current.onClose();
                current.gameObject.SetActive(false);
            }

            if (index == 0)
            {
                if (A3_PetModel.getInstance().hasPet())
                {
                    if (pet == null)
                    {
                        GameObject prefab = GAMEAPI.ABLayer_LoadNow_GameObject("uilayer_a3_pet_skin");
                        GameObject panel  = GameObject.Instantiate(prefab) as GameObject;
                        //pet = new a3_pet_skin(panel.transform);
                        //pet.setPerent(con);
                        //pet.gameObject.SetActive(false);
                    }
                    if (FunctionOpenMgr.instance.Check(FunctionOpenMgr.PET))
                    {
                        current = pet;
                    }
                }
                else
                {
                    flytxt.instance.fly(ContMgr.getCont("no_get_pet"));
                    current = null;
                }
            }
            else if (index == 1)
            {
                if (wing == null)
                {//TODO
                    GameObject prefab = GAMEAPI.ABLayer_LoadNow_GameObject("uilayer_a3_wing_skin");
                    GameObject panel  = GameObject.Instantiate(prefab) as GameObject;
                    //wing = new a3_wing_skin(panel.transform);
                    // wing.setPerent(con);
                    //wing.gameObject.SetActive(false);
                }
                if (FunctionOpenMgr.instance.Check(FunctionOpenMgr.PET_SWING))
                {
                    current = wing;
                }
            }

            if (current != null)
            {
                current.onShowed();
                current.visiable = true;
                if (!current.__mainTrans.gameObject.activeSelf)
                {
                    current.__mainTrans.gameObject.SetActive(true);
                }
            }
        }
Example #4
0
        private void OnBless(Variant data)
        {
            A3_PetModel instance = ModelBase <A3_PetModel> .getInstance();

            instance.Tpid  = data["id"];
            instance.Level = data["level"];
            instance.Exp   = data["exp"];
        }
        private void OnBless(Variant data)
        {
            A3_PetModel cpet = A3_PetModel.getInstance();

            cpet.Tpid  = data["id"];
            cpet.Level = data["level"];
            cpet.Exp   = data["exp"];
        }
        private void OnStage(Variant data)
        {
            A3_PetModel cpet = A3_PetModel.getInstance();

            cpet.Tpid  = data["id"];
            cpet.Stage = data["stage"];
            cpet.Level = 1;
            cpet.Exp   = 0;
            flytxt.instance.fly(ContMgr.getCont("petmodel_upok"));
        }
Example #7
0
        private void OnStage(Variant data)
        {
            A3_PetModel instance = ModelBase <A3_PetModel> .getInstance();

            instance.Tpid  = data["id"];
            instance.Stage = data["stage"];
            instance.Level = 1;
            instance.Exp   = 0;
            flytxt.instance.fly("恭喜,升阶成功!", 0, default(Color), null);
        }
        private void OnSyncStarvation(Variant data)
        {
            A3_PetModel cpet = A3_PetModel.getInstance();

            cpet.Starvation = data["starvation"];
            if (a3_pet_skin.instan != null)
            {
                a3_pet_skin.instan.OnStarvationChange();
            }
        }
        private void OnAutoPlayUpgrade(Variant data)
        {
            A3_PetModel cpet = A3_PetModel.getInstance();

            cpet.Tpid = data["id"];
            cpet.Exp  = data["exp"];
            if (data.ContainsKey("level"))
            {
                cpet.Level = data["level"];
            }
        }
Example #10
0
        private void OnSyncStarvation(Variant data)
        {
            A3_PetModel instance = ModelBase <A3_PetModel> .getInstance();

            instance.Starvation = data["starvation"];
            bool flag = a3_pet_skin.instan != null;

            if (flag)
            {
                a3_pet_skin.instan.OnStarvationChange();
            }
        }
Example #11
0
        private void OnGetPets(Variant data)
        {
            bool flag = data.ContainsKey("pet");

            if (flag)
            {
                Variant     variant  = data["pet"];
                A3_PetModel instance = ModelBase <A3_PetModel> .getInstance();

                instance.Tpid = variant["id"];
            }
        }
Example #12
0
        private void OnAutoPlayUpgrade(Variant data)
        {
            A3_PetModel instance = ModelBase <A3_PetModel> .getInstance();

            instance.Tpid = data["id"];
            instance.Exp  = data["exp"];
            bool flag = data.ContainsKey("level");

            if (flag)
            {
                instance.Level = data["level"];
            }
        }
        private void OnSyncAutoFeed(Variant data)
        {
            A3_PetModel cpet = A3_PetModel.getInstance();

            if (data["auto_feed"] == 0)
            {
                cpet.Auto_feed = false;
            }
            else
            {
                cpet.Auto_feed = true;
            }
            //debug.Log(cpet.Auto_feed + "::::::::" + a3_pet_skin.instan.autofeed.isOn);
        }
Example #14
0
        private void OnSyncAutoFeed(Variant data)
        {
            A3_PetModel instance = ModelBase <A3_PetModel> .getInstance();

            bool flag = data["auto_feed"] == 0;

            if (flag)
            {
                instance.Auto_feed = false;
            }
            else
            {
                instance.Auto_feed = true;
            }
        }
Example #15
0
        private void OnOneKeyBless(Variant data)
        {
            A3_PetModel instance = ModelBase <A3_PetModel> .getInstance();

            bool flag = data.ContainsKey("multi_res");

            if (flag)
            {
                int err_code = data["multi_res"];
                flytxt.instance.fly(err_string.get_Err_String(err_code), 0, default(Color), null);
            }
            instance.Tpid  = data["id"];
            instance.Level = data["level"];
            instance.Exp   = data["exp"];
        }
        private void Getpet(Variant data)
        {
            if (!PlayerModel.getInstance().havePet)
            {
                PlayerModel.getInstance().havePet = true;//刷新palyermodel里面数据是否有pet
            }
            debug.Log(data.dump());
            A3_PetModel.getInstance().petId = data["pet"]["id_arr"]._arr;
            A3_PetModel.curPetid = (uint)data["pet"]["id"]._int;
            A3_PetModel.getInstance().Tpid = (uint)data["pet"]["id"]._int;
            dispatchEvent(GameEvent.Create(EVENT_GET_PET, this, data));

            if (SelfRole._inst != null)
            {
                SelfRole.OnPetHaveChange(data);
            }
        }
        public void ChangePetAvatar(int petID, int petStage)
        {
            if (petID == m_petID && petStage == m_petStage)
            {
                return;
            }

            m_petID    = petID;
            m_petStage = petStage;

            if (m_myPetBird != null)
            {
                GameObject.Destroy(m_myPetBird.gameObject);
                m_myPetBird = null;
            }

            Transform stop   = m_curModel.FindChild("birdstop");
            string    petava = A3_PetModel.getInstance().GetPetAvatar(m_petID, 0);

            if (petava == "")
            {
                return;
            }
            GameObject birdPrefab = GAMEAPI.ABModel_LoadNow_GameObject("profession_" + petava);


            GameObject pathPrefab = GAMEAPI.ABModel_LoadNow_GameObject("profession_birdpath");

            if (birdPrefab == null || pathPrefab == null)
            {
                return;
            }

            GameObject bird = GameObject.Instantiate(birdPrefab, stop.position, Quaternion.identity) as GameObject;
            GameObject path = GameObject.Instantiate(pathPrefab, stop.position, Quaternion.identity) as GameObject;

            if (bird == null || path == null)
            {
                return;
            }

            path.transform.parent     = stop;
            bird.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
            m_myPetBird      = bird.AddComponent <PetBird>();
            m_myPetBird.Path = path;
        }
        private void OnOneKeyBless(Variant data)
        {
            A3_PetModel cpet = A3_PetModel.getInstance();

            if (data.ContainsKey("multi_res"))
            {
                int res = data["multi_res"];
                if (res < 0)
                {
                    Globle.err_output(res);
                }
            }

            cpet.Tpid  = data["id"];
            cpet.Level = data["level"];
            cpet.Exp   = data["exp"];
        }
        public override void init()
        {
            instan   = this;
            petmodel = A3_PetModel.getInstance();

            feedid  = petmodel.GetFeedItemTpid();
            levelid = petmodel.GetLevelItemTpid();
            stageid = petmodel.GetStageItemTpid();

            currentLevel = petmodel.CurrentLevelConf();
            currentStage = petmodel.CurrentStageConf();
            stagestep    = currentStage.getUint("crystal_step");

            BaseButton upBtn = new BaseButton(getTransformByPath("exp_con/upgrade"));

            upBtn.onClick = OnUpgrade;

            BaseButton onekeyBtn = new BaseButton(getTransformByPath("exp_con/onekey"));

            onekeyBtn.onClick = OnOnekey;

            BaseButton feedBtn = new BaseButton(getTransformByPath("lampoil"));

            feedBtn.onClick = OnFeed;

            BaseButton stageBtn = new BaseButton(getTransformByPath("stage_con/improve"));

            stageBtn.onClick = OnStage;

            BaseButton helpBtn = new BaseButton(getTransformByPath("title/help"));

            helpBtn.onClick = OnHelp;

            BaseButton close_btn = new BaseButton(getTransformByPath("close"));

            close_btn.onClick = onclose;

            autofeed = getComponentByPath <Toggle>("light_hint/toggle");
            autofeed.onValueChanged.AddListener(OnAutoFeedToggleChange);

            autobuy = getComponentByPath <Toggle>("light_hint/toggle2");
            autobuy.onValueChanged.AddListener(OnAutoBuyToggleChange);

            prefab = getGameObjectByPath("att/a3_pet_att");
        }
Example #20
0
        public override void onShowed()
        {
            A3_PetProxy.getInstance().addEventListener(A3_PetProxy.EVENT_GET_LAST_TIME, getlastTime);
            //A3_PetProxy.getInstance().addEventListener(A3_PetProxy.EVENT_GET_PET, getPet);
            A3_PetProxy.getInstance().addEventListener(A3_PetProxy.EVENT_SHOW_PET, showPet);
            A3_PetProxy.getInstance().addEventListener(A3_PetProxy.EVENT_FEED_PET, feedPet);
            A3_PetProxy.getInstance().addEventListener(A3_PetProxy.EVENT_HAVE_PET, havePet);
            toback = false;
            UIClient.instance.addEventListener(UI_EVENT.ON_MONEY_CHANGE, onMoneyChange);
            refreshMoney();
            refreshGold();
            refreshGift();
            petgo.createAvatar();
            petgo.creatPetAvatar(petid);
            petgo.canshow = true;
            if (A3_PetModel.showbuy)
            {
                getGameObjectByPath("buyshow").SetActive(true);
            }
            InterfaceMgr.getInstance().changeState(InterfaceMgr.STATE_FUNCTIONBAR);
            GRMap.GAME_CAMERA.SetActive(false);

            List <int> lst = new List <int>();

            lst.Clear();
            for (int i = 0; i < A3_PetModel.getInstance().petId.Count; i++)
            {
                lst.Add(A3_PetModel.getInstance().petId[i]);
            }
            if (lst.Contains(petid))
            {
                chosenpetBtnOnClick(transform.FindChild("scoll/cont/" + petid + "/icon_bg/icon").gameObject, false);
            }
            else
            {
                chosenpetBtnOnClick(transform.FindChild("scoll/cont/" + petid + "/lock").gameObject, true);
            }



            UiEventCenter.getInstance().onWinOpen(uiName);
        }
Example #21
0
 void getPet(GameEvent e)//修改宠物是否可用
 {
     A3_PetModel.getInstance().petId = e.data["pet"]["id_arr"]._arr;
     for (int i = 0; i < A3_PetModel.getInstance().petId.Count; i++)
     {
         int    petGo = A3_PetModel.getInstance().petId[i];
         string str   = "";
         str = XMLMgr.instance.GetSXML("newpet.pet", "pet_id==" + petGo).getString("mod");
         //switch (petGo)
         //{
         //    case 2: str = "eagle"; break;
         //    case 5: str ="yingwu"; break;
         //    case 3: str = "yaque"; break;
         //    default:
         //        break;
         //}
         transform.FindChild("scoll/cont/" + petGo + "/lock").gameObject.SetActive(false);
         transform.FindChild("scoll/cont/" + petGo + "/lock/image_lock").gameObject.SetActive(false);
     }
 }
        private void OnSyncAutoBuy(Variant data)
        {
            A3_PetModel cpet = A3_PetModel.getInstance();

            if (data["auto_buy_feeds"] == 0)
            {
                cpet.Auto_buy = false;
            }
            else
            {
                cpet.Auto_buy = true;
            }
            int num = a3_BagModel.getInstance().getItemNumByTpid(cpet.GetFeedItemTpid());

            if (cpet.Auto_buy && num <= 0)
            {
                A3_PetModel.getInstance().AutoBuy();
            }
            //debug.Log(cpet.Auto_buy + "::::::::" + a3_pet_skin.instan.autobuy.isOn);
        }
Example #23
0
        public override void onClosed()
        {
            A3_PetModel expr_07 = this.petmodel;

            expr_07.OnExpChange = (Action)Delegate.Remove(expr_07.OnExpChange, new Action(this.OnExpChange));
            A3_PetModel expr_2E = this.petmodel;

            expr_2E.OnStarvationChange = (Action)Delegate.Remove(expr_2E.OnStarvationChange, new Action(this.OnStarvationChange));
            A3_PetModel expr_55 = this.petmodel;

            expr_55.OnLevelChange = (Action)Delegate.Remove(expr_55.OnLevelChange, new Action(this.OnLevelChange));
            A3_PetModel expr_7C = this.petmodel;

            expr_7C.OnStageChange = (Action)Delegate.Remove(expr_7C.OnStageChange, new Action(this.OnStageChange));
            BaseProxy <BagProxy> .getInstance().removeEventListener(BagProxy.EVENT_ITEM_CHANGE, new Action <GameEvent>(this.OnPetItemChange));

            bool flag = this.petTexture != null;

            if (flag)
            {
                UnityEngine.Object.Destroy(this.petTexture);
                this.petTexture = null;
            }
            bool flag2 = this.avatarCamera != null;

            if (flag2)
            {
                UnityEngine.Object.Destroy(this.avatarCamera);
                this.avatarCamera = null;
            }
            bool flag3 = this.pet != null;

            if (flag3)
            {
                UnityEngine.Object.Destroy(this.pet);
                this.pet = null;
            }
        }
 private void OnGetPets(Variant data)
 {
     if (data.ContainsKey("pet"))
     {
         Variant     spet = data["pet"];
         A3_PetModel cpet = A3_PetModel.getInstance();
         cpet.Tpid = spet["id"];
         //cpet.Stage = spet["stage"];
         //cpet.Level = spet["level"];
         //cpet.Exp = spet["exp"];
         //if (spet.ContainsKey("starvation")) cpet.Starvation = spet["starvation"];
         //if (spet.ContainsKey("auto_feed"))
         //{
         //    if (spet["auto_feed"] == 0) { cpet.Auto_feed = false; }
         //    else { cpet.Auto_feed = true; }
         //}
         //if (spet.ContainsKey("auto_buy_feeds"))
         //{
         //    if (spet["auto_buy_feeds"] == 0) { cpet.Auto_buy = false; }
         //    else { cpet.Auto_buy = true; }
         //}
     }
 }
        private void OnFeed(GameObject go)
        {
            int havenum = a3_BagModel.getInstance().getItemNumByTpid(feedid);

            if (havenum > 0)
            {
                if (havenum == 1)
                {
                    if (A3_PetModel.getInstance().Auto_buy == false)
                    {
                        //String hint = ContMgr.getCont("pet_no_feed");
                        // if (flytxt.instance != null)
                        //  flytxt.instance.fly(hint);
                    }
                }
                A3_PetProxy.getInstance().Feed();
            }
            else
            {
                a3_store.itm_tpid = feedid;
                InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_STORE);
            }
        }
Example #26
0
        private void OnSyncAutoBuy(Variant data)
        {
            A3_PetModel instance = ModelBase <A3_PetModel> .getInstance();

            bool flag = data["auto_buy_feeds"] == 0;

            if (flag)
            {
                instance.Auto_buy = false;
            }
            else
            {
                instance.Auto_buy = true;
            }
            int itemNumByTpid = ModelBase <a3_BagModel> .getInstance().getItemNumByTpid(instance.GetFeedItemTpid());

            bool flag2 = instance.Auto_buy && itemNumByTpid <= 0;

            if (flag2)
            {
                ModelBase <A3_PetModel> .getInstance().AutoBuy();
            }
        }
Example #27
0
        public override void init()
        {
            #region 初始化汉字
            getComponentByPath <Text>("timeBuy/buyIt/Text").text = ContMgr.getCont("a3_new_pet_00");
            getComponentByPath <Text>("timeBuy/use/Text").text   = ContMgr.getCont("a3_new_pet_0000");
            getComponentByPath <Text>("help/descTxt").text       = ContMgr.getCont("a3_new_pet_11") + "\n" + ContMgr.getCont("a3_new_pet_1212") + "\n" + ContMgr.getCont("a3_new_pet_1313") + "\n" + ContMgr.getCont("a3_new_pet_1414");
            getComponentByPath <Text>("help/btn/Text").text      = ContMgr.getCont("a3_new_pet_22");
            getComponentByPath <Text>("buyshow/scollBuy/content/buy0/free").text      = ContMgr.getCont("a3_new_pet_33");
            getComponentByPath <Text>("buyshow/scollBuy/content/buy0/image/buy").text = ContMgr.getCont("a3_new_pet_44");
            getComponentByPath <Text>("buyshow/scollBuy/content/buy1/1").text         = ContMgr.getCont("a3_new_pet_55");
            getComponentByPath <Text>("buyshow/scollBuy/content/buy1/image/buy").text = ContMgr.getCont("a3_new_pet_66");
            getComponentByPath <Text>("buyshow/scollBuy/content/buy2/3").text         = ContMgr.getCont("a3_new_pet_77");
            getComponentByPath <Text>("buyshow/scollBuy/content/buy2/image/buy").text = ContMgr.getCont("a3_new_pet_88");
            getComponentByPath <Text>("zdsq/info").text  = ContMgr.getCont("a3_new_pet_99");
            getComponentByPath <Text>("lxjy/info").text  = ContMgr.getCont("a3_new_pet_1010");
            getComponentByPath <Text>("lxjy/info2").text = ContMgr.getCont("a3_new_pet_1111");


            getComponentByPath <Text>("buyshow/scollBuy/content/buy3/image/buy").text = ContMgr.getCont("a3_new_pet_89");
            #endregion



            instance   = this;
            pet_name   = getComponentByPath <Text>("pet_name/Text");
            usepet_btn = getGameObjectByPath("timeBuy/use");
            zdsq       = getGameObjectByPath("zdsq");
            lxjy       = getGameObjectByPath("lxjy");
            new BaseButton(getTransformByPath("btn_zdsq")).onClick = (GameObject go) => { zdsq.SetActive(true); };
            new BaseButton(getTransformByPath("btn_lxjy")).onClick = (GameObject go) => { lxjy.SetActive(true); };
            BaseButton lxjyclose  = new BaseButton(getTransformByPath("lxjy/close"));
            BaseButton lxjyclose1 = new BaseButton(getTransformByPath("lxjy/close1"));
            lxjyclose.onClick = lxjyclose1.onClick = (GameObject go) => { lxjy.SetActive(false); };
            BaseButton zdsqclose  = new BaseButton(getTransformByPath("zdsq/close"));
            BaseButton zdsqclose1 = new BaseButton(getTransformByPath("zdsq/close1"));
            zdsqclose.onClick = zdsqclose1.onClick = (GameObject go) => { zdsq.SetActive(false); };
            //if (PlayerModel.getInstance().last_time == -1)
            //{
            //    lastTime = -1;
            //    getGameObjectByPath("timeBuy/buyIt").SetActive(false);
            //}
            if (PlayerModel.getInstance().last_time <= 0)
            {
                lastTime = 0;
                usepet_btn.SetActive(false);
            }
            else if (PlayerModel.getInstance().last_time > 0)
            {
                usepet_btn.SetActive(true);
                lastTime = PlayerModel.getInstance().last_time - muNetCleint.instance.CurServerTimeStamp;//当前饲料剩余时间
            }

            first = PlayerModel.getInstance().first;
            debug.Log("first:" + first.ToString() + "  last_time:" + lastTime);
            petgo    = new petGO();
            timeGo   = transform.FindChild("timeBuy/Text").GetComponent <Text>();
            sliderGo = getGameObjectByPath("timeBuy/expbar/slider");
            if (first)
            {
                getGameObjectByPath("buyshow/scollBuy/content/buy0").SetActive(true);
            }
            else
            {
                getGameObjectByPath("buyshow/scollBuy/content/buy0").SetActive(false);
            }

            //A3_PetProxy.getInstance().addEventListener(A3_PetProxy.EVENT_GET_LAST_TIME, getlastTime);
            A3_PetProxy.getInstance().addEventListener(A3_PetProxy.EVENT_GET_PET, getPet);
            //A3_PetProxy.getInstance().addEventListener(A3_PetProxy.EVENT_SHOW_PET, showPet);
            //A3_PetProxy.getInstance().addEventListener(A3_PetProxy.EVENT_FEED_PET, feedPet);
            //A3_PetProxy.getInstance().addEventListener(A3_PetProxy.EVENT_HAVE_PET, havePet);
            //if (lastTime <= -1)
            //{
            //    lastTime = -1;
            //    getGameObjectByPath("timeBuy/buyIt").SetActive(false);
            //}

            #region button
            new BaseButton(getTransformByPath("title/btn_close")).onClick = (GameObject go) =>
            {
                InterfaceMgr.getInstance().close(InterfaceMgr.A3_NEW_PET);
            };
            BaseButton touchClose = new BaseButton(getTransformByPath("buyshow/touchClose"));
            touchClose.onClick = close;
            new BaseButton(getTransformByPath("showSth/help")).onClick = (GameObject go) =>
            {
                getGameObjectByPath("help").SetActive(true);
            };
            new BaseButton(getTransformByPath("help/btn")).onClick = (GameObject go) =>
            {
                getGameObjectByPath("help").SetActive(false);
            };
            //金币钻石绑钻按钮
            new BaseButton(getTransformByPath("top/jingbi/Image")).onClick = (GameObject go) =>
            {
                InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_EXCHANGE);
                if (a3_exchange.Instance != null)
                {
                    a3_exchange.Instance.transform.SetAsLastSibling();
                }
            };
            new BaseButton(getTransformByPath("top/zuanshi/Image")).onClick = (GameObject go) =>
            {
                toback = true;
                InterfaceMgr.getInstance().close(this.uiName);
                InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_RECHARGE);
            };
            new BaseButton(getTransformByPath("top/bangzuan/Image")).onClick = (GameObject go) =>
            {
                InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_HONOR);
                if (a3_honor.instan != null)
                {
                    a3_honor.instan.transform.SetAsLastSibling();
                }
            };
            //===============
            //购买饲料
            new BaseButton(getTransformByPath("timeBuy/buyIt")).onClick = (GameObject go) =>
            {
                //if (all <= -1)
                //{
                //    flytxt.instance.fly(ContMgr.getCont("a3_new_pet_long"));
                //}
                //else
                getGameObjectByPath("buyshow").SetActive(true);
            };
            //免费一天-----1\2\永久
            new BaseButton(getTransformByPath("buyshow/scollBuy/content/buy0/image")).onClick = (GameObject go) =>
            {
                A3_PetProxy.getInstance().SendTime(1);
                getGameObjectByPath("buyshow").SetActive(false);
                getGameObjectByPath("buyshow/scollBuy/content/buy0").SetActive(false);
            };
            new BaseButton(getTransformByPath("buyshow/scollBuy/content/buy1/image")).onClick = (GameObject go) =>
            {
                A3_PetProxy.getInstance().SendTime(2);
                getGameObjectByPath("buyshow").SetActive(false);
            };
            new BaseButton(getTransformByPath("buyshow/scollBuy/content/buy2/image")).onClick = (GameObject go) =>
            {
                A3_PetProxy.getInstance().SendTime(3);
                getGameObjectByPath("buyshow").SetActive(false);
            };
            new BaseButton(getTransformByPath("buyshow/scollBuy/content/buy3/image")).onClick = (GameObject go) =>
            {
                getGameObjectByPath("buyshow").SetActive(false);
                A3_PetProxy.getInstance().SendTime(4);
                List <SXML> buyList = XMLMgr.instance.GetSXMLList("newpet.buy.b", "id==" + 4);
                int         zuan    = buyList[0].getInt("zuan");
                //if (zuan <= PlayerModel.getInstance().gold)
                //    getGameObjectByPath("timeBuy/buyIt").SetActive(false);
            };
            //===============
            #endregion
            iconTemp = getGameObjectByPath("icon_temp");
            xml      = XMLMgr.instance.GetSXML("newpet");
            list     = xml.GetNodeList("pet");
            petNum   = list.Count;
            cont     = getTransformByPath("scoll/cont");
            sizeY    = cont.GetComponent <GridLayoutGroup>().cellSize.y;
            cont.GetComponent <RectTransform>().sizeDelta = new Vector2(130f, sizeY * petNum);
            transform.FindChild("ig_bg_bg").gameObject.SetActive(false);

            getEventTrigerByPath("rotate").onDrag = OnDrag;

            #region 宠物icon按钮
            A3_PetModel petmodel = A3_PetModel.getInstance();
            getTransformByPath("shuxing/exp/Text").GetComponent <Text>().text   = ContMgr.getCont("a3_new_pet_1") + list[0].getInt("exp") + "%";
            getTransformByPath("shuxing/gold/Text").GetComponent <Text>().text  = ContMgr.getCont("a3_new_pet_2") + list[0].getInt("gold") + "%";
            getTransformByPath("shuxing/equip/Text").GetComponent <Text>().text = ContMgr.getCont("a3_new_pet_3") + list[0].getInt("arm") + "%";
            getTransformByPath("shuxing/mate/Text").GetComponent <Text>().text  = ContMgr.getCont("a3_new_pet_4") + list[0].getInt("mat") + "%";

            foreach (var item in list)
            {
                goIcon = Instantiate(iconTemp) as GameObject;
                goIcon.transform.SetParent(getTransformByPath("scoll/cont"));
                goIcon.name = item.getString("pet_id");
                goIcon.SetActive(true);
                goIcon.transform.localScale = Vector3.one;
                String str = "scoll/cont/" + goIcon.name + "/icon_bg/icon";
                transform.FindChild("scoll/cont/" + list[0].getString("pet_id") + "/icon_bg/image_on").gameObject.SetActive(true);
                string names = item.getString("mod");
                // if (names == "jiexi")
                //  names = "yingwu";
                getTransformByPath(str).GetComponent <Image>().sprite = GAMEAPI.ABUI_LoadSprite("icon_pet_" + names);
                new BaseButton(transform.FindChild("scoll/cont/" + goIcon.name + "/icon_bg/icon")).onClick = (GameObject go) =>
                {
                    chosenpetBtnOnClick(go, false);
                };
                new BaseButton(transform.FindChild("scoll/cont/" + goIcon.name + "/lock")).onClick = (GameObject go) =>
                {
                    chosenpetBtnOnClick(go, true);
                };
            }
            timeSet(lastTime);
            CancelInvoke("time");
            InvokeRepeating("time", 0, 1);
            if (A3_PetModel.curPetid != 0)
            {
                transform.FindChild("scoll/cont/" + A3_PetModel.curPetid + "/icon_bg/yuxuan_on").gameObject.SetActive(true);
            }
            #endregion
            getPet0();
            if (a3_everydayLogin.instans != null && a3_everydayLogin.instans.open)
            {
                InterfaceMgr.getInstance().close(InterfaceMgr.A3_EVERYDAYLOGIN);
                openEveryLogin = true;
            }

            new BaseButton(usepet_btn.transform).onClick = (GameObject go) =>
            {
                if (A3_PetModel.curPetid == old_petid)
                {
                    flytxt.instance.fly(ContMgr.getCont("pet_this_old"));
                    return;
                }
                for (int i = 0; i < getTransformByPath("scoll/cont").childCount; i++)
                {
                    if (int.Parse(getTransformByPath("scoll/cont").GetChild(i).gameObject.name) == petid)
                    {
                        getTransformByPath("scoll/cont").GetChild(i).FindChild("icon_bg/yuxuan_on").gameObject.SetActive(true);
                    }
                    else
                    {
                        getTransformByPath("scoll/cont").GetChild(i).FindChild("icon_bg/yuxuan_on").gameObject.SetActive(false);
                    }
                }
                A3_PetProxy.getInstance().SendPetId(petid);    //发送换宠物
            };
        }