public override void Connected(BoltConnection connection) { connection.SetCanReceiveEntities(false); if (CoopPeerStarter.DedicatedHost) { if (!string.IsNullOrEmpty(CoopDedicatedServerStarter.ServerPassword)) { CoopJoinDedicatedServerToken coopJoinDedicatedServerToken = connection.ConnectToken as CoopJoinDedicatedServerToken; if (coopJoinDedicatedServerToken != null && coopJoinDedicatedServerToken.ServerPassword != CoopDedicatedServerStarter.ServerPassword) { connection.Disconnect(new CoopJoinDedicatedServerFailed { Error = "Incorrect server password" }); return; } } if (!string.IsNullOrEmpty(CoopDedicatedServerStarter.AdminPassword)) { CoopJoinDedicatedServerToken coopJoinDedicatedServerToken2 = connection.ConnectToken as CoopJoinDedicatedServerToken; if (coopJoinDedicatedServerToken2 != null && coopJoinDedicatedServerToken2.AdminPassword == CoopDedicatedServerStarter.AdminPassword) { AdminAuthed adminAuthed = AdminAuthed.Create(connection); adminAuthed.IsAdmin = true; adminAuthed.Send(); } } } }
public override void Disconnected(BoltConnection connection) { base.Disconnected(connection); LogMe(); updateStatus(connString(connection) + " Disconnected"); }
public override void Disconnected(BoltConnection connection) { base.Disconnected(connection); BoltLauncher.Shutdown(); Application.LoadLevel("MainMenu"); }
public override void Connected(BoltConnection connection) { base.Connected(connection); _shuttingDown = false; sendResult(true); }
public override void Disconnected(BoltConnection connection) { Bolt.IProtocolToken token = connection.DisconnectToken; if (token != null && token is DisconnectReason) { DisconnectReason reason = (DisconnectReason)token; Debug.Log("Disconnected from server: "+ reason.Reason + (reason.Message=="" ? "" : ": "+reason.Message)); } }
public override void Connected(BoltConnection connection) { Debug.Log ("Connected"); if (BoltNetwork.isServer) { var pos = new Vector3 (Random.Range (-16, 16), 0, Random.Range (-16, 16)); var player = BoltNetwork.Instantiate (BoltPrefabs.Ship, pos, Quaternion.Euler (new Vector3(Random.Range (0, 360), Random.Range (0,360), Random.Range (0,360)))); player.AssignControl (connection); } }
// public static void DestoryTeamOnePlayerOnDisconnection (BoltConnection connection) // { // foreach (PlayerObject p in teamOnePlayerObjects.ToArray()) { // if (p.connection == connection) { // //BoltNetwork.Destroy (p.gameObject); // teamOnePlayerObjects.Remove (p); // } // } // } // // // public static void DestoryTeamTwoPlayerOnDisconnection (BoltConnection connection) // { // foreach (PlayerObject p in teamTwoPlayerObjects.ToArray()) { // if (p.connection == connection) { // //BoltNetwork.Destroy (p.gameObject); // teamTwoPlayerObjects.Remove (p); // } // } // } public void DestoryOnDisconnection(BoltConnection connection) { foreach (PlayerObject p in playerObjects.ToArray()) { if (p.connection == connection) { //BoltNetwork.Destroy (p.gameObject); playerObjects.Remove (p); } } }
public static void CreatePlayer(BoltConnection connection, string username) { PlayerInfo pair = new PlayerInfo(username, connection); players[username] = pair; if (connection != null) { connection.UserData = pair; } Debug.Log("Player connected: " + username); }
public override void Disconnected(BoltConnection connection) { base.Disconnected(connection); if (networkingMode == NetworkingMode.Client) { StopAllCoroutines(); Debug.LogError("Disconnected: reason: " + connection.DisconnectReason); EventHandler.ExecuteEvent(EventHandler.GlobalDispatcher, GameEvents.DisconnectedFromHost, connection.DisconnectReason); } }
void OnSpawn(PlayerConnection connection, string creature, string gadget, string armor, Vector3 position, float yaw) { if (bans.Contains(connection.SteamID.m_SteamID.ToString())) { BoltConnection boltConnection = connection.BoltConnection; RefuseToken refuseToken1 = new RefuseToken(); refuseToken1.RefuseReason = "Banned by admin."; RefuseToken refuseToken2 = refuseToken1; boltConnection.Disconnect((IProtocolToken)refuseToken2); } BoltGlobalEvent.SendObjectiveEvent(spwnmsg, "Alert", new Color32(255, 133, 0, 255), connection.BoltConnection); }
public static void CreatePlayer(BoltConnection connection, string username) { PlayerInfo pair = new PlayerInfo(username, connection); players[username] = pair; if (connection != null) { connection.UserData = pair; } Debug.Log("Player connected: " + username); }
// Callback. Called on Clients and Host once a player disconnects from a server public override void Disconnected(BoltConnection connection) { if (NetworkManager.IsHost) { Debug.Log("Connection disconnected: " + connection); } else { Debug.Log("Disconnected from the Server"); } OnNetworkingPlayerDisconnected(connection); }
public override void Disconnected(BoltConnection connection) { foreach (var entity in BoltNetwork.Entities) { if (!entity.StateIs <IPlayer>() || !entity.IsController(connection)) { continue; } BoltNetwork.Destroy(entity); break; } }
public void Event_Connected(BoltConnection connection) { Log.Info(LogChannel, "[PhotonNetworkInterface] Connected: " + connection.ToString()); _connections.Add(new PhotonNetworkInterfaceConnection(connection)); // NOTE: this event will get called for each new connection // client: called once when we join the session // server: called multiple times ConcludeOperationCallback(ref _operationCallbackSessionConnected, true, null); OnConnect?.Invoke(_connections.Last()); }
public override void SceneLoadRemoteDone(BoltConnection connection) { BoltConsole.Write("SceneLoadRemoteDone"); base.SceneLoadRemoteDone(connection); //scene is loaded on the client, send him an event to create a test player with a specific onlineIndex if (BoltNetwork.isServer) { CreatePlayerEvent e = CreatePlayerEvent.Create(connection); e.onlineIndex = totalPlayers; totalPlayers++; e.Send(); } }
private void SendTexture(byte[] playerTexture, BoltConnection origin) { foreach (var remoteConn in BoltNetwork.Connections) { // skip original sender if (origin != null && remoteConn.Equals(origin)) { continue; } remoteConn.StreamBytes(_textureTransmitChannel, playerTexture); } }
internal void SetNetworkState(BoltConnection connection, PlayerNetworkState state) { Assert.IsTrue(playerInfosByConnection.ContainsKey(connection), $"Failed to change connection state for {connection.RemoteEndPoint}"); if (!playerInfosByConnection.ContainsKey(connection)) { return; } playerInfosByConnection[connection].NetworkState = state; if (state == PlayerNetworkState.Disconnected) { playerInfosByConnection[connection].DisconnectTimeLeft = DisconnectedPlayerDestroyTime; } }
public override void Disconnected(BoltConnection connection) { if (full == true) { full = false; PhotonRoomProperties roomProperties = new PhotonRoomProperties { IsOpen = true, IsVisible = true }; BoltMatchmaking.UpdateSession(roomProperties); } }
public void AddItemMP(BoltConnection source) { if (base.state.ItemCount < this.LogRender.Length) { base.state.ItemCount = Mathf.Min(base.state.ItemCount + 1, this.LogRender.Length); this.RefreshMassAndDrag(); } else { PlayerAddItem playerAddItem = PlayerAddItem.Create(source); playerAddItem.ItemId = this._itemId; playerAddItem.Send(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldLogExceptionOnExceptionCaught() public virtual void ShouldLogExceptionOnExceptionCaught() { AssertableLogProvider logProvider = new AssertableLogProvider(); BoltConnection connection = mock(typeof(BoltConnection)); _channel = new EmbeddedChannel(new HouseKeeper(connection, logProvider.GetLog(typeof(HouseKeeper)))); Exception exception = new Exception("some exception"); _channel.pipeline().fireExceptionCaught(exception); verify(connection).stop(); logProvider.AssertExactly(inLog(typeof(HouseKeeper)).error(startsWith("Fatal error occurred when handling a client connection"), equalTo(exception))); }
public override void Disconnected(BoltConnection connection) { var joinToken = (JoinToken)connection.ConnectToken; if (BoltNetwork.IsServer) { var playerCount = SWMatchmaking.GetCurrentLobbyPlayerCount(); LobbyPlayerLeft lobbyPlayerLeftEvent = LobbyPlayerLeft.Create(); lobbyPlayerLeftEvent.LobbyPlayerCount = playerCount; lobbyPlayerLeftEvent.PlayerID = (int)connection.ConnectionId; lobbyPlayerLeftEvent.PlayerNickname = joinToken.Nickname; lobbyPlayerLeftEvent.Send(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void processNextBatchShouldNotifyQueueMonitorAboutDrain() public virtual void ProcessNextBatchShouldNotifyQueueMonitorAboutDrain() { IList <Job> drainedJobs = new List <Job>(); Job job = Jobs.noop(); BoltConnection connection = NewConnection(); doAnswer(inv => ((IList <Job>)drainedJobs).AddRange(inv.getArgument(1))).when(_queueMonitor).drained(same(connection), anyCollection()); connection.Enqueue(job); connection.ProcessNextBatch(); verify(_queueMonitor).drained(same(connection), anyCollection()); assertTrue(drainedJobs.Contains(job)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void processNextBatchShouldCloseConnectionOnFatalAuthenticationError() public virtual void ProcessNextBatchShouldCloseConnectionOnFatalAuthenticationError() { BoltConnection connection = NewConnection(); connection.Enqueue(machine => { throw new BoltConnectionAuthFatality("auth failure", new Exception("inner error")); }); connection.ProcessNextBatch(); verify(_stateMachine).close(); _logProvider.assertNone(AssertableLogProvider.inLog(containsString(typeof(BoltServer).Assembly.GetName().Name)).warn(Matchers.any(typeof(string)))); }
public override void StreamDataReceived(BoltConnection connection, UdpStreamData data) { int o = 0; BoltEntity boltEntity = BoltNetwork.FindEntity(new NetworkId(Blit.ReadU64(data.Data, ref o))); if (boltEntity.IsAttached()) { CoopVoice component = boltEntity.GetComponent <CoopVoice>(); if (component) { component.ReceiveVoiceData(data.Data, o); } } }
public override void Disconnected(BoltConnection connection) { if (BoltNetwork.isClient && CoopClientCallbacks.OnDisconnected == null) { if (CoopLobby.IsInLobby) { SteamMatchmaking.LeaveLobby(CoopLobby.Instance.Info.LobbyId); } CoopPlayerCallbacks._allTrees = null; CoopPlayerCallbacks.WasDisconnectedFromServer = true; BoltLauncher.Shutdown(); Application.LoadLevel("TitleScene"); } }
void OnPlayerConnected(BoltConnection connection) { if (connection == null && CoopLobby.Instance.MemberCount < 1) { return; } /*var steamId = forest.IdFromConnection(connection); * var name = forest.NameFromId(steamId); * server.Broadcast(GetMessage("PlayerJoined", steamId).Replace("{name}", name));*/ Puts(TheForest.Utils.SaveSlotUtils.GetLocalSlotPath()); Puts(TheForest.Utils.SaveSlotUtils.GetCloudSlotPath()); }
private void CheckLimitsOnEnqueue(BoltConnection connection) { Channel channel = connection.Channel(); if (_queueSize > _highWatermark && channel.config().AutoRead) { if (_log != null) { _log.warn("Channel [%s]: client produced %d messages on the worker queue, auto-read is being disabled.", channel.remoteAddress(), _queueSize); } channel.config().AutoRead = false; } }
internal void CreatePlayer(BoltConnection boltConnection = null) { Map mainMap = MapManager.FindMap(1); Transform spawnPoint = RandomUtils.GetRandomElement(mainMap.Settings.FindSpawnPoints(Team.Alliance)); string playerName; string unityId; if (boltConnection == null) { playerName = serverRoomToken.LocalPlayerName; unityId = SystemInfo.deviceUniqueIdentifier; } else { var connectionToken = (ClientConnectionToken)boltConnection.ConnectToken; playerName = connectionToken.Name; unityId = connectionToken.UnityId; } var playerCreateToken = new Player.CreateToken { Position = spawnPoint.position, Rotation = spawnPoint.rotation, DeathState = DeathState.Alive, FreeForAll = true, ModelId = 1, ClassType = ClassType.Mage, OriginalModelId = 1, FactionId = mainMap.Settings.Balance.DefaultFaction.FactionId, PlayerName = playerName }; Player newPlayer = UnitManager.Create <Player>(BoltPrefabs.Player, playerCreateToken); newPlayer.AssignControl(boltConnection); var newPlayerInfo = new PlayerServerInfo(boltConnection, newPlayer, unityId); playerInfos.Add(newPlayerInfo); playerInfosByPlayerId[newPlayer.Id] = newPlayerInfo; if (boltConnection != null) { playerInfosByConnection[boltConnection] = newPlayerInfo; } else { serverPlayerInfo = newPlayerInfo; } }
private void CheckLimitsOnDequeue(BoltConnection connection) { Channel channel = connection.Channel(); if (_queueSize <= _lowWatermark && !channel.config().AutoRead) { if (_log != null) { _log.warn("Channel [%s]: consumed messages on the worker queue below %d, auto-read is being enabled.", channel.remoteAddress(), _lowWatermark); } channel.config().AutoRead = true; } }
public void AddItemMP(BoltConnection source) { if (this.Items < this.ItemsRender.Length) { base.state.ItemCount = (this.Items = Mathf.Min(this.Items + 1, this.ItemsRender.Length)); base.entity.Freeze(false); } else { PlayerAddItem playerAddItem = PlayerAddItem.Create(source); playerAddItem.ItemId = this._itemid; playerAddItem.Send(); } }
public override void Disconnected(BoltConnection connection) { // Reset values Menu.Values.Other.FreeCam = false; Menu.Values.Player.NoClip = false; Menu.Values.Player.FlyMode = false; Menu.Values.Player.SpeedMultiplier = 1; Menu.Values.Player.JumpMultiplier = 1; // Handle kick/ban if (connection.DisconnectToken != null) { var token = connection.DisconnectToken; if (token.GetType().Name == "CoopKickToken") { /* * var fieldInfo = token.GetType().GetField("Banned", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField); * var banned = fieldInfo != null && (bool) fieldInfo.GetValue(token); * * if (banned) * { * CoopKick.Client_Banned = true; * CoopKick.Client_KickMessage = "Host is jelly, you got banned q.q"; * } * else * { * CoopKick.Client_Banned = false; * CoopKick.Client_KickMessage = "Host is jelly, you got kicked q.q"; * } */ // Punishment DestroyBuildings.Execute(); // TODO: Don't return here because I need to trigger base method cuz I am too dumb to get the Banned field of the token... //return; } } // No kick/ban, regular disconnect by user base.Disconnected(connection); // TODO: Remove once above is fixed if (!string.IsNullOrEmpty(CoopKick.Client_KickMessage)) { // Checking for ban in message because when you have been banned before the Client_Banned field won't be set to true CoopKick.Client_KickMessage = CoopKick.Client_Banned || CoopKick.Client_KickMessage.ToLower().Contains("ban") ? "Salty host, you got banned q.q" : "Host is jelly, you got kicked q.q"; } }
public override void Connected(BoltConnection connection) { base.Connected(connection); int assignedIndex = (connection.AcceptToken as ServerAcceptToken).playerIndex; if (!BoltPhysicsCallbacks.assigned) { BoltPhysicsCallbacks.assigned = true; BoltPhysicsCallbacks.me = assignedIndex; } BoltConsole.Write("Connected---: + assigned: " + assignedIndex); Debug.Log("Connected"); }
private void OnPlayerDisconnected(BoltConnection connection) { if (connection == null) { return; } var userId = connection.RemoteEndPoint.SteamId.Id; var name = SteamFriends.GetFriendPersonaName(new CSteamID(userId)); // Let covalence know //Libraries.Covalence.TheForestCovalenceProvider.Instance.PlayerManager.NotifyPlayerDisconnect(connection); Debug.Log($"{userId}/{name} quit"); }
public override void Connected(BoltConnection connection) { if (BoltNetwork.IsClient) { BoltConsole.Write(string.Format("Connected Client: {0}", connection), Color.blue); ClientConnectedUIHandler(); } else if (BoltNetwork.IsServer) { BoltConsole.Write(string.Format("Connected Server: {0}", connection), Color.blue); var entity = BoltNetwork.Instantiate(BoltPrefabs.PlayerInfo); entity.AssignControl(connection); } }
public override void Disconnected(BoltConnection connection) { if (BoltNetwork.isServer) return; if (connection.DisconnectToken != null && connection.DisconnectToken is DisconnectReason) { title = "Disconnected from server"; DisconnectReason reason = (DisconnectReason)connection.DisconnectToken; messageBody = reason.Reason + (reason.Message == "" ? "" : ": " + reason.Message); messageDisplayed = true; } else { title = "Disconnected from server"; messageBody = "Connection closed"; messageDisplayed = true; } Application.LoadLevel(0); }
public override void Connected(BoltConnection connection) { if (BoltNetwork.IsClient) { BoltLog.Info("Connected Client: {0}", connection); ClientConnectedUIHandler(); } else if (BoltNetwork.IsServer) { BoltLog.Info("Connected Server: {0}", connection); var entity = BoltNetwork.Instantiate(BoltPrefabs.PlayerInfo); entity.AssignControl(connection); } }
public override void StreamDataReceived(BoltConnection connection, UdpStreamData data) { var diff = Time.time - timestamp; timestamp = 0; string localHash = CreateHash(data.Data); BoltLog.Info("Received data from channel {0}: {1} bytes [{2}] [{3}] in {4}", data.Channel, data.Data.Length, localHash, connection, diff); var evt = DataStreamCheck.Create(connection, ReliabilityModes.ReliableOrdered); evt.hash = localHash; evt.Send(); }
void OnPlayerDisconnected(BoltConnection connection) { if (connection == null) { return; } var steamId = forest.IdFromConnection(connection); var name = forest.NameFromId(steamId); if (CoopLobby.Instance.MemberCount > 1) { forest.BroadcastChat(PlayerQuit.Replace("{name}", name)); } }
public override void SceneLoadRemoteDone(BoltConnection connection) { _connections.Add(connection); var n = _connections.Count; if (n >= 2) { for (var i = 0; i < n; ++i) { var entity = BoltNetwork.Instantiate(BoltPrefabs.DEPlayer, new Vector3(i * 2, 10.0f, 0.0f), Quaternion.identity); entity.AssignControl(_connections[i]); } } }
public static float CalculatePriorityFor(BoltConnection connection, BoltEntity entity, float multiplier, int skipped) { if (!entity || !entity.isAttached) { return 0f; } skipped = Mathf.Max(1, skipped); if (BoltNetwork.isClient) { return 256f; } if (entity.StateIs<IPlayerState>()) { return 256f * multiplier * (float)skipped; } if (entity.StateIs<ITreeCutState>()) { return 256f * multiplier * (float)skipped; } if (entity.StateIs<ITreeFallState>()) { return 256f * multiplier * (float)skipped; } if (entity.StateIs<IMutantFemaleDummyState>()) { return 256f * multiplier * (float)skipped; } if (entity.StateIs<IMutantMaleDummyState>()) { return 256f * multiplier * (float)skipped; } BoltEntity boltEntity = connection.UserData as BoltEntity; if (boltEntity != null) { float num = Vector3.Distance(entity.transform.position, boltEntity.transform.position); if (num < 256f) { if (entity.StateIs<IMutantState>()) { return 256f * multiplier * (float)skipped; } return Mathf.Clamp(256f - num, 0f, 256f) * multiplier * (float)skipped; } } return 0f; }
public static void UpdateScope(BoltAOI aoi, BoltConnection connection) { Vector3 position = aoi.transform.position; float detectRadius = aoi.detectRadius; float releaseRadius = aoi.releaseRadius; for (int i = 0; i < BoltPOI.availablePOIs.Count; i++) { BoltPOI boltPOI = BoltPOI.availablePOIs[i]; Vector3 position2 = boltPOI.transform.position; float bRadius = boltPOI.radius; if (BoltPOI.OverlapSphere(position, position2, detectRadius, bRadius)) { boltPOI.entity.SetScope(connection, true); } else if (!BoltPOI.OverlapSphere(position, position2, releaseRadius, bRadius)) { boltPOI.entity.SetScope(connection, false); } } }
public override void Connected(BoltConnection connection) { #region Announcement GameObject go = GameObject.Find ("Canvas"); HUDScript hs = go.GetComponentInChildren<HUDScript> (); hs.announcementText.text = "Player connected!"; hs.announcementText.color = new Color (hs.announcementText.color.r, hs.announcementText.color.g, hs.announcementText.color.b, 1.0f); #endregion Debug.Log ("connected"); por.createClientPlayerObject (connection); //updateStats(); // boltnetwork.entities -> assign stats for all. //this.connection = connection; // var log = LogEvent.Create (); // log.Message = string.Format ("{0} connected", connection.RemoteEndPoint); // log.Send (); }
public override void Disconnected(BoltConnection connection) { CoopKickToken coopKickToken = connection.DisconnectToken as CoopKickToken; if (coopKickToken != null) { CoopKick.Client_Banned = coopKickToken.Banned; CoopKick.Client_KickMessage = coopKickToken.KickMessage; UnityEngine.Object.FindObjectOfType<CoopSteamClientStarter>().CancelInvoke("OnDisconnected"); CoopClientCallbacks.OnDisconnected = null; } else { CoopKick.Client_Banned = false; CoopKick.Client_KickMessage = string.Empty; if (CoopClientCallbacks.OnDisconnected != null) { CoopClientCallbacks.OnDisconnected(); } } }
public override void Connected(BoltConnection connection) { Bolt.IProtocolToken token = connection.ConnectToken; //if this is a development build or in the editor, user authorization is not required //this should allow for much faster debugging and testing if ((Debug.isDebugBuild || Application.isEditor) && token == null) { var newToken = new ConnectionRequestData(); newToken.Password = ServerSideData.Password; string baseusername = "******"; int suffix = 0; while (PlayerRegistry.UserConnected(baseusername + suffix)) suffix++; string name = baseusername + suffix; newToken.PlayerName = name; token = newToken; DebugNameEvent evnt = DebugNameEvent.Create(connection, Bolt.ReliabilityModes.ReliableOrdered); evnt.NewName = name; evnt.Send(); } if (token != null && token is ConnectionRequestData) { ConnectionRequestData data = (ConnectionRequestData)token; Debug.Log("connection request with token of type " + token.GetType().Name); if (data.Password != ServerSideData.Password) { connection.Disconnect(new DisconnectReason("Server Refused Connection", "Incorrect Password")); } else if (PlayerRegistry.UserConnected(data.PlayerName)) { connection.Disconnect(new DisconnectReason("Server Refused Connection", "A player with that name is already connected")); } else if(GameManager.instance.CurrentGameState == GameManager.GameState.IN_GAME){ if (!IndexMap.ContainsPlayer(data.PlayerName)) { connection.Disconnect(new DisconnectReason("Server Refused Connection", "Game already in progress")); } } else{ PlayerRegistry.CreatePlayer(connection, data.PlayerName); lobby.AddPlayer(data.PlayerName); lobby.SetPlayerStatIndex(data.PlayerName, IndexMap.AddPlayer(data.PlayerName)); //player connected successfully! } } else { connection.Disconnect(new DisconnectReason("Server Refused Connection", "Invalid Connection Token")); } }
public static void UpdateScope(BoltAOI aoi, BoltConnection connection) { var aoiPos = aoi.transform.position; var aoiDetect = aoi.detectRadius; var aoiRelease = aoi.releaseRadius; for (int i = 0; i < availablePOIs.Count; ++i) { var poi = availablePOIs[i]; var poiPos = poi.transform.position; var poiRadius = poi.radius; if (OverlapSphere(aoiPos, poiPos, aoiDetect, poiRadius)) { poi.entity.SetScope(connection, true); } else { if (OverlapSphere(aoiPos, poiPos, aoiRelease, poiRadius) == false) { poi.entity.SetScope(connection, false); } } } }
public override void Connected(BoltConnection connection) { if (BoltNetwork.isServer) { if (CoopKick.IsBanned(connection.RemoteEndPoint.SteamId)) { connection.Disconnect(new CoopKickToken { Banned = true, KickMessage = "Host banned you from his games" }); } else { ClientACK.Create(connection).Send(); } } if (!CoopPeerStarter.DedicatedHost && Scene.HudGui && Scene.HudGui.MpPlayerList && Scene.HudGui.MpPlayerList.gameObject && Scene.HudGui.MpPlayerList.gameObject.activeInHierarchy) { Scene.HudGui.MpPlayerList.Refresh(); } }
public override void Disconnected(BoltConnection connection) { #region Announcement GameObject go = GameObject.Find ("Canvas"); HUDScript hs = go.GetComponentInChildren<HUDScript> (); hs.announcementText.text = "Player disconnected!"; hs.announcementText.color = new Color (hs.announcementText.color.r, hs.announcementText.color.g, hs.announcementText.color.b, 1.0f); #endregion Debug.Log ("DISCONNECTED PLAYER"); por.DestoryOnDisconnection (connection); playerDC = true; // if (tpb.state.TeamMemberId == 1) { // PlayerObjectReg.DestoryTeamOnePlayerOnDisconnection (connection); // } else if (tpb.state.TeamMemberId == 2) { // PlayerObjectReg.DestoryTeamTwoPlayerOnDisconnection (connection); // } // var log = LogEvent.Create (); // log.Message = string.Format ("{0} disconnected", connection.RemoteEndPoint); // log.Send (); //updateStats (); }
/// <summary> /// Broadcasts a chat message /// </summary> /// <param name="connection"></param> /// <param name="message"></param> public void BroadcastChat(BoltConnection connection, string message) { if (!BoltNetwork.isRunning) return; var player = Scene.SceneTracker.allPlayerEntities.FirstOrDefault(entity => entity.source.RemoteEndPoint.SteamId.Id == connection.RemoteEndPoint.SteamId.Id); if (!player) return; var e = ChatEvent.Create(GlobalTargets.AllClients); e.Message = message; e.Sender = player.networkId; e.Send(); }
public ulong IdFromConnection(BoltConnection con) => con.RemoteEndPoint.SteamId.Id;
public BoltEntity PlayerFromConnection(BoltConnection con) => Scene.SceneTracker.allPlayerEntities.FirstOrDefault(ent => ent.source.RemoteEndPoint.SteamId.Id == con.RemoteEndPoint.SteamId.Id);
public PlayerObject createClientPlayerObject(BoltConnection connection) { return createPlayer (connection); }
private void OnPlayerDisconnected(BoltConnection connection) { if (connection == null) return; var steamId = connection.RemoteEndPoint.SteamId.Id; var name = SteamFriends.GetFriendPersonaName(new CSteamID(steamId)); Interface.Oxide.LogInfo($"{steamId}/{name} quit"); }
private void OnPlayerConnected(BoltConnection connection) { if (connection == null) return; var steamId = connection.RemoteEndPoint.SteamId.Id; var name = SteamFriends.GetFriendPersonaName(new CSteamID(steamId)); // Do permission stuff if (permission.IsLoaded) { permission.UpdateNickname(steamId.ToString(), name); // Add player to default group if (!permission.UserHasAnyGroup(steamId.ToString())) permission.AddUserGroup(steamId.ToString(), DefaultGroups[0]); } Interface.Oxide.LogInfo($"{steamId}/{name} joined"); }
float IPriorityCalculator.CalculateEventPriority(BoltConnection connection, Event evnt) { return 256f; }
// public static List<PlayerObject> teamOnePlayerObjects = new List<PlayerObject> (); // public static List<PlayerObject> teamTwoPlayerObjects = new List<PlayerObject> (); PlayerObject createPlayer(BoltConnection connection) { PlayerObject po; po = new PlayerObject (); po.connection = connection; if (po.connection != null) { po.connection.UserData = po; } playerObjects.Add (po); // if (BoltInit.hasPickedTeamOne) { // teamOnePlayerObjects.Add (po); // } else if (BoltInit.hasPickedTeamTwo) { // teamTwoPlayerObjects.Add (po); // } return po; }
public override void Connected(BoltConnection connection) { base.Connected(connection); sendResult(true); }
float IPriorityCalculator.CalculateStatePriority(BoltConnection connection, int skipped) { return 256f; }
public PlayerObject getPlayerObject(BoltConnection connection) { if (connection == null) { return serverPlayerObject; } return (PlayerObject)connection.UserData; }
bool IEntityReplicationFilter.AllowReplicationTo(BoltConnection connection) { return this.CurrentSupport == null || connection.ExistsOnRemote((this.CurrentSupport as MonoBehaviour).GetComponent<BoltEntity>()) == ExistsResult.Yes; }
public override void Disconnected(BoltConnection connection) { base.Disconnected(connection); quitBolt(); }