Exemplo n.º 1
0
        public async Task JoinGame(IUser user)
        {
            var sink = await user.GetClientPacketSink();

            var generator = new ClientPlayPacketGenerator(sink);
            var settings  = await GrainFactory.GetGrain <IServerSettings>(0).GetSettings();

            _users[user] = new UserContext
            {
                Generator = generator
            };

            await user.JoinGame();

            var player = await user.GetPlayer();

            await generator.JoinGame(
                await player.GetEntityId(),
                await user.GetGameMode(),
                Dimension.Overworld,
                Difficulty.Easy,
                (byte)settings.MaxPlayers,
                await player.GetViewDistance(),
                LevelTypes.Default,
                false);

            await user.NotifyLoggedIn();

            await SendWholePlayersList(user);
        }
Exemplo n.º 2
0
        public async Task JoinGame(IUser user)
        {
            var sink = await user.GetClientPacketSink();

            var generator = new ClientPlayPacketGenerator(sink);

            _users[user] = new UserContext
            {
                Generator = generator
            };

            await user.JoinGame();

            await generator.JoinGame(
                await (await user.GetPlayer()).GetEntityId(),
                new GameMode { ModeClass = GameMode.Class.Survival },
                Dimension.Overworld,
                Difficulty.Easy,
                10,
                LevelTypes.Default,
                false);

            await user.NotifyLoggedIn();
        }