Esempio n. 1
0
        /* We are done with this table */
        public void Terminate()
        {
            PlayerList.Clear();
            if (hhMonitor != null)
            {
                hhMonitor.StopMonitoring();
            }
            if (visualRecognitionManager != null)
            {
                visualRecognitionManager.Cleanup();
            }

            Globals.Director.RunFromGUIThread((Action) delegate()
            {
                if (DisplayWindow != null)
                {
                    displayWindow.Close();
                    displayWindow = null;
                }
            }, false);

            Globals.Director.RunFromGUIThread((Action) delegate()
            {
                if (Hud != null)
                {
                    Hud.RemoveHud();
                    Hud = null;
                }
            }, false);
        }
 void ClearPlayerList()
 {
     if (!Hosting)
     {
         playerList.Clear();
     }
 }
Esempio n. 3
0
 protected GameManager(DominoList dominos, params Player[] players)
 {
     _playerList.Clear();
     _playerList.AddPlayers(players);
     PublicTrain = new PublicTrain();
     _dominoList = dominos;
 }
Esempio n. 4
0
        public bool Clear()
        {
            if (!udonDebug.Assert(Utilities.IsValid(playerList), "playerList invalid", this))
            {
                return(false);
            }

            playerList.DiscardInvalid();

            if (IsActiveAndEnabled())
            {
                if (!udonDebug.Assert(Utilities.IsValid(betterPlayerAudio), "playerAudio invalid", this))
                {
                    return(false);
                }

                if (playerList.players != null)
                {
                    foreach (var affectedPlayer in playerList.players)
                    {
                        betterPlayerAudio.ClearPlayerOverride(this, VRCPlayerApi.GetPlayerById(affectedPlayer));
                    }
                }
                // DeactivateReverb();
            }

            playerList.Clear();
            return(true);
        }
Esempio n. 5
0
        private void btnPlayers_Click(object sender, EventArgs e)
        {
            playerList.Clear();
            lbMain.Items.Clear();
            playerAmount = Convert.ToInt32(nudPlayers.Value);
            Player user = new Player("Player", 50000);

            playerList.Add(user);
            List <int> AI = new List <int>(playerAmount);

            for (int i = 0; i < 3; i++)
            {
                AI.Add(i);
            }
            for (int i = 0; i < 4 - playerAmount; i++)
            {
                AI.Remove(rand.Next(AI.Count));
            }
            AI = shuffle(AI);
            for (int i = 1; i < playerAmount; i++)
            {
                playerList.Add(new AIPlayer(50000, 1, AI[i - 1]));
            }
            pokerTable = new Table(playerList);
            foreach (Player player in pokerTable)
            {
                lbMain.Items.Add(player.Name);
            }
            lbMain.SelectedIndex = rand.Next(lbMain.Items.Count - 1) + 1;
        }
Esempio n. 6
0
 public void ClearAll()
 {
     PlayerList.Clear();
     CityList.Clear();
     ArmyList.Clear();
     ResearchList.Clear();
     DebugList.Clear();
 }
Esempio n. 7
0
 private void ClearEntries()
 {
     ExecuteOnUIThread.Invoke(() =>
     {
         PlayerList.Clear();
         SpectatorList.Clear();
     });
 }
Esempio n. 8
0
 public override void StartProcess()
 {
     base.StartProcess();
     players.Clear();
     GeneratePlayers();
     PreparePlayersForNewGame();
     FinishProcess();
 }
        private void OnPlay(object obj)
        {
            // IEnumerable<PlayerInfo> temp = (IEnumerable<PlayerInfo>)PlayerList.GetEnumerator();
            List <PlayerInfo> p = PlayerList.ToList();

            CommonUtils.Utilities.Shuffle(ref p);
            int numPlayers = p.Count;

            PlayerList.Clear();
            int i = 0;

            ////Create Mafia List
            for (i = 0; i < NumMafias && i < numPlayers; ++i)
            {
                p[i].Role = "mafia";
                Mafias.Add(p[i]);
                PlayerList.Add(p[i]);
            }
            //Create SpecialChar List
            if (HasDoctor && i < numPlayers)
            {
                p[i].Role = "doctor";
                Specialists.Add(p[i]);
                PlayerList.Add(p[i]);
                i++;
            }

            if (HasDetective && i < numPlayers)
            {
                p[i].Role = "detective";
                Specialists.Add(p[i]);
                PlayerList.Add(p[i]);
                i++;
            }


            if (HasJoker && i < numPlayers)
            {
                p[i].Role = "joker";
                Specialists.Add(p[i]);
                PlayerList.Add(p[i]);
                i++;
            }

            //Create Villager List
            for (; i < numPlayers; ++i)
            {
                p[i].Role = "villager";
                PlayerList.Add(p[i]);
            }

            //notify roles to the players
            foreach (var x in PlayerList)
            {
                _serverModel.SendMessage(x.ConnectionInfo.Connection, "Role", x.Role);
            }
        }
Esempio n. 10
0
 public void End()
 {
     if (Game != null)
     {
         Game.Stop();
         Game.PropertyChanged    -= Game_PropertyChanged;
         Game.EffectQueueChanged -= Game_EffectQueueChanged;
         Game = null;
         PlayerList.Clear();
     }
     BroadcastGame();
 }
Esempio n. 11
0
        /* Resets all entity lists to empty */
        private void ClearLists()
        {
            PlayerList.Clear();
            PlanetList.Clear();
            ProjectileList.Clear();
            BlackHoleList.Clear();
            BloodParticleList.Clear();

            EntityList.Clear();
            PhysicalObjectList.Clear();
            GravityPointList.Clear();
        }
Esempio n. 12
0
        public void Disband(string message)
        {
            foreach (string playerID in PlayerList)
            {
                MySockets.Server.GetAUser(playerID).MessageHandler(message);
            }

            PendingInvitations.Clear();
            PendingRequests.Clear();
            PlayerList.Clear();
            LeaderID  = null;
            GroupName = null;
        }
Esempio n. 13
0
        private async Task RefreshPlayerList()
        {
            var result = await _playerManager.GetPlayerList();

            PlayerList.Clear();

            if (result != null)
            {
                foreach (var item in result.OrderBy(x => x.LastName))
                {
                    PlayerList.Add(item);
                }
            }

            //RaisePropertyChanged("PlayerList");
        }
Esempio n. 14
0
 public override void OnDisabled()
 {
     base.OnDisabled();
     CraftAddQueue.Clear();
     CraftDeleteQueue.Clear();
     CraftResponseQueue.Clear();
     PlayersWithCrafts.Clear();
     PlayerList.Clear();
     UploadList.Clear();
     SelectedPlayer    = "";
     UploadCraftType   = CraftType.VAB;
     UploadCraftName   = "";
     DownloadCraftType = CraftType.VAB;
     DownloadCraftName = "";
     DeleteCraftType   = CraftType.VAB;
     DeleteCraftName   = "";
 }
 protected override void OnDisabled()
 {
     base.OnDisabled();
     CraftAddQueue      = new ConcurrentQueue <CraftChangeEntry>();
     CraftDeleteQueue   = new ConcurrentQueue <CraftChangeEntry>();
     CraftResponseQueue = new ConcurrentQueue <CraftResponseEntry>();
     PlayersWithCrafts.Clear();
     PlayerList.Clear();
     UploadList.Clear();
     SelectedPlayer    = "";
     UploadCraftType   = CraftType.Vab;
     UploadCraftName   = "";
     DownloadCraftType = CraftType.Vab;
     DownloadCraftName = "";
     DeleteCraftType   = CraftType.Vab;
     DeleteCraftName   = "";
 }
Esempio n. 16
0
        internal async void StartPolling()
        {
            while (true)
            {
                if (PollingCancelled)
                {
                    break;
                }
                Stopwatch timer = new Stopwatch();
                timer.Start();
                IEnumerable <MatchDescriptor> currentStatus = await GameLoader.Instance.LoadMatchesFromServer(true);

                timer.Stop();
                Ping = (int)timer.ElapsedMilliseconds;
                GameLoader.Instance.Player.Ping = Ping;
                _match = currentStatus.FirstOrDefault(x => x.MatchId == _match.MatchId);
                if (_match != null)
                {
                    MaxPlayers         = _match.MaxPlayers;
                    IsGameReady        = _match.CurrentPlayers.Length == _match.MaxPlayers;
                    IsHost             = (_match.HostPlayer == GameLoader.Instance.Player.Name);
                    CurrentPlayerCount = _match.CurrentPlayers.Length;
                    PlayerList.Clear();
                    foreach ((string name, int ping) in _match.CurrentPlayers.Zip(_match.CurrentPings, (a, b) => (a, b)))
                    {
                        PlayerList.Add(new Tuple <string, int>(name, ping));
                    }
                    DisplayText = IsGameReady ? "Game is ready to start!" : "Waiting for players...";
                    if (_match.Status == "Started")
                    {
                        PollingCancelled = true;
                        if (!IsHost)
                        {
                            GameStarted();
                        }
                    }
                    await Task.Delay(1000);
                }
                else
                {
                    PollingCancelled = true;
                    GameAborted();
                }
            }
        }
Esempio n. 17
0
        /// <summary>
        ///     Will apply the current server-info to the public vars
        /// </summary>
        /// <param name="si"></param>
        private void ApplyServerInfo(ServerInfoBase si)
        {
            var nu = si == null;

            LastStatusDate = nu ? "-" : si.RequestDate.AddMilliseconds(si.RequestTime).ToString("HH:mm:ss");
            IsOnline       = !nu && si.HadSuccess;
            PlayerCount    = nu ? 0 : si.CurrentPlayerCount;
            MaxPlayerCount = nu ? 0 : si.MaxPlayerCount;
            Version        = nu ? "0.0.0" : si.MinecraftVersion;
            MOTD           = nu || !si.HadSuccess ? "-" : si.ServerMotd;
            LastError      = !nu && si.LastError != null?si.LastError.GetType().Name : "-";

            PlayerList.Clear();
            if (!nu && si.OnlinePlayers != null)
            {
                PlayerList.AddRange(si.OnlinePlayers);
            }
        }
Esempio n. 18
0
        /// <summary>
        /// Who is Playing this round?
        /// </summary>
        public List <PlayerInfoModel> MakePlayerList()
        {
            // Start from a clean list of players
            PlayerList.Clear();

            // Remember the Insert order, used for Sorting
            var ListOrder = 0;

            foreach (var data in CharacterList)
            {
                if (data.Alive)
                {
                    PlayerList.Add(
                        new PlayerInfoModel(data)
                    {
                        // Remember the order
                        ListOrder = ListOrder
                    });

                    ListOrder++;
                }
            }

            foreach (var data in MonsterList)
            {
                if (data.Alive)
                {
                    PlayerList.Add(
                        new PlayerInfoModel(data)
                    {
                        // Remember the order
                        ListOrder = ListOrder
                    });

                    ListOrder++;
                }
            }

            return(PlayerList);
        }
Esempio n. 19
0
        public void Load(long initalOwner)
        {
            PlayerList.Clear();
            PlayerList.Add(new OwnerModel()
            {
                Name = "{None}", PlayerId = 0
            });

            foreach (var identity in SpaceEngineersCore.WorldResource.Checkpoint.Identities.OrderBy(p => p.DisplayName))
            {
                if (SpaceEngineersCore.WorldResource.Checkpoint.AllPlayersData != null)
                {
                    var player = SpaceEngineersCore.WorldResource.Checkpoint.AllPlayersData.Dictionary.FirstOrDefault(kvp => kvp.Value.IdentityId == identity.PlayerId);
                    PlayerList.Add(new OwnerModel()
                    {
                        Name = identity.DisplayName, PlayerId = identity.PlayerId, Model = identity.Model, IsPlayer = player.Value != null
                    });
                }
            }

            SelectedPlayer = PlayerList.FirstOrDefault(p => p.PlayerId == initalOwner);
        }
Esempio n. 20
0
        void handHistoryParser_NewTableHasBeenCreated(string gameId, string tableId)
        {
            if (this.TableId != String.Empty && this.TableId != tableId)
            {
                Trace.WriteLine("An existing table has just changed its tableID... starting transition.");
                Trace.WriteLine("Previous ID: " + this.TableId);
                Trace.WriteLine("New ID: " + tableId);

                // Clear the list of players (new ones are coming)
                foreach (Player p in PlayerList)
                {
                    // If the player has a hud associated, also mark that hud as disposable
                    p.DisposeHud();
                }

                PlayerList.Clear();
            }

            this.GameID  = gameId;
            this.TableId = tableId;
            //this.maxSeatingCapacity = 0;
        }
Esempio n. 21
0
        /// <summary>
        /// Returns a set of players with best draw including player 
        /// cards and cards on table
        /// </summary>
        public PlayerList GetBestDrawPlayers(PlayerList players)
        {
            PlayerList currentBestDrawPlayers = new PlayerList();
            Draw bestDrawSoFar = null;

            // Get best draw types by comparing all players draws.
            foreach (Player player in players)
            {
                if (!player.HasCards()) continue;
                Draw currentDraw = GetDraw(player.GetAllCards());
                try {
                    // save the current draw if it is better than the previuosly best found draw
                    if (!GetBestDraw(currentDraw, bestDrawSoFar).Equals(bestDrawSoFar)){
                        currentBestDrawPlayers.Clear();
                        currentBestDrawPlayers.Add(player);
                        bestDrawSoFar = currentDraw;
                    }
                }
                catch (TieDrawException) {
                    currentBestDrawPlayers.Add(player);
                }
            }
            return currentBestDrawPlayers;
        }
Esempio n. 22
0
 public void Load_players()
 {
     PlayerList.Clear();
     Data_store.LoadPlayers(PlayerList);
     PlayerList = PlayerList;
 }
Esempio n. 23
0
 private void ClearPlayerList()
 {
     PlayerList.Clear();
 }
Esempio n. 24
0
 public void Reset()
 {
     PlayerList.Clear();
 }