Example #1
0
        // GET: Player/Edit/5
        public ActionResult Edit(int id)
        {
            UpdatePlayer ViewModel = new UpdatePlayer();

            string url = "playerdata/findplayer/" + id;
            HttpResponseMessage response = client.GetAsync(url).Result;

            //Can catch the status code (200 OK, 301 REDIRECT), etc.
            //Debug.WriteLine(response.StatusCode);
            if (response.IsSuccessStatusCode)
            {
                //Put data into player data transfer object
                PlayerDto SelectedPlayer = response.Content.ReadAsAsync <PlayerDto>().Result;
                ViewModel.player = SelectedPlayer;

                //get information about teams this player COULD play for.
                url      = "teamdata/getteams";
                response = client.GetAsync(url).Result;
                IEnumerable <TeamDto> PotentialTeams = response.Content.ReadAsAsync <IEnumerable <TeamDto> >().Result;
                ViewModel.allteams = PotentialTeams;

                return(View(ViewModel));
            }
            else
            {
                return(RedirectToAction("Error"));
            }
        }
Example #2
0
        public void Record(string aPath)
        {
            updatePlayCurrent = sequencer.UpdateRecord;

            sequencer.Stop();

            path = aPath;
        }
Example #3
0
        public PlayerMidi(string aFilePath)
        {
            FilePath = aFilePath;
            Music    = ConstructorCollection.ConstructMusic(aFilePath);

            sequencer = new MidiSequencer(( MusicMidi )Music, new MidiSynthesizer());

            updatePlayCurrent = sequencer.UpdatePlay;
        }
Example #4
0
        private void txtUPlayer_Click(object sender, EventArgs e)
        {
            UpdatePlayer uPlayer = new UpdatePlayer();

            uPlayer.Show();
            uPlayer.name(txtName.Text);
            uPlayer.logName(button1.Text);
            this.Close();
        }
Example #5
0
        private void Awake()
        {
            gameController = Finder <GameController> .Find;

            playerMover             = GetComponent <FlapMover>();
            sensor                  = GetComponentInChildren <Sensor>();
            playerDeathEventChannel = Finder <PlayerDeathEventChannel> .Find;

            updatePlayer = UpdatePlayerInMainMenu;
        }
Example #6
0
 private void GameStateChanged(GameState gameState)
 {
     if (gameState == GameState.MainMenu)
     {
         updatePlayer = UpdatePlayerInMainMenu;
     }
     else if (gameState == GameState.Playing)
     {
         updatePlayer = UpdatePlayerInGame;
     }
 }
Example #7
0
        // GET: Player/Create
        public ActionResult Create()
        {
            UpdatePlayer ViewModel = new UpdatePlayer();
            //get information about teams this player COULD play for.
            string url = "teamdata/getteams";
            HttpResponseMessage   response       = client.GetAsync(url).Result;
            IEnumerable <TeamDto> PotentialTeams = response.Content.ReadAsAsync <IEnumerable <TeamDto> >().Result;

            ViewModel.allteams = PotentialTeams;

            return(View(ViewModel));
        }
Example #8
0
        public PlayerMidi(string aFilePath)
        {
            MusicMidi lMusic = ( MusicMidi )LoaderMusic.Load(aFilePath);

            sequencer = new MidiSequencer(lMusic, new MidiSynthesizer());

            updatePlayCurrent = sequencer.UpdatePlay;

            float lVolume = ( float )(40.0d * Math.Log10(0.5f));

            volume = ( float )Math.Pow(10.0d, lVolume / 20.0d) * 2.0f;
        }
Example #9
0
        public void Pause()
        {
            if (updatePlayCurrent == sequencer.UpdatePlay)
            {
                updatePlayCurrent = sequencer.UpdateSynth;

                sequencer.Pause();
            }
            else
            {
                updatePlayCurrent = sequencer.UpdatePlay;
            }
        }
Example #10
0
    void Start()
    {
        m_board         = FindObjectOfType <Board>();
        m_spawner       = FindObjectOfType <Spawner>();
        m_soundManager  = FindObjectOfType <SoundManager>();
        m_scoreManager  = FindObjectOfType <ScoreManager>();
        m_ghost         = FindObjectOfType <Ghost>();
        m_holder        = FindObjectOfType <Holder>();
        m_addPlayer     = FindObjectOfType <AddPlayer>();
        m_getPlayerInfo = FindObjectOfType <GetPlayerInfos>();
        m_updatePlayer  = FindObjectOfType <UpdatePlayer>();

        m_timeToNextKey          = Time.time;
        m_timeToNextKeyLeftRight = Time.time + m_keyRepeatRateLeftRight;
        m_timeToNextKeyDown      = Time.time + m_keyRepeatRateDown;
        m_timeToNextKeyRotate    = Time.time + m_keyRepeatRateRotate;

        if (!m_spawner || !m_board || !m_soundManager || !m_scoreManager)
        {
            Debug.LogWarning("Warning! m_board or m_spawner or m_soundManager or m_scoreManager aren't defined.");
        }
        else
        {
            if (m_activeShape == null)
            {
                m_activeShape = m_spawner.SpawnShape();
            }

            m_spawner.transform.position = Vectorf.Round(m_spawner.transform.position);
        }

        if (m_gameOverPanel)
        {
            m_gameOverPanel.SetActive(false);
        }

        if (m_pausePanel)
        {
            m_pausePanel.SetActive(false);
        }


        m_dropIntervalModded          = m_dropInterval;
        m_soundManager.m_fxEnabled    = SaveManager.Instance.IsFxOn();
        m_soundManager.m_musicEnabled = SaveManager.Instance.IsMusicOn();

        m_soundManager.m_fxIconToggle.ToggleIcon(m_soundManager.m_fxEnabled);
        m_soundManager.m_musicIconToggle.ToggleIcon(m_soundManager.m_musicEnabled);

        m_soundManager.UpdateMusic();
    }
Example #11
0
        public ActionResult Update(int id)
        {
            // Retrieve data from a particular Player
            Player          selectedplayer = db.Players.SqlQuery("SELECT * FROM players WHERE playerID = @id", new SqlParameter("@id", id)).FirstOrDefault();
            List <Team>     Teams          = db.Teams.SqlQuery("SELECT * FROM teams ORDER BY name").ToList();
            var             position_query = "SELECT * FROM Positions";
            var             fk_parameter   = new SqlParameter("@id", id);
            List <Position> Positions      = db.Positions.SqlQuery(position_query, fk_parameter).ToList();

            UpdatePlayer UpdatePlayerViewModel = new UpdatePlayer();

            UpdatePlayerViewModel.Player    = selectedplayer;
            UpdatePlayerViewModel.Teams     = Teams;
            UpdatePlayerViewModel.Positions = Positions;

            return(View(UpdatePlayerViewModel));
        }
Example #12
0
        public async Task <IActionResult> UpdatePlayer([FromBody] UpdatePlayer newPlayer)
        {
            try
            {
                var player = await _smartPlayerContext.Set <Player>().FirstOrDefaultAsync(i => i.Id == newPlayer.PlayerId);

                if (player == null)
                {
                    return(BadRequest("bad player id"));
                }

                if (newPlayer.HeightOfUser != null)
                {
                    player.HeighOfUser = newPlayer.HeightOfUser.GetValueOrDefault();
                }

                if (newPlayer.WeightOfUser != null)
                {
                    player.WeightOfUser = newPlayer.WeightOfUser.GetValueOrDefault();
                }

                var updatedPlayer = _smartPlayerContext.Set <Player>().Update(player);
                await _smartPlayerContext.SaveChangesAsync();

                if (updatedPlayer == null)
                {
                    return(BadRequest("something wrong"));
                }

                return(Ok());
            }
            catch (Exception e)
            {
                return(BadRequest("something wrong"));
            }
        }
Example #13
0
        public async Task UpdatePlayerShouldUpdateDbEntity()
        {
            var command = new UpdatePlayer()
            {
                Id        = _testDbFixture.MockedDataInstance.PlayerInternalIdForUpdate,
                FirstName = "Updated firstname",
                LastName  = "Updated lastname",
                LeagueId  = 1,
                Rate      = "8.0"
            };

            var creationTask = await _rabbitMqFixture.SubscribeAndGetAsync <PlayerUpdated>(
                _testDbFixture.GetPlayerAndRateByExternalId,
                _testDbFixture.MockedDataInstance.PlayerExternalIdForUpdate);

            await _rabbitMqFixture.PublishAsync(command);

            (Player player, PlayerRate playerRate) = await creationTask.Task;

            player.FirstName.Should().Be(command.FirstName);
            player.LastName.Should().Be(command.LastName);

            playerRate.Value.Should().Be(double.Parse(command.Rate));
        }
Example #14
0
 public async Task <IActionResult> Put(UpdatePlayer command)
 {
     return(await SendAsync(command));
 }
 public void OnUpdate()
 {
     UpdatePlayer?.Invoke();
 }
Example #16
0
        private void SendData(int packetType, int remoteClient = -1, int ignoreClient = -1, string networkText = null,
                              int number  = 0, float number2 = 0.0f, float number3 = 0.0f, float number4 = 0.0f, int number5 = 0,
                              int number6 = 0, int number7   = 0)
        {
            if (!_tcpClient.Connected)
            {
                return;
            }

            lock (SyncLock)
            {
                //Debug.WriteLine($"TX: {packetType}");
                var buffer = new byte[131070];
                using (var memoryStream = new MemoryStream(buffer)
                {
                    Position = 0
                })
                    using (var writer = new BinaryWriter(memoryStream))
                    {
                        var oldSteamPosition = writer.BaseStream.Position;
                        writer.BaseStream.Position += 2L;

                        writer.Write((byte)packetType);

                        IPacket packet = null;
                        switch ((PacketType)packetType)
                        {
                        case PacketType.ConnectRequest:
                            PacketEvents.InvokePacketPreSend(new PacketEventArgs(packet = new ConnectRequest()));
                            PacketHelper.WriteToWriter(writer, packet);
                            break;

                        case PacketType.PlayerInfo:
                            PacketEvents.InvokePacketPreSend(new PacketEventArgs(packet = new PlayerInfo()));
                            PacketHelper.WriteToWriter(writer, packet);
                            break;

                        case PacketType.PlayerInventorySlot:
                            PacketEvents.InvokePacketPreSend(new PacketEventArgs(packet = new PlayerInventorySlot()));
                            PacketHelper.WriteToWriter(writer, packet);
                            break;

                        case PacketType.RequestSpawn:
                            PacketEvents.InvokePacketPreSend(new PacketEventArgs(packet = new RequestSpawn()));
                            PacketHelper.WriteToWriter(writer, packet);
                            break;

                        case PacketType.SpawnPlayer:
                            PacketEvents.InvokePacketPreSend(new PacketEventArgs(packet = new SpawnPlayer {
                                PlayerIndex = (byte)number
                            }));
                            PacketHelper.WriteToWriter(writer, packet);
                            break;

                        case PacketType.UpdatePlayer:
                            PacketEvents.InvokePacketPreSend(new PacketEventArgs(packet = new UpdatePlayer {
                                PlayerIndex = (byte)number
                            }));
                            PacketHelper.WriteToWriter(writer, packet);
                            break;

                        case PacketType.SendPlayerHealth:
                            PacketEvents.InvokePacketPreSend(new PacketEventArgs(packet = new SendPlayerHealth
                            {
                                PlayerIndex = (byte)number, CurrentHealth = 100, HealthMax = 100
                            }));
                            PacketHelper.WriteToWriter(writer, packet);
                            break;

                        case PacketType.SendPlayerMana:
                            PacketEvents.InvokePacketPreSend(new PacketEventArgs(packet = new SendPlayerMana {
                                PlayerIndex = (byte)number, CurrentMana = 100, ManaMax = 100
                            }));
                            PacketHelper.WriteToWriter(writer, packet);
                            break;

                        case PacketType.SendPlayerBuffs:
                            PacketEvents.InvokePacketPreSend(new PacketEventArgs(packet = new SendPlayerBuffs {
                                PlayerIndex = (byte)number
                            }));
                            PacketHelper.WriteToWriter(writer, packet);
                            break;

                        case PacketType.SendClientUUID:
                            PacketEvents.InvokePacketPreSend(new PacketEventArgs(packet = new SendClientUUID()));
                            PacketHelper.WriteToWriter(writer, packet);
                            break;
                        }

                        var newStreamPosition = writer.BaseStream.Position;
                        writer.BaseStream.Position = oldSteamPosition;
                        writer.Write((short)newStreamPosition);
                        writer.BaseStream.Position = newStreamPosition;

                        try
                        {
                            _networkStream.BeginWrite(buffer, 0, (int)memoryStream.Position,
                                                      ar => _networkStream.EndWrite(ar), null);
                        }
                        catch // The connection was most likely closed by the host (Disconnect packets)
                        {
                        }
                    }
            }
        }
Example #17
0
        public void Stop()
        {
            updatePlayCurrent = sequencer.UpdateSynth;

            sequencer.Stop();
        }
Example #18
0
        public void Play()
        {
            updatePlayCurrent = sequencer.UpdatePlay;

            sequencer.Play();
        }