Ejemplo n.º 1
0
        public IActionResult Get()
        {
            User       user       = (User)HttpContext.Items["User"];
            DateTime   dt         = new DateTime(1970, 01, 01);
            var        daysFromBd = appCtx.Days.Where(d => d.StatisticsId == (int)user.StatisticsId).ToList();
            List <Day> days       = new List <Day>();

            foreach (var d in daysFromBd)
            {
                var f = dt.AddMilliseconds(d.Date).AddHours(3).Date;
                if (f.CompareTo(DateTime.Now.Date) == 0)
                {
                    days.Add(d);
                }
            }
            UserAccountResponse uar = new UserAccountResponse
            {
                Email = user.Email,
                Login = user.Login,
                Today = days,
                Week  = Get("week"),
                Month = Get("month"),
                Year  = Get("year")
            };

            return(Json(uar));
        }
Ejemplo n.º 2
0
        void ProcessUnprocessedLoginServerResponses()
        {
            List <BasePacket> tempPacketList;

            lock (responsesLock)
            {
                tempPacketList = unprocessedLoginServerResponses;
                unprocessedLoginServerResponses = new List <BasePacket>();
            }

            foreach (BasePacket packet in tempPacketList)
            {
                UserAccountResponse uar = packet as UserAccountResponse;
                if (uar == null)
                {
                    IntrepidSerialize.ReturnToPool(packet);
                    continue;
                }

                //List<PlayerConnectionState> validConnections;
                // the pending users should be a tiny list
                PlayerConnectionState foundPlayer = null;
                int indexOfFoundPlayer            = -1;
                foreach (PlayerConnectionState player in limboConnections)
                {
                    indexOfFoundPlayer++;
                    if (player.tempId == uar.connectionId)
                    {
                        foundPlayer = player;
                        break;
                    }
                }
                if (foundPlayer != null)
                {
                    limboConnections.RemoveAt(indexOfFoundPlayer);
                    foundPlayer.finishedLoginSuccessfully = uar.isValidAccount;
                    if (uar.isValidAccount == false)
                    {
                        invalidPlayers.Add(foundPlayer);
                    }
                    else
                    {
                        loggedInPlayers.Add(foundPlayer);
                    }

                    OnNewPlayerLoggedIn?.Invoke(foundPlayer, uar.isValidAccount, uar.state);
                }
                IntrepidSerialize.ReturnToPool(uar);
            }
        }
Ejemplo n.º 3
0
        private void ProcessUserAccountRequest(RequestSetup requestInProcess)
        {
            UserAccountRequest request   = requestInProcess.request as UserAccountRequest;
            PlayerSaveState    saveState = accountQuerier.GetPlayerSaveState(
                request.username.MakeString(),
                request.password.MakeString(),
                request.product_name.MakeString());

            UserAccountResponse response = (UserAccountResponse)IntrepidSerialize.TakeFromPool(PacketType.UserAccountRequest);

            response.connectionId   = request.connectionId;
            response.isValidAccount = saveState != null;
            if (saveState != null)
            {
                response.state = saveState;
            }

            ConnectionState cs = connections[requestInProcess.connectionId];

            cs.Send(response);
        }
Ejemplo n.º 4
0
 //UserAccountRequest
 public bool ReceiveLogin(UserAccountResponse response)
 {
     Console.Write("response id: {0}\nis valid account: {1}\n state: {2}\n", response.connectionId, response.isValidAccount, response.state);
     return(true);
 }