117 【武将】武将系统 - 武将属性查看,非主线上阵武将战力提升显示
| | |
| | | |
| | | public static string GetValueDescription(int id, long value) |
| | | { |
| | | return GetValueDescription(id, value, false); |
| | | return GetValueDescription(id, value, true); |
| | | } |
| | | |
| | | public static string GetValueDescription(int id, long value, bool largeValue) |
| | |
| | | var hero = HeroManager.Instance.GetHero(item.guid); |
| | | if (hero == null) |
| | | return; |
| | | |
| | | var dict = FightPowerManager.Instance.GetHeroTotalAttr(hero); |
| | | foreach (var kv in attrBtns) |
| | | { |
| | | //每个按钮下有两个Text:name 和 value |
| | |
| | | Text valueText = button.transform.Find("value").GetComponent<Text>(); |
| | | |
| | | nameText.text = PlayerPropertyConfig.Get(id).ShowName; |
| | | valueText.text = PlayerPropertyConfig.GetValueDescription(id, 123); |
| | | var value = dict.TryGetValue(id, out long v) ? v : 0; |
| | | valueText.text = PlayerPropertyConfig.GetValueDescription(id, value); |
| | | } |
| | | } |
| | | |
| | |
| | | List<string> attrStrArr = new List<string>(); |
| | | for (int i = 0; i < nextQualityBreakConfig.AttrIDList.Length; i++) |
| | | { |
| | | if (nextQualityBreakConfig.AttrIDList[i] == 0) |
| | | { |
| | | continue; |
| | | } |
| | | attrStrArr.Add(PlayerPropertyConfig.GetFullDescription(nextQualityBreakConfig.AttrIDList[i], nextQualityBreakConfig.AttrValueList[i])); |
| | | } |
| | | if (nextQualityBreakConfig.SkillID != 0) |
| | | { |
| | | attrStrArr.Add(SkillConfig.Get(nextQualityBreakConfig.SkillID)?.Description); |
| | | var skill = SkillConfig.Get(nextQualityBreakConfig.SkillID); |
| | | if (skill != null) |
| | | { |
| | | attrStrArr.Add(skill.Description); |
| | | } |
| | | else |
| | | { |
| | | Debug.LogError("未配置技能" + nextQualityBreakConfig.SkillID); |
| | | } |
| | | } |
| | | potentialText.text = Language.Get("L1100", Language.Get("herocard56"), string.Join(Language.Get("L1112"), attrStrArr)); |
| | | } |
| | |
| | | var pack = new CB232_tagCSHeroBreak(); |
| | | pack.ItemIndex = (ushort)hero.itemHero.gridIndex; |
| | | GameNetSystem.Instance.SendInfo(pack); |
| | | HeroUIManager.Instance.lastFightPower = new KeyValuePair<int, long>(hero.heroId, hero.CalculatePower(false)); |
| | | CloseWindow(); |
| | | //设置个等待回复的标识 显示成功界面 |
| | | HeroUIManager.Instance.waitResponse = new WaitHeroFuncResponse() |
| | |
| | | /// <summary> |
| | | /// 武将培养界面 |
| | | /// </summary> |
| | | public class HeroTrainWin : UIBase |
| | | public partial class HeroTrainWin : UIBase |
| | | { |
| | | [SerializeField] Button showFuncBtn; //只显示立绘时点击,显示功能 |
| | | [SerializeField] Transform funcForm; |
| | |
| | | [SerializeField] Text allPotentialText; //潜能 |
| | | string guid; |
| | | HeroInfo hero; |
| | | |
| | | |
| | | |
| | | protected override void InitComponent() |
| | | { |
| | | showFuncBtn.AddListener(() => |
| | |
| | | HeroManager.Instance.onHeroChangeEvent -= RefreshHeroEvent; |
| | | } |
| | | |
| | | |
| | | |
| | | public override void Refresh() |
| | | { |
| | | roleLhModel.Create(hero.SkinID, HeroUIManager.lihuiScale, motionName: "", isLh: true); |
| | |
| | | jobPosNameText.text = HeroUIManager.Instance.GetJobName(hero.heroConfig.Class); |
| | | descText.text = hero.heroConfig.Desc; |
| | | fightPowerText.text = UIHelper.ReplaceLargeArtNum(hero.CalculatePower()); |
| | | PlayerMainDate.Instance.AddPowerNotOnTeam(hero); |
| | | lockImg.SetActive(hero.isLock); |
| | | unLockImg.SetActive(!hero.isLock); |
| | | nameText.text = hero.breakLevel == 0 ? hero.heroConfig.Name : Language.Get("herocardbreaklv", hero.heroConfig.Name, hero.breakLevel); |
| | |
| | | { |
| | | addPerObject.SetActive(false); |
| | | }); |
| | | HeroUIManager.Instance.lastFightPower = new KeyValuePair<int, long>(hero.heroId, hero.CalculatePower(false)); |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | allPotentialText.text = allAttrStr.Trim(); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | public const float lihuiScale = 0.6f; //立绘缩放大小 |
| | | |
| | | |
| | | //用于非上阵武将战力变化时 武将ID:上次战力 |
| | | public KeyValuePair<int, long> lastFightPower = new KeyValuePair<int, long>(0, 0); |
| | | |
| | | public override void Init() |
| | | { |
| | |
| | | { |
| | | return hero.heroLevel == GetMaxLVByBreakLV(hero.Quality, hero.breakLevel); |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | |
| | | #endregion |
| | | |
| | | |
| | | public Dictionary<int, long> GetHeroTotalAttr(HeroInfo hero) |
| | | { |
| | | |
| | | Dictionary<int, long> tmpAttrs = new Dictionary<int, long>(); |
| | | hero.RefreshFetterAttrsWhenCalcPower(TeamType.Story); //羁绊属性要实时算 |
| | | |
| | | #if UNITY_EDITOR |
| | | propertyStrForDebug = ""; |
| | | #endif |
| | | |
| | | foreach (var config in PlayerPropertyConfig.GetValues()) |
| | | { |
| | | if (config.showType < 1 || config.showType > 4) |
| | | { |
| | | continue; |
| | | } |
| | | if (config.showType == 1) |
| | | { |
| | | tmpAttrs[config.ID] = (long)GetPropertyVaule(config.ID, hero, propertyFormula); |
| | | } |
| | | else |
| | | { |
| | | tmpAttrs[config.ID] = (long)GetPropertyVaule(config.ID, hero, fightPropertyFormula); |
| | | } |
| | | } |
| | | #if UNITY_EDITOR |
| | | Debug.Log($"战力:武将ID {hero.heroId} 属性信息 {propertyStrForDebug}"); |
| | | #endif |
| | | return tmpAttrs; |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | }
|
| | | else
|
| | | {
|
| | | if ((long)power > prowNum)
|
| | | if ((long)power != prowNum)
|
| | | {
|
| | | prowNumChange = (long)power - prowNum;
|
| | | prowNum = (long)power;
|
| | | isAdd = true;
|
| | | if (customDisplayPower != null && customDisplayPower())
|
| | | {
|
| | | return;
|
| | | }
|
| | | if (UIManager.Instance.IsOpened<PowerAddWin>())
|
| | | {
|
| | | AddPowerEvent?.Invoke();
|
| | | return;
|
| | | }
|
| | | UIManager.Instance.OpenWindow<PowerAddWin>();
|
| | | }
|
| | | else if ((long)power < prowNum)
|
| | | {
|
| | | prowNumChange = prowNum - (long)power;
|
| | | prowNum = (long)power;
|
| | | isAdd = false;
|
| | | isAdd = prowNumChange > 0;
|
| | | prowNumChange = Math.Abs(prowNumChange);
|
| | | if (customDisplayPower != null && customDisplayPower())
|
| | | {
|
| | | return;
|
| | |
| | | // UIManager.Instance.OpenWindow<PowerAddWin>();
|
| | | // }
|
| | |
|
| | | |
| | | /// <summary>
|
| | | /// 武将自身的战力变化
|
| | | /// </summary>
|
| | | /// <param name="hero"></param>
|
| | | public void AddPowerNotOnTeam(HeroInfo hero)
|
| | | {
|
| | | if (HeroUIManager.Instance.lastFightPower.Key != hero.heroId)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | if (hero.IsInTeamByTeamType(TeamType.Story))
|
| | | { |
| | | return;
|
| | | }
|
| | |
|
| | | prowNumChange = hero.CalculatePower() - HeroUIManager.Instance.lastFightPower.Value;
|
| | | isAdd = prowNumChange > 0;
|
| | | prowNumChange = Math.Abs(prowNumChange);
|
| | | prowNum = hero.CalculatePower();
|
| | | if (UIManager.Instance.IsOpened<PowerAddWin>())
|
| | | {
|
| | | AddPowerEvent?.Invoke();
|
| | | return;
|
| | | }
|
| | | UIManager.Instance.OpenWindow<PowerAddWin>();
|
| | | }
|
| | | }
|
| | |
|
| | |
|