Exemplo n.º 1
0
    private void CreateNewBuff(SideEffectExecute newSee, PlayerBuffSideEffects buff, Dictionary <int, SideEffectExecute> sees)
    {
        sees.Add(newSee.ID, newSee);
        GameManager.EventManager.RegisterEvent(newSee);
        PlayerBuffUpdateRequest request = new PlayerBuffUpdateRequest(ClientId, newSee.ID, PlayerBuffUpdateRequest.UpdateTypes.Add, newSee);

        BroadCastRequest(request);
    }
Exemplo n.º 2
0
    private void RemoveSEE(string buffName, Dictionary <int, SideEffectExecute> sees, SideEffectExecute remove_see)
    {
        sees.Remove(remove_see.ID);
        GameManager.EventManager.UnRegisterEvent(remove_see);
        PlayerBuffUpdateRequest request = new PlayerBuffUpdateRequest(ClientId, remove_see.ID, PlayerBuffUpdateRequest.UpdateTypes.Remove, remove_see);

        BroadCastRequest(request);
    }
Exemplo n.º 3
0
    private void OnUpdatePlayerBuff(PlayerBuffUpdateRequest r)
    {
        ClientPlayer cp = GetPlayerByClientId(r.clientId);

        if (r.updateType == PlayerBuffUpdateRequest.UpdateTypes.Remove)
        {
            cp.BattlePlayer.PlayerBuffManager.RemovePlayerBuff(r.buffId);
        }
        else
        {
            cp.BattlePlayer.PlayerBuffManager.UpdatePlayerBuff(r.buffSEE, r.buffId, r.updateType);
        }
    }
Exemplo n.º 4
0
 public void PlayerBuffTrigger(int seeID, PlayerBuffSideEffects buff)
 {
     if (SideEffectBundles_Player.ContainsKey(buff.Name))
     {
         Dictionary <int, SideEffectExecute> sees = SideEffectBundles_Player[buff.Name];
         if (sees.ContainsKey(seeID))
         {
             SideEffectExecute       see     = sees[seeID];
             PlayerBuffUpdateRequest request = new PlayerBuffUpdateRequest(ClientId, seeID, PlayerBuffUpdateRequest.UpdateTypes.Trigger, see);
             BroadCastRequest(request);
         }
     }
 }
Exemplo n.º 5
0
    public void UpdatePlayerBuff(SideEffectExecute newSee, bool isAdd = false)
    {
        foreach (SideEffectBase se in newSee.SideEffectBases)
        {
            if (se is PlayerBuffSideEffects buff)
            {
                if (SideEffectBundles_Player.ContainsKey(buff.Name))
                {
                    Dictionary <int, SideEffectExecute> sees = SideEffectBundles_Player[buff.Name];
                    if (sees.Count != 0)                                       //存在该buff
                    {
                        if (buff.M_SideEffectParam.GetParam_Bool("Singleton")) //buff是单例,只能存在一个
                        {
                            if (sees.Count > 1)                                //多于一个,清空重来
                            {
                                int RemainRemoveTriggerTime = 0;
                                foreach (KeyValuePair <int, SideEffectExecute> kv in sees)
                                {
                                    RemainRemoveTriggerTime = kv.Value.M_ExecuteSetting.RemoveTriggerTimes;
                                }

                                ClearSEEByBuffName(buff.Name, sees);

                                if (buff.M_SideEffectParam.GetParam_Bool("CanPiled")) //可以堆叠
                                {
                                    newSee.M_ExecuteSetting.RemoveTriggerTimes = RemainRemoveTriggerTime;
                                }

                                CreateNewBuff(newSee, buff, sees);
                            }
                            else
                            {
                                SideEffectExecute see = sees.Values.ToList()[0];
                                if (isAdd)
                                {
                                    PileBuff(see, newSee);
                                }
                                else
                                {
                                    see.M_ExecuteSetting.RemoveTriggerTimes      = newSee.M_ExecuteSetting.RemoveTriggerTimes;
                                    see.M_ExecuteSetting.RemoveTriggerDelayTimes = newSee.M_ExecuteSetting.RemoveTriggerDelayTimes;
                                }

                                PlayerBuffUpdateRequest request = new PlayerBuffUpdateRequest(ClientId, see.ID, PlayerBuffUpdateRequest.UpdateTypes.Refresh, see);
                                BroadCastRequest(request);
                            }
                        }
                        else //buff不是单例,则对应加到seeID上去
                        {
                            if (sees.ContainsKey(newSee.ID))
                            {
                                SideEffectExecute see = sees[newSee.ID];
                                if (isAdd)
                                {
                                    PileBuff(see, newSee);
                                }
                                else
                                {
                                    see.M_ExecuteSetting.RemoveTriggerTimes      = newSee.M_ExecuteSetting.RemoveTriggerTimes;
                                    see.M_ExecuteSetting.RemoveTriggerDelayTimes = newSee.M_ExecuteSetting.RemoveTriggerDelayTimes;
                                }

                                PlayerBuffUpdateRequest request = new PlayerBuffUpdateRequest(ClientId, see.ID, PlayerBuffUpdateRequest.UpdateTypes.Refresh, see);
                                BroadCastRequest(request);
                            }
                            else //ID不存在场上,新建一个buff
                            {
                                CreateNewBuff(newSee, buff, sees);
                            }
                        }
                    }
                    else //不存在该buff
                    {
                        CreateNewBuff(newSee, buff, sees);
                    }
                }
                else
                {
                    Dictionary <int, SideEffectExecute> sees = new Dictionary <int, SideEffectExecute>();
                    SideEffectBundles_Player.Add(buff.Name, sees);
                    CreateNewBuff(newSee, buff, sees);
                }
            }
        }
    }