//升级后刷新 public void UpgradeHallows(int id, hallowsData data) { Text nameandlv = getComponentByPath <Text>("right_bg/have/panels/info/nameandlv"); nameandlv.text = a3_BagModel.getInstance().getItemDataById((uint)data.item_id).item_name + "LV:" + data.lvl; show_attribute(id, data); divine_soul_nums(); divine_soul_nums(data.lvl, data.exp); }
//刷新属性 void show_attribute(int id, hallowsData data) { for (int i = 0; i < lsts_attributes.Count; i++) { int attribute_name = A3_HallowsModel.getInstance().GetAttributeForQuality(data.h_s_d.quality)[i].Keys.ElementAt(0);//字典key的下标 float attribute_value = A3_HallowsModel.getInstance().GetAttributeForQuality(data.h_s_d.quality)[i][attribute_name]; lsts_attributes[i].GetComponent <Text>().text = Globle.getAttrAddById(attribute_name, (int)((attribute_value + attribute_value * data.lvl * 0.1f)) + 1); } }
public A3_HallowsModel() { attributes = new List <Dictionary <int, float> >(); for (int i = 1; i < 10; i++) { hallowsData hd = new hallowsData(); hd.id = i; hd.item_id = 0; hd.lvl = 1; hd.exp = 0; now_hallows_dic[hd.id] = hd; } }
//刷新信息 void show_infos(int id, hallowsData data) { Dictionary <int, hallowsData> dic = A3_HallowsModel.getInstance().now_hallows(); Text nameandlv = getComponentByPath <Text>("right_bg/have/panels/info/nameandlv"); nameandlv.text = a3_BagModel.getInstance().getItemDataById((uint)data.item_id).item_name + "LV:" + data.lvl; GameObject iconf = getGameObjectByPath("right_bg/have/panels/info/icon/icon"); iconf.GetComponent <Image>().sprite = GAMEAPI.ABUI_LoadSprite("icon_holic_skill_" + data.h_s_d.skill_id); //GameObject icon = IconImageMgr.getInstance().createA3ItemIcon((uint)data.h_s_d.skill_id); //icon.transform.SetParent(iconf.transform, false); Text skill_name = getComponentByPath <Text>("right_bg/have/panels/info/skill_name"); skill_name.text = data.h_s_d.skill_name; Text des = getComponentByPath <Text>("right_bg/have/panels/info/skill_des"); des.text = data.h_s_d.skill_des; }
void onLoadHallows(Variant data) { debug.Log("受到圣器的协议:" + data.dump()); int res = data["res"]; switch (res) { case 1: //其实是发了九个位置的信息,没发的就是默认等级(item_id是不是为0判断身上有没有穿东西) A3_HallowsModel.getInstance().soul_num = data["soul_num"]; if (data["ware_lvl"].Count > 0) { for (int i = 0; i < data["ware_lvl"].Count; i++) { hallowsData hd = new hallowsData(); hd.id = data["ware_lvl"][i]["soul_type"]._int; hd.item_id = data["ware_lvl"][i]["ware_tpid"]._int; hd.lvl = data["ware_lvl"][i]["soul_lvl"]._int; hd.exp = data["ware_lvl"][i]["soul_exp"]._int; hallows_skill_data hsd = new hallows_skill_data(); if (hd.item_id != 0) { hsd = A3_HallowsModel.getInstance().GetHallowsSkillData(hd.id, hd.item_id); hd.h_s_d = hsd; } A3_HallowsModel.getInstance().now_hallows_dic[hd.id] = hd; } } break; case 2: A3_HallowsModel.getInstance().soul_num = data["soul_num"]; hallowsData hds = new hallowsData(); hds.id = data["soul_info"]["soul_type"]._int; hds.item_id = data["soul_info"]["ware_tpid"]._int; hds.lvl = data["soul_info"]["soul_lvl"]._int; hds.exp = data["soul_info"]["soul_exp"]._int; hallows_skill_data hsds = new hallows_skill_data(); hsds = A3_HallowsModel.getInstance().GetHallowsSkillData(hds.id, hds.item_id); hds.h_s_d = hsds; A3_HallowsModel.getInstance().now_hallows_dic[hds.id] = hds; if (a3_hallows.instance) { a3_hallows.instance.UpgradeHallows(hds.id, hds); } break; case 3: A3_HallowsModel.getInstance().soul_num = data["soul_num"]; if (a3_hallows.instance.AllCompose) { a3_hallows.instance.DecomposeHallows(); } else { a3_hallows.instance.DecomposeHallows(a3_hallows.instance.this_tpid); } break; case 4: if (a3_hallows.instance) { if (a3_hallows.instance.PutOrDown) { A3_HallowsModel.getInstance().now_hallows_dic[data["soul_type"]].item_id = data["ware_tpid"]; A3_HallowsModel.getInstance().now_hallows_dic[data["soul_type"]].h_s_d = A3_HallowsModel.getInstance().GetHallowsSkillData(data["soul_type"], data["ware_tpid"]); a3_hallows.instance.PutHallows(data["soul_type"], data["ware_tpid"]); } else { A3_HallowsModel.getInstance().now_hallows_dic[data["soul_type"]].item_id = 0; a3_hallows.instance.DownHallows(data["soul_type"]); } } break; case 10: if (data["tf"]._int == 0) { //不显示 A3_HallowsModel.type_duihuan = 0; } else if (data["tf"]._int == 1) { //显示 A3_HallowsModel.type_duihuan = 1; } break; default: Globle.err_output(res); return; } }