/*锁,隐藏时装,隐藏飞翼按钮刷新*/ void refreshObj() { Dictionary <int, uint> dic = A3_FashionShowModel.getInstance().dic_have_fs; foreach (int id in dic_objs.Keys) { if (dic.ContainsKey(id)) { dic_objs[id].transform.FindChild("lock").gameObject.SetActive(false); } else { dic_objs[id].transform.FindChild("lock").gameObject.SetActive(true); } } bool show = A3_FashionShowModel.getInstance().dress_show; getComponentByPath <Toggle>("right_bg/down/shizhuang").isOn = !show; if (FunctionOpenMgr.instance.Check(FunctionOpenMgr.PET_SWING)) { bool showwind = A3_WingModel.getInstance()?.ShowStage > 0 ? false : true; getComponentByPath <Toggle>("right_bg/down/feiyi").isOn = showwind; } }
/*身上穿的刷新*/ public void RefreshSelfObj() { int id = A3_FashionShowModel.getInstance().nowfs[0]; int id1 = A3_FashionShowModel.getInstance().nowfs[1]; if (id != 0) { xiongjia_obj.transform.FindChild("icon").gameObject.SetActive(true); string file = "icon_item_" + (uint)id; Image icon = xiongjia_obj.transform.FindChild("icon").GetComponent <Image>(); icon.sprite = GAMEAPI.ABUI_LoadSprite(file); } else { xiongjia_obj.transform.FindChild("icon").gameObject.SetActive(false); } if (id1 != 0) { wuqi_obj.transform.FindChild("icon").gameObject.SetActive(true); string file = "icon_item_" + (uint)id1; Image icon = wuqi_obj.transform.FindChild("icon").GetComponent <Image>(); icon.sprite = GAMEAPI.ABUI_LoadSprite(file); } else { wuqi_obj.transform.FindChild("icon").gameObject.SetActive(false); } /* */ if (A3_FashionShowModel.getInstance().dress_show) { Show_this_Fashion(); } }
void dressinOnClick(GameObject go) { go.SetActive(false); // 0:武器 1:胸甲 List <int> lst = new List <int>(); Dictionary <int, fashionshow_date> dic = A3_FashionShowModel.getInstance().Dic_AllData; if (dic[nowchooseid].dress_type == 0) { A3_FashionShowModel.getInstance().nowfs[0] = nowchooseid_eqp; } else if (dic[nowchooseid].dress_type == 1) { A3_FashionShowModel.getInstance().nowfs[1] = nowchooseid_body; } //A3_FashionShowModel.getInstance().nowfs[0]= nowchooseid_eqp; //A3_FashionShowModel.getInstance().nowfs[1] = nowchooseid_body; for (int i = 0; i < A3_FashionShowModel.getInstance().nowfs.Length; i++) { lst.Add(A3_FashionShowModel.getInstance().nowfs[i]); } a3_fashionshowProxy.getInstance().SendProxys(2, lst); }
void tabOnclick(int dresstype) { something(); if (contain == null) { return; } for (int i = 0; i < contain.transform.childCount; i++) { int id = int.Parse(contain.transform.GetChild(i).gameObject.name); bool iddresstype = A3_FashionShowModel.getInstance().Dic_AllData[id].dress_type == dresstype ? true : false; int carr_id = -1; if (SelfRole._inst is P2Warrior) { carr_id = 2; } else if (SelfRole._inst is P3Mage) { carr_id = 3; } else if (SelfRole._inst is P5Assassin) { carr_id = 5; } else { carr_id = -1; } bool iscarr = A3_FashionShowModel.getInstance().Dic_AllData[id].carr == carr_id ? true : false; bool show = iddresstype && iscarr ? true : false; contain.transform.GetChild(i).gameObject.SetActive(show); } //默认选择第一个 }
/*界面中自己模型更改*/ public void Show_this_Fashion() { int body_id = 0; int eqp_id = 0; /* SelfRole._inst*/ Dictionary <int, fashionshow_date> dic = A3_FashionShowModel.getInstance().Dic_AllData; if (nowchooseid_body == 0) { if (A3_FashionShowModel.getInstance().nowfs[1] == 0) { body_id = 0; } else { body_id = A3_FashionShowModel.getInstance().nowfs[1]; } } else { body_id = nowchooseid_body; } if (nowchooseid_eqp == 0) { if (A3_FashionShowModel.getInstance().nowfs[0] == 0) { eqp_id = 0; } else { eqp_id = A3_FashionShowModel.getInstance().nowfs[0]; } } else { eqp_id = nowchooseid_eqp; } if (body_id != 0) { m_proAvatar.set_body(body_id, 0); } if (eqp_id != 0) { switch (PlayerModel.getInstance().profession) { case 2: case 3: m_proAvatar.set_weaponr(eqp_id, 0); break; case 5: m_proAvatar.set_weaponl(eqp_id, 0); m_proAvatar.set_weaponr(eqp_id, 0); break; } } }
void openbuyOnClick(GameObject go) { #region 没用的 /* Dictionary<int, fashionshow_date> dic = A3_FashionShowModel.getInstance().Dic_AllData; * if (nowchooseid == 0) * return; * * * if(dic.ContainsKey(nowchooseid)) * { * string file = "icon_equip_" + (uint)dic[nowchooseid].lst_fu[0].need_id; * Image icon = getComponentByPath<Image>("buy_bg/icon"); * icon.sprite = GAMEAPI.ABUI_LoadSprite(file); * int needitem_num = a3_BagModel.getInstance().getItemNumByTpid ((uint)dic[nowchooseid].lst_fu[0].need_id); * getComponentByPath<Text>("buy_bg/icon/Text").text = "x" + needitem_num; * for (int i=0;i< dic[nowchooseid].lst_fu.Count-1;i++) * { * int j = i; * buy_objs[i].transform.FindChild("btn").GetComponent<Button>().interactable = needitem_num < dic[nowchooseid].lst_fu[i].need_num?false:true; * buy_objs[i].transform.FindChild("des").GetComponent<Text>().text = ContMgr.getCont("a3_fashionshow11") + dic[nowchooseid].lst_fu[i].need_num + ContMgr.getCont("a3_fashionshow12") + * a3_BagModel.getInstance().getItemDataById((uint)dic[nowchooseid].lst_fu[i].need_id).item_name + * ContMgr.getCont("a3_fashionshow13") + dic[nowchooseid].lst_fu[i].limit_day + ContMgr.getCont("a3_fashionshow14"); * new BaseButton(buy_objs[i].transform.FindChild("btn")).onClick = (GameObject gos) => * { * * a3_fashionshowProxy.getInstance().SendProxys(3, null, nowchooseid, dic[nowchooseid].lst_fu[j].type); * buy_bg.SetActive(false); * }; * } * * }*/ #endregion if (jihuo_type != -1) { jihuo_bg.SetActive(true); } Dictionary <int, fashionshow_date> dic = A3_FashionShowModel.getInstance().Dic_AllData; int need_id_num = dic[nowchooseid].lst_fu[jihuo_type - 1].need_num; need_id = (uint)dic[nowchooseid].lst_fu[jihuo_type - 1].need_id; int have_id_num = a3_BagModel.getInstance().getItemNumByTpid((uint)dic[nowchooseid].lst_fu[jihuo_type - 1].need_id); string name = a3_BagModel.getInstance().getItemDataById((uint)dic[nowchooseid].lst_fu[jihuo_type - 1].need_id).item_name; int day = dic[nowchooseid].lst_fu[jihuo_type - 1].limit_day; getComponentByPath <Text>("jihuo_bg/Text").text = ContMgr.getCont("a3_fashionshow17") + need_id_num + ContMgr.getCont("a3_fashionshow12") + name + ContMgr.getCont("a3_fashionshow5") + day + ContMgr.getCont("a3_fashionshow18") + "\n" + ContMgr.getCont("a3_fashionshow19") + name + ":" + have_id_num; enough_item = have_id_num < need_id_num? false:true; }
int jihuo_type = -1;/*当前选择的激活type*/ void inti_jihuo_panel() { for (int i = 0; i < lst_jihuo_infos.Count; i++) { lst_jihuo_infos[i].transform.FindChild("yes").gameObject.SetActive(i == 0 ? true : false); } Dictionary <int, fashionshow_date> dic = A3_FashionShowModel.getInstance().Dic_AllData; if (nowchooseid == 0) { return; } if (dic.ContainsKey(nowchooseid)) { jihuo_type = dic[nowchooseid].lst_fu[0].type; int needitem_num = a3_BagModel.getInstance().getItemNumByTpid((uint)dic[nowchooseid].lst_fu[0].need_id); for (int i = 0; i < lst_jihuo_infos.Count; i++) { string des = ContMgr.getCont("a3_fashionshow5") + dic[nowchooseid].lst_fu[i].limit_day + ContMgr.getCont("a3_fashionshow14"); lst_jihuo_infos[i].transform.FindChild("day").GetComponent <Text>().text = des; Image icon = lst_jihuo_infos[i].transform.FindChild("Image").GetComponent <Image>(); debug.Log("IIIIIIIIIIIIII:" + a3_BagModel.getInstance().getItemDataById((uint)dic[nowchooseid].lst_fu[0].need_id).file); icon.sprite = GAMEAPI.ABUI_LoadSprite(a3_BagModel.getInstance().getItemDataById((uint)dic[nowchooseid].lst_fu[0].need_id).file); lst_jihuo_infos[i].transform.FindChild("num").GetComponent <Text>().text = "x" + dic[nowchooseid].lst_fu[i].need_num; int num = i; new BaseButton(lst_jihuo_infos[num].transform).onClick = (GameObject gos) => { ; jihuo_type = dic[nowchooseid].lst_fu[num].type; for (int j = 0; j < lst_jihuo_infos.Count; j++) { lst_jihuo_infos[j].transform.FindChild("yes").gameObject.SetActive(j == num ? true : false); } }; } } }
void creatrveObj() { Dictionary <int, fashionshow_date> dic = A3_FashionShowModel.getInstance().Dic_AllData; foreach (int id in dic.Keys) { GameObject cloneobj = GameObject.Instantiate(image) as GameObject; cloneobj.SetActive(true); cloneobj.transform.SetParent(contain.transform, false); cloneobj.name = id.ToString(); string file = "icon_item_" + (uint)dic[id].icon_file; Image icon = cloneobj.transform.FindChild("icon").GetComponent <Image>(); icon.sprite = GAMEAPI.ABUI_LoadSprite(file); //GameObject gso = IconImageMgr.getInstance().createA3ItemIcon((uint)dic[id].icon_file, scale: 1f); dic_objs[id] = cloneobj; int ids = id; new BaseButton(cloneobj.transform).onClick = (GameObject go) => { showthisOnclick(ids); }; } tabOnclick(1); // for (int i = 0; i < contain1.transform.childCount; i++) { buy_objs[i] = contain1.transform.GetChild(i).gameObject; } // for (int i = 0; i < jihuo_info.transform.childCount; i++) { if (i == 0) { continue; } lst_jihuo_infos.Add(jihuo_info.transform.GetChild(i).gameObject); } }
/*返回刷新*/ void returnFashion() { panel.SetActive(false); txt.SetActive(true); if (a3_EquipModel.getInstance().getEquips() != null && a3_EquipModel.getInstance().getEquips().Count > 0) { foreach (a3_BagItemData data in a3_EquipModel.getInstance().getEquips().Values) { #region body int bodyid = -1; int bodyFxid = -1; bool ishavebody = false; foreach (a3_BagItemData equip in a3_EquipModel.getInstance().getEquips().Values) { if (equip.confdata.equip_type == 3) { ishavebody = true; break; } } if (ishavebody) { if (data.confdata.equip_type == 3) { bodyid = (int)data.tpid; bodyFxid = data.equipdata.stage; if (A3_FashionShowModel.getInstance().first_nowfs[1] != 0) { m_proAvatar.set_body(A3_FashionShowModel.getInstance().first_nowfs[1], 0); } else { m_proAvatar.set_body(bodyid, bodyFxid); } } } else { if (A3_FashionShowModel.getInstance().first_nowfs[1] != 0) { m_proAvatar.set_body(A3_FashionShowModel.getInstance().first_nowfs[1], 0); } else { m_proAvatar.set_body(0, 0); } } #endregion #region wepon int weaponid = -1; int weaponFxid = -1; bool ishaveequ = false; foreach (a3_BagItemData equip in a3_EquipModel.getInstance().getEquips().Values) { if (equip.confdata.equip_type == 6) { ishaveequ = true; break; } } if (ishaveequ) { if (data.confdata.equip_type == 6) { weaponid = (int)data.tpid; weaponFxid = data.equipdata.stage; if (A3_FashionShowModel.getInstance().first_nowfs[0] != 0) { m_proAvatar.set_weaponr(A3_FashionShowModel.getInstance().first_nowfs[0], 0); if (PlayerModel.getInstance().profession == 5) { m_proAvatar.set_weaponl(A3_FashionShowModel.getInstance().first_nowfs[0], 0); } } else { m_proAvatar.set_weaponr(weaponid, weaponFxid); if (PlayerModel.getInstance().profession == 5) { m_proAvatar.set_weaponl(weaponid, weaponFxid); } } } } else { if (A3_FashionShowModel.getInstance().first_nowfs[0] != 0) { m_proAvatar.set_weaponr(A3_FashionShowModel.getInstance().first_nowfs[0], 0); if (PlayerModel.getInstance().profession == 5) { m_proAvatar.set_weaponl(A3_FashionShowModel.getInstance().first_nowfs[0], 0); } } else { m_proAvatar.set_weaponr(0, 0); if (PlayerModel.getInstance().profession == 5) { m_proAvatar.set_weaponl(0, 0); } } } #endregion } } else { if (A3_FashionShowModel.getInstance().first_nowfs[1] != 0) { m_proAvatar.set_body(A3_FashionShowModel.getInstance().first_nowfs[1], 0); } else { m_proAvatar.set_body(0, 0); } if (A3_FashionShowModel.getInstance().first_nowfs[0] != 0) { m_proAvatar.set_weaponr(A3_FashionShowModel.getInstance().first_nowfs[0], 0); if (PlayerModel.getInstance().profession == 5) { m_proAvatar.set_weaponl(A3_FashionShowModel.getInstance().first_nowfs[0], 0); } } else { m_proAvatar.set_weaponr(0, 0); if (PlayerModel.getInstance().profession == 5) { m_proAvatar.set_weaponl(0, 0); } } } }
void showthisOnclick(int id) { nowchooseid = id; panel.SetActive(true); txt.SetActive(false); Dictionary <int, fashionshow_date> dic = A3_FashionShowModel.getInstance().Dic_AllData; if (dic[id].dress_type == 0) { nowchooseid_eqp = id; } else if (dic[id].dress_type == 1) { nowchooseid_body = id; } #region this_icon for (int i = 0; i < contain.transform.childCount; i++) { contain.transform.GetChild(i).transform.FindChild("this").gameObject.SetActive(false); } dic_objs[id].transform.FindChild("this").gameObject.SetActive(true); #endregion #region info c_name.text = dic[id].name; c_shuxing.text = ""; for (int i = 0; i < dic[id].lst_fa.Count; i++) { string nub_str = string.Empty; int nub = dic[id].lst_fa[i].type; if (nub >= 100) { nub_str = dic[id].lst_fa[i].value + "%"; c_shuxing.text += Globle.getAttrNameById(dic[id].lst_fa[i].type - 100) + "+" + nub_str + " "; } else { nub_str = dic[id].lst_fa[i].value.ToString(); c_shuxing.text += Globle.getAttrNameById(dic[id].lst_fa[i].type) + "+" + nub_str + " "; } } c_info.text = dic[id].des; if (A3_FashionShowModel.getInstance().dic_have_fs.ContainsKey(id)) { // long now_time = muNetCleint.instance.CurServerTimeStamp; //long over_time = long.Parse(ConvertStringToDateTime((long)A3_FashionShowModel.getInstance().dic_have_fs[id])); c_time.text = ContMgr.getCont("a3_fashionshow9") + Globle.getStrTime((int)A3_FashionShowModel.getInstance().dic_have_fs[id], true); c_jihuo_obj.SetActive(true); jihuo_info.SetActive(false); c_info.gameObject.SetActive(true); c_time.gameObject.SetActive(true); if (A3_FashionShowModel.getInstance().nowfs[0] == id || A3_FashionShowModel.getInstance().nowfs[1] == id) { btn_buy_obj.SetActive(false); btn_dress_obj.SetActive(false); } else { btn_buy_obj.SetActive(false); btn_dress_obj.SetActive(true); } } else { c_time.text = ContMgr.getCont("a3_fashionshow10"); c_jihuo_obj.SetActive(false); btn_buy_obj.SetActive(true); btn_dress_obj.SetActive(false); jihuo_info.SetActive(true); inti_jihuo_panel(); c_info.gameObject.SetActive(false); c_time.gameObject.SetActive(false); } #endregion #region 模型更改 if (A3_FashionShowModel.getInstance().dress_show) { Show_this_Fashion(); } #endregion }
void onfashionshow_info(Variant data) { debug.Log("受到时装的协议:" + data.dump()); int res = data["res"]; if (res < 0) { Globle.err_output(res); return; } switch (res) { //0:武器 1:胸甲 case 1: //身上穿的 if (data["dress_list"] != null && data["dress_list"].Count > 0) { A3_FashionShowModel.getInstance().nowfs[0] = data["dress_list"][0]._int; A3_FashionShowModel.getInstance().nowfs[1] = data["dress_list"][1]._int; if (data["dress_show"]) { A3_FashionShowModel.getInstance().first_nowfs[0] = data["dress_list"][0]._int; A3_FashionShowModel.getInstance().first_nowfs[1] = data["dress_list"][1]._int; } else { A3_FashionShowModel.getInstance().first_nowfs[0] = A3_FashionShowModel.getInstance().first_nowfs[1] = 0; } } else { A3_FashionShowModel.getInstance().nowfs[0] = A3_FashionShowModel.getInstance().nowfs[1] = 0; A3_FashionShowModel.getInstance().first_nowfs[0] = A3_FashionShowModel.getInstance().first_nowfs[1] = 0; } //拥有的 if (data["dressments"] != null && data["dressments"].Count > 0) { for (int i = 0; i < data["dressments"].Count; i++) { A3_FashionShowModel.getInstance().dic_have_fs[data["dressments"][i]["dress"]] = data["dressments"][i]["limit"]; } } else { A3_FashionShowModel.getInstance().dic_have_fs.Clear(); } A3_FashionShowModel.getInstance().dress_show = data["dress_show"]; break; case 2: if (data["dress_list"] != null && data["dress_list"].Count > 0) { A3_FashionShowModel.getInstance().nowfs[0] = data["dress_list"][0]._int; A3_FashionShowModel.getInstance().nowfs[1] = data["dress_list"][1]._int; if (A3_FashionShowModel.getInstance().dress_show) { A3_FashionShowModel.getInstance().first_nowfs[0] = data["dress_list"][0]._int; A3_FashionShowModel.getInstance().first_nowfs[1] = data["dress_list"][1]._int; } else { A3_FashionShowModel.getInstance().first_nowfs[0] = A3_FashionShowModel.getInstance().first_nowfs[1] = 0; } } else { A3_FashionShowModel.getInstance().nowfs[0] = A3_FashionShowModel.getInstance().nowfs[1] = 0; A3_FashionShowModel.getInstance().first_nowfs[0] = A3_FashionShowModel.getInstance().first_nowfs[1] = 0; a3_fashionshow.ShowHide_SelefFashion(); } if (a3_fashionshow._insatnce != null) { a3_fashionshow._insatnce.RefreshSelfObj(); } // dispatchEvent(GameEvent.Create(CHANGEFA, this, data)); break; case 3: A3_FashionShowModel.getInstance().dic_have_fs[data["dress"]._int] = data["limit"]._uint; if (a3_fashionshow._insatnce != null) { a3_fashionshow._insatnce.RefreshObjs(data["dress"]._int); } break; case 4: A3_FashionShowModel.getInstance().dress_show = data["dress_show"]; if (data["dress_show"]._bool) { A3_FashionShowModel.getInstance().first_nowfs[0] = A3_FashionShowModel.getInstance().nowfs[0]; A3_FashionShowModel.getInstance().first_nowfs[1] = A3_FashionShowModel.getInstance().nowfs[1]; if (a3_fashionshow._insatnce != null) { a3_fashionshow._insatnce.Show_this_Fashion(); } } else { A3_FashionShowModel.getInstance().first_nowfs[0] = 0; A3_FashionShowModel.getInstance().first_nowfs[1] = 0; if (a3_fashionshow._insatnce) { a3_fashionshow._insatnce.Hide_this_Fashion(); } } break; } }