private async Task <bool[]> CanExecuteFunction() { if (PS3.GetAttached()) { IsAttached = true; if (PS3.Extension.ReadBool(Addresses.IsInGame_a)) { bool isHost = ImHost(); if (isHost) { return new bool[] { true, true } } ; else if (!isHost && PS3.Extension.ReadByte(0xDE810) != 0xF8) { return new bool[] { true, false } } ; else { await Dialog.ShowMessageAsync(this, Resources["functionsFailed"].ToString(), Resources["installRCE"].ToString()); } } else { await Dialog.ShowMessageAsync(this, Resources["functionsFailed"].ToString(), Resources["mustBeInGame"].ToString()); } } IsAttached = false; Players?.Clear(); SelectedPlayer = null; return(new bool[] { false, false }); }
/// <summary>Updates the players list.</summary> private void UpdatePlayers() { Players.Clear(); Players = new ObservableCollection <PlayerInstance>(ClientManager.Instance.playersInSession.Values); NotifyOfPropertyChange(() => Players); }
public void Init() { RogueEncampmentWp = null; RedPortal = null; InGame = false; FullyEnteredGame = false; LastTeleport = 0; Experience = 0; Me = new Player(); Logger.Write("Reset GameData"); SkillLevels.Clear(); ItemSkillLevels.Clear(); Players.Clear(); Npcs.Clear(); Items.Clear(); WorldObjects.Clear(); Inventory = new Container("Inventory", ContainerType.Inventory, InventoryWidth, InventoryHeight); Stash = new Container("Stash", ContainerType.Stash, StashWidth, StashHeight); Cube = new Container("Cube", ContainerType.Cube, CubeWidth, CubeHeight); //todo make configurable Belt = new Container("Belt", ContainerType.Belt, 4, 4); //todo make size depend on belt type... MalahId = 0; CurrentLife = 0; FirstNpcInfoPacket = true; AttacksSinceLastTeleport = 0; WeaponSet = 0; HasMerc = false; }
private IEnumerator UpdateSetups() { while (true) { yield return(null); if (Players.Any(x => x == null)) { Players.Clear(); AllPlayerEntities.Clear(); PlayerStates.Clear(); Players.AddRange(Scene.SceneTracker.allPlayers); for (int i = 0; i < Scene.SceneTracker.allPlayers.Count; i++) { BoltEntity b = Scene.SceneTracker.allPlayers[i].GetComponent <BoltEntity>(); if (b != null) { AllPlayerEntities.Add(b); PlayerStates.Add(b.GetState <IPlayerState>()); } } } yield return(new WaitForSeconds(10)); } }
public void Init() { RogueEncampmentWp = null; RedPortal = null; InGame = false; FullyEnteredGame = false; LastTeleport = 0; Experience = 0; Me = new Player(); Logging.Logger.Write("Reset self"); SkillLevels.Clear(); ItemSkillLevels.Clear(); Logging.Logger.Write("Cleared Skills"); Players.Clear(); Logging.Logger.Write("Cleared Players"); Npcs.Clear(); Logging.Logger.Write("Cleared Npcs"); Items.Clear(); WorldObjects.Clear(); Inventory = new Container("Inventory", GameData.InventoryWidth, GameData.InventoryHeight); Stash = new Container("Stash", GameData.StashWidth, GameData.StashHeight); Cube = new Container("Cube", GameData.CubeWidth, GameData.CubeHeight); Belt = new Container("Belt", 4, 4); MalahId = 0; CurrentLife = 0; FirstNpcInfoPacket = true; AttacksSinceLastTeleport = 0; WeaponSet = 0; HasMerc = false; }
/// <summary> /// Disconnect the server /// </summary> public override void Disconnect() { if (Players != null) { lock (Players) { foreach (NetworkingPlayer player in Players) { ((TcpClient)player.SocketEndpoint).Close(); } Players.Clear(); } } if (listenWorker != null) { listenWorker.CancelAsync(); } if (readWorker != null) { readWorker.CancelAsync(); } tcpListener.Stop(); OnDisconnected(); }
protected void FromWorldMap(Stream dat) { log.InfoFormat("Loading map for world {0}({1})...", Id, Name); Map = new Wmap(Manager.GameData); entityInc = 0; entityInc += Map.Load(dat, 0); int w = Map.Width, h = Map.Height; EnemiesCollision = new CollisionMap <Entity>(0, w, h); PlayersCollision = new CollisionMap <Entity>(1, w, h); PetsCollision = new CollisionMap <Entity>(1, w, h); Projectiles.Clear(); StaticObjects.Clear(); Enemies.Clear(); Players.Clear(); Pets.Clear(); foreach (Entity i in Map.InstantiateEntities(Manager)) { EnterWorld(i); } CheckDisposable(); }
private void FromWorldMap(Stream dat) { var map = new Wmap(Manager.GameData); Map = map; entityInc = 0; entityInc += Map.Load(dat, 0); int w = Map.Width, h = Map.Height; Obstacles = new byte[w, h]; for (var y = 0; y < h; y++) { for (var x = 0; x < w; x++) { try { var tile = Map[x, y]; ObjectDesc desc; if (Manager.GameData.Tiles[tile.TileId].NoWalk) { Obstacles[x, y] = 3; } if (Manager.GameData.ObjectDescs.TryGetValue(tile.ObjType, out desc)) { if (desc.Class == "Wall" || desc.Class == "ConnectedWall" || desc.Class == "CaveWall") { Obstacles[x, y] = 2; } else if (desc.OccupySquare || desc.EnemyOccupySquare) { Obstacles[x, y] = 1; } } } catch (Exception ex) { logger.Error(ex); } } } EnemiesCollision = new CollisionMap <Entity>(0, w, h); PlayersCollision = new CollisionMap <Entity>(1, w, h); Projectiles.Clear(); StaticObjects.Clear(); Enemies.Clear(); Players.Clear(); foreach (var i in Map.InstantiateEntities(Manager)) { if (i.ObjectDesc != null && (i.ObjectDesc.OccupySquare || i.ObjectDesc.EnemyOccupySquare)) { Obstacles[(int)(i.X - 0.5), (int)(i.Y - 0.5)] = 2; } EnterWorld(i); } }
/// <summary> /// Updates the player setups and changes the static variable accordingly /// </summary> private void UpdateSetups() { try { Players.Clear(); AllPlayerEntities.Clear(); for (int i = 0; i < Scene.SceneTracker.allPlayers.Count; i++) { Players.Add(Scene.SceneTracker.allPlayers[i]); if (Scene.SceneTracker.allPlayers[i].transform.root == LocalPlayer.Transform.root) { ThisPlayerID = i; } BoltEntity b = Scene.SceneTracker.allPlayers[i].GetComponent <BoltEntity>(); if (b != null) { AllPlayerEntities.Add(b); } } ThisPlayerPacked = LocalPlayer.Entity.networkId.PackedValue; } catch (System.Exception e) { ModAPI.Log.Write(e.ToString()); } }
async Task ExecuteLoadItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { Players.Clear(); var players = await PlayerDataStore.GetItemsAsync(Location.Id); foreach (var player in players) { Players.Add(player); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
private async void GetPlayers() { bool[] canExecuteFunction = await CanExecuteFunction(); if (!canExecuteFunction[0]) { return; } Player player; Player selectedPlayer = SelectedPlayer; Players?.Clear(); uint maxClient = PS3.Extension.ReadUInt32(Addresses.MaxClients_a); for (uint i = 0; i < maxClient; i++) { player = new Player(PS3) { Id = i }.GetInfo(); if (!string.IsNullOrEmpty(player.Name) && !string.IsNullOrEmpty(player.Name)) { Players?.Add(player); } } SelectedPlayer = Players?.SingleOrDefault(p => p.Id == selectedPlayer?.Id); }
/// <summary> /// DictionaryのPlayersを初期化する /// </summary> /// <param name="players"></param> private void ResetPlayersDictionary(IEnumerable <Player> players) { Players.Clear(); foreach (var player in players) { Players.Add(player.PlayerID, player); } }
public void Clear() { Data = null; Players.Clear(); Monsters.Clear(); Npcs.Clear(); Others.Clear(); }
void UpdatePlayers(Player[] x) { if (x == null) { Players.Clear(); return; } x.SyncCollectionPK(Players); }
/// <summary> /// Stop or start collecting player entities /// </summary> /// <param name="stopStart"></param> public void StopOrStartCollectingPlayers(bool stopStart) { _isCollectingPlayers = stopStart; if (stopStart == false) { Players.Clear(); } }
public void Dispose() { disposedValue = true; img.Dispose(); img = null; map.Dispose(); map = null; Players.Clear(); Players = null; MG.Dispose(); MG = null; recording = null; }
/// <summary> /// Clears the playerlist. /// Deletes any/all Matches. /// May fire MatchesModified and GamesDeleted events, if updates occur. /// </summary> public void ResetPlayers() { if (null == Players) { Players = new List <IPlayer>(); } Players.Clear(); DeleteBracketData(); }
public static void Reset() { foreach (var(_, Players) in Affinities) { Players.Clear(); } Synchronize(); }
protected override void OnDisconnect(ISubscription source, Exception error) { this.BeginInvoke(() => { AvailableCards.Clear(); Players.Clear(); }); base.OnDisconnect(source, error); }
public ServerMessage CreateMessage(byte[] bytes) { var messageType = (bytes?.FirstOrDefault() ?? 0).GetMessageType(); switch (messageType) { case ServerMessageType.PlayerJoined: var playerJoinedMessage = new PlayerJoinedMessage(bytes); Players.Add(playerJoinedMessage.Player); return(playerJoinedMessage); case ServerMessageType.StartOfGame: Players.Clear(); ResetGameTime(); return(new StartOfGameMessage(bytes)); case ServerMessageType.StartOfDay: case ServerMessageType.StartOfNight: Trial.Clear(); MoveTimeForward(); return(new MoveTimeForwardMessage(bytes)); case ServerMessageType.PlayerVote: var playerVoteMessage = new PlayerVoteMessage(bytes); Trial.AddVote(playerVoteMessage); return(playerVoteMessage); case ServerMessageType.PlayerOnStand: var playerOnStandMessage = new PlayerOnStandMessage(bytes); Trial.SetPlayerOnStand(playerOnStandMessage); return(playerOnStandMessage); case ServerMessageType.VoteVerdict: var voteVerdictMessage = new VoteVerdictMessage(bytes); Trial.AddVerdict(voteVerdictMessage); return(voteVerdictMessage); case ServerMessageType.PlayerIsGuilty: case ServerMessageType.PlayerIsInnocent: Trial.Complete(); return(new ServerMessage(bytes)); case ServerMessageType.Chat: return(new ChatMessage(bytes)); case ServerMessageType.PlayerDead: return(new PlayerDeadMessage(bytes)); case ServerMessageType.LocalPlayerReport: return(new LocalPlayerReportMessage(bytes)); case ServerMessageType.MafiaPlayersReport: return(new MafiaPlayersReportMessage(bytes)); case ServerMessageType.MayorRevealed: return(new MayorRevealedMessage(bytes)); case ServerMessageType.PlayerRevived: return(new PlayerRevivedMessage(bytes)); default: return(new ServerMessage(bytes)); } }
public void Clear() { LogManager.Debug("Clearing Model"); Players.Clear(); ActingPlayer.Clear(); PushbackSquares.Clear(); TrackNumbers.Clear(); BlockDice.Clear(); }
public IEnumerable <Player> CreateDummyPlayers() { Players.Clear(); for (int i = 1; i <= 15; i++) { Players.Add(new Player($"Player{i}", i)); } return(Players); }
public void UnregisterPlayers() { Console.WriteLine("Removing all Players!"); foreach (var pc in Players) { pc.IsActive = false; } Players.Clear(); }
public static void MainMenu() { for (int i = Players.Count - 1; i >= 0; i--) { Destroy(Players[i].gameObject); } Players.Clear(); SceneManager.LoadScene(_instance.mainMenuScene); }
/// <summary> /// Handles an options broadcast sent by the game host. /// </summary> private void HandleOptionsMessage(string sender, string data) { if (sender != hostName) { return; } string[] parts = data.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (parts.Length < 1) { return; } int sgIndex = Conversions.IntFromString(parts[0], -1); if (sgIndex < 0) { return; } if (sgIndex >= ddSavedGame.Items.Count) { AddNotice("The game host has selected an invalid saved game index! " + sgIndex); channel.SendCTCPMessage(INVALID_SAVED_GAME_INDEX_CTCP_COMMAND, QueuedMessageType.SYSTEM_MESSAGE, 10); return; } ddSavedGame.SelectedIndex = sgIndex; Players.Clear(); for (int i = 1; i < parts.Length; i++) { string[] playerAndReadyStatus = parts[i].Split(':'); if (playerAndReadyStatus.Length < 2) { return; } string playerName = playerAndReadyStatus[0]; int readyStatus = Conversions.IntFromString(playerAndReadyStatus[1], -1); if (string.IsNullOrEmpty(playerName) || readyStatus == -1) { return; } PlayerInfo pInfo = new PlayerInfo(); pInfo.Name = playerName; pInfo.Ready = Convert.ToBoolean(readyStatus); Players.Add(pInfo); } CopyPlayerDataToUI(); }
public void Reset() { Players.Clear(); PlayersByNetworkId.Clear(); Messages.Clear(); SetupPlayers(); me = null; Players.ForEach(p => Signals.PublishPlayerUpdatedEvent(p)); }
public virtual void Clear() { if (!IsHost) { AIPlayers.Clear(); } Players.Clear(); }
private void ResetGameTimer(object timerState) { StopGame(); _mazeBuilder.CreateRandomMaze(); CreateEnemies(); StartGame(); Players.Clear(); _gameHub.Clients.All.SendAsync("ResetGame"); Console.WriteLine("Reset Maze after 10 Minutes without Completion."); }
public void DestroyAllPlayers() { Debug.Log("Destroying all players"); foreach (var player in Players) { Destroy(player.gameObject); } Players.Clear(); }
public void Dispose() { Players.Clear(); Enemies.Clear(); Quests.Clear(); Pets.Clear(); Projectiles.Clear(); StaticObjects.Clear(); Timers.Clear(); }