コード例 #1
0
        public override void onShowed()
        {
            bool flag = ModelBase <PlayerModel> .getInstance().last_time == 0 && BaseProxy <OffLineExpProxy> .getInstance().eqp.Count == 0;

            if (flag)
            {
                base.transform.FindChild("equp/image_con").gameObject.SetActive(true);
            }
            else
            {
                base.transform.FindChild("equp/image_con").gameObject.SetActive(false);
            }
            this.show_eqp();
            for (int i = 0; i < this.lBtn.Count; i++)
            {
                this.lBtn[i].addEvent();
                Text component = this.lBtn[i].transform.FindChild("Text_exp").GetComponent <Text>();
                component.text = "经验+" + this.offLineModel.BaseExp * (i + 1);
            }
            base.onShowed();
            this.vip_getexp_btn();
            BaseProxy <OffLineExpProxy> .getInstance().addEventListener(OffLineExpProxy.EVENT_OFFLINE_EXP_GET, new Action <GameEvent>(this.doGetExp));

            this.OnCostTextChange();
            this.OnTitleChange();
            OffLineModel expr_11B = this.offLineModel;

            expr_11B.OnOffLineTimeChange = (Action)Delegate.Combine(expr_11B.OnOffLineTimeChange, new Action(this.OnTitleChange));
            OffLineModel expr_142 = this.offLineModel;

            expr_142.OnBaseExpChange = (Action)Delegate.Combine(expr_142.OnBaseExpChange, new Action(this.OnCostTextChange));
        }
コード例 #2
0
        //像服务器发送请求
        int vip_lite(int type)
        {
            SXML _xml = OffLineModel.getInstance().OffLineXML.GetNode("rate_type", "type==" + type.ToString());
            int  vip  = _xml.getInt("vip_level");

            return(vip);
        }
コード例 #3
0
 public override void init()
 {
     base.init();
     off_line_exp.instance      = this;
     this.contain               = base.getGameObjectByPath("equp/scroll/contain").transform;
     this.eqp_icon              = base.getGameObjectByPath("icon");
     this.left_click            = new BaseButton(base.transform.FindChild("r_l_btn/left"), 1, 1);
     this.right_click           = new BaseButton(base.transform.FindChild("r_l_btn/right"), 1, 1);
     this.Text_exp              = base.transform.FindChild("exp_bg/exp").gameObject.GetComponent <Text>();
     this.fenjie                = base.getComponentByPath <Toggle>("Toggle_fenjie");
     this.btn1                  = new BaseButton(base.transform.FindChild("exp/btn1/btn"), 1, 1);
     this.btn2                  = new BaseButton(base.transform.FindChild("exp/btn2/btn"), 1, 1);
     this.btn3                  = new BaseButton(base.transform.FindChild("exp/btn3/btn"), 1, 1);
     this.btn4                  = new BaseButton(base.transform.FindChild("exp/btn4/btn"), 1, 1);
     this.closeBtn1             = new BaseButton(base.transform.FindChild("closeBtn"), 1, 1);
     this.Text_time             = base.getComponentByPath <Text>("state/Text_time");
     this.timeSlider            = base.transform.FindChild("state/time_Slider/Fill Area/Fill").GetComponent <Image>();
     this.timeSlider.type       = Image.Type.Filled;
     this.timeSlider.fillMethod = Image.FillMethod.Vertical;
     this.timeSlider.fillOrigin = 0;
     this.vip_getexp_btn();
     this.btn1.onClick = delegate(GameObject go)
     {
         this.OnClickToGetExp(1);
     };
     this.btn2.onClick = delegate(GameObject go)
     {
         this.OnClickToGetExp(2);
     };
     this.btn3.onClick = delegate(GameObject go)
     {
         this.OnClickToGetExp(3);
     };
     this.btn4.onClick = delegate(GameObject go)
     {
         this.OnClickToGetExp(4);
     };
     this.left_click.onClick = delegate(GameObject go)
     {
         this.OnClick_left();
     };
     this.right_click.onClick = delegate(GameObject go)
     {
         this.OnClick_right();
     };
     this.closeBtn1.onClick = delegate(GameObject go)
     {
         this.OnClickToClose();
     };
     this.recharge = base.transform.FindChild("recharge").gameObject;
     this.lBtn.Add(this.btn1);
     this.lBtn.Add(this.btn2);
     this.lBtn.Add(this.btn3);
     this.lBtn.Add(this.btn4);
     this.lBtn2.Add(this.closeBtn1);
     this.lBtn2.Add(this.left_click);
     this.lBtn2.Add(this.right_click);
     this.offLineModel = ModelBase <OffLineModel> .getInstance();
 }
コード例 #4
0
        public override void onClosed()
        {
            foreach (BaseButton current in this.lBtn)
            {
                current.removeAllListener();
            }
            base.onClosed();
            BaseProxy <OffLineExpProxy> .getInstance().removeEventListener(OffLineExpProxy.EVENT_OFFLINE_EXP_GET, new Action <GameEvent>(this.doGetExp));

            OffLineModel expr_64 = this.offLineModel;

            expr_64.OnOffLineTimeChange = (Action)Delegate.Remove(expr_64.OnOffLineTimeChange, new Action(this.OnTitleChange));
            OffLineModel expr_8B = this.offLineModel;

            expr_8B.OnBaseExpChange = (Action)Delegate.Remove(expr_8B.OnBaseExpChange, new Action(this.OnCostTextChange));
        }
コード例 #5
0
        //标题变化
        private void OnTitleChange()
        {
            string min  = ((offLineModel.OffLineTime % 3600) / 60).ToString();
            string hour = (offLineModel.OffLineTime / 3600).ToString();

            Text_time.text = ContMgr.getCont("off_line_exp_time", new List <string> {
                hour, min
            });
            // timeSlider.value = (float)OffLineModel.getInstance().OffLineTime / (24 * 3600);
            timeSlider.fillAmount = (float)OffLineModel.getInstance().OffLineTime / (24 * 3600);
            if (offLineModel.ismaxlvl)
            {
                Text_exp.text = "EXP " + 0;
            }
            else
            {
                Text_exp.text = "EXP " + offLineModel.BaseExp;
            }
        }
コード例 #6
0
        private void OnGetRes(Variant data)
        {
            debug.Log("获得离线经验信息::" + data.dump());
            OffLineModel expModel = OffLineModel.getInstance();
            int          res      = data["res"];

            if (data["eqp"] != null)
            {
                OffLineModel.getInstance().IsHaveEQP = data["eqp"].Count > 0 ? true : false;

                foreach (Variant v in data["eqp"]._arr)
                {
                    a3_BagItemData item = new a3_BagItemData();
                    item.equipdata.gem_att     = new Dictionary <int, int>();
                    item.equipdata.subjoin_att = new Dictionary <int, int>();
                    item.tpid = v["tpid"];
                    item.bnd  = v["bnd"];
                    //item.isEquip = v["isEquip"];
                    item.id = v["id"];
                    item.equipdata.intensify_lv = v["intensify_lv"];
                    //item.equipdata.combpt = v["combpt"];

                    Variant att = v["gem_att"];

                    foreach (Variant one in att._arr)
                    {
                        int type  = one["att_type"];
                        int value = one["att_value"];
                        item.equipdata.gem_att[type] = value;
                    }
                    item.equipdata.add_exp     = v["add_exp"];
                    item.equipdata.add_level   = v["add_level"];
                    item.equipdata.blessing_lv = v["blessing_lv"];
                    Variant sub = v["subjoin_att"];

                    foreach (Variant one in sub._arr)
                    {
                        int type  = one["att_type"];
                        int value = one["att_value"];
                        item.equipdata.subjoin_att[type] = value;
                    }
                    item.confdata         = a3_BagModel.getInstance().getItemDataById(item.tpid);
                    item.equipdata.combpt = a3_BagModel.getInstance().Getcombpt(a3_BagModel.getInstance().Getequip_att(item));
                    eqp.Add(item);
                }
            }
            if (res < 0)
            {
                debug.Log("off_line_exp_erro::" + res);
                Globle.err_output(res);
                return;
            }

            if (data.ContainsKey("offline_tm") && res > 4)
            {
                expModel.OffLineTime = data["offline_tm"];
            }

            switch (res)
            {
            case 1:
            case 2:
            case 3:
            case 4:
                eqp.Clear();
                dispatchEvent(GameEvent.Create(EVENT_OFFLINE_EXP_GET, this, data));
                break;

            default:
                if (res == 5)
                {
                    expModel.ismaxlvl = true;
                }
                else
                {
                    expModel.ismaxlvl = false;
                }
                expModel.BaseExp = res;
                break;
            }
        }
コード例 #7
0
        public override void init()
        {
            base.init();
            instance    = this;
            contain     = getGameObjectByPath("equp/scroll/contain").transform;
            eqp_icon    = getGameObjectByPath("icon");
            left_click  = new BaseButton(transform.FindChild("r_l_btn/left"));
            right_click = new BaseButton(transform.FindChild("r_l_btn/right"));//getGameObjectByPath("r_l_btn/right").GetComponent<BaseButton>();

            Text_exp = transform.FindChild("exp_bg/exp").gameObject.GetComponent <Text>();
            fenjie   = getComponentByPath <Toggle>("Toggle_fenjie");
            //fenjie.onValueChanged.AddListener(delegate (bool ison)
            //{
            //    if (ison) { EquipsSureSell();/* OnLoadItem_fenjie();*/ }
            //    else { outItemCon_fenjie(); /*EquipsNoSell(1);*/ }
            //});


            btn1      = new BaseButton(transform.FindChild("exp/btn1/btn"));
            btn2      = new BaseButton(transform.FindChild("exp/btn2/btn"));
            btn3      = new BaseButton(transform.FindChild("exp/btn3/btn"));
            btn4      = new BaseButton(transform.FindChild("exp/btn4/btn"));
            closeBtn1 = new BaseButton(transform.FindChild("closeBtn"));

            Text_time = this.getComponentByPath <Text>("state/Text_time");
            //timeSlider = this.getComponentByPath<Slider>("state/time_Slider");
            timeSlider            = transform.FindChild("state/time_Slider/Fill Area/Fill").GetComponent <Image>();
            timeSlider.type       = Image.Type.Filled;
            timeSlider.fillMethod = Image.FillMethod.Vertical;
            timeSlider.fillOrigin = (int)Image.OriginVertical.Bottom;

            vip_getexp_btn();
            btn1.onClick        = delegate(GameObject go) { OnClickToGetExp(1); };
            btn2.onClick        = delegate(GameObject go) { OnClickToGetExp(2); };
            btn3.onClick        = delegate(GameObject go) { OnClickToGetExp(3); };
            btn4.onClick        = delegate(GameObject go) { OnClickToGetExp(4); };
            left_click.onClick  = delegate(GameObject go) { OnClick_left(); };
            right_click.onClick = delegate(GameObject go) { OnClick_right(); };
            closeBtn1.onClick   = delegate(GameObject go) { OnClickToClose(); };
            recharge            = transform.FindChild("recharge").gameObject;
            lBtn.Add(btn1);
            lBtn.Add(btn2);
            lBtn.Add(btn3);
            lBtn.Add(btn4);
            lBtn2.Add(closeBtn1);
            lBtn2.Add(left_click);
            lBtn2.Add(right_click);
            offLineModel = OffLineModel.getInstance();

            //btn3.transform.FindChild("Text").GetComponent<Text>().text = "VIP" + vip_lite(3) + "领取";
            //btn4.transform.FindChild("Text").GetComponent<Text>().text = "VIP" + vip_lite(4) + "领取";
            //if (PlayerModel.getInstance().last_time == 0)
            //{
            //    transform.FindChild("equp/image_con").gameObject.SetActive(true);
            //}
            //Debug.LogError(PlayerModel.getInstance().havePet + "sss" + PlayerModel.getInstance().last_time);
            //OffLineExpProxy.getInstance().Send_Off_Line(0);
            //OffLineExpProxy.getInstance().sendType(0);

            #region 初始化汉字提取
            getComponentByPath <Text>("exp/btn1/Text").text         = ContMgr.getCont("off_line_exp_0");
            getComponentByPath <Text>("exp/btn2/btn/TextOnee").text = ContMgr.getCont("off_line_exp_1");
            getComponentByPath <Text>("state/Text_des").text        = ContMgr.getCont("off_line_exp_2");
            getComponentByPath <Text>("state/Text_desc_1").text     = ContMgr.getCont("off_line_exp_3");
            getComponentByPath <Text>("exp_bg/text").text           = ContMgr.getCont("off_line_exp_4");
            getComponentByPath <Text>("recharge/Text").text         = ContMgr.getCont("off_line_exp_5");
            getComponentByPath <Text>("recharge/yes/Text").text     = ContMgr.getCont("off_line_exp_6");
            getComponentByPath <Text>("Toggle_fenjie/Label").text   = ContMgr.getCont("piliang_fenjie_0");
            getComponentByPath <Text>("equp/image_con/text").text   = ContMgr.getCont("off_line_exp_7");
            getComponentByPath <Text>("btn/btn1/text").text         = ContMgr.getCont("off_line_exp_8");
            getComponentByPath <Text>("btn/btn2/text").text         = ContMgr.getCont("off_line_exp_9");

            getComponentByPath <Text>("exp/btn1/btn/Text").text        = ContMgr.getCont("off_line_exp_1");
            getComponentByPath <Text>("exp/btn3/btn/image1/Text").text = ContMgr.getCont("off_line_exp_1");
            getComponentByPath <Text>("exp/btn4/btn/image1/Text").text = ContMgr.getCont("off_line_exp_1");

            #endregion
        }
コード例 #8
0
        private void OnClickToGetExp(int type)
        {
            A3_VipModel vipModel = A3_VipModel.getInstance();


            if (!offLineModel.CanGetExp)
            {
                flytxt.instance.fly(ContMgr.getCont("off_line_empty"));
                InterfaceMgr.getInstance().close(InterfaceMgr.OFFLINEEXP);
                a3_expbar.instance.getGameObjectByPath("operator/LightTips/btnAuto_off_line_exp").SetActive(false);
                return;
            }
            offline_item.Clear();
            offline = true;
            switch (type)
            {
            case 1:

                if (fenjie.isOn == true)
                {
                    OffLineExpProxy.getInstance().sendType(1, true);
                }
                else
                {
                    OffLineExpProxy.getInstance().sendType(1, false);
                }
                currentType = 1;
                break;

            case 2:

                if (PlayerModel.getInstance().money < OffLineModel.getInstance().GetCost(2))
                {
                    flytxt.instance.fly(ContMgr.getCont("off_line_exp_money"));
                }
                else
                {
                    if (fenjie.isOn == true)
                    {
                        OffLineExpProxy.getInstance().sendType(2, true);
                    }
                    else
                    {
                        OffLineExpProxy.getInstance().sendType(2, false);
                    }
                }
                currentType = 2;
                break;

            case 3:
                if (PlayerModel.getInstance().gold < OffLineModel.getInstance().GetCost(3))
                {
                    flytxt.instance.fly(ContMgr.getCont("off_line_exp_gold"));
                }
                //else if (vipModel.Level < vip_lite(3))
                //    flytxt.instance.fly(ContMgr.getCont("off_line_exp_vip"));
                else
                {
                    if (fenjie.isOn == true)
                    {
                        OffLineExpProxy.getInstance().sendType(3, true);
                    }
                    else
                    {
                        OffLineExpProxy.getInstance().sendType(3, false);
                    }
                }
                currentType = 3;
                break;

            case 4:
                if (PlayerModel.getInstance().gold < OffLineModel.getInstance().GetCost(4))
                {
                    flytxt.instance.fly(ContMgr.getCont("off_line_exp_gold"));
                }
                //else if (vipModel.Level < vip_lite(4))
                //    flytxt.instance.fly(ContMgr.getCont("off_line_exp_vip"));
                else
                {
                    if (fenjie.isOn == true)
                    {
                        OffLineExpProxy.getInstance().sendType(4, true);
                    }
                    else
                    {
                        OffLineExpProxy.getInstance().sendType(4, false);
                    }
                }
                currentType = 4;
                break;

            default:
                break;
            }
        }
コード例 #9
0
        private void OnGetRes(Variant data)
        {
            debug.Log("获得离线经验信息::" + data.dump());
            OffLineModel instance = ModelBase <OffLineModel> .getInstance();

            int  num  = data["res"];
            bool flag = data["eqp"] != null;

            if (flag)
            {
                foreach (Variant current in data["eqp"]._arr)
                {
                    a3_BagItemData a3_BagItemData = default(a3_BagItemData);
                    a3_BagItemData.equipdata.gem_att     = new Dictionary <int, int>();
                    a3_BagItemData.equipdata.subjoin_att = new Dictionary <int, int>();
                    a3_BagItemData.tpid = current["tpid"];
                    a3_BagItemData.bnd  = current["bnd"];
                    a3_BagItemData.id   = current["id"];
                    a3_BagItemData.equipdata.intensify_lv = current["intensify_lv"];
                    a3_BagItemData.equipdata.combpt       = current["combpt"];
                    Variant variant = current["gem_att"];
                    foreach (Variant current2 in variant._arr)
                    {
                        int key   = current2["att_type"];
                        int value = current2["att_value"];
                        a3_BagItemData.equipdata.gem_att[key] = value;
                    }
                    a3_BagItemData.equipdata.add_exp     = current["add_exp"];
                    a3_BagItemData.equipdata.add_level   = current["add_level"];
                    a3_BagItemData.equipdata.blessing_lv = current["blessing_lv"];
                    Variant variant2 = current["subjoin_att"];
                    foreach (Variant current3 in variant2._arr)
                    {
                        int key2   = current3["att_type"];
                        int value2 = current3["att_value"];
                        a3_BagItemData.equipdata.subjoin_att[key2] = value2;
                    }
                    a3_BagItemData.confdata = ModelBase <a3_BagModel> .getInstance().getItemDataById(a3_BagItemData.tpid);

                    this.eqp.Add(a3_BagItemData);
                }
            }
            bool flag2 = num < 0;

            if (flag2)
            {
                Debug.Log("off_line_exp_erro::" + num);
                Globle.err_output(num);
            }
            else
            {
                bool flag3 = data.ContainsKey("offline_tm") && num > 4;
                if (flag3)
                {
                    instance.OffLineTime = data["offline_tm"];
                }
                switch (num)
                {
                case 1:
                case 2:
                case 3:
                case 4:
                    base.dispatchEvent(GameEvent.Create(OffLineExpProxy.EVENT_OFFLINE_EXP_GET, this, data, false));
                    break;

                default:
                    instance.BaseExp = num;
                    break;
                }
            }
        }