public HttpResponseMessage Post([FromBody] TempGuestInput gi)
        {
            var date = gi.DateOfBirth;

            if (date.Length == 6)
            {
                date = "19" + date;
            }
            date = date.Insert(4, "-");
            date = date.Insert(7, "-");

            var newDate = Convert.ToDateTime(date);

            var newgi = new GuestInput()
            {
                Name = gi.Name,
                //Relation = gi.Relation,
                Email       = gi.Email,
                DateOfBirth = newDate
            };

            if (newgi.Created == default(DateTime))
            {
                newgi.Created = DateTime.UtcNow;
            }

            if (_repo.AddGuestFormInput(newgi) &&
                _repo.Save())
            {
                return(Request.CreateResponse(HttpStatusCode.Created, newgi));
            }

            return(Request.CreateResponse(HttpStatusCode.BadRequest));
        }
Пример #2
0
        public async Task <ApiResultData <ApiResultTokenData> > GetGuestToken(GuestInput input)
        {
            var returnResult = new ApiResultData <ApiResultTokenData>();
            var userInfo     = await _userService.GetOrGenerateItemByUniqueIdAsync(_authenticationSettings.RegisterDefaultGroupId,
                                                                                   _authenticationSettings.RegisterDefaultStatus,
                                                                                   input.UniqueId);

            if (userInfo == null)
            {
                returnResult.Code    = 400;
                returnResult.Message = "异常:根据唯一识别码获取用户失败";
                return(returnResult);
            }

            if (userInfo.Status != UserStatus.Normal)
            {
                returnResult.Code    = 201;
                returnResult.Message = "注册成功,请等待审核。";
                return(returnResult);
            }

            await SaveUserActionLogAsync(userInfo.UserId, 1, "根据唯一识别码获取游客 Token", input);

            returnResult.Data = await _tokenService.GenerateApiResultTokenData(userInfo);

            returnResult.Code    = 200;
            returnResult.Message = "根据唯一识别码获取游客 Token 成功";
            return(returnResult);
        }
Пример #3
0
 static void Main(string[] args)
 {
     //ShowAdminMenu showAdmMen;
     //Storage storage = new Storage();
     //GuestMenu guestMenu = new GuestMenu();
     //MenuForRegistered menu = new MenuForRegistered();
     //AdminMenu adminMenu = new AdminMenu();
     //showAdmMen = menu.Show;
     //Show.ShowMenu(guestMenu);
     GuestMenu.Show();
     GuestInput.Input();
 }
Пример #4
0
 public bool AddGuestFormInput(GuestInput gi)
 {
     try
     {
         _ctx.GuestFormInputs.Add(gi);
         return(true);
     }
     catch (Exception ex)
     {
         // TODO log this error
         return(false);
     }
 }
Пример #5
0
    void Start()
    {
        gameObjectTracker = new GameObjectTracker();
        lastGuestInput    = new GuestInput();
        miceTracker       = new MiceTracker();

        Cursor.visible = false;

        stateFluxClient = GameObject.Find("StateFlux").GetComponent <StateFluxClient>();
        if (stateFluxClient == null)
        {
            DebugLog("Failed to connect with StateFluxClient");
            return;
        }
        stateFluxClient.AddListener(this);

        // lobby makes sure we are logged in before starting a game
        playerId = stateFluxClient.clientId;

        // when the game instance starts, LobbyManager receives a game instance start notification and saves these
        // we copy them here for convenience
        hostPlayer = LobbyManager.Instance.hostPlayer;
        players    = LobbyManager.Instance.players;
        thisPlayer = players[playerId];
        thatPlayer = players.Values.Where(p => p.Id != playerId).FirstOrDefault();

        CreateMousePointerGameObjects();

        if (stateFluxClient.isHosting)
        {
            var g = GameObject.Find("State_IsGuest");
            g.SetActive(false);
            var textMesh = g.GetComponentInChildren <TextMesh>();
            if (textMesh != null)
            {
                textMesh.color = StateFluxTypeConvert.Convert(thisPlayer.Color);
            }
            StartCoroutine(gameObjectTracker.SendStateAsHost());
        }
        else
        {
            var g = GameObject.Find("State_IsHost");
            g.SetActive(false);
            var textMesh = g.GetComponentInChildren <TextMesh>();
            if (textMesh != null)
            {
                textMesh.color = StateFluxTypeConvert.Convert(thisPlayer.Color);
            }
            StartCoroutine(nameof(SendInputAsGuest));
        }
    }
Пример #6
0
    // called when the game is guest (not hosting), gathers and sends user input to host
    private void SendInputAsGuest()
    {
        bool clicked = Input.GetMouseButtonDown(0);

        if (clicked)
        {
            SendGuestGroovyCommand();
            clicked = false; // eat the click if a command is sent
        }

        var input = new GuestInput
        {
            mPos     = GetMousePoint().Convert2d(),
            mDown    = Input.GetMouseButton(0),
            mClicked = Input.GetMouseButtonDown(0),
            hArrows  = Input.GetAxis("Horizontal"),
            vArrows  = Input.GetAxis("Vertical"),
            btn1     = Input.GetButtonDown("Fire1"),
            btn2     = Input.GetButtonDown("Fire2"),
            btn3     = Input.GetButtonDown("Jump")
        };

        if (lastGuestInput.mPos == null ||
            input.mPos.X != lastGuestInput.mPos.X ||
            input.mPos.Y != lastGuestInput.mPos.Y ||
            input.mDown != lastGuestInput.mDown ||
            input.hArrows != lastGuestInput.hArrows ||
            input.vArrows != lastGuestInput.vArrows ||
            input.btn1 != lastGuestInput.btn1 ||
            input.btn2 != lastGuestInput.btn2 ||
            input.btn3 != lastGuestInput.btn3)
        {
            var message = new GuestInputChangeMessage
            {
                Payload = input
            };
            //Debug.Log($"SendInputAsGuest: {JsonConvert.SerializeObject(message)}");
            stateFluxClient.SendRequest(message);
            lastGuestInput = input;
        }
    }