Ejemplo n.º 1
0
    /// <summary>
    /// Event Register when click register on Register pannel.
    /// </summary>
    public void ButtonRegistered()
    {
        bool valid = false;

        for (int i = 0; i < LoadAllInfo.maxDictionary; i++)
        {
            if (listUser[i].user.userName == userRegister.text || userRegister.text == "" || emailRegister.text == "" || passRegister.text == "")
            {
                valid = true;
            }
        }
        if (valid)
        {
            userValid.SetActive(true);
        }
        else
        {
            PlayerData.User newUser = new PlayerData.User();
            newUser.userName = userRegister.text;
            newUser.passWord = passRegister.text;
            PlayerData.Player.Digimon newDigimon   = new PlayerData.Player.Digimon();
            PlayerData.Player         createPlayer = new PlayerData.Player(newDigimon);
            PlayerData playermore = new PlayerData(LoadAllInfo.maxDictionary, newUser, createPlayer);
            WriteFileUser(playermore);
            LoadPlayers();
            RegisteredSuccessed.SetActive(true);
        }
    }
        public async Task OnMessage(LobbyServerConnection connection, object requestData)
        {
            RegisterGameClientRequest request = (RegisterGameClientRequest)requestData;

            PlayerData.Player p = PlayerData.GetPlayer(request.SessionInfo.Handle);

            connection.SessionToken = request.SessionInfo.SessionToken;

            //connection.PlayerInfo = SessionManager.Get(connection.SessionToken);
            //connection.PlayerInfo.SetHandle(p.UserName);
            //connection.PlayerInfo.SetAccountId(p.AccountId);
            //connection.PlayerInfo.SetBannerID(p.SelectedBackgroundBannerID);
            //connection.PlayerInfo.SetEmblemID(p.SelectedForegroundBannerID);
            //connection.PlayerInfo.SetRibbonID(p.SelectedRibbonID);
            //connection.PlayerInfo.SetTitleID(p.SelectedTitleID);
            //connection.PlayerInfo.SetCharacterType(p.LastSelectedCharacter);

            // Send RegisterGameClientResponse
            await Send_RegisterGameClientResponse(connection, request);

            // Sent LobbyServerReadyNotification
            await Send_LobbyServerReadyNotification(connection);

            // Send "{username} has connected" to global chat
            await Send_ChatConnectedNotification(connection);
        }
Ejemplo n.º 3
0
        public void Configure(IApplicationBuilder app)
        {
            var serverAddressesFeature = app.ServerFeatures.Get <IServerAddressesFeature>();

            Log.Print(LogType.Server, "Started DirectoryServer on '0.0.0.0:6050'");

            app.Run((context) =>
            {
                context.Response.ContentType = "application/json";
                MemoryStream ms = new MemoryStream();
                context.Request.Body.CopyTo(ms);
                ms.Position        = 0;
                string requestBody = new StreamReader(ms).ReadToEnd();;
                ms.Dispose();

                AssignGameClientRequest request   = JsonConvert.DeserializeObject <AssignGameClientRequest>(requestBody);
                AssignGameClientResponse response = new AssignGameClientResponse();
                response.RequestId    = request.RequestId;
                response.ResponseId   = request.ResponseId;
                response.Success      = true;
                response.ErrorMessage = "";

                PlayerData.Player p = PlayerData.GetPlayer(request.AuthInfo.Handle);
                if (p == null)
                {
                    Log.Print(LogType.Warning, $"Player {request.AuthInfo.Handle} doesnt exists");
                    PlayerData.CreatePlayer(request.AuthInfo.Handle);
                    p = PlayerData.GetPlayer(request.AuthInfo.Handle);
                    if (p != null)
                    {
                        Log.Print(LogType.Debug, $"Succesfully Registered {p.UserName}");
                    }
                    else
                    {
                        Log.Print(LogType.Error, $"Error creating a new account for player '{request.AuthInfo.UserName}'");
                    }
                }

                response.SessionInfo                   = request.SessionInfo;
                response.SessionInfo.AccountId         = p.AccountId;
                response.SessionInfo.Handle            = p.UserName;
                response.SessionInfo.ConnectionAddress = "127.0.0.1";
                response.SessionInfo.ProcessCode       = "";
                response.SessionInfo.FakeEntitlements  = "";
                response.SessionInfo.LanguageCode      = "EN"; // Needs to be uppercase

                response.LobbyServerAddress = "127.0.0.1";

                LobbyGameClientProxyInfo proxyInfo = new LobbyGameClientProxyInfo();
                proxyInfo.AccountId      = response.SessionInfo.AccountId;
                proxyInfo.SessionToken   = request.SessionInfo.SessionToken;
                proxyInfo.AssignmentTime = 1565574095;
                proxyInfo.Handle         = request.SessionInfo.Handle;
                proxyInfo.Status         = ClientProxyStatus.Assigned;

                response.ProxyInfo = proxyInfo;

                return(context.Response.WriteAsync(JsonConvert.SerializeObject(response)));
            });
        }
Ejemplo n.º 4
0
        public EventConditions(IInterpreter <Closure> interpreter, GameState gameState)
        {
            _player = gameState.Player;

            interpreter.AddFunction("_FlagCondition", (Func <string, bool, bool>)CheckFlag);
            interpreter.AddFunction("_VarCondition", (Func <string, Equality, object, bool>)CheckVariable);
            interpreter.AddType <Equality>("Equality");
        }
Ejemplo n.º 5
0
        public EventTriggers(IInterpreter <Closure> interpreter, ISignal signal, GameState gameState)
        {
            _interpreter = interpreter;
            _signal      = signal;
            _player      = gameState.Player;

            interpreter.AddFunction("Subscribe", (Action <Table>)CreateEvent);
            interpreter.AddFunction("Notify", (Action <string>)Notify);
        }
Ejemplo n.º 6
0
        public Player(IInterpreter <Closure> interpreter, GameState gameState)
        {
            _player = gameState.Player;

            interpreter.AddFunction("Lock", (Action)LockMovement);
            interpreter.AddFunction("Unlock", (Action)UnlockMovement);
            interpreter.AddFunction("Flag", (Func <string, bool?, bool>)Flag);
            interpreter.AddFunction("Var", (Func <string, IComparable, object>)Var);
            interpreter.AddFunction("Save", (Action)Save);
        }
Ejemplo n.º 7
0
        public async Task OnMessage(ClientConnection connection, object requestData)
        {
            RegisterGameClientRequest request = (RegisterGameClientRequest)requestData;

            PlayerData.Player p = PlayerData.GetPlayer(request.SessionInfo.Handle);
            connection.AccountId                  = p.AccountId;
            connection.UserName                   = p.UserName;
            connection.SelectedTitleID            = p.SelectedTitleID;
            connection.SelectedBackgroundBannerID = p.SelectedBackgroundBannerID;
            connection.SelectedForegroundBannerID = p.SelectedForegroundBannerID;
            connection.SelectedRibbonID           = p.SelectedTitleID;
            connection.SelectedCharacter          = p.LastSelectedCharacter;

            // Send RegisterGameClientResponse
            await Send_RegisterGameClientResponse(connection, request);

            // Sent LobbyServerReadyNotification
            await Send_LobbyServerReadyNotification(connection);

            // Send "{username} has connected" to global chat
            await Send_ChatConnectedNotification(connection);
        }