private static void OnSetDisconnectedPlayerMatchStateMsg(NetworkMessage msg) { var msmsg = msg.ReadMessage <DisconnectedPlayerMatchStateMessage>(); foreach (var pl_state in msmsg.m_player_states) { GameObject gameObject = ClientScene.FindLocalObject(pl_state.m_net_id); if (gameObject == null) { // Disconnected players need instantiated client side to get added to scoreboard as proper Players gameObject = UnityEngine.Object.Instantiate <GameObject>(NetworkSpawnPlayer.m_player_prefab); var p = gameObject.GetComponent <Player>(); p.m_kills = pl_state.m_kills; p.m_deaths = pl_state.m_deaths; p.m_assists = pl_state.m_assists; p.m_mp_name = pl_state.m_mp_name; p.m_mp_team = pl_state.m_mp_team; p.gameObject.SetActive(false); Overload.NetworkManager.m_PlayersForScoreboard.Add(p); continue; } var player = gameObject.GetComponent <Player>(); player.m_kills = pl_state.m_kills; player.m_deaths = pl_state.m_deaths; player.m_assists = pl_state.m_assists; } NetworkMatch.SortAnarchyPlayerList(); }
public void SetMatchHost(string newHost, int port, bool https) { if (matchMaker == null) { matchMaker = gameObject.AddComponent <NetworkMatch>(); } if (newHost == "localhost" || newHost == "127.0.0.1") { newHost = Environment.MachineName; } string prefix = "http://"; if (https) { prefix = "https://"; } if (LogFilter.logDebug) { Debug.Log("SetMatchHost:" + newHost); } m_MatchHost = newHost; m_MatchPort = port; matchMaker.baseUri = new Uri(prefix + m_MatchHost + ":" + m_MatchPort); }
private static void ProcessPing(byte[] packetData, IPEndPoint senderEndPoint, UdpClient client) { byte[] outBuf = new byte[packetData.Length]; Array.Copy(packetData, outBuf, packetData.Length); // calculate incoming hash Array.Copy(BitConverter.GetBytes(0), 0, outBuf, 8, 4); uint srcHash = xxHashSharp.xxHash.CalculateHash(outBuf); if (srcHash != BitConverter.ToUInt32(packetData, 8)) // ignore packet with invalid hash { return; } Array.Copy(BitConverter.GetBytes((int)-2), 0, outBuf, 0, 4); if (outBuf.Length >= 19 + 4) { Array.Copy(BitConverter.GetBytes(0), 0, outBuf, 19, 4); // version } if (outBuf.Length >= 19 + 4 + 4) { Array.Copy(BitConverter.GetBytes((int)NetworkMatch.NetSystemGetStatus()), 0, outBuf, 19 + 4, 4); // status } // calculate outgoing hash Array.Copy(BitConverter.GetBytes(0), 0, outBuf, 8, 4); uint hash = xxHashSharp.xxHash.CalculateHash(outBuf); Array.Copy(BitConverter.GetBytes(hash), 0, outBuf, 8, 4); client.Send(outBuf, outBuf.Length, senderEndPoint); }
static bool Prefix(UIElement __instance, ref Vector2 pos) { if (MPModPrivateData.MatchMode == ExtMatchMode.RACE) { Race.DrawMpMiniScoreboard(ref pos, __instance); return(false); } if (NetworkMatch.GetMode() == MatchMode.ANARCHY || MPTeams.NetworkMatchTeamCount == 2) { return(true); } int match_time_remaining = NetworkMatch.m_match_time_remaining; int match_time = (int)NetworkMatch.m_match_elapsed_seconds; pos.y -= 15f; __instance.DrawDigitsTime(pos + Vector2.right * 95f, (float)match_time_remaining, 0.45f, (match_time <= 10 || match_time_remaining >= 10) ? UIManager.m_col_ui2 : UIManager.m_col_em5, __instance.m_alpha, false); pos.y -= 3f; MpTeam myTeam = GameManager.m_local_player.m_mp_team; foreach (var team in MPTeams.TeamsByScore) { pos.y += 28f; int score = NetworkMatch.GetTeamScore(team); MPTeams.DrawTeamScoreSmall(__instance, pos, team, score, 98f, team == myTeam); } pos.y += 6f; return(false); }
public static void Postfix() { if (GameplayManager.IsMultiplayerActive && NetworkMatch.InGameplay()) { if (!dontAutoselectAfterFiring && !Controls.IsPressed(CCInput.FIRE_WEAPON) && !waitingSwapWeaponType.Equals("")) { // Thunderbolt needs atleast a 4ms delay after releasing the fire button to actually release the shot. // so swapping on release would swallow an already charged shot if the client picked up a weapon if (GameManager.m_local_player.m_weapon_type.Equals(WeaponType.THUNDERBOLT)) { if (ThunderboltSwapDelay > 0f) { ThunderboltSwapDelay -= Time.deltaTime; return; } ThunderboltSwapDelay = 0.025f; // 25ms to ensure that it is 100% reliable } swapToWeapon(waitingSwapWeaponType); GameManager.m_local_player.UpdateCurrentWeaponName(); waitingSwapWeaponType = ""; } } if (sp_next_missileType != MissileType.NUM && delay == 0) // do this properly once you wake up again { swapToMissile((int)sp_next_missileType); sp_next_missileType = MissileType.NUM; } else if (delay > 0) { delay--; } }
public void SetMatchHost(string newHost, int port, bool https) { if (this.matchMaker == null) { this.matchMaker = base.gameObject.AddComponent <NetworkMatch>(); } if ((newHost == "localhost") || (newHost == "127.0.0.1")) { newHost = Environment.MachineName; } string str = "http://"; if (https) { str = "https://"; } if (LogFilter.logDebug) { Debug.Log("SetMatchHost:" + newHost); } this.m_MatchHost = newHost; this.m_MatchPort = port; object[] objArray1 = new object[] { str, this.m_MatchHost, ":", this.m_MatchPort }; this.matchMaker.baseUri = new Uri(string.Concat(objArray1)); }
static bool Prefix(UIElement __instance) { if (!MenuManager.m_mp_lan_match) { return(true); } var uie = __instance; uie.DrawMenuBG(); Vector2 position = uie.m_position; position.y = UIManager.UI_TOP + 75f; uie.DrawHeaderLarge(position, Loc.LS("SCOREBOARD")); position.y += 42f; MatchMode mode = NetworkMatch.GetMode(); string s = NetworkMatch.GetModeString(mode) + " - " + GameplayManager.Level.DisplayName; uie.DrawSubHeader(s, position); position.y += 20f; uie.DrawMenuSeparator(position); position.y += 20f; position.x = 0f; position.y += 10f; _UIElement_DrawMpScoreboardRaw_Method.Invoke(uie, new object[] { position }); position.y = UIManager.UI_BOTTOM - 30f; uie.SelectAndDrawItem(Loc.LS("MULTIPLAYER MENU"), position, 100, false); position.y -= 62f; uie.SelectAndDrawItem(Loc.LS(NetworkMatch.m_match_req_password == "" ? "CREATE AGAIN" : "JOIN AGAIN"), position, 2, false); return(false); }
public void Awake() { print("NetworkManager awake"); blackListedMatches = new List <string>(); networkMatcher = gameObject.AddComponent <NetworkMatch>(); }
public static void Score(Player player) { if (NetworkMatch.m_postgame) { return; } if (!PlayerHasFlag.TryGetValue(player.netId, out int flag) || FlagStates[MPTeams.TeamNum(player.m_mp_team)] != FlagState.HOME) { return; } PlayerHasFlag.Remove(player.netId); if (!SendCTFLose(-1, player.netId, flag, FlagState.HOME, true)) { return; } if (!CTF.CarrierBoostEnabled) { player.c_player_ship.m_boost_overheat_timer = 0; player.c_player_ship.m_boost_heat = 0; } NetworkMatch.AddPointForTeam(player.m_mp_team); NotifyAll(CTFEvent.SCORE, string.Format(Loc.LS("{0} ({1}) CAPTURES THE {2} FLAG!"), player.m_mp_name, MPTeams.TeamName(player.m_mp_team), MPTeams.TeamName(MPTeams.AllTeams[flag])), player, flag); }
private static IEnumerator SendSceneLoad(int connectionId) { // wait until we've received the loadout while (!NetworkMatch.m_player_loadout_data.ContainsKey(connectionId)) { if (!NetworkMatch.m_players.ContainsKey(connectionId)) // disconnected? { yield break; } yield return(null); } StringMessage levelNameMsg = new StringMessage(MPJoinInProgress.NetworkMatchLevelName()); NetworkServer.SendToClient(connectionId, CustomMsgType.SceneLoad, levelNameMsg); Debug.Log("JIP: sending scene load " + levelNameMsg.value); if (NetworkMatch.GetMatchState() == MatchState.LOBBY_LOADING_SCENE) { yield break; } StringMessage sceneNameMsg = new StringMessage(GameplayManager.m_level_info.SceneName); NetworkServer.SendToClient(connectionId, CustomMsgType.SceneLoaded, sceneNameMsg); Debug.Log("JIP: sending scene loaded " + sceneNameMsg.value); }
private static void Postfix(NetworkMessage msg) { var connId = msg.conn.connectionId; if (connId == 0) // ignore local connection { return; } if (!MPTweaks.ClientInfos.TryGetValue(connId, out var clientInfo)) { clientInfo = MPTweaks.ClientCapabilitiesSet(connId, new Dictionary <string, string>()); } Debug.Log("MPTweaks: conn " + connId + " OnLoadoutDataMessage clientInfo is now " + clientInfo.Capabilities.Join()); if (!MPTweaks.ClientHasMod(connId) && MPTweaks.MatchNeedsMod()) { //LobbyChatMessage chatMsg = new LobbyChatMessage(connId, "SERVER", MpTeam.ANARCHY, "You need OLMOD to join this match", false); //NetworkServer.SendToClient(connId, CustomMsgType.LobbyChatToClient, chatMsg); NetworkServer.SendToClient(connId, 86, new StringMessage("This match requires OLMod to play.")); GameManager.m_gm.StartCoroutine(DisconnectCoroutine(connId)); } if ((NetworkMatch.GetMatchState() != MatchState.LOBBY && NetworkMatch.GetMatchState() != MatchState.LOBBY_LOAD_COUNTDOWN) && !ClientLoadoutValid(connId)) { NetworkServer.SendToClient(connId, 86, new StringMessage("This match has disabled modifiers. Please disable these modifiers and try again: " + MPModifiers.GetDisabledModifiers())); GameManager.m_gm.StartCoroutine(DisconnectCoroutine(connId)); } if (!clientInfo.Capabilities.ContainsKey("ClassicWeaponSpawns") && (MPClassic.matchEnabled || MPModPrivateData.ClassicSpawnsEnabled)) { NetworkServer.SendToClient(connId, 86, new StringMessage("This match has classic weapon spawns and requires OLMod 0.3.6 or greater.")); GameManager.m_gm.StartCoroutine(DisconnectCoroutine(connId)); } if (clientInfo.Capabilities.ContainsKey("ModPrivateData")) { MPModPrivateDataTransfer.SendTo(connId); } }
void Awake() { // We abuse unity's matchmaking system to pass around connection info but no match is ever actually joined networkMatch = gameObject.AddComponent <NetworkMatch>(); // Use reflection to get a reference to the private m_ClientId field of NetworkClient // We're going to need this later to set the port that client connects from. // Even though it's called clientId it is actually the transport level host id that the NetworkClient // uses to connect clientIDField = typeof(NetworkClient).GetField("m_ClientId", BindingFlags.NonPublic | BindingFlags.Instance); natHelper = GetComponent <NATHelper_PHP>(); singleton = this; scriptCRCCheck = false; NetworkCRC.scriptCRCCheck = false; myPort = networkPort; System.Type type = typeof(UnityEngine.Networking.NetworkManager); var baseMethod = type.GetMethod("Awake", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); if (baseMethod != null) { baseMethod.Invoke(this, null); } StartCoroutine("PHPTest"); }
static void Postfix() { if (MenuManager.m_menu_sub_state != MenuSubState.ACTIVE || NetworkManager.IsHeadless() || !UIManager.PushedSelect(100) || UIManager.m_menu_selection != 2) { return; } MenuManager.PlaySelectSound(); UIManager.DestroyAll(); NetworkMatch.SetNetworkGameClientMode(NetworkMatch.NetworkGameClientMode.Invalid); NetworkMatch.SetNetworkGameClientMode(NetworkMatch.NetworkGameClientMode.LocalLAN); MenuManager.ClearMpStatus(); if (NetworkMatch.m_match_req_password == "") { //MenuManager.m_updating_pm_settings = true; //MenuManager.ChangeMenuState(MenuState.MP_LOCAL_MATCH); //var pmd = (PrivateMatchDataMessage)typeof(MenuManager).GetMethod("BuildPrivateMatchData", BindingFlags.NonPublic | BindingFlags.Static).Invoke(null, new object[] { false }); //NetworkMatch.StartPrivateLobby(pmd); //MenuManager.m_updating_pm_settings = true; MenuManager.ChangeMenuState(MenuState.MP_LOCAL_MATCH); } else { MenuManager.m_mp_status = Loc.LS("JOINING " + MPInternet.ClientModeName()); NetworkMatch.JoinPrivateLobby(MPInternet.MenuPassword); } }
private static void Postfix(NetworkMessage msg) { if (NetworkMatch.GetMatchState() == MatchState.PLAYING) { GameManager.m_gm.StartCoroutine(MatchStart(msg.conn.connectionId)); } }
private static void SendMatchState(int connectionId) { if (NetworkMatch.IsTeamMode(NetworkMatch.GetMode())) { foreach (var team in MPTeams.ActiveTeams) { NetworkServer.SendToClient(connectionId, CustomMsgType.SetScoreForTeam, new ScoreForTeamMessage { team = (int)team, score = NetworkMatch.m_team_scores[(int)team] }); } } //if (!MPTweaks.ClientHasMod(connectionId)) // return; var n = Overload.NetworkManager.m_Players.Count; var msg = new MatchStateMessage() { m_match_elapsed_seconds = NetworkMatch.m_match_elapsed_seconds, m_player_states = new PlayerMatchState[n] }; int i = 0; foreach (var player in Overload.NetworkManager.m_Players) { msg.m_player_states[i++] = new PlayerMatchState() { m_net_id = player.netId, m_kills = player.m_kills, m_deaths = player.m_deaths, m_assists = player.m_assists } } ; NetworkServer.SendToClient(connectionId, ModCustomMsg.MsgSetMatchState, msg); }
public void SetMatchHost(string newHost, int port, bool https) { if (matchMaker == null) { matchMaker = base.gameObject.AddComponent <NetworkMatch>(); } if (newHost == "127.0.0.1") { newHost = "localhost"; } string text = "http://"; if (https) { text = "https://"; } if (newHost.StartsWith("http://")) { newHost = newHost.Replace("http://", ""); } if (newHost.StartsWith("https://")) { newHost = newHost.Replace("https://", ""); } m_MatchHost = newHost; m_MatchPort = port; string text2 = text + m_MatchHost + ":" + m_MatchPort; if (LogFilter.logDebug) { Debug.Log("SetMatchHost:" + text2); } matchMaker.baseUri = new Uri(text2); }
private static bool Prefix(MpTeam team, ref LevelData.SpawnPoint __result) { // Check mode, bail if not Anarchy or Team Anarchy. var mode = NetworkMatch.GetMode(); if (mode != MatchMode.ANARCHY && mode != MatchMode.TEAM_ANARCHY) { return(true); } var respawnPointCandidates = GetRespawnPointCandidates(team); if (respawnPointCandidates.Count == 0) { __result = (LevelData.SpawnPoint)_NetworkSpawnPoints_GetRandomRespawnPointWithoutFiltering_Method.Invoke(null, new object[] { }); } else if (NetworkManager.m_Players.Count == 0) { __result = respawnPointCandidates[UnityEngine.Random.Range(0, respawnPointCandidates.Count)]; } else { var scores = GetRespawnPointScores(team, respawnPointCandidates, true); __result = scores.OrderByDescending(s => s.Value).First().Key; } lastRespawn[__result] = DateTime.Now; return(false); }
private static void Postfix() { if (!GameplayManager.IsDedicatedServer()) { return; } Debug.Log("MPTweaksLoadScene"); RobotManager.ReadMultiplayerModeFile(); Debug.Log("MPTweaks loaded mode file"); var tweaks = new Dictionary <string, string>() { }; if (NetworkMatch.GetMode() == CTF.MatchModeCTF) { tweaks.Add("ctf.returntimer", CTF.ReturnTimeAmountDefault.ToStringInvariantCulture()); } if (!MPCustomModeFile.PickupCheck) { tweaks.Add("item.pickupcheck", Boolean.FalseString); } tweaks.Add("nocompress.reliable_timestamps", Boolean.TrueString); if (tweaks.Any()) { Debug.LogFormat("MPTweaks: sending tweaks {0}", tweaks.Join()); MPTweaks.Set(tweaks); MPTweaks.Send(); } }
public void Connect(string pass) { NetworkLobbyManager manager = GameObject.FindGameObjectWithTag("NetworkManager").GetComponent <NetworkLobbyManager>();; NetworkMatch match = manager.GetComponent <NetworkLobbyManager>().matchMaker; match.JoinMatch(ConnectGame.networkId, pass, manager.OnMatchJoined); }
private static bool Prefix(Projectile __instance, Collider other, float ___m_strength) { if (!other || other.isTrigger) { return(true); } var proj = __instance; if (NetworkMatch.GetMode() == MatchMode.MONSTERBALL && other.gameObject.layer == 31) { if (proj.m_owner_player) { MonsterballAddon.SetPlayer(proj.m_owner_player); } if (proj.m_type == ProjPrefab.proj_thunderbolt) { Vector3 vector = other.transform.position - proj.transform.position; other.attachedRigidbody.AddForce(vector.normalized * 340f * ___m_strength + vector.normalized * 60f, ForceMode.Impulse); ParticleElement particleElement = ParticleManager.psm[3].StartParticle((int)proj.m_death_particle_default, proj.c_transform.localPosition, proj.c_transform.localRotation, null, null, false); particleElement.SetExplosionOwner(proj.m_owner); particleElement.SetParticleScaleAndSimSpeed(1f + ___m_strength * 0.25f, 1f - ___m_strength * 0.15f); GameManager.m_audio.PlayCuePos(255, proj.c_transform.localPosition, 0.7f, UnityEngine.Random.Range(-0.15f, 0.15f), 0f, 1f); return(false); } } return(true); }
public static void UnlockWeaponEvent(WeaponType wt, Player __instance) { if (MenuManager.opt_primary_autoswitch == 0 && MPAutoSelection.primarySwapFlag) { if (GameplayManager.IsMultiplayerActive && NetworkMatch.InGameplay() && __instance == GameManager.m_local_player) { int new_weapon = getWeaponPriority(wt); int current_weapon = getWeaponPriority(GameManager.m_local_player.m_weapon_type); if (!PrimaryNeverSelect[new_weapon] && (new_weapon < current_weapon || (MPClassic.matchEnabled && GameManager.m_local_player.m_weapon_type.Equals(WeaponType.IMPULSE) && GameManager.m_local_player.m_weapon_level[0].Equals(WeaponUnlock.LEVEL_1)) // Specific impulse upgrade case for classic mod )) { if (!Controls.IsPressed(CCInput.FIRE_WEAPON)) { swapToWeapon(wt.ToString()); GameManager.m_local_player.UpdateCurrentWeaponName(); } else { waitingSwapWeaponType = wt.ToString(); } } } } }
public static void MaybeSubtractPointForTeam(MpTeam team) { if (NetworkMatch.GetMode() != MatchMode.MONSTERBALL && NetworkMatch.GetMode() != CTF.MatchModeCTF) { NetworkMatch.SubtractPointForTeam(team); } }
public static IEnumerator DelayedDisconnect(int connection_id, bool banned) { if (connection_id < NetworkServer.connections.Count && NetworkServer.connections[connection_id] != null) { NetworkConnection conn = NetworkServer.connections[connection_id]; if (NetworkMatch.GetMatchState() >= MatchState.PREGAME) { // Sending this command first prevents the client to load the scene // and getting into some inconsistend state NetworkServer.SendToClient(connection_id, CustomMsgType.MatchEnd, new IntegerMessage(0)); yield return(new WaitForSecondsRealtime(0.5f)); } // nicely tell the client to F**K OFF :) NetworkServer.SendToClient(connection_id, CustomMsgType.UnsupportedMatch, new StringMessage(String.Format("You {0} from this server", (banned)?"are BANNED":"were KICKED"))); yield return(new WaitForSecondsRealtime(0.5f)); // Fake client's OnDisconnect message NetworkMessage msg = new NetworkMessage(); msg.conn = conn; msg.msgType = 33; // Disconnect _Server_OnDisconnect_Method.Invoke(null, new object[] { msg }); // get rid of the client conn.Disconnect(); } }
private static void Prefix() { if (NetworkMatch.GetMode() == MatchMode.MONSTERBALL) { UnityEngine.Object.DestroyObject(NetworkMatch.m_monsterball); } }
private static bool Prefix() { if (!MPInternet.OldEnabled || MPInternet.ServerEnabled) { return(true); } string pwd = NetworkMatch.m_match_req_password; if (pwd == "") { var pmd = (PrivateMatchDataMessage)_NetworkMatch_m_private_data_Field.GetValue(null); pwd = pmd != null ? pmd.m_password : ""; } MPInternet.ServerAddress = MPInternet.FindPasswordAddress(pwd.Trim(), out string msg); if (MPInternet.ServerAddress == null) { Debug.Log("SwitchToLobbyMenu FindPasswordAddress failed " + msg); NetworkMatch.CreateGeneralUIPopup("INTERNET MATCH", msg, 1); //MenuManager.ChangeMenuState(MenuState.MP_LOCAL_MATCH, true); /* * MenuManager.m_menu_state = MenuState.MP_LOCAL_MATCH; * MenuManager.m_next_menu_state = MenuManager.m_menu_state; * UIManager.CreateUIElement(UIManager.SCREEN_CENTER, 7000, UIElementType.MP_MATCH_SETUP, Loc.LS("INTERNET MATCH")); * MenuManager.m_menu_sub_state = MenuSubState.ACTIVE; * MenuManager.m_menu_micro_state = NetworkMatch.m_match_req_password == "" ? 4 : 1; */ MenuManager.ClearMpStatus(); return(false); } MenuManager.m_mp_status = NetworkMatch.m_match_req_password == "" ? Loc.LS("CREATING INTERNET MATCH") : Loc.LS("JOINING INTERNET MATCH"); return(true); }
private static bool Prefix(int sender_connection_id, LobbyChatMessage msg) { MpTeam team = NetworkMatch.GetTeamFromLobbyData(sender_connection_id); MPChatCommand cmd = new MPChatCommand(msg.m_text, sender_connection_id, msg.m_sender_name, team, true); return(cmd.Execute()); }
public static JObject GetGameData() { return(JObject.FromObject(new { creator = NetworkMatch.m_name.Split('\0')[0], forceModifier1 = NetworkMatch.m_force_modifier1 == 4 ? "OFF" : Player.GetMpModifierName(NetworkMatch.m_force_modifier1, true), forceModifier2 = NetworkMatch.m_force_modifier2 == 4 ? "OFF" : Player.GetMpModifierName(NetworkMatch.m_force_modifier2, false), forceMissile1 = NetworkMatch.m_force_m1.ToString()?.Replace('_', ' '), forceMissile2 = NetworkMatch.m_force_m2 == MissileType.NUM ? "NONE" : NetworkMatch.m_force_m2.ToString()?.Replace('_', ' '), forceWeapon1 = NetworkMatch.m_force_w1.ToString(), forceWeapon2 = NetworkMatch.m_force_w2 == WeaponType.NUM ? "NONE" : NetworkMatch.m_force_w2.ToString(), forceLoadout = MenuManager.GetToggleSetting(NetworkMatch.m_force_loadout), powerupFilterBitmask = NetworkMatch.m_powerup_filter_bitmask, powerupBigSpawn = GetPowerupBigSpawnString(NetworkMatch.m_powerup_big_spawn), powerupInitial = GetPowerupInitialString(NetworkMatch.m_powerup_initial), turnSpeedLimit = GetTurnSpeedLimitString(NetworkMatch.m_turn_speed_limit), powerupSpawn = GetPowerupSpawnString(NetworkMatch.m_powerup_spawn), friendlyFire = NetworkMatch.m_team_damage, matchMode = GetMatchModeString(NetworkMatch.GetMode()), maxPlayers = NetworkMatch.GetMaxPlayersForMatch(), showEnemyNames = NetworkMatch.m_show_enemy_names.ToString()?.Replace('_', ' '), timeLimit = NetworkMatch.m_match_time_limit_seconds, scoreLimit = NetworkMatch.m_match_score_limit, respawnTimeSeconds = NetworkMatch.m_respawn_time_seconds, respawnShieldTimeSeconds = NetworkMatch.m_respawn_shield_seconds, level = GetCurrentLevelName(), joinInProgress = MPJoinInProgress.NetworkMatchEnabled, rearViewAllowed = RearView.MPNetworkMatchEnabled, teamCount = MPTeams.NetworkMatchTeamCount, players = NetworkMatch.m_players.Values.Where(x => !x.m_name.StartsWith("OBSERVER")).Select(x => x.m_name), hasPassword = MPModPrivateData.HasPassword, matchNotes = MPModPrivateData.MatchNotes //Overload.NetworkManager.m_Players.Where(x => !x.m_spectator).Select(x => x.m_mp_name) })); }
// Execute END command public bool DoEnd() { Debug.Log("END request via chat command"); ReturnTo(String.Format("manual match END request by {0}", senderEntry.name)); NetworkMatch.End(); return(false); }
private static void Postfix() { var isMonsterball = NetworkMatch.GetMode() == MatchMode.MONSTERBALL; Physics.IgnoreLayerCollision(31, (int)Overload.UnityObjectLayers.ITEMS, isMonsterball); Physics.IgnoreLayerCollision(31, (int)Overload.UnityObjectLayers.ITEM_LEVEL, isMonsterball); }
static void Postfix(PlayerShip __instance) { if (NetworkMatch.InGameplay()) { __instance.gameObject.SetActive(false); RUtility.DestroyGameObjectDelayed(__instance.gameObject, true, 0); } }
void Awake() { nameText = nameObject.GetComponent<Text>(); nm = GameObject.FindGameObjectWithTag("NetworkManager").GetComponent<NetworkManager>(); if(nm.matchMaker == null) nm.StartMatchMaker(); networkMatch = nm.matchMaker.GetComponent<NetworkMatch>(); }
void Awake() { networkMatch = gameObject.AddComponent<NetworkMatch>(); networkDiscovery = gameObject.AddComponent<OverriddenNetworkDiscovery>(); networkDiscovery.showGUI = false; //networkDiscovery.useNetworkManager = false; networkDiscovery.Initialize(); }
void Awake() { nm = GameObject.FindGameObjectWithTag("NetworkManager").GetComponent<NetworkManager>(); if (nm.matchMaker == null) nm.StartMatchMaker(); networkMatch = nm.matchMaker.GetComponent<NetworkMatch>(); menuSelector = GetComponent<MenuSelector>(); networkMatch.ListMatches(0, 20, "", OnMatchList); }
//[SerializeField] public Camera PlayerCam; void Update() { if(networkMatch == null) { var nm = GetComponent<NetworkMatch>(); if (nm != null) { networkMatch = nm as NetworkMatch; UnityEngine.Networking.Types.AppID appid = (UnityEngine.Networking.Types.AppID)339051; networkMatch.SetProgramAppID(appid); } } }
void Awake() { networkMatch = gameObject.AddComponent<NetworkMatch>(); //immediately make a room CreateMatchRequest create = new CreateMatchRequest(); create.name = "NewRoom"; create.size = 4; create.advertise = true; create.password = ""; networkMatch.CreateMatch(create, OnMatchCreate); }
void Start() { //NetworkManager_Custom取得 manager_ = GetComponent<NetworkManager_Custom>(); Debug.Log(manager_); //マッチメイクの準備 Debug.Log("Start Match Maker"); manager_.StartMatchMaker(); manager_.matchName = matchName; manager_.matchSize = matchSize; match_ = manager_.matchMaker; }
void OnGUI() { if (GUI.Button (new Rect (250, 20, 200, 20), "Create Room")) { //CreateMatchRequest: UNETにマッチメイキングを作らせるためのJSONオブジェクト CreateMatchRequest create = new CreateMatchRequest (); //部屋名 create.name = "NewRoom"; //人数 create.size = 4; //部屋ができたことを知らせるか? create.advertise = true; //パスワード create.password = ""; networkMatch = manager.matchMaker; //CreateMatch: create情報を持って、部屋を作ろうとしている //情報を元に部屋を作り、ホストとして実行 networkMatch.CreateMatch(create, NetworkManager.singleton.OnMatchCreate); } }
void Start() { manager = GetComponent<NetworkManager>(); manager.StartMatchMaker(); matcher = manager.matchMaker; matcher.ListMatches(0, ListSize, "", (matches) => { if (matches.success) { if (matches.matches.Count > 0 && !OnlyHost) { matcher.JoinMatch(matches.matches[0].networkId, "", (join) => { if (join.success) { Utility.SetAccessTokenForNetwork(join.networkId, new NetworkAccessToken(join.accessTokenString)); NetworkClient client = new NetworkClient(); client.RegisterHandler(MsgType.Connect, (connected) => { Debug.Log("Connected"); }); client.Connect(new MatchInfo(join)); manager.StartClient(); } else { Debug.LogError("Could not join match"); } }); } else { matcher.CreateMatch(URandom.value.ToString(), PlayerCountPerRoom, Advertise, "", (created) => { if (created.success) { Debug.Log("Create match succeeded"); Utility.SetAccessTokenForNetwork(created.networkId, new NetworkAccessToken(created.accessTokenString)); NetworkServer.Listen(new MatchInfo(created), 9000); manager.StartHost(); isHost = true; } else { Debug.LogError("Could not create match"); } }); } } else { Debug.LogError("Could not recieve list of matchces"); } }); }
void Update() { if (Input.GetKeyDown(KeyCode.Alpha1)) { Debug.Log("Start Match Maker"); manager_.StartMatchMaker(); manager_.matchName = matchName; manager_.matchSize = matchSize; match_ = manager_.matchMaker; } if (match_ != null && Input.GetKeyDown(KeyCode.Alpha2)) { match_.CreateMatch(manager_.matchName, manager_.matchSize, true, "", manager_.OnMatchCreate); } if (match_ != null && Input.GetKeyDown(KeyCode.Alpha3)) { Debug.Log("List Matches"); match_.ListMatches(0, 20, "", manager_.OnMatchList); } if (match_ != null && Input.GetKeyDown(KeyCode.Alpha4)) { Debug.Log("Join Match"); var desc = manager_.matches[0]; // join first room match_.JoinMatch(desc.networkId, "", manager_.OnMatchJoined); // match_.JoinMatch(desc.networkId, "", OnMatchJoinedAsClient); } }
public InGameHostState(NetworkManager networkManager, NetworkMatch networkMatch) : base(networkManager, networkMatch) { }
void Start() { manager = NetworkManager.singleton; networkMatch = gameObject.AddComponent<NetworkMatch>(); }
void Awake() { networkMatch = gameObject.AddComponent<NetworkMatch>(); InvokeRepeating ("ListRooms", 1, 5); }
void Update() { if (string.Equals (Application.loadedLevelName.ToString (), "Main")) { HideMenu (); } else { CG.alpha = 1; } if(networkMatch == null) { var nm = GetComponent<NetworkMatch>(); if (nm != null) { networkMatch = nm as NetworkMatch; UnityEngine.Networking.Types.AppID appid = (UnityEngine.Networking.Types.AppID)339051; networkMatch.SetProgramAppID(appid); } } }
/// <summary> /// <para>Stops the matchmaker that the NetworkManager is using.</para> /// </summary> public void StopMatchMaker() { if ((UnityEngine.Object) this.matchMaker != (UnityEngine.Object) null) { UnityEngine.Object.Destroy((UnityEngine.Object) this.matchMaker); this.matchMaker = (NetworkMatch) null; } this.matchInfo = (MatchInfo) null; this.matches = (List<MatchDesc>) null; }
private void Start() { this.networkManager = this.GetComponent<NetworkManager>(); this.networkMatch = this.gameObject.AddComponent<NetworkMatch>(); this.state = new CreateOrJoinGameState(this.networkManager, this.networkMatch); }
public CreateOrJoinGameState(NetworkManager networkManager, NetworkMatch networkMatch) : base(networkManager, networkMatch) { this.UpdateMatchList(); }
void OnDestroyMatch(BasicResponse response) { Debug.Log ("OnDestroyMatch()"); networkLobbyManager.StopClient (); NetworkServer.Reset(); match = null; switchState(nextState); }
void OnConnectionDrop(BasicResponse response) { Debug.Log ("OnConnectionDrop()"); networkLobbyManager.StopClient (); NetworkServer.Reset(); match = null; switchState(nextState); }
public void StopMatchMaker() { if (this.matchMaker != null) { UnityEngine.Object.Destroy(this.matchMaker); this.matchMaker = null; } this.matchInfo = null; this.matches = null; }
public void SetMatchHost(string newHost, int port, bool https) { if (this.matchMaker == null) { this.matchMaker = base.gameObject.AddComponent<NetworkMatch>(); } if ((newHost == "localhost") || (newHost == "127.0.0.1")) { newHost = Environment.MachineName; } string str = "http://"; if (https) { str = "https://"; } if (LogFilter.logDebug) { Debug.Log("SetMatchHost:" + newHost); } this.m_MatchHost = newHost; this.m_MatchPort = port; object[] objArray1 = new object[] { str, this.m_MatchHost, ":", this.m_MatchPort }; this.matchMaker.baseUri = new Uri(string.Concat(objArray1)); }
/// <summary> /// /// <para> /// This set the address of the matchmaker service. /// </para> /// /// </summary> /// <param name="newHost">Hostname of matchmaker service.</param><param name="port">Port of matchmaker service.</param><param name="https">Protocol used by matchmaker service.</param> public void SetMatchHost(string newHost, int port, bool https) { // this should populate the NetworkMatch singleton property, attaching a NetworkMatch component(not publicly available to add yourself) // to this NetworkManager.. the NetworkManager public matchMaker property is then set by it. This is how you interact/reference the match making service // through the NetManager now, like the public manager client property for example after it is set up // you can then call the Join/Create/List NetworkMatch functions on the managers matchMaker singleton if ((UnityEngine.Object) this.matchMaker == (UnityEngine.Object) null) this.matchMaker = this.gameObject.AddComponent<NetworkMatch>(); // this is currently set to the url for the Unity match making service, not sure when/why it would be localhost // maybe something in the future if (newHost == "localhost" || newHost == "127.0.0.1") newHost = Environment.MachineName; if (LogFilter.logDebug) Debug.Log((object) ("SetMatchHost:" + newHost)); // both are currently just set to what they already were, default unity match making service url/port this.m_MatchHost = newHost; this.m_MatchPort = port; // Not sure what the rest of this method is for.. why create a copy, set its uri, and do nothing with it? #region NetworkMatch networkMatch = this.matchMaker; string str1 = "http://"; if (https) str1 = "https://"; // piece together the uri for the match maker service object[] objArray = new object[4]; int index1 = 0; string str2 = str1; objArray[index1] = (object) str2; int index2 = 1; string str3 = this.m_MatchHost; objArray[index2] = (object) str3; int index3 = 2; string str4 = ":"; objArray[index3] = (object) str4; int index4 = 3; // ISSUE: variable of a boxed type __Boxed<int> local = (ValueType) this.m_MatchPort; objArray[index4] = (object) local; Uri uri = new Uri(string.Concat(objArray)); networkMatch.baseUri = uri; #endregion }
// Use this for initialization void Start() { NetworkManager.singleton.StartMatchMaker(); networkMatch = NetworkManager.singleton.matchMaker; networkMatch.SetProgramAppID((AppID)379051); gameCode = ""; }
/// <summary> /// <para>This set the address of the matchmaker service.</para> /// </summary> /// <param name="newHost">Hostname of matchmaker service.</param> /// <param name="port">Port of matchmaker service.</param> /// <param name="https">Protocol used by matchmaker service.</param> public void SetMatchHost(string newHost, int port, bool https) { if ((UnityEngine.Object) this.matchMaker == (UnityEngine.Object) null) this.matchMaker = this.gameObject.AddComponent<NetworkMatch>(); if (newHost == "localhost" || newHost == "127.0.0.1") newHost = Environment.MachineName; string str = "http://"; if (https) str = "https://"; if (LogFilter.logDebug) Debug.Log((object) ("SetMatchHost:" + newHost)); this.m_MatchHost = newHost; this.m_MatchPort = port; this.matchMaker.baseUri = new Uri(str + this.m_MatchHost + ":" + (object) this.m_MatchPort); }
public WaitForJoinGameState(NetworkManager networkManager, NetworkMatch networkMatch) : base(networkManager, networkMatch) { }
void Awake() { nm = GameObject.Find ("Network Manager").GetComponent<NetworkManager> (); nm.StartMatchMaker (); networkMatch = nm.matchMaker; }
public State(NetworkManager networkManager, NetworkMatch networkMatch) { this.networkManager = networkManager; this.networkMatch = networkMatch; }
private void Awake() { foreach (Font font in fonts) font.material.mainTexture.filterMode = FilterMode.Point; tutorialObject.SetActive(false); match = gameObject.AddComponent<NetworkMatch>(); match.baseUri = new System.Uri("https://eu1-mm.unet.unity3d.com"); enterButton.onClick.AddListener(OnClickedEnter); worlds = new MonoBehaviourPooler<GameListing, WorldPanel>(worldPrefab, worldContainer, InitialiseWorld); Application.runInBackground = true; StartCoroutine(SendMessages()); avatarGraphic = BlankTexture.New(32, 32, Color.clear); ResetAvatar(); chatOverlay.Setup(chats, message => { tutorialChat.SetActive(false); SendAll(ChatMessage(worldView.viewer, message)); Chat(worldView.viewer, message); }); customiseTab.Setup(tileEditor, BlankTexture.FullSprite(avatarGraphic), SaveConfig, ResetAvatar); LoadConfig(); mapTextureLocal = new Texture2D(1024, 1024); ipOpen.onClick.AddListener(() => { ipObject.SetActive(true); ipInput.text = ""; }); ipAccept.onClick.AddListener(() => { PreConnect(); ConnectThroughLAN(ipInput.text); ipObject.SetActive(false); } ); ipCancel.onClick.AddListener(() => ipObject.SetActive(false)); }
public void OnSwitchToOnline() { Debug.Log ("OnSwitchToOnline()"); networkLobbyManager.StartMatchMaker(); match = networkLobbyManager.matchMaker; }
void Awake() { networkMatch = gameObject.AddComponent<NetworkMatch>(); }
public void OnMatchList(ListMatchResponse matchListResponse, NetworkMatch networkMatch, NetworkMatch.ResponseDelegate<JoinMatchResponse> OnMatchJoined) { foreach (MatchDesc md in matchListResponse.matches) { GameObject newButton = GameObject.Instantiate(joinButtonPrefab); newButton.transform.parent = joinGameUI.transform; newButton.transform.localPosition = new Vector2(newButton.transform.position.x, joinListY); newButton.GetComponentInChildren<Text>().text = md.name; newButton.GetComponent<Button>().onClick.AddListener(() => { networkMatch.JoinMatch(md.networkId, "", OnMatchJoined); }); joinListY -= 20; joinGameButtons.Add(newButton); } }