战役关卡评分奖励的评分计算修改

main
yurui 2024-11-01 18:10:09 +08:00
parent 56e5a68b0f
commit 5a6af43f86
2 changed files with 35 additions and 25 deletions

View File

@ -1,8 +1,10 @@
using System.Collections.Generic;
using cfg.LevelCfg;
using cfg.RedPoint;
using Framework;
using Gameplay.Level;
using Gameplay.Net;
using UnityEngine;
/// <summary>
/// 关卡组信息
@ -130,16 +132,33 @@ public class LevelGroupInfo : IRedPointTreeNode
{
get
{
int index = Cfg.StarList.Length - 1;
for (int i = Cfg.StarList.Length - 1; i >= 0; --i)
if (E_ChapterType.War == ChapterInfo.Cfg.Type)
{
if (Cfg.StarList[i] > Score)
index = i;
else
break;
}
List<float> listScoreRate = TableManager.Instance.Tables.GlobalConfig.CampaignScoreClass;
int index = listScoreRate.Count - 1;
for (int i = listScoreRate.Count - 1; i >= 0; --i)
{
if ((int)(listScoreRate[i] * ScoreMax) > Score)
index = i;
else
break;
}
return index;
return index;
}
else
{
int index = Cfg.StarList.Length - 1;
for (int i = Cfg.StarList.Length - 1; i >= 0; --i)
{
if (Cfg.StarList[i] > Score)
index = i;
else
break;
}
return index;
}
}
}
#endregion

View File

@ -93,47 +93,38 @@ public class UI_WarScoreRewardController : UIWindow
}
#region UI
/// <summary>
/// 高斯模糊遮罩
/// </summary>
private RawImage rawImageGaussianBlurMask;
/// <summary>
/// 评级
/// </summary>
private Image imageRating;
/// <summary>
/// 关闭
/// </summary>
private Button buttonClose;
/// <summary>
/// 领取奖励按钮
/// </summary>
private Button buttonGet;
/// <summary>
/// 下一目标文本
/// </summary>
private TMP_Text textTitle;
/// <summary>
/// 下一目标评分
/// </summary>
private TMP_Text textScore;
/// <summary>
/// 循环列表
/// </summary>
private RecycleView recycleView;
/// <summary>
/// 不能领取按钮表现
/// </summary>
private GameObject goGetOff;
#endregion
/// <summary>
@ -230,9 +221,10 @@ public class UI_WarScoreRewardController : UIWindow
IsGet = levelGroupInfo.IsHasGetRewards;
int nextTargerScoreIndex = levelGroupInfo.NextTargerStarIndex;
int nextTargetScore = levelGroupInfo.Cfg.StarList[nextTargerScoreIndex];
List<float> listScoreRate = TableManager.Instance.Tables.GlobalConfig.CampaignScoreClass;
int nextTargetScore = (int)(listScoreRate[nextTargerScoreIndex] * levelGroupInfo.ScoreMax);
textScore.text = nextTargetScore.ToString();
if (nextTargerScoreIndex + 1 == levelGroupInfo.Cfg.StarList.Length && levelGroupInfo.IsGetReward(nextTargerScoreIndex + 1))
if (nextTargerScoreIndex + 1 == listScoreRate.Count && levelGroupInfo.IsGetReward(nextTargerScoreIndex + 1))
{
textTitle.text = "目标完成"; // TODO 本地化
Dictionary<int, int> dicItemCount = new();
@ -323,17 +315,17 @@ public class UI_WarScoreRewardController : UIWindow
return;
}
var curStarScore = levelGroupInfo.Cfg.StarList[index];
var nextStarScore = index + 1 < levelGroupInfo.Cfg.StarList.Length
? levelGroupInfo.Cfg.StarList[index + 1]
: levelGroupInfo.Cfg.StarList[index];
List<float> listScoreRate = TableManager.Instance.Tables.GlobalConfig.CampaignScoreClass;
int curStarScore = (int)(listScoreRate[index] * levelGroupInfo.ScoreMax);
int nextStarScore = index + 1 < listScoreRate.Count
? (int)(listScoreRate[index + 1] * levelGroupInfo.ScoreMax)
: (int)(listScoreRate[index] * levelGroupInfo.ScoreMax);
starListItem.SetInfo(curStarScore, levelGroupInfo.ScoreMax, levelGroupInfo.Score, nextStarScore, levelGroupInfo.Cfg.Rewards[index],
levelGroupInfo.IsGetReward(index + 1));
}
#region 按钮回调
private void OnClose()
{
CloseWindow();
@ -346,6 +338,5 @@ public class UI_WarScoreRewardController : UIWindow
{
NetHelper.LevelGroupReward((uint)levelGroupInfo.Cfg.Id);
}
#endregion
}