补充快速结算第一个界面的基础逻辑展示
This commit is contained in:
parent
4f32edc6a5
commit
696aca3159
@ -86,6 +86,30 @@ namespace GameLogic
|
|||||||
m_AddPush++;
|
m_AddPush++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取该阵营积分最高的玩家
|
||||||
|
/// </summary>
|
||||||
|
public UnitPlayerData GetOnePlayer()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (m_ListUnitPlayDatas.Count <= 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前阵营积分最高的玩家
|
||||||
|
UnitPlayerData data = m_ListUnitPlayDatas[0];
|
||||||
|
for (int i = 1; i < m_ListUnitPlayDatas.Count; i++)
|
||||||
|
{
|
||||||
|
if (data.m_Score < m_ListUnitPlayDatas[i].m_Score)
|
||||||
|
{
|
||||||
|
data = m_ListUnitPlayDatas[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 返回该玩家数据
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
public double GetAllPower()
|
public double GetAllPower()
|
||||||
{
|
{
|
||||||
return m_AllPush;
|
return m_AllPush;
|
||||||
|
@ -17,12 +17,18 @@ namespace GameLogic
|
|||||||
public string ackType;
|
public string ackType;
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum GameStateType
|
|
||||||
|
public class GameEndData
|
||||||
{
|
{
|
||||||
团队赛 = 0,
|
public string m_WinTeamName;
|
||||||
个人赛 = 1
|
public string m_WinPlayerName;
|
||||||
|
public string m_SbyrPlayerName;
|
||||||
|
public string m_ZjgxPlayerName;
|
||||||
|
public string m_TzhsPlayerName;
|
||||||
|
public string m_DzzwPlayerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public enum GameRankType
|
public enum GameRankType
|
||||||
{
|
{
|
||||||
当局排行榜 = 0,
|
当局排行榜 = 0,
|
||||||
@ -57,6 +63,8 @@ namespace GameLogic
|
|||||||
public long m_Score; // 当局积分
|
public long m_Score; // 当局积分
|
||||||
public long m_AllWinCount;// 当局胜点
|
public long m_AllWinCount;// 当局胜点
|
||||||
public long m_LikeCount;//当局点赞
|
public long m_LikeCount;//当局点赞
|
||||||
|
public int m_GongXian;//当局贡献
|
||||||
|
public int m_AtkCount;//当局攻击
|
||||||
|
|
||||||
public void AddExp(long v)
|
public void AddExp(long v)
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,6 @@ namespace GameLogic
|
|||||||
public class EventConts
|
public class EventConts
|
||||||
{
|
{
|
||||||
public static PlatformType PlatformType = PlatformType.Dy; // 平台类型
|
public static PlatformType PlatformType = PlatformType.Dy; // 平台类型
|
||||||
public static GameStateType gameStateType = GameStateType.团队赛;
|
|
||||||
|
|
||||||
public static string Token = string.Empty; // 登录token
|
public static string Token = string.Empty; // 登录token
|
||||||
|
|
||||||
|
@ -10,19 +10,19 @@ public class DataGameModelManager : GameBase.Singleton<DataGameModelManager>
|
|||||||
#region 游戏结算上报
|
#region 游戏结算上报
|
||||||
public void C2S_GameRankEnd()
|
public void C2S_GameRankEnd()
|
||||||
{
|
{
|
||||||
if (EventConts.gameStateType == GameStateType.团队赛)
|
//if (EventConts.gameStateType == GameStateType.团队赛)
|
||||||
{
|
//{
|
||||||
GameRankEnd();
|
// GameRankEnd();
|
||||||
}
|
//}
|
||||||
else if (EventConts.gameStateType == GameStateType.个人赛)
|
//else if (EventConts.gameStateType == GameStateType.个人赛)
|
||||||
{
|
//{
|
||||||
OneGameRankEnd();
|
// OneGameRankEnd();
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
Log.Error("结算异常,不支持的模式:{0}", EventConts.gameStateType);
|
// Log.Error("结算异常,不支持的模式:{0}", EventConts.gameStateType);
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
|
|
||||||
// 比例瓜分积分池
|
// 比例瓜分积分池
|
||||||
DataGameSceneManager.Instance.ScoreAllValue = (int)(DataGameSceneManager.Instance.ScoreAllValue * 0.3f);
|
DataGameSceneManager.Instance.ScoreAllValue = (int)(DataGameSceneManager.Instance.ScoreAllValue * 0.3f);
|
||||||
|
@ -668,11 +668,226 @@ namespace GameLogic
|
|||||||
// 设置游戏状态
|
// 设置游戏状态
|
||||||
SetGameState(false);
|
SetGameState(false);
|
||||||
|
|
||||||
// 调用结算分配
|
ShowRankEndForm();
|
||||||
DataGameModelManager.Instance.C2S_GameRankEnd();
|
|
||||||
|
|
||||||
// // 理论上是结算界面显示完成后,才开始调用的,先测试重开逻辑的问题
|
// 多了一步流程
|
||||||
// OnRestData();
|
// 显示结算总结
|
||||||
|
|
||||||
|
//// 调用结算分配
|
||||||
|
//DataGameModelManager.Instance.C2S_GameRankEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void ShowRankEndForm()
|
||||||
|
{
|
||||||
|
|
||||||
|
var winActorTeam = OnCheckWinTeam();
|
||||||
|
|
||||||
|
string winActorName = GetStrs(winActorTeam.m_Index);
|
||||||
|
|
||||||
|
Log.Debug("获胜阵营的名称:" + winActorName);
|
||||||
|
|
||||||
|
var winActorPlayer = winActorTeam.GetOnePlayer();
|
||||||
|
|
||||||
|
if (winActorPlayer == null)
|
||||||
|
{
|
||||||
|
Log.Error("当前阵营没有玩家数据");
|
||||||
|
|
||||||
|
// 调用结算分配
|
||||||
|
DataGameModelManager.Instance.C2S_GameRankEnd();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string winActorPlayerName = winActorPlayer.protCustMessageData.nickName;
|
||||||
|
|
||||||
|
Log.Debug("当前积分最高的玩家");
|
||||||
|
|
||||||
|
var topPlayer = GetTopGongXianPlayer();
|
||||||
|
|
||||||
|
if (topPlayer == null)
|
||||||
|
{
|
||||||
|
Log.Error("当前没有玩家数据");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string sbyrPlayerName = GetSbyrPlayerName().protCustMessageData.nickName;
|
||||||
|
Log.Debug("当前虽败犹荣阵营的玩家:" + sbyrPlayerName);
|
||||||
|
|
||||||
|
|
||||||
|
string zjgxPlayerName = topPlayer.protCustMessageData.nickName;
|
||||||
|
Log.Debug("当前最佳贡献的玩家:" + zjgxPlayerName);
|
||||||
|
|
||||||
|
string tzhsPlayerName = GetTzhsPlayer().protCustMessageData.nickName;
|
||||||
|
Log.Debug("当前天灾化身的玩家:" + tzhsPlayerName);
|
||||||
|
|
||||||
|
string dzzwPlayerName = GetDzzwPlayer().protCustMessageData.nickName;
|
||||||
|
Log.Debug("当前点赞最多的玩家:" + dzzwPlayerName);
|
||||||
|
|
||||||
|
|
||||||
|
GameEndData gameEndData = new GameEndData()
|
||||||
|
{
|
||||||
|
m_DzzwPlayerName = dzzwPlayerName,
|
||||||
|
m_TzhsPlayerName = tzhsPlayerName,
|
||||||
|
m_SbyrPlayerName = sbyrPlayerName,
|
||||||
|
m_ZjgxPlayerName = zjgxPlayerName,
|
||||||
|
m_WinPlayerName = winActorPlayerName,
|
||||||
|
m_WinTeamName = zjgxPlayerName
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 显示结算界面
|
||||||
|
GameModule.UI.ShowUI<UIGameEndForm>(gameEndData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取除了胜利阵营外积分最高的玩家
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private UnitPlayerData GetSbyrPlayerName()
|
||||||
|
{
|
||||||
|
List<UnitPlayerData> m_tempList = new List<UnitPlayerData>();
|
||||||
|
foreach (var item in m_DicUnitPlayerDatas)
|
||||||
|
{
|
||||||
|
m_tempList.Add(item.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_tempList.Sort((a, b) =>
|
||||||
|
{
|
||||||
|
if (a.m_LikeCount > b.m_LikeCount)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (m_tempList.Count <= 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_tempList[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取当局点赞次数最多的玩家
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private UnitPlayerData GetDzzwPlayer()
|
||||||
|
{
|
||||||
|
List<UnitPlayerData> m_tempList = new List<UnitPlayerData>();
|
||||||
|
foreach (var item in m_DicUnitPlayerDatas)
|
||||||
|
{
|
||||||
|
m_tempList.Add(item.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_tempList.Sort((a, b) =>
|
||||||
|
{
|
||||||
|
if (a.m_LikeCount > b.m_LikeCount)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (m_tempList.Count <= 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_tempList[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取攻击次数最高的玩家
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private UnitPlayerData GetTzhsPlayer()
|
||||||
|
{
|
||||||
|
List<UnitPlayerData> m_tempList = new List<UnitPlayerData>();
|
||||||
|
foreach (var item in m_DicUnitPlayerDatas)
|
||||||
|
{
|
||||||
|
m_tempList.Add(item.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_tempList.Sort((a, b) =>
|
||||||
|
{
|
||||||
|
if (a.m_AtkCount > b.m_AtkCount)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (m_tempList.Count <= 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_tempList[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取全场贡献值最高的玩家
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private UnitPlayerData GetTopGongXianPlayer()
|
||||||
|
{
|
||||||
|
|
||||||
|
List<UnitPlayerData> m_tempList = new List<UnitPlayerData>();
|
||||||
|
foreach (var item in m_DicUnitPlayerDatas)
|
||||||
|
{
|
||||||
|
m_tempList.Add(item.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_tempList.Sort((a, b) =>
|
||||||
|
{
|
||||||
|
if (a.m_GongXian > b.m_GongXian)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (m_tempList.Count <= 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_tempList[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 确认获胜阵营
|
||||||
|
/// </summary>
|
||||||
|
private ActorHItem OnCheckWinTeam()
|
||||||
|
{
|
||||||
|
m_TeamSortList.Sort((a, b) =>
|
||||||
|
{
|
||||||
|
if (a.GetAllPower() > b.GetAllPower())
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// 第一名就是胜利的阵营
|
||||||
|
return m_TeamSortList[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -39,5 +39,10 @@ namespace GameLogic
|
|||||||
#region 事件
|
#region 事件
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
protected override void OnCreate()
|
||||||
|
{
|
||||||
|
base.OnCreate();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ namespace GameLogic
|
|||||||
|
|
||||||
// 设置游戏模式
|
// 设置游戏模式
|
||||||
// EventConts.gameStateType = (GameStateType)gameModelId;
|
// EventConts.gameStateType = (GameStateType)gameModelId;
|
||||||
EventConts.gameStateType = GameStateType.团队赛;
|
//EventConts.gameStateType = GameStateType.团队赛;
|
||||||
// 设置游戏时长
|
// 设置游戏时长
|
||||||
switch (gameLenTiemrId)
|
switch (gameLenTiemrId)
|
||||||
{
|
{
|
||||||
@ -71,7 +71,7 @@ namespace GameLogic
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Info("当前选择游戏模式: {0} , 设置游戏时长: {1}", EventConts.gameStateType, EventConts.gameLenTiemr);
|
//Log.Info("当前选择游戏模式: {0} , 设置游戏时长: {1}", EventConts.gameStateType, EventConts.gameLenTiemr);
|
||||||
|
|
||||||
GameModule.Setting.SetInt("gameModelId", gameModelId);
|
GameModule.Setting.SetInt("gameModelId", gameModelId);
|
||||||
GameModule.Setting.SetInt("gameLenTiemrId", gameLenTiemrId);
|
GameModule.Setting.SetInt("gameLenTiemrId", gameLenTiemrId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user