Esempio n. 1
0
        public ActionResult RobotDown(Dictionary <string, string> queryvalues)
        {
            int gametype = queryvalues.ContainsKey("gametype") ? Convert.ToInt32(queryvalues["gametype"]) : 0;
            int downtype = queryvalues.ContainsKey("downtype") ? Convert.ToInt32(queryvalues["downtype"]) : 0;


            RobotControl robotCon = new RobotControl();

            ModifyRobotConfig ModifyRobotConfig;

            ModifyRobotConfig = ModifyRobotConfig.CreateBuilder()
                                .SetGameType((uint)gametype)
                                .SetIsBet((uint)downtype)
                                .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());
                return(Json(new
                {
                    res = 1,
                    Data = "",
                    down = (downtype)
                }));
            }
            return(Json(new
            {
                res = 0,
                Data = "",
                down = (downtype == 1 ? 0 : 1)
            }));
        }
Esempio n. 2
0
        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 = ""
            }));
        }