void onClick(GameObject e) { if (!e.GetComponent <Button>().enabled) { return; } switch (e.name) { case "MakeBtn": if (roleData.State == RoleStateType.NotRecruited) { // ConfirmCtrl.Show(string.Format("是否将<color=\"{0}\">{1}</color>赠给{2}与其结交?", Statics.GetQualityColorString(weapon.Quality), weapon.Name, roleData.Name), () => { // Messenger.Broadcast<int>(NotifyTypes.InviteRole, roleData.PrimaryKeyId); // }); string needMsg = ""; for (int i = 0, len = weapon.Needs.Count; i < len; i++) { needMsg += string.Format("{0}个{1}", weapon.Needs[i].Num, Statics.GetEnmuDesc <ResourceType>(weapon.Needs[i].Type)) + (i < len - 1 ? "," : ""); } if (needMsg != "") { ConfirmCtrl.Show(string.Format("要将<color=\"{0}\">{1}</color>赠送给{2}\n需要{3}\n是否立即锻造兵器?", Statics.GetQualityColorString(weapon.Quality), weapon.Name, roleData.Name, needMsg), () => { Messenger.Broadcast <int>(NotifyTypes.InviteRole, roleData.PrimaryKeyId); }); } else { AlertCtrl.Show("兵器没有原材料无法打造", null); } } else { AlertCtrl.Show(string.Format("{0}已经和你结交", roleData.Name), null); } break; case "Btn": Messenger.Broadcast <RoleData>(NotifyTypes.ShowRoleDetailPanel, roleData); break; default: break; } viewedNewFlag(); }
void onClick(GameObject e) { switch (e.name) { case "Block": Back(); break; case "lvUpgradeBtn": if (weaponData.LV >= weaponLVData.MaxLV) { AlertCtrl.Show(string.Format("<color=\"{0}\">{1}</color>强化度已到满级", Statics.GetQualityColorString(weaponData.Quality), weaponData.Name)); break; } string needMsg = ""; double needRate = DbManager.Instance.GetWeaponNeedRate(weaponData.LV + 1); for (int i = 0, len = weaponData.Needs.Count; i < len; i++) { needMsg += string.Format("{0}个{1}", weaponData.Needs[i].Num * needRate, Statics.GetEnmuDesc <ResourceType>(weaponData.Needs[i].Type)) + (i < len - 1 ? "," : ""); } ConfirmCtrl.Show(string.Format("将<color=\"{0}\">{1}</color>强化到{2}\n需要{3}\n是否立即强化兵器?", Statics.GetQualityColorString(weaponData.Quality), weaponData.Name, weaponData.LV + 1, needMsg), () => { Messenger.Broadcast <WeaponData>(NotifyTypes.WeaponLVUpgrade, weaponData); }); break; default: break; } }
/// <summary> /// 装备秘籍 /// </summary> /// <param name="id">Identifier.</param> public void UseBook(int id) { //查询主角当前的兵器类型 WeaponType hostWeaponType = GetHostWeaponType(); db = OpenDb(); //查询角色信息 SqliteDataReader sqReader = db.ExecuteQuery("select RoleId, RoleData from RolesTable where RoleId = '" + currentRoleId + "' and BelongToRoleId = '" + currentRoleId + "'"); int addIndex = -1; if (sqReader.Read()) { string roleId = sqReader.GetString(sqReader.GetOrdinal("RoleId")); //获取角色数据 RoleData role = JsonManager.GetInstance().DeserializeObject <RoleData>(sqReader.GetString(sqReader.GetOrdinal("RoleData"))); sqReader = db.ExecuteQuery("select BookId, SeatNo from BooksTable where SeatNo >= 0 and State = " + ((int)BookStateType.Read) + " and BelongToRoleId = '" + currentRoleId + "'"); List <string> resourceBookDataIds = new List <string>(); List <int> seatNos = new List <int>() { -1, -1, -1 }; int seatNo; while (sqReader.Read()) { seatNo = sqReader.GetInt32(sqReader.GetOrdinal("SeatNo")); if (seatNos.Count > seatNo) { seatNos[seatNo] = seatNo; resourceBookDataIds.Add(sqReader.GetString(sqReader.GetOrdinal("BookId"))); } } addIndex = seatNos.FindIndex(item => item == -1); if (addIndex >= 0) { sqReader = db.ExecuteQuery("select BookId from BooksTable where Id = " + id); if (sqReader.Read()) { string bookId = sqReader.GetString(sqReader.GetOrdinal("BookId")); BookData bookData = JsonManager.GetInstance().GetMapping <BookData>("Books", bookId); if (bookData.LimitWeaponType == WeaponType.None || hostWeaponType == WeaponType.None || bookData.LimitWeaponType == hostWeaponType) { resourceBookDataIds.Add(bookId); db.ExecuteQuery("update BooksTable set SeatNo = " + addIndex + ", BeUsingByRoleId = '" + currentRoleId + "' where Id = " + id); //更新角色的秘籍信息 role.ResourceBookDataIds = resourceBookDataIds; db.ExecuteQuery("update RolesTable set RoleData = '" + JsonManager.GetInstance().SerializeObjectDealVector(role) + "' where RoleId = '" + roleId + "'"); } else { AlertCtrl.Show(string.Format("装备上[{0}]才能习练<color=\"{1}\">{2}</color>\n{3}", Statics.GetEnmuDesc <WeaponType>(bookData.LimitWeaponType), Statics.GetQualityColorString(bookData.Quality), bookData.Name, hostWeaponType != WeaponType.None ? ("你现在拿的是[" + Statics.GetEnmuDesc <WeaponType>(hostWeaponType) + "]") : "你现在手里没有任何兵器"), null); } } } } db.CloseSqlConnection(); if (addIndex >= 0) { GetBooksListPanelData(); CallRoleInfoPanelData(false); //刷新队伍数据 } else { AlertCtrl.Show("最多只能同时习练3本秘籍!", null); } }
public override void RefreshView() { iconImage.sprite = Statics.GetIconSprite(bookData.IconId); nameText.text = string.Format("<color=\"{0}\">{1}</color>", Statics.GetQualityColorString(bookData.Quality), bookData.Name); descText.text = string.Format("{0}{1}描述:\n{2}", bookData.LimitWeaponType != WeaponType.None ? string.Format("兵器限制:{0}\n", Statics.GetEnmuDesc <WeaponType>(bookData.LimitWeaponType)) : "", info != "" ? string.Format("附加属性:\n<color=\"#00FF00\">{0}</color>", info) : "", bookData.Desc); if (prefabObj == null) { prefabObj = Statics.GetPrefab("Prefabs/UI/GridItems/SkillItemContainer"); } if (bookData.Skills.Count > 0) { emptyImage.gameObject.SetActive(false); SkillData skill; GameObject itemPrefab; SkillItemContainer container; for (int i = 0; i < bookData.Skills.Count; i++) { skill = bookData.Skills[i]; if (containers.Count <= i) { itemPrefab = Statics.GetPrefabClone(prefabObj); MakeToParent(gridTrans.transform, itemPrefab.transform); container = itemPrefab.GetComponent <SkillItemContainer>(); containers.Add(container); } else { container = containers[i]; } container.UpdateData(skill, i != bookData.Skills.Count - 1); container.RefreshView(); } } else { emptyImage.gameObject.SetActive(true); } }
public override void RefreshView() { iconImage.sprite = Statics.GetIconSprite(bookData.IconId); flashImage.gameObject.SetActive(((int)bookData.Quality) >= ((int)QualityType.FlashGold)); nameText.text = string.Format("<color=\"{0}\">{1}</color>", Statics.GetQualityColorString(bookData.Quality), bookData.Name); descText.text = string.Format("{0}{1}{2}{3}\n描述:\n{4}", bookData.GetCurrentSkill() != null ? bookData.GetCurrentSkill().Desc : "心法无招式", bookData.LimitWeaponType != WeaponType.None ? string.Format("\n兵器限制:{0}", Statics.GetEnmuDesc <WeaponType>(bookData.LimitWeaponType)) : "", info != "" ? string.Format("\n附加属性:\n<color=\"#00FF00\">{0}</color>", info) : "", secretInfo != "" ? string.Format("\n诀要加成属性:\n<color=\"#00FF00\">{0}</color>", secretInfo) : "", !string.IsNullOrEmpty(bookData.Desc) ? bookData.Desc : "无"); if (bookData.IsMindBook) { titleText.text = "心法"; } else if (bookData.IsLostKnowledge) { titleText.text = "绝学"; } else { titleText.text = "秘籍"; } if (prefabObj == null) { prefabObj = Statics.GetPrefab("Prefabs/UI/GridItems/SkillItemContainer"); } StartCoroutine(refreshHeight()); if (!bookData.IsMindBook) { secretsDescText.text = string.Format("修为:\n{0}/{1}", expAndSecretData.Exp.Cur, expAndSecretData.Exp.Max > 0 ? Statics.GetBookStepExp(expAndSecretData.Exp.Cur) : 0); studyText.text = string.Format("领悟:{0}/{1}", expAndSecretData.Secrets.Count, Statics.GetBookLV(expAndSecretData.Exp.Cur)); MakeButtonEnable(studyBtn, true); } else { secretsDescText.text = "修为:\n不可修炼"; studyText.text = "不可领悟"; MakeButtonEnable(studyBtn, false); } // if (bookData.Skills.Count > 0) { // emptyImage.gameObject.SetActive(false); // SkillData skill; // GameObject itemPrefab; // SkillItemContainer container; // for (int i = 0; i < bookData.Skills.Count; i++) { // skill = bookData.Skills[i]; // if (containers.Count <= i) { // itemPrefab = Statics.GetPrefabClone(prefabObj); // MakeToParent(gridTrans.transform, itemPrefab.transform); // container = itemPrefab.GetComponent<SkillItemContainer>(); // containers.Add(container); // } // else { // container = containers[i]; // } // container.UpdateData(skill, i != bookData.Skills.Count - 1); // container.RefreshView(); // } // } // else { // emptyImage.gameObject.SetActive(true); // } }