// Internal void OnClientStatusChanged(NetConnectionStatus inNewStatus, NetIncomingMessage inMsg) { if (inNewStatus == NetConnectionStatus.Connected) { OnPlayerJoin?.Invoke(inMsg.SenderConnection); } }
public override void OnPlayerEnteredRoom(Player newPlayer) { if (QuickSetup && PhotonNetwork.IsMasterClient) { } OnPlayerJoin?.Invoke(); }
public static void InvokePlayerJoin(ReferenceHub hub) { OnPlayerJoin onPlayerJoin = PlayerJoinEvent; if (onPlayerJoin == null) { return; } PlayerJoinEvent ev = new PlayerJoinEvent() { Player = hub }; onPlayerJoin?.Invoke(ev); }
public void Start() { if (Active) { return; } Active = true; _listener = new TcpListener(IPAddress.Any, Port); _listener.Start(); Logger.Info("Started Coordinator Server"); _listenThread = new Thread(async() => { while (Active) { var client = await _listener.AcceptTcpClientAsync(); var c = new CoordinatorClient(client, _cancel.Token); Logger.Info($"CoordinationClient: {c.Descriptor.Address}"); c.OnRegistered += (descriptor) => { Logger.Info($"Client [{descriptor.Address}] registered {descriptor.Name}"); OnPlayerJoin?.Invoke(c, descriptor); }; c.OnDisconnected += (descriptor) => { Logger.Info($"Client [{descriptor.Address} disconnected"); OnPlayerLeave?.Invoke(c, descriptor); }; lock (_clients) { _clients.Add(c); } } }); _listenThread.Start(); }
public void PlayerJoin(IPlayer player, IMessageAdd message) { OnPlayerJoin?.Invoke(player, message); }
public static void NetworkInit() { if (NetworkManager.field_Internal_Static_NetworkManager_0 == null) { return; } var field0 = NetworkManager.field_Internal_Static_NetworkManager_0.field_Internal_VRCEventDelegate_1_Player_0; var field1 = NetworkManager.field_Internal_Static_NetworkManager_0.field_Internal_VRCEventDelegate_1_Player_1; field0.field_Private_HashSet_1_UnityAction_1_T_0.Add(new Action <Player>((player) => OnPlayerJoin?.Invoke(player))); field1.field_Private_HashSet_1_UnityAction_1_T_0.Add(new Action <Player>((player) => OnPlayerLeave?.Invoke(player))); }
private void Server_OnPeerConnected(int id) { OnPlayerJoin?.Invoke(id); }
public void AddPlayer(string playerName) { Players.Add(playerName); OnPlayerJoin.Invoke(); }
public void Parse(UpdatePacket packet) { Entity self = packet.NewObjs.FirstOrDefault(x => x.Status.Data.FirstOrDefault(z => z.Id == StatsType.AccountId && z.StringValue == Client.State.ACCID) != null); // The first new object whos data has a Status whos id is AccountId and equals the accound id of the client that's not null; if (self != null) { HitTheGround(self); if (Client.State["NextSpawn"] != null) { self.Status.Position = Client.State["NextSpawn"] as Location; Client.State["NextSpawn"] = null; } } foreach (Entity entity in packet.NewObjs) { if (entity.IsPlayer()) { Player freshy = new Player(entity); Players.Add(freshy); if (!AllRenderedPlayers.Select(x => x.Entity.Status.Data.GetHashCode()).Contains(freshy.Entity.Status.Data.GetHashCode())) { AllRenderedPlayers.Add(freshy); } OnPlayerJoin?.Invoke(freshy); } else if (entity.IsBag()) { Bags.Add(entity); OnBagSpawn?.Invoke(entity); } else if (entity.IsPortal()) { } else if (entity.IsEnemy()) { } } foreach (int objectId in packet.Drops.ToList()) { Entity entity = Client.GetEntity(objectId); OnEntityLeave?.Invoke(entity); if (entity.IsPlayer()) { //Player player = entity.GetPlayer(); Player player = Client.Self().Players.First(x => x.Entity.Status.ObjectId == entity.Status.ObjectId); // Don't know if ic an just do entity == entity too l8z two test if (!cPlayers.SelectMany(x => x.Players).Contains(player)) { AllRenderedPlayers.Remove(player); } Players.Remove(player); OnPlayerLeave?.Invoke(player); } else if (entity.IsBag()) { Bags.Remove(entity); OnBagDespawn?.Invoke(entity); } else if (entity.IsPortal()) { } else if (entity.IsEnemy()) { } } }