Inheritance: CaptainsMessLobbyManager
Exemple #1
0
    public override void OnStartLocalPlayer()
    {
        networkManager             = NetworkManager.singleton as CaptainsMessNetworkManager;
        networkManager.localPlayer = this;

                #if UNITY_ANDROID
        deviceName = SystemInfo.deviceModel;
                #else
        deviceName = SystemInfo.deviceName;
                #endif

        version     = VERSION;
        deviceId    = networkManager.deviceId;
        peerId      = networkManager.peerId;
        playerIndex = slot;
        ready       = false;

        // deviceModel = SystemInfo.deviceModel;
        // memory = SystemInfo.systemMemorySize;
        // processorFrequency = SystemInfo.processorFrequency;
        // operatingSystem = SystemInfo.operatingSystem;
        // Debug.Log(String.Format("Device specs: {0}, {1}, {2} proc, {3} mem", deviceModel, operatingSystem, processorFrequency, memory));

        CmdSetBasePlayerInfo(version, deviceName, deviceId, peerId, playerIndex);
    }
    public void Setup(CaptainsMessNetworkManager aNetworkManager)
    {
        networkManager = aNetworkManager;
        broadcastKey   = Mathf.Abs(aNetworkManager.broadcastIdentifier.GetHashCode());       // Make sure broadcastKey matches client
        isOpen         = false;
        numPlayers     = 0;

        broadcastDataObject        = new BroadcastData();
        broadcastDataObject.peerId = networkManager.peerId;
        UpdateBroadcastData();
    }
Exemple #3
0
    private void OnDataComepletelyReceived(int transmissionId, byte[] data)
    {
        CaptainsMessNetworkManager networkManager = NetworkManager.singleton as CaptainsMessNetworkManager;
        ExamplePlayerScript        p = networkManager.localPlayer as ExamplePlayerScript;

        if (p != null)
        {
            //deserialize data and relocalize
            StartCoroutine(p.RelocateDevice(data));
        }
    }
 public override void OnStartClient()
 {
     networkManager = NetworkManager.singleton as CaptainsMessNetworkManager;
     if (networkManager)
     {
         networkManager.lobbySlots[slot] = this;
         OnClientEnterLobby();
     }
     else
     {
         Debug.LogError("CaptainsMessPlayer could not find a CaptainsMessNetworkManager.");
     }
 }
Exemple #5
0
    public void Setup(CaptainsMessNetworkManager aNetworkManager)
    {
        networkManager = aNetworkManager;
        broadcastKey   = Mathf.Abs(aNetworkManager.broadcastIdentifier.Hash());       // Make sure broadcastKey matches client
        Debug.Log("Set-up hash code in Server: " + broadcastKey.ToString());
        isOpen     = false;
        numPlayers = 0;

        broadcastDataObject        = new BroadcastData();
        broadcastDataObject.Name   = networkManager.RoomName;
        broadcastDataObject.peerId = networkManager.peerId;
        UpdateBroadcastData();
    }
    public void Update()
    {
        if (networkManager == null)
        {
            networkManager          = FindObjectOfType(typeof(CaptainsMessNetworkManager)) as CaptainsMessNetworkManager;
            networkManager.listener = listener;

            if (networkManager.verboseLogging)
            {
                Debug.Log("#CaptainsMess# !! RECONNECTING !!");
            }
        }
    }
 public override void OnStartClient()
 {
     networkManager = NetworkManager.singleton as CaptainsMessNetworkManager;
     if (networkManager)
     {
         networkManager.lobbySlots[slot] = this;
         OnClientEnterLobby();
     }
     else
     {
         Debug.LogError("CaptainsMessPlayer could not find a CaptainsMessNetworkManager.");
     }
 }
Exemple #8
0
 public override void OnStartClient()
 {
     //"as" is like type conversion and returns null if cannot be converted
     networkManager = NetworkManager.singleton as CaptainsMessNetworkManager;
     if (networkManager)
     {
         networkManager.lobbySlots[slot] = this;
         OnClientEnterLobby();
     }
     else
     {
         Debug.LogError("CaptainsMessPlayer could not find a CaptainsMessNetworkManager.");
     }
 }
Exemple #9
0
    public void Awake()
    {
        ValidateConfig();

        // Create network manager
        var resource       = Resources.Load("CaptainsMessNetworkManager");
        var resourceObject = Instantiate(resource) as GameObject;

        networkManager = resourceObject.GetComponent <CaptainsMessNetworkManager>();

        if (networkManager != null)
        {
            //networkManager.logLevel = 0;

            networkManager.name                = "CaptainsMessNetworkManager";
            networkManager.runInBackground     = false; // runInBackground is not recommended on iOS
            networkManager.broadcastIdentifier = broadcastIdentifier;
            networkManager.minPlayers          = minPlayers;
            networkManager.SetMaxPlayers(maxPlayers); //Setting maxPlayers and maxConnections
            networkManager.allReadyCountdownDuration = countdownDuration;
            networkManager.forceServer = forceServer;

            // I'm just using a single scene for everything
            networkManager.offlineScene = "";
            networkManager.onlineScene  = "";

            networkManager.playerPrefab   = playerPrefab.gameObject;
            networkManager.listener       = listener;
            networkManager.verboseLogging = verboseLogging;

            // Optionally create Debug GUI
            if (useDebugGUI)
            {
                networkManager.GetComponent <CaptainsMessDebugGUI>().enabled = true;
            }

            if (spawnableObjects != null)
            {
                foreach (var spawnableObject in spawnableObjects)
                {
                    networkManager.spawnPrefabs.Add(spawnableObject);
                }
            }
        }
        else
        {
            Debug.LogError("#CaptainsMess# Error creating network manager");
        }
    }
    public override void OnStartLocalPlayer()
    {
        networkManager             = NetworkManager.singleton as CaptainsMessNetworkManager;
        networkManager.localPlayer = this;

#if UNITY_ANDROID
        deviceName = SystemInfo.deviceModel;
#else
        deviceName = SystemInfo.deviceName;
#endif

        version     = VERSION;
        deviceId    = networkManager.deviceId;
        peerId      = networkManager.peerId;
        playerIndex = slot;
        ready       = false;

        CmdSetBasePlayerInfo(version, deviceName, deviceId, peerId, playerIndex);
    }
    public void Awake()
    {
        ValidateConfig();

        // Create network manager
        networkManager = (Instantiate(Resources.Load("CaptainsMessNetworkManager")) as GameObject).GetComponent<CaptainsMessNetworkManager>();
        if (networkManager != null)
        {
            //networkManager.logLevel = 0;

            networkManager.name = "CaptainsMessNetworkManager";
            networkManager.runInBackground = false; // runInBackground is not recommended on iOS
            networkManager.broadcastIdentifier = broadcastIdentifier;
            networkManager.minPlayers = minPlayers;
            networkManager.SetMaxPlayers(maxPlayers); //Setting maxPlayers and maxConnections
            networkManager.allReadyCountdownDuration = countdownDuration;
            networkManager.forceServer = forceServer;

            // I'm just using a single scene for everything
            networkManager.offlineScene = "";
            networkManager.onlineScene = "";

            networkManager.playerPrefab = playerPrefab.gameObject;
            networkManager.listener = listener;
            networkManager.verboseLogging = verboseLogging;

            // Optionally create Debug GUI
            if (useDebugGUI) {
                networkManager.GetComponent<CaptainsMessDebugGUI>().enabled = true;
            }
        }
        else
        {
            Debug.LogError("#CaptainsMess# Error creating network manager");
        }
    }
 public void Awake()
 {
     mess = FindObjectOfType(typeof(CaptainsMess)) as CaptainsMess;
     networkManager = GetComponent<CaptainsMessNetworkManager>();
 }
Exemple #13
0
 public void Setup(CaptainsMessNetworkManager aNetworkManager)
 {
     networkManager = aNetworkManager;
     broadcastKey   = Mathf.Abs(aNetworkManager.broadcastIdentifier.Hash()); // Make sure broadcastKey matches server
     Debug.Log("Set-up hash code in Client: " + broadcastKey.ToString());
 }
    public void Setup(CaptainsMessNetworkManager aNetworkManager)
    {
        networkManager = aNetworkManager;
        broadcastKey = Mathf.Abs(aNetworkManager.broadcastIdentifier.GetHashCode()); // Make sure broadcastKey matches client
        isOpen = false;
        numPlayers = 0;

        broadcastDataObject = new BroadcastData();
        broadcastDataObject.peerId = networkManager.peerId;
        UpdateBroadcastData();
    }
Exemple #15
0
 public void Setup(CaptainsMessNetworkManager aNetworkManager)
 {
     networkManager = aNetworkManager;
     broadcastKey   = Mathf.Abs(aNetworkManager.broadcastIdentifier.GetHashCode());       // Make sure broadcastKey matches server
     Debug.Log($"Broadcast key set to {broadcastKey} on client");
 }
Exemple #16
0
 public void Awake()
 {
     mess           = FindObjectOfType(typeof(CaptainsMess)) as CaptainsMess;
     networkManager = GetComponent <CaptainsMessNetworkManager>();
 }
Exemple #17
0
 public void Setup(CaptainsMessNetworkManager aNetworkManager)
 {
     networkManager = aNetworkManager;
     broadcastKey   = Mathf.Abs(aNetworkManager.broadcastIdentifier.GetHashCode());       // Make sure broadcastKey matches server
 }
    public override void OnStartLocalPlayer()
    {
        networkManager = NetworkManager.singleton as CaptainsMessNetworkManager;
        networkManager.localPlayer = this;

        #if UNITY_ANDROID
            deviceName = SystemInfo.deviceModel;
        #else
            deviceName = SystemInfo.deviceName;
        #endif

        version = VERSION;
        deviceId = networkManager.deviceId;
        peerId = networkManager.peerId;
        playerIndex = slot;
        ready = false;

        // deviceModel = SystemInfo.deviceModel;
        // memory = SystemInfo.systemMemorySize;
        // processorFrequency = SystemInfo.processorFrequency;
        // operatingSystem = SystemInfo.operatingSystem;
        // Debug.Log(String.Format("Device specs: {0}, {1}, {2} proc, {3} mem", deviceModel, operatingSystem, processorFrequency, memory));

        CmdSetBasePlayerInfo(version, deviceName, deviceId, peerId, playerIndex);
    }
    public void Update()
    {
        if (networkManager == null)
        {
            networkManager = FindObjectOfType(typeof(CaptainsMessNetworkManager)) as CaptainsMessNetworkManager;
            networkManager.listener = listener;

            if (networkManager.verboseLogging) {
                Debug.Log("#CaptainsMess# !! RECONNECTING !!");
            }
        }
    }
 public void Setup(CaptainsMessNetworkManager aNetworkManager)
 {
     networkManager = aNetworkManager;
     broadcastKey = Mathf.Abs(aNetworkManager.broadcastIdentifier.GetHashCode()); // Make sure broadcastKey matches server
 }