public override void processMessage(NetWorker.Utilities.RawMessage message, User user) { if(user.userState == User.UserState.GAME) { StatTracker statTracker = user.player.game.statTracker; List<Player> recievers = new List<Player>(); recievers.Add(user.player); for (int i = 0; i < user.player.game.statPlayers.Count; i++ ) { if(user.player.game.statPlayers[i] != null) { for (int j = 0; j < statTracker.playerStatsList.Count; j++ ) { if(user.player == statTracker.playerStatsList[j].ownerPlayer) { statTracker.playerStatsList[j].income = user.player.income; statTracker.playerStatsList[j].cash = user.player.cash; break; } } } } OutgoingMessages.Game.GEndGameStatisticsResult.sendMessage(recievers, statTracker); } }
public override void processMessage(NetWorker.Utilities.RawMessage message) { Player p = Engine.Game.getUserById(message.getInt("uid")).player; if(p!= null) Engine.Game.setPlayerHealth(p, message.getInt("h")); }
public override void processMessage(NetWorker.Utilities.RawMessage message) { int minionInstanceId = message.getInt("miid"); int boardId = message.getInt("tbid"); int towerIndexOnBoard = message.getInt("tiob"); Minion minion = Engine.Game.getMinionById(minionInstanceId); if (minion == null) { Debug.Log("LaserTower: targetlanacak minion oyunda yok!"); return; } Board board = Engine.Game.getBoardById(boardId); if( board != null && board.towers.Length > towerIndexOnBoard && towerIndexOnBoard >= 0) { Tower tower = board.towers[towerIndexOnBoard]; if (tower != null && tower is LaserTower) { Runner.Graphics.tower_laserTower_target((LaserTower)tower, minion); } } }
public override void processMessage(NetWorker.Utilities.RawMessage message) { Minion minion = Engine.Game.getMinionById(message.getInt("iid")); Minion minionToHookTo = Engine.Game.getMinionById(message.getInt("tiid")); if (minion != null && minionToHookTo != null && minion is RoboHookMinion) ((RoboHookMinion)minion).hook(minionToHookTo); }
/// <summary> /// Add a NetWorker to this list /// </summary> /// <param name="netWorker"></param> public static void AddNetWorker(NetWorker netWorker) { if (Instance == null || NetWorkers == null) NetWorkers = new List<NetWorker>(); if (!NetWorkers.Contains(netWorker)) NetWorkers.Add(netWorker); }
/// <summary> /// Add a NetWorker to this list /// </summary> /// <param name="netWorker"></param> public static void AddNetWorker(NetWorker netWorker) { if (ReferenceEquals(Instance, null) || NetWorkers == null) NetWorkers = new List<NetWorker>(); if (!NetWorkers.Contains(netWorker)) NetWorkers.Add(netWorker); }
public override void processMessage(NetWorker.Utilities.RawMessage message) { int cash = message.getInt("c"); int income = message.getInt("i"); PlayerMe.cash = cash; PlayerMe.income = income; Runner.Graphics.updateCashAndIncome(); }
public override void processMessage(NetWorker.Utilities.RawMessage message) { Board board = Engine.Game.getBoardById(message.getInt("bid")); Tower tower = board.towers[message.getInt("iob")]; ITowerEffect effect = (ITowerEffect) Activator.CreateInstance(TypeIdGenerator.getTowerEffectClass(message.getInt("tid"))); if (tower != null) tower.effects.AddLast(effect); }
public override void processMessage(NetWorker.Utilities.RawMessage message) { int minionInstanceId = message.getInt("miid"); int boardId = message.getInt("tbid"); int towerIndexOnBoard = message.getInt("tiob"); Minion minion = Engine.Game.getMinionById(minionInstanceId); DroseraTower tower = (DroseraTower)Engine.Game.getBoardById(boardId).towers[towerIndexOnBoard]; Runner.Graphics.tower_droseraTower_bite(tower, minion); }
public override void processMessage(NetWorker.Utilities.RawMessage message) { Tower tower = (Tower)System.Activator.CreateInstance( TypeIdGenerator.getTowerType( message.getInt("tid"))); tower.indexOnBoard = message.getInt("iob"); Board board = Assets.Scripts.Engine.Game.getBoardById( message.getInt ("bid")); if( board.AddTower(tower,tower.indexOnBoard)) Runner.Graphics.createTower(tower); }
public override void processMessage(NetWorker.Utilities.RawMessage message, User user) { if (user.userState == User.UserState.QUEUE) { LCancelQueueResult.sendMessage(user, true); Runner.queue.removeUser(user); } else LCancelQueueResult.sendMessage(user, false); }
public override void processMessage(NetWorker.Utilities.RawMessage message) { Minion minion = Engine.Game.getMinionById(message.getInt("iid")); MinionEffect effect = (MinionEffect) Activator.CreateInstance(TypeIdGenerator.getMinionEffectClass(message.getInt("tid"))); if (minion != null) { minion.effects.AddLast(effect); Runner.Graphics.addMinionEffect(minion, effect); } }
public override void processMessage(NetWorker.Utilities.RawMessage message, User user) { if (user.userState == User.UserState.LOBBY) { LEnterQueueResult.sendMessage(user, true); string qType = message.getUTF8String("st"); user.selectedScienceTypeInQueue = (ScienceType) Enum.Parse(typeof(ScienceType), qType, true); Runner.queue.addUser(user); } else LEnterQueueResult.sendMessage(user, false); }
public override void processMessage(NetWorker.Utilities.RawMessage message) { Minion minion = Engine.Game.getMinionById(message.getInt("iid")); float slowAmount = message.getFloat ("sa"); NailTrapSlowEffect effect = new NailTrapSlowEffect (slowAmount); if (minion != null) { minion.effects.AddLast(effect); Runner.Graphics.addMinionEffect(minion, effect); } }
public override void processMessage(NetWorker.Utilities.RawMessage message) { Minion minion = Engine.Game.getMinionById(message.getInt("iid")); if (minion != null) { minion.minionState = Minion.MinionState.ALIVE; minion.stats.health = 264; minion.stats.baseMovementSpeed = 1.1f; Runner.Graphics.minion_zombie_raise((ZombieMinion)minion); } }
public override void processMessage(NetWorker.Utilities.RawMessage message) { Minion minion = Engine.Game.getMinionById(message.getInt("iid")); float runBackTime = message.getFloat("t"); TrypanophobiaEffect effect = new TrypanophobiaEffect(runBackTime); if (minion != null) { minion.effects.AddLast(effect); Runner.Graphics.addMinionEffect(minion, effect); } }
public override void processMessage(NetWorker.Utilities.RawMessage message) { Minion minion = Engine.Game.getMinionById(message.getInt("iid")); Board board = Engine.Game.getBoardById(message.getInt("bid")); if (board != null && minion != null && !board.minions.ContainsKey(minion.instanceId)) board.AddMinion(minion); if (minion != null) { minion.position.pathPosition.pointIndex = message.getInt("cid"); minion.position.pathPosition.ratio = message.getFloat("t"); } }
public override void processMessage(NetWorker.Utilities.RawMessage message) { int instanceId = message.getInt("iid"); int typeId = message.getInt("tid"); User ownerUser = Engine.Game.getUserById(message.getInt("uid")); float[] position = message.getFloatArray("pos"); if (ownerUser != null) { AreaEffect areaEffect = (AreaEffect)Activator.CreateInstance(TypeIdGenerator.getAreaEffectClass(typeId), instanceId, ownerUser.player, new Vector3(position[0],position[1],position[2])); Engine.Game.AddAreaEffect(areaEffect); Runner.Graphics.createAreaEffect(areaEffect); } }
public override void processMessage(NetWorker.Utilities.RawMessage message) { int instanceId = message.getInt("iid"); int[] minionIds = message.getIntArray("miid"); for (int i = 0; i < minionIds.Length; i++) { Minion m = Engine.Game.getMinionById(minionIds[i]); if (m != null) { Runner.Graphics.tower_blackHoleTower_teleportStart(m); m.moveCustomDistance(-2.0f); Runner.Graphics.tower_blackHoleTower_teleportEnd(m); } } }
public override void processMessage(NetWorker.Utilities.RawMessage message) { int instanceId = message.getInt("iid"); int typeId = message.getInt("tid"); User ownerUser = Engine.Game.getUserById(message.getInt("uid")); float[] position = message.getFloatArray("pos"); float dmgPerSecond = message.getFloat ("dps"); float slowAmount = message.getFloat ("sa"); if (ownerUser != null) { NailTrapAreaEffect areaEffect = new NailTrapAreaEffect(instanceId,ownerUser.player,new Vector3(position[0],position[1],position[2]),slowAmount,dmgPerSecond); Engine.Game.AddAreaEffect(areaEffect); Runner.Graphics.createAreaEffect(areaEffect); } }
public override void processMessage(NetWorker.Utilities.RawMessage message) { int minionInstanceId = message.getInt("miid"); int boardId = message.getInt("tbid"); int towerIndexOnBoard = message.getInt("tiob"); Board board = Engine.Game.getBoardById(boardId); if( board != null && board.towers.Length > towerIndexOnBoard && towerIndexOnBoard >= 0) { Tower tower = board.towers[towerIndexOnBoard]; if (tower != null && tower is LaserTower) { Runner.Graphics.tower_laserTower_untarget((LaserTower)tower, minionInstanceId); } } }
public override void processMessage(NetWorker.Utilities.RawMessage message) { Minion minion = Engine.Game.getMinionById(message.getInt("iid")); if (minion != null && minion is QuantumSoldierMinion) { ((QuantumSoldierMinion)minion).teleport(); Runner.Graphics.minion_quantumSoldier_teleport(minion); } int[] minionInstanceIDs = message.getIntArray("mids"); float dist = message.getFloat("ds"); for(int i = 0; i < minionInstanceIDs.Length; i++) { Minion minionToTp = Engine.Game.getMinionById(minionInstanceIDs[i]); minionToTp.moveCustomDistance(dist); } }
public override void processMessage(NetWorker.Utilities.RawMessage message, User user) { int nodetypeid = message.getInt("tid"); // Get type of science node to access its ScienceNode instance. // Find parent of it and check if the user has already unlocked it or not. // If successfull access database and change it. try { Type nodeType = TypeIdGenerator.getScienceNodeTypes(nodetypeid); ScienceNode newNode = ScienceTrees.ScienceNodes.ScienceNode.scienceNodeInst[nodeType]; //int parentNodeId = TypeIdGenerator.getScienceNodeIds(newNode.parent.GetType()); //if (user.unlockedScienceNodes[parentNodeId] && !user.unlockedScienceNodes[nodetypeid] ) if (!user.unlockedScienceNodes[nodetypeid]) { // TODO: try to spend science points user.unlockedScienceNodes[nodetypeid] = true; bool[] unlockedScienceNodesWithDdId = new bool[user.unlockedScienceNodes.Length]; for (int i = 0; i < user.unlockedScienceNodes.Length; i++ ) { Type tmpNodeType = TypeIdGenerator.getScienceNodeTypes(i); ScienceNode tmpNode = ScienceTrees.ScienceNodes.ScienceNode.scienceNodeInst[tmpNodeType]; int tmpDbId = ScienceNode.scienceNodeDbIds[tmpNode]; if (user.unlockedScienceNodes[i]) unlockedScienceNodesWithDdId[tmpDbId] = true; else unlockedScienceNodesWithDdId[tmpDbId] = false; } newNode.unlock(user); Runner.dal.openScienceNode(user.id, unlockedScienceNodesWithDdId); LUnlockNodeResult.sendMessage(user, true); } else LUnlockNodeResult.sendMessage(user,false); } catch { LUnlockNodeResult.sendMessage(user,false); } }
public override void processMessage(NetWorker.Utilities.RawMessage message, User user) { if (user.userState == User.UserState.GAME && user.player != null) { user.player.loadedTheGame = true; bool allLoaded = true; foreach (var player in user.player.game.players) { if (player.loadedTheGame == false) { allLoaded = false; break; } } if (allLoaded) { user.player.game.setState( Science_Wars_Server.Game.GameState.STARTCOUNTDOWN); } } }
public override void processMessage(NetWorker.Utilities.RawMessage message, User user) { if (user.player != null && user.player.playerState == Player.PlayerState.ALIVE && // player hayatta mi (user.player.game.gameState == Science_Wars_Server.Game.GameState.PLAYTIME || // oyun playtime da mi user.player.game.gameState == Science_Wars_Server.Game.GameState.STARTCOUNTDOWN))// oyun startcountdownda mi { int typeId = message.getInt("tid"); int indexOnBoard = message.getInt("iob"); if( typeId < 0 || user.unlockedTowers.Length < typeId) //typeId valid? return; if (indexOnBoard < 0 || indexOnBoard > user.player.board.towers.Length - 1) // indexOnBoard valid? return; if (checkScienceTypeOfTower(typeId, user.player.getScienceType()) == false) // player'in oyun basinda sectigi science'a ait bir kule mi bu? return; if ( user.unlockedTowers[typeId] == true // bu kule unlocklanmis mi? && user.player.board.towers[indexOnBoard] == null) // bu slotta baska kule var mi? { Tower tower = (Tower) Activator.CreateInstance(TypeIdGenerator.getTowerType(typeId), user.player.board, indexOnBoard); if (user.player.trySpendCash(tower.getCost()) && user.player.board.AddTower(tower, indexOnBoard)) { // STATCODE PlayerStats pStats = user.player.game.statTracker.getPlayerStatsOfPlayer(user.player); pStats.towersBuilt += 1; OutgoingMessages.Game.GCreateTowerResult.sendMessage(user.player.game.players, tower); OutgoingMessages.Game.GCashAndIncomeInfo.sendMessage(user.player); } } } }
public override void processMessage(NetWorker.Utilities.RawMessage message, User user) { if (user.player != null && user.player.playerState == Player.PlayerState.ALIVE && // player hayatta mi (user.player.game.gameState == Science_Wars_Server.Game.GameState.PLAYTIME || // oyun playtime da mi user.player.game.gameState == Science_Wars_Server.Game.GameState.STARTCOUNTDOWN))// oyun startcountdownda mi { int newTowerTypeId = message.getInt("tid"); int indexOnBoard = message.getInt("iob"); if( newTowerTypeId < 0 || user.unlockedTowers.Length < newTowerTypeId) //typeId valid? return; if (indexOnBoard < 0 || indexOnBoard > user.player.board.towers.Length - 1) // indexOnBoard valid? return; Tower oldTower = user.player.board.towers[indexOnBoard]; if ( oldTower == null) // upgrade edilmek istenen noktada bir kule var mi. ( havayi mi upgrade edeceksin essoglu essek ) return; if (checkIfTowerUpgradableTo( TypeIdGenerator.getTowerId(oldTower.GetType()), TypeIdGenerator.getTowerType(newTowerTypeId) ) == false) // bu kule, istenen turdeki kuleye upgrade edilebilir mi? return; if ( user.unlockedTowers[newTowerTypeId] == true )// bu kule unlocklanmis mi? { Tower tower = (Tower) Activator.CreateInstance(TypeIdGenerator.getTowerType(newTowerTypeId), user.player.board, indexOnBoard); if (user.player.trySpendCash(tower.getCost()) && user.player.board.AddTower(tower, indexOnBoard)) { OutgoingMessages.Game.GUpgradeTowerResult.sendMessage(user.player.game.players, tower, newTowerTypeId); OutgoingMessages.Game.GCashAndIncomeInfo.sendMessage(user.player); } } } }
private void DestroyGameObject(NetWorker sender) { MainThreadManager.Run(() => { try { Destroy(gameObject); } catch { } }); networkObject.onDestroy -= DestroyGameObject; }
private void RemoveSocketReference() { socket = null; Networking.NetworkReset -= RemoveSocketReference; }
public RobotManagerNetworkObject(NetWorker networker, uint serverId, FrameStream frame) : base(networker, serverId, frame) { Initialize(); }
protected override void Connected(NetWorker networker) { base.Connected(networker); //if (networker is IServer) // NetworkObject.Flush(networker); }
private void PingReceived(double ping, NetWorker sender) { Debug.Log("Ping Received: " + ping); }
public ExampleProximityPlayerNetworkObject(NetWorker networker, INetworkBehavior networkBehavior = null, int createCode = 0, byte[] metadata = null) : base(networker, networkBehavior, createCode, metadata) { Initialize(); }
public TowerUIEntityNetworkObject(NetWorker networker, INetworkBehavior networkBehavior = null, int createCode = 0, byte[] metadata = null) : base(networker, networkBehavior, createCode, metadata) { Initialize(); }
public override NetworkObject CreateNetworkObject(NetWorker networker, int createCode, byte[] metadata = null) { return(new RandomMovingNPCNetworkObject(networker, this, createCode, metadata)); }
private void OnPingPong(double ping, NetWorker sender) { RoundTripLatency = ping; }
public ZfBaseRPCMoveCubeNetworkObject(NetWorker networker, INetworkBehavior networkBehavior = null, int createCode = 0, byte[] metadata = null) : base(networker, networkBehavior, createCode, metadata) { Initialize(); }
public ZfBaseRPCMoveCubeNetworkObject(NetWorker networker, uint serverId, FrameStream frame) : base(networker, serverId, frame) { Initialize(); }
public void Refresh() { // Clear out all the currently listed servers for (int i = content.childCount - 1; i >= 0; --i) { Destroy(content.GetChild(i).gameObject); } // The Master Server communicates over TCP client = new TCPMasterClient(); // Once this client has been accepted by the master server it should sent it's get request client.serverAccepted += () => { try { // Create the get request with the desired filters JSONNode sendData = JSONNode.Parse("{}"); JSONClass getData = new JSONClass(); getData.Add("id", gameId); getData.Add("type", gameType); getData.Add("mode", gameMode); sendData.Add("get", getData); // Send the request to the server client.Send(Frame.Text.CreateFromString(client.Time.Timestep, sendData.ToString(), true, Receivers.Server, MessageGroupIds.MASTER_SERVER_GET, true)); } catch { // If anything fails, then this client needs to be disconnected client.Disconnect(true); client = null; } }; // An event that is raised when the server responds with hosts client.textMessageReceived += (player, frame) => { try { // Get the list of hosts to iterate through from the frame payload JSONNode data = JSONNode.Parse(frame.ToString()); if (data["hosts"] != null) { MasterServerResponse response = new MasterServerResponse(data["hosts"].AsArray); if (response != null && response.serverResponse.Count > 0) { // Go through all of the available hosts and add them to the server browser foreach (MasterServerResponse.Server server in response.serverResponse) { string protocol = server.Protocol; string address = server.Address; ushort port = server.Port; string name = server.Name; // name, address, port, comment, type, mode, players, maxPlayers, protocol CreateServerOption(name, () => { // Determine which protocol should be used when this client connects NetWorker socket = null; if (protocol == "udp") { // TODO: Add NAT hole punching server socket = new UDPClient(); ((UDPClient)socket).Connect(address, port); } else if (protocol == "tcp") { socket = new TCPClient(); ((TCPClient)socket).Connect(address, port); } else if (protocol == "web") { socket = new TCPClientWebsockets(); ((TCPClientWebsockets)socket).Connect(address, port); } if (socket == null) { throw new Exception("No socket of type " + protocol + " could be established"); } Connected(socket); }); } } } } finally { if (client != null) { // If we succeed or fail the client needs to disconnect from the Master Server client.Disconnect(true); client = null; } } }; client.Connect(masterServerHost, (ushort)masterServerPort); }
public UDPNetworkingPlayer(uint networkId, string ip, bool isHost, object socketEndpoint, NetWorker networker) : base(networkId, ip, isHost, socketEndpoint, networker) { PacketManager = new UDPPacketManager(); }
public override NetworkObject CreateNetworkObject(NetWorker networker, int createCode, byte[] metadata = null) { return(new InputListenerPlayerNetworkObject(networker, this, createCode, metadata)); }
/// <summary> /// The callback for when a player is trying to connect to this server from /// the NAT server /// </summary> /// <param name="player">The NAT server player</param> /// <param name="frame">The data that the NAT server has sent for consumption</param> private void PlayerConnectRequestReceived(NetworkingPlayer player, Text frame, NetWorker sender) { Logging.BMSLog.Log("PLAYER CONNECTION REQUEST"); Logging.BMSLog.Log(frame.ToString()); try { // This is a Text frame with JSON so parse it all var json = JSON.Parse(frame.ToString()); // If this is a route from the NAT then read it if (json["nat"] != null) { Logging.BMSLog.Log("DOING NAT"); // These fields are required for this server to punch a hole for a client if (json["nat"]["host"] != null && json["nat"]["port"] != null) { string host = json["nat"]["host"]; ushort port = json["nat"]["port"].AsUShort; //Logging.BMSLog.Log($"HOST IS {host} AND PORT IS {port}"); // Fire the event that a client is trying to connect if (clientConnectAttempt != null) { clientConnectAttempt(host, port); } } } } catch { /* Ignore message */ } }
private void PlayerAccepted(NetworkingPlayer player, NetWorker sender) { MainThreadManager.Run(() => { networkObject.SendRpc(player, RPC_INITIALIZE_MAP, min, max, SerializeMap()); }); }
public WeaponPickupNetworkObject(NetWorker networker, uint serverId, FrameStream frame) : base(networker, serverId, frame) { Initialize(); }
public override NetworkObject CreateNetworkObject(NetWorker networker, int createCode, byte[] metadata = null) { return(new TowerUIEntityNetworkObject(networker, this, createCode, metadata)); }
public TowerUIEntityNetworkObject(NetWorker networker, uint serverId, FrameStream frame) : base(networker, serverId, frame) { Initialize(); }
public Cache(NetWorker socket) { Socket = socket; Socket.binaryMessageReceived += BinaryMessageReceived; }
public override void processMessage(NetWorker.Utilities.RawMessage message) { float payment = message.getFloat("s"); Engine.Game.setPaymentTime(payment); }
public CTFGameStateNetworkObject(NetWorker networker, INetworkBehavior networkBehavior = null, int createCode = 0, byte[] metadata = null) : base(networker, networkBehavior, createCode, metadata) { Initialize(); }
public override void processMessage(NetWorker.Utilities.RawMessage message) { Minion minion = Engine.Game.getMinionById(message.getInt("iid")); if(minion!=null) minion.destroyable = true; }
public ExampleProximityPlayerNetworkObject(NetWorker networker, uint serverId, FrameStream frame) : base(networker, serverId, frame) { Initialize(); }
public void onPlayerConnect(NetworkingPlayer player, NetWorker sender) { Debug.Log("player with ip " + player.Ip + "connected"); player.Name = ("client"); connectedPlayers.Add(player); }
public void TCPLocal() { socket = Networking.Connect("127.0.0.1", (ushort)port, protocolType, IsWinRT, useNatHolePunching); Go(); }
public override void processMessage(NetWorker.Utilities.RawMessage message) { float randomMinion = message.getFloat("s"); Engine.Game.setRandomMinionTime(randomMinion); }
private void NetworkerDisconnected(NetWorker sender) { Networker.disconnected -= NetworkerDisconnected; MasterServerNetworker.Disconnect(false); MasterServerNetworker = null; }
private void ReadBinary(NetworkingPlayer player, Binary frame, NetWorker sender) { if (frame.GroupId == MessageGroupIds.VIEW_INITIALIZE) { if (Networker is IServer) { return; } int count = frame.StreamData.GetBasicType <int>(); loadingScenes.Clear(); for (int i = 0; i < count; i++) { loadingScenes.Add(frame.StreamData.GetBasicType <int>()); } int[] scenesToLoad = loadingScenes.ToArray(); MainThreadManager.Run(() => { if (scenesToLoad.Length == 0) { return; } SceneManager.LoadScene(scenesToLoad[0], LoadSceneMode.Single); for (int i = 1; i < scenesToLoad.Length; i++) { SceneManager.LoadSceneAsync(scenesToLoad[i], LoadSceneMode.Additive); } }); return; } if (frame.GroupId != MessageGroupIds.VIEW_CHANGE) { return; } if (Networker.IsServer) { // The client has loaded the scene if (playerLoadedScene != null) { playerLoadedScene(player, Networker); } return; } int sceneIndex; LoadSceneMode mode; lock (NetworkObject.PendingCreatesLock) { // We need to halt the creation of network objects until we load the scene Networker.PendCreates = true; // Get the scene index that the server loaded sceneIndex = frame.StreamData.GetBasicType <int>(); // Get the mode in which the server loaded the scene int modeIndex = frame.StreamData.GetBasicType <int>(); // Convert the int mode to the enum mode mode = (LoadSceneMode)modeIndex; if (mode == LoadSceneMode.Single) { loadingScenes.Clear(); } loadingScenes.Add(sceneIndex); } if (networkSceneChanging != null) { networkSceneChanging(sceneIndex, mode); } MainThreadManager.Run(() => { // Load the scene that the server loaded in the same LoadSceneMode if (mode == LoadSceneMode.Additive) { SceneManager.LoadSceneAsync(sceneIndex, LoadSceneMode.Additive); } else if (mode == LoadSceneMode.Single) { SceneManager.LoadScene(sceneIndex, LoadSceneMode.Single); } }); }
public override NetworkObject CreateNetworkObject(NetWorker networker, int createCode, byte[] metadata = null) { return(new ChatManagerNetworkObject(networker, this, createCode, metadata)); }
public override void processMessage(NetWorker.Utilities.RawMessage message) { Minion minion = Engine.Game.getMinionById(message.getInt("iid")); if (minion != null) minion.stats.health = message.getFloat("h"); }
public override void Initialize(NetWorker networker, byte[] metadata = null) { Initialize(new TestNetworkObject(networker, createCode: TempAttachCode, metadata: metadata)); }
public DroneNetworkObject(NetWorker networker, uint serverId, FrameStream frame) : base(networker, serverId, frame) { Initialize(); }
public override void NetworkCreateObject(NetWorker networker, int identity, uint id, FrameStream frame, Action <NetworkObject> callback) { if (networker.IsServer) { if (frame.Sender != null && frame.Sender != networker.Me) { if (!ValidateCreateRequest(networker, identity, id, frame)) { return; } } } bool availableCallback = false; NetworkObject obj = null; MainThreadManager.Run(() => { switch (identity) { case BasicCubeNetworkObject.IDENTITY: availableCallback = true; obj = new BasicCubeNetworkObject(networker, id, frame); break; case ChatManagerNetworkObject.IDENTITY: availableCallback = true; obj = new ChatManagerNetworkObject(networker, id, frame); break; case CubeForgeGameNetworkObject.IDENTITY: availableCallback = true; obj = new CubeForgeGameNetworkObject(networker, id, frame); break; case ExampleProximityPlayerNetworkObject.IDENTITY: availableCallback = true; obj = new ExampleProximityPlayerNetworkObject(networker, id, frame); break; case GameLogicNetworkObject.IDENTITY: availableCallback = true; obj = new GameLogicNetworkObject(networker, id, frame); break; case MoveCube1NetworkObject.IDENTITY: availableCallback = true; obj = new MoveCube1NetworkObject(networker, id, frame); break; case MoveCubeNetworkObject.IDENTITY: availableCallback = true; obj = new MoveCubeNetworkObject(networker, id, frame); break; case NetworkCameraNetworkObject.IDENTITY: availableCallback = true; obj = new NetworkCameraNetworkObject(networker, id, frame); break; case PlayerCubeNetworkObject.IDENTITY: availableCallback = true; obj = new PlayerCubeNetworkObject(networker, id, frame); break; case PlayerNetworkObject.IDENTITY: availableCallback = true; obj = new PlayerNetworkObject(networker, id, frame); break; case TestNetworkObject.IDENTITY: availableCallback = true; obj = new TestNetworkObject(networker, id, frame); break; case GameBallNetworkObject.IDENTITY: availableCallback = true; obj = new GameBallNetworkObject(networker, id, frame); break; } if (!availableCallback) { base.NetworkCreateObject(networker, identity, id, frame, callback); } else if (callback != null) { callback(obj); } }); }