private void onCreate(MobaClient client, string name) { int accId = accountCache.GetId(client); if (playerCache.Has(accId)) { return; } //验证时候开始创建 playerCache.Create(name, accId); Send(client, OpCode.PlayerCode, OpPlayer.Create, 0, "创建成功"); }
/// <summary> /// 获取角色信息的处理 /// </summary> private void OnGetInfo(MOBAClient client) { int accountID = accountCache.GetID(client); if (accountID == -1) { Send(client, OperationCode.PlayerCode, OpPlayer.GetPlayerInfo, -1, "非法登录"); return; } else if (playerCache.Has(accountID)) { Send(client, OperationCode.PlayerCode, OpPlayer.GetPlayerInfo, 0, "角色存在"); return; } else { Send(client, OperationCode.PlayerCode, OpPlayer.GetPlayerInfo, -2, "角色不存在"); return; } }
/// <summary> /// 获取角色信息 /// </summary> private void OnGetInfo(MobaClient client) { int accId = accountCache.GetId(client); if (accId == -1) { Send(client, OpCode.PlayerCode, OpPlayer.GetInfo, -1, "非法登录"); return; } if (playerCache.Has(accId)) { Send(client, OpCode.PlayerCode, OpPlayer.GetInfo, 0, "存在角色"); return; } else { Send(client, OpCode.PlayerCode, OpPlayer.GetInfo, -2, "没有角色"); return; } }