public bool Form(IPgInvitation inv) { if (BelongsMap.ContainsKey(inv.PlayerDst.PlayerId)) { return(false); } PremadeGroup group; if (BelongsMap.ContainsKey(inv.PlayerSrc.PlayerId)) { group = BelongsMap[inv.PlayerSrc.PlayerId]; group._Players.Add(inv.PlayerDst); BelongsMap[inv.PlayerDst.PlayerId] = group; } else { group = new PremadeGroup() { GroupId = evolib.Util.KeyGen.Get(32), LeaderPlayerId = inv.PlayerSrc.PlayerId, _Players = new List <IPremadeGroupPlayer>() { inv.PlayerSrc, inv.PlayerDst }, }; Groups[group.GroupId] = group; BelongsMap[inv.PlayerSrc.PlayerId] = group; BelongsMap[inv.PlayerDst.PlayerId] = group; } return(true); }
public void RemoveInvitation(IPgInvitation inv) { InvitationsDstMap.Remove(inv.PlayerDst.PlayerId); InvitationsSrcMap[inv.PlayerSrc.PlayerId].Remove(inv.PlayerDst.PlayerId); }