void Start() { GameData.networkPlayers.Clear(); discoveredServers.Clear(); roomListPanel.SetActive(!GameData.isHost); playerListPanel.SetActive(GameData.isHost); networkDiscovery = GetComponent <MyNetworkDiscovery>(); networkDiscovery.OnServerFound.AddListener(OnDiscoveredServer); roomPanelBackBtn.onClick.AddListener(Back); playerPanelBackBtn.onClick.AddListener(Back); startGameBtn.gameObject.SetActive(false); // 开始不显示游戏开始按钮 startGameBtn.onClick.AddListener(OnClickStartGame); MyNetworkRoomManager mamager = NetworkManager.singleton as MyNetworkRoomManager; mamager.onCreateRoomPlayer = OnCreateRoomPlayer; mamager.onClientDisconnect = OnClientDisconnect; mamager.onGameStartStateChange = OnGameStartStateChange; if (GameData.isHost) { roomName.text = $"[{GameData.playerName}的房间]"; NetworkManager.singleton.StartHost(); networkDiscovery.AdvertiseServer(); } else { networkDiscovery.MyStartDiscovery(); } }
public void Construct(ServiceProvider provider, ConnectionStateMachine connMachine, UIManager uiManager) { _netManager = provider.networkManager; _netDiscovery = provider.networkDiscovery; _connMachine = connMachine; _uiManager = uiManager; }
private void Awake() { base.Initialize(); StartListen(); StartCoroutine(CleanupExpiredEntries()); instance = this; }
void Start() { StartCoroutine("WaitForNetworkManager"); StartCoroutine("WaitForNetwork"); singleton = this; didInit = Initialize(); isServer = false; isClient = false; }
private void Start() { soundManager = FindObjectOfType <SoundManager>(); networkManager = GameObject.FindObjectOfType <NetworkManager>(); networkDiscovery = GameObject.FindObjectOfType <MyNetworkDiscovery>(); hudManager = FindObjectOfType <HUDNetworkManagerCostumized>(); CreateRoomBtn.SetActive(true); FindRoomBtn.SetActive(true); DifficultyLevelDropDownPanel.SetActive(true); }
void Start() { client = new NetworkClient(); if (networkDiscovery == null) { networkDiscovery = GetComponent <MyNetworkDiscovery>(); } //if (networkDiscovery == null) throw new System.Exception(); RegisterHandlers(); }
IEnumerator Startup(float delay) { if (!isInDelayedStart) { isInDelayedStart = true; yield return(new WaitForSeconds(delay)); if (isInDelayedStart) { discovery = GetComponent <MyNetworkDiscovery>(); if (PlayerList == null) { PlayerList = FindObjectOfType <PlayerList>(); } if (AutoStartDiscovery) { StartBroadcastDiscovery(); } } isInDelayedStart = false; } }
// Use this for initialization void Start () { // Get NetworkDiscovery to initialize broadcast in OnStartHost hook networkDiscovery = GetComponent<MyNetworkDiscovery>(); // Get StartController for handling UI changes startController = GameObject.Find("StartController").GetComponent<StartController>(); // Get LobbyPlayer RectTransform for positioning lobby players when they spawn lobbyPlayerRectTransform = lobbyPlayerPrefab.GetComponent<RectTransform>(); lobbyPlayerOffset = lobbyPlayerRectTransform.rect.height * lobbyPlayerRectTransform.localScale.y * 1.2f; Debug.Log("lobby player offset is " + lobbyPlayerOffset); /*for(int i = 0; i < MaxPlayers; i++) { GameObject start = Instantiate(startPositionPrefab, new Vector2(0, height - offset * i), Quaternion.identity) as GameObject; start.transform.SetParent(canvasObj.transform, false); }*/ // Set round robin player spawn method playerSpawnMethod = PlayerSpawnMethod.RoundRobin; }
// Use this for initialization void Start() { messageBuffer = new List <KeyValuePair <int, BufferedMessage> >(); if (networkDiscovery == null) { networkDiscovery = gameObject.GetComponent <MyNetworkDiscovery>(); } // if (networkDiscovery == null) throw new System.Exception(); // running server in background Application.runInBackground = true; ipAddress = LocalIPAddress(); for (int i = 0; i < 4; i++) { HRZTAxis[i] = new CrossPlatformInputManager.VirtualAxis(hrztaxis_n + i); CrossPlatformInputManager.RegisterVirtualAxis(HRZTAxis[i]); VTCAxis[i] = new CrossPlatformInputManager.VirtualAxis(vtcaxis_n + i); CrossPlatformInputManager.RegisterVirtualAxis(VTCAxis[i]); } bool networkStart = false; do { try { networkStart = NetworkServer.Listen(port); } catch (System.Exception err) { Debug.LogWarning("Start Server Not complete: " + err + "Try Changing port"); port++; } }while (!networkStart); //Debug.Log("listening at port: " + port); RegisterHandlers(); }
public void Construct(ServiceProvider provider, PrefabManager prefabManager, DiContainer container) { _netDiscovery = provider.networkDiscovery; _prefabManager = prefabManager; _container = container; }
public void StartLocalBroadcast() { localNetworkDiscovery = GetComponent <MyNetworkDiscovery>(); localNetworkDiscovery.Initialize(); localNetworkDiscovery.StartAsServer(); }
private void Start() { _discovery = GetComponent <MyNetworkDiscovery>(); //this require on network discovery _discovery.Initialize(); }
// Use this for initialization void Start() { m_NetworkDiscovery = GetComponent <MyNetworkDiscovery>(); }
//public string myName; // Use this for initialization void Start() { originalNetDis = transform.root.GetComponent <MyNetworkDiscovery>(); }
void Awake() { my_network_discovery_ = GetComponent<MyNetworkDiscovery>(); }
public void StartReceiveLocalBroadcast() { localNetworkDiscovery = GetComponent <MyNetworkDiscovery>(); localNetworkDiscovery.Initialize(); localNetworkDiscovery.StartAsClient(); }
void Awake() { myNetworkDiscovery = FindObjectOfType <MyNetworkDiscovery>(); }
private void Awake() { networkDiscovery = GetComponent <MyNetworkDiscovery>(); }