You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.3 KiB
58 lines
1.3 KiB
1 month ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
|
||
|
using Sog;
|
||
|
|
||
|
namespace HttpProxyPay
|
||
|
{
|
||
|
public class PlayerTableOp : BaseReloadableService
|
||
|
{
|
||
|
public PlayerTable Table;
|
||
|
|
||
|
public override int GetServiceType()
|
||
|
{
|
||
|
return HttpProxyPayServiceType.PlayerTableOp;
|
||
|
}
|
||
|
|
||
|
public override void Dispose()
|
||
|
{
|
||
|
Table = null;
|
||
|
}
|
||
|
|
||
|
public PlayerTableOp(PlayerTable table)
|
||
|
{
|
||
|
Table = table;
|
||
|
}
|
||
|
|
||
|
public int GetUserCount()
|
||
|
{
|
||
|
return Table.m_playerTable.Count;
|
||
|
}
|
||
|
|
||
|
public PlayerOnPay GetPlayer(long uid)
|
||
|
{
|
||
|
PlayerOnPay player;
|
||
|
Table.m_playerTable.TryGetValue(uid, out player);
|
||
|
return player;
|
||
|
}
|
||
|
|
||
|
public bool AddPlayer(PlayerOnPay player)
|
||
|
{
|
||
|
if(Table.m_playerTable.ContainsKey(player.uid))
|
||
|
{
|
||
|
TraceLog.Error("PlayerTableOp.AddPlayer fail, uid {0} already exist", player.uid);
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
Table.m_playerTable.Add(player.uid, player);
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public bool RemovePlayer(PlayerOnPay player)
|
||
|
{
|
||
|
return Table.m_playerTable.Remove(player.uid);
|
||
|
}
|
||
|
}
|
||
|
}
|