礼物效果数值增加

This commit is contained in:
SD-20250424WZPW\Administrator 2025-05-06 16:21:22 +08:00
parent 98b055c1c3
commit 6d73f6f76a
3 changed files with 181 additions and 122 deletions

View File

@ -36,16 +36,8 @@ namespace GameLogic
private long m_AllPush = 0; // 当前总值 private long m_AllPush = 0; // 当前总值
private int m_AllAddPush = 0;//永久增加推力值 private int m_AllAddPush = 0;//永久增加推力值
private int aniIndex = 1; // 当前人物动画索引Id
private int texuteIndex = 0; // 当前人物纹理索引Id
private Dictionary<string, List<Buff>> m_Buffs = new Dictionary<string, List<Buff>>(); //自身Buff列表
private TextureEntry m_CurrentTextureEntry; // 当前播放的 TextureEntry
private int m_CurrentTextureIndex = 0; // 当前播放的纹理索引
private float m_FrameInterval = 0.1f; // 每帧的时间间隔(秒)
private float m_TimeSinceLastFrame = 0f; // 距离上次切换的时间
private bool m_IsPlaying = false; // 是否正在播放
private bool m_Loop = true; // 是否循环播放
protected override void OnCreate() protected override void OnCreate()
{ {
@ -83,7 +75,7 @@ namespace GameLogic
public void AddPlayer(UnitPlayerData data) public void AddPlayer(UnitPlayerData data)
{ {
data.teamId = m_Index; data.teamId = m_Index.ToString();
m_ListUnitPlayDatas.Add(data); m_ListUnitPlayDatas.Add(data);
m_AddPush++; m_AddPush++;
} }
@ -95,6 +87,51 @@ namespace GameLogic
private void AddMyPush() private void AddMyPush()
{ {
// 最终结果值 = 初始推力+玩家数量 + 永久增加推力值
m_AddPush = EventConts.InitPower + m_ListUnitPlayDatas.Count + m_AllAddPush;
foreach (var item in m_Buffs)
{
// 临时准备移除的Buff列表
List<Buff> m_tempBuffList = new List<Buff>();
// 两层遍历,计算Buff效果
foreach (var buff in item.Value)
{
// 增加Buff耗时开销
buff.m_CraeteTimer += 0.05f;
// 计算Buff时常
if (buff.m_CraeteTimer >= buff.m_AllTimer)
{
// 超时移除
m_tempBuffList.Add(buff);
}
else
{
// 增加推力
if (buff.addPower > 0)
{
m_AddPush += buff.addPower;
}
}
}
// 移除超时的Buff
foreach (var buff in m_tempBuffList)
{
Log.Debug("移除Buff列表:" + buff.m_Id);
item.Value.Remove(buff);
}
}
// 减速也不能减到负数
if (m_AddPush <= 0)
{
m_AddPush = 0;
}
m_AllPush += m_AddPush; m_AllPush += m_AddPush;
} }
@ -103,6 +140,40 @@ namespace GameLogic
m_tmpAllValue.text = m_AllPush.ToString(); m_tmpAllValue.text = m_AllPush.ToString();
} }
/// <summary>
/// 增加礼物推力效果
/// </summary>
/// <param name="buff"></param>
/// <param name="unitPlayerData"></param>
public void AddBuff(Buff buff, UnitPlayerData unitPlayerData)
{
if (m_Buffs.ContainsKey(unitPlayerData.protCustMessageData.openId))
{
// // 存在相同BuffId,目前设计是增加时常?
// foreach (var item in m_Buffs[unitPlayerData.protCustMessageData.openId])
// {
// // 相同类型
// if (item.m_Id == buff.m_Id)
// {
// // 增加时常
// item.m_AllTimer += buff.m_AllTimer;
// return;
// }
// }
// 累加设计
// 没有该Buff,则新增这个Buff
m_Buffs[unitPlayerData.protCustMessageData.openId].Add(buff);
}
else
{
// 初始化这个列表Buff
m_Buffs.Add(unitPlayerData.protCustMessageData.openId, new List<Buff>());
m_Buffs[unitPlayerData.protCustMessageData.openId].Add(buff);
}
}
/// <summary> /// <summary>
/// 计算百分比大小值 /// 计算百分比大小值
/// </summary> /// </summary>

View File

@ -51,7 +51,7 @@ namespace GameLogic
public class UnitPlayerData public class UnitPlayerData
{ {
public int teamId; public string teamId;
public ProtCustMessageData protCustMessageData; public ProtCustMessageData protCustMessageData;
public long m_Score; // 当局积分 public long m_Score; // 当局积分
public long m_AllWinCount;// 当局胜点 public long m_AllWinCount;// 当局胜点

View File

@ -115,7 +115,7 @@ namespace GameLogic
UnitPlayerData unitPlayerData = new UnitPlayerData() UnitPlayerData unitPlayerData = new UnitPlayerData()
{ {
protCustMessageData = protCustMessageData, protCustMessageData = protCustMessageData,
teamId = -1 teamId = "-1"
}; };
if (string.IsNullOrEmpty(protCustMessageData.imgURL)) if (string.IsNullOrEmpty(protCustMessageData.imgURL))
@ -321,21 +321,10 @@ namespace GameLogic
} }
// // 处理音效 // 特殊Buff处理
// if (buff.addPower > 0) if (buff.isZoneTimer)
// { {
// // GameModule.Audio.Play(TEngine.AudioType.UISound, "数字跳动的音效", false); // 冻结
// // 加速特效
// m_SpeefEffectTimer += buff.m_AllTimer;
// }
// else
// {
// m_SnowEffectTimer += buff.m_AllTimer;
// }
// // 特殊Buff处理
// if (buff.isZoneTimer)
// {
//// 除了我自己以外,都挂这个Buff //// 除了我自己以外,都挂这个Buff
//var d = GetTeamActors(); //var d = GetTeamActors();
//var actor = DataGameSceneManager.Instance.GetTeamActor(unitPlayerData.teamId); //var actor = DataGameSceneManager.Instance.GetTeamActor(unitPlayerData.teamId);
@ -350,12 +339,12 @@ namespace GameLogic
// item.Value.ShowGift5Emoji(); // item.Value.ShowGift5Emoji();
// } // }
//} //}
// } }
// else else
// { {
// // 减速Buff的处理 // 减速Buff的处理
// if (buff.addPower < 0) if (buff.addPower < 0)
// { {
//// 获取加速最快的星球 //// 获取加速最快的星球
//var actors = GetAllRankUnityPlayerData(); //var actors = GetAllRankUnityPlayerData();
//actors.Sort((a, b) => //actors.Sort((a, b) =>
@ -419,21 +408,20 @@ namespace GameLogic
// } // }
// } // }
//} //}
// } }
// else else
// { {
// var actor = DataGameSceneManager.Instance.GetTeamActor(unitPlayerData.teamId); var actor = GetTeamActor(unitPlayerData.teamId);
// if (actor != null) if (actor != null)
// { {
// // actor.m_Go.transform.DOScale(actor.m_Go.transform.localScale.x + 2f, 1f); actor.AddBuff(buff, unitPlayerData);
// actor.AddBuff(buff, unitPlayerData); }
// } else
// else {
// { Log.Error("没有找到自己对应的阵营:{0}", unitPlayerData.teamId);
// Log.Error("没有找到自己对应的阵营:{0}", unitPlayerData.teamId); }
// } }
// } }
// }
// if (giftConfig.Id != 1) // if (giftConfig.Id != 1)
// { // {