Пример #1
0
        private void OnStageChange()
        {
            currentStage = petmodel.CurrentStageConf();
            stagestep    = currentStage.getUint("crystal_step");

            //!--更新宠物的阶
            Text stage = getComponentByPath <Text>("stage");

            stage.text = "(" + petmodel.Stage.ToString() + ContMgr.getCont("zhuan") + ")";

            Text name = getComponentByPath <Text>("name");

            name.text = petmodel.CurrentStageConf().getString("name");

            //!--更新阶面板的金币
            Text gold = getComponentByPath <Text>("stage_con/gold/text");

            gold.text = currentStage.getString("gold_cost");

            //!--更新阶面板的启灵水晶消耗
            Text   cost    = getComponentByPath <Text>("exp_con/upgrade/text");
            uint   costnum = currentStage.getUint("crystal");
            int    havenum = a3_BagModel.getInstance().getItemNumByTpid(stageid);
            string color   = (costnum <= havenum) ? "<color=#00ffff>" : "<color=#ff0000>";

            cost.text = costnum.ToString();

            //!--更新进阶成功率
            Text rate  = getComponentByPath <Text>("stage_con/rate");
            uint urate = currentStage.getUint("rate") / 100;

            rate.text = ContMgr.getCont("pet_succ", new List <string> {
                urate.ToString()
            });

            //!--检查是否需要显示升阶的面板
            CheckShowLevelOrStage();

            //!--刷新界面上宠物avatar
            RefreshAvatar();
        }
Пример #2
0
        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");
        }