public int ChangeRoleState(int roleId, KuaFuRoleStates state, bool noWait = false) { int result = StdErrorCode.Error_Operation_Faild; ITianTiService kuaFuService = null; KuaFuRoleData kuaFuRoleData = null; int serverId = ClientInfo.ServerId; lock (Mutex) { if (RoleId2RoleDataDict.TryGetValue(roleId, out kuaFuRoleData)) { serverId = kuaFuRoleData.ServerId; } } kuaFuService = GetKuaFuService(noWait); if (null != kuaFuService) { try { result = kuaFuService.RoleChangeState(serverId, roleId, (int)state); if (result >= 0) { lock (Mutex) { if (RoleId2RoleDataDict.TryGetValue(roleId, out kuaFuRoleData)) { kuaFuRoleData.State = (KuaFuRoleStates)result; } } if (null != kuaFuRoleData) { UpdateRoleData(kuaFuRoleData); } } } catch (System.Exception ex) { result = StdErrorCode.Error_Server_Internal_Error; } } return(result); }
/// <summary> /// 角色状态修改 /// </summary> /// <param name="rid"></param> /// <param name="gameType"></param> /// <param name="groupIndex"></param> /// <param name="state"></param> /// <returns></returns> public int RoleChangeState(int serverId, int rid, int state) { int result = StdErrorCode.Error_Operation_Faild; ITianTiService kuaFuService = GetKuaFuService(); if (null != kuaFuService) { try { result = kuaFuService.RoleChangeState(serverId, rid, state); } catch (System.Exception ex) { ResetKuaFuService(); } } return(result); }