//像服务器发送请求 int vip_lite(int type) { SXML _xml = OffLineModel.getInstance().OffLineXML.GetNode("rate_type", "type==" + type.ToString()); int vip = _xml.getInt("vip_level"); return(vip); }
//标题变化 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; } }
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; } }
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 }
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; } }