Esempio n. 1
0
        public override void init()
        {
            scrollControer0 = new ScrollControler();
            scrollControer0.create(getComponentByPath <ScrollRect>("con_page/view"));


            instan = this;
            inText();
            achModel = A3_AchievementModel.getInstance();

            conTypeTab = this.getTransformByPath("con_tab");

            conPage  = this.getTransformByPath("con_page/view/con");
            tempPage = this.getGameObjectByPath("con_page/tempPage");

            textPoint = this.getComponentByPath <Text>("Text_point/Text_point");

            // btnUpgrade = new BaseButton(this.getTransformByPath("btn_upgrade"));
            //btnUpgrade.onClick = OnUpgradeClick;

            btnLeft          = new BaseButton(this.getTransformByPath("btn_select/btn_left"));
            btnLeft.onClick  = OnLeftClick;
            btnRight         = new BaseButton(this.getTransformByPath("btn_select/btn_right"));
            btnRight.onClick = OnRightClick;
            textPageIndex    = this.getComponentByPath <Text>("btn_select/bg/Text");

            btnClose         = new BaseButton(this.getTransformByPath("btn_close"));
            btnClose.onClick = OnCloseClick;

            scrollPage = this.getComponentByPath <ScrollRect>("con_page/view");
            //TODO 初始化页面内容
            InitBtnTab();
            base.init();
        }
Esempio n. 2
0
        public void onLoadinfos(Variant data)
        {
            debug.Log("s2c_rank_achievement_::" + data.dump());
            int res = data["res"];

            if (res < 0)
            {
                Globle.err_output(res);
                return;
            }

            switch (res)
            {
            case 1:
                A3_AchievementModel.getInstance().SyncAchievementDataByServer(data);
                dispatchEvent(GameEvent.Create(RANKREFRESH, this, data));
                break;

            case 2:
                A3_AchievementModel.getInstance().OnAchievementChangeFromServer(data);
                dispatchEvent(GameEvent.Create(ON_ACHIEVEMENT_CHANGE, this, data));
                break;

            case 3:
                break;

            case 4:
                //获得成就奖励
                A3_AchievementModel.getInstance().OnGetAchievePrize(data);
                if (data.ContainsKey("ach_point"))
                {
                    PlayerModel.getInstance().ach_point = data["ach_point"];
                    a3_RankModel.nowexp = data["ach_point"];
                    A3_AchievementModel.getInstance().AchievementPoint = data["ach_point"];
                    dispatchEvent(GameEvent.Create(RANKREFRESH, this, data));
                }
                dispatchEvent(GameEvent.Create(ON_GET_ACHIEVEMENT_PRIZE, this, data));
                break;

            case 5:
                debug.Log("升级成功:" + data["title"]);
                if (data.ContainsKey("title"))
                {
                    PlayerModel.getInstance().titileChange(data);

                    a3_RankModel.getInstance().refreinfo(data["title"], a3_RankModel.nowexp);
                    if (data.ContainsKey("ach_point"))
                    {
                        PlayerModel.getInstance().ach_point = data["ach_point"];
                        a3_RankModel.nowexp = data["ach_point"];
                        A3_AchievementModel.getInstance().AchievementPoint = data["ach_point"];
                        dispatchEvent(GameEvent.Create(RANKREFRESH, this, data));
                    }
                    dispatchEvent(GameEvent.Create(RANKADDLV, this, data));
                }
                break;

            case 6:
                debug.Log("显示或者隐藏:" + data["title_display"]._bool);
                PlayerModel.getInstance().titleShoworHide(data);
                break;

            case 7:
                //成就变化数组
                A3_AchievementModel.getInstance().OnAchievementReachChange(data);

                dispatchEvent(GameEvent.Create(ON_REACH_ACHIEVEMENT, this, data));
                break;

            default:
                Globle.err_output(data["res"]);
                break;
            }
            ;
            if (data.ContainsKey("ach_point"))
            {
                PlayerModel.getInstance().ach_point = data["ach_point"];
                A3_AchievementModel.getInstance().AchievementPoint = data["ach_point"];
                a3_RankModel.nowexp = data["ach_point"];
            }
        }