public ActionResult RobotUpdateLimit(Dictionary <string, string> queryvalues) { int gametype = queryvalues.ContainsKey("gametype") ? Convert.ToInt32(queryvalues["gametype"]) : 0; int limit0 = queryvalues.ContainsKey("limit0") ? Convert.ToInt32(queryvalues["limit0"]) : 0; int limit1 = queryvalues.ContainsKey("limit1") ? Convert.ToInt32(queryvalues["limit1"]) : 0; int limit2 = queryvalues.ContainsKey("limit2") ? Convert.ToInt32(queryvalues["limit2"]) : 0; int limit3 = queryvalues.ContainsKey("limit3") ? Convert.ToInt32(queryvalues["limit3"]) : 0; int limit4 = queryvalues.ContainsKey("limit4") ? Convert.ToInt32(queryvalues["limit4"]) : 0; RobotControl robotCon = new RobotControl(); ModifyRobotConfig ModifyRobotConfig; ModifyRobotConfig = ModifyRobotConfig.CreateBuilder() .SetGameType((uint)gametype) .AddLimit((uint)limit0) .AddLimit((uint)limit1) .AddLimit((uint)limit2) .AddLimit((uint)limit3) .AddLimit((uint)limit4) .Build(); Bind tbind = Cmd.runClientRobot(new Bind(ServiceCmd.SC_ROBOT_MODIFY, ModifyRobotConfig.ToByteArray()), 12001); switch ((CenterCmd)tbind.header.CommandID) { case CenterCmd.CS_ROBOT_STATU: RobotStatus RobotStatus = RobotStatus.ParseFrom(tbind.body.ToBytes()); IList <GameStatu> gameStatuList = RobotStatus.GameStatuList; GameStatu game = gameStatuList.FirstOrDefault(m => m.GameType == gametype); string limits = ""; for (int i = 0; i < game.PlayerLimitList.Count(); i++) { limits += game.PlayerLimitList[i] + ","; } limits = limits.Trim(','); return(Json(new { res = 1, Data = limits })); } return(Json(new { res = 0, Data = "" })); }
public ActionResult RobotManager(Dictionary <string, string> queryvalues) { //获取全部信息 RobotControl robotCon = new RobotControl(); QueryRobotStatu QueryRobotStatu; QueryRobotStatu = QueryRobotStatu.CreateBuilder() .SetModuleType(0) .Build(); Bind tbind = Cmd.runClientRobot(new Bind(ServiceCmd.SC_ROBOT_QUERY, QueryRobotStatu.ToByteArray()), 12001); switch ((CenterCmd)tbind.header.CommandID) { case CenterCmd.CS_ROBOT_STATU: RobotStatus RobotStatus = RobotStatus.ParseFrom(tbind.body.ToBytes()); uint moduleType = RobotStatus.ModuleType; IList <GameStatu> gameStatuList = RobotStatus.GameStatuList; ProtoCmd.Service.GameOverView gameOverview = RobotStatus.GameOverview; SystemStatu systemStatu = RobotStatus.SystemStatu; RobotSystemStatu robotSystemStatu = new RobotSystemStatu { CPUPercent = systemStatu.CpuPercent.ToString(), MemUsed = systemStatu.MemUsed.ToString(), MemTotal = systemStatu.MemTotal.ToString(), FlowRate = systemStatu.FlowRate.ToString(), ConnCnt = (int)systemStatu.ConnCnt, ConnLimit = (int)systemStatu.ConnLimit }; robotCon.RobotSystemStatu = robotSystemStatu; GameStatu CARSGame = gameStatuList.FirstOrDefault(m => m.GameType == (int)ModuleType.CARS); GameStatu TexasGame = gameStatuList.FirstOrDefault(m => m.GameType == (int)ModuleType.TEXAS); GameStatu TEXAS_EXGame = gameStatuList.FirstOrDefault(m => m.GameType == (int)ModuleType.TEXAS_EX); GameStatu ZFBGame = gameStatuList.FirstOrDefault(m => m.GameType == (int)ModuleType.ZFB); GameStatu ZODIACGame = gameStatuList.FirstOrDefault(m => m.GameType == (int)ModuleType.ZODIAC); RobotGameStatu robotGameStatu = new RobotGameStatu { CARS = CARSGame.PlayerCnt, All = CARSGame.PlayerCnt + TexasGame.PlayerCnt + ZFBGame.PlayerCnt + ZODIACGame.PlayerCnt, Texas = TexasGame.PlayerCnt, ZFB = ZFBGame.PlayerCnt, ZODIAC = ZODIACGame.PlayerCnt, TEXAS_EX = TEXAS_EXGame.PlayerCnt }; RobotDown robotDown = new RobotDown { CARS = CARSGame.IsBet > 0, Texas = TexasGame.IsBet > 0, ZFB = ZFBGame.IsBet > 0, ZODIAC = ZODIACGame.IsBet > 0, TEXAS_EX = TEXAS_EXGame.IsBet > 0 }; robotCon.RobotDown = robotDown; robotCon.RobotGameStatu = robotGameStatu; RobotPlayerLimit robotPlayerLimit = new RobotPlayerLimit { CARSLimit = CARSGame.PlayerLimitList.ToList(), TexasLimit = TexasGame.PlayerLimitList.ToList(), ZFBLimit = ZFBGame.PlayerLimitList.ToList(), ZODIACLimit = ZODIACGame.PlayerLimitList.ToList(), TEXAS_EXLimit = TEXAS_EXGame.PlayerLimitList.ToList() }; robotCon.RobotPlayerLimit = robotPlayerLimit; break; case CenterCmd.CS_CONNECT_ERROR: break; } if (Request.IsAjaxRequest()) { return(Json(new { res = 1, data = robotCon })); } return(View(robotCon)); }