//서버에서 사용할 때. public NetworkController() { m_hostType = HostType.Server; GameObject nObj = GameObject.Find("Network"); m_network = nObj.GetComponent<TransportTCP>(); m_network.StartServer(USE_PORT, 1); }
void Start() { logic = transform.Find("Logic").GetComponent <Logic>(); field = transform.Find("Field").GetComponent <Field>(); /* 初期配置 */ logic.Set(Logic.c_sizeOfField / 2 - 1, Logic.c_sizeOfField / 2 - 1, false); logic.Set(Logic.c_sizeOfField / 2, Logic.c_sizeOfField / 2 - 1, true); logic.Set(Logic.c_sizeOfField / 2 - 1, Logic.c_sizeOfField / 2, true); logic.Set(Logic.c_sizeOfField / 2, Logic.c_sizeOfField / 2, false); turnUI.transform.position = new Vector3(turnUI.transform.position.x, 365.0f, turnUI.transform.position.z); transport = GameObject.Find("Network").GetComponent <TransportTCP>(); if (transport.IsServer()) { isPlayerBlack = true; Debug.Log("あなたは先行です"); } else { isPlayerBlack = false; Debug.Log("あなたは後攻です"); } }
//클라이언트에서 사용할 때. public NetworkController(string serverAddress) { m_hostType = HostType.Client; GameObject nObj = GameObject.Find("Network"); m_network = nObj.GetComponent<TransportTCP>(); m_network.Connect(serverAddress, USE_PORT); }
// Use this for initialization void Start() { // Transport 클래스의 컴포넌트를 가져온다. #if USE_TRANSPORT_TCP GameObject obj = GameObject.Instantiate(transportTcpPrefab) as GameObject; m_transport = obj.GetComponent <TransportTCP>(); m_transport.RegisterEventHandler(test); #else GameObject obj = GameObject.Instantiate(transportUdpPrefab) as GameObject; m_transport = obj.GetComponent <TransportUDP>(); #endif IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); System.Net.IPAddress hostAddress = hostEntry.AddressList[0]; m_strings = hostAddress.ToString(); Debug.Log(m_strings); // 얻은 주소체계를 모두 출력 string ClientIP = string.Empty; Debug.Log("hostEntry.AddressList.Length : " + hostEntry.AddressList.Length); for (int i = 0; i < hostEntry.AddressList.Length; i++) { ClientIP = hostEntry.AddressList[i].ToString(); Debug.Log(i + ", ClientIP : " + ClientIP + " " + hostEntry.AddressList[i].AddressFamily); //if(hostEntry.AddressList[i].AddressFamily == AddressFamily.InterNetwork) //{ // // 실제 접속할 IP // ClientIP = hostEntry.AddressList[i].ToString(); //} } }
// Use this for initialization void Start() { IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); System.Net.IPAddress hostAddress = hostEntry.AddressList[0]; foreach (IPAddress ip in hostEntry.AddressList) //IP v4 { if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { hostAddress = ip; } } Debug.Log(hostEntry.HostName); m_hostAddress = hostAddress.ToString(); GameObject go = new GameObject("Network"); m_transport = go.AddComponent <TransportTCP>(); m_transport.RegisterEventHandler(OnEventHandling); m_message = new List <string> [CHAT_MEMBER_NUM]; for (int i = 0; i < CHAT_MEMBER_NUM; ++i) { m_message[i] = new List <string>(); } }
// Use this for initialization void Start() { Players = new GameObject[PlayersNum]; try { Players[0] = player0; Players[1] = player1; Players[2] = player2; Players[3] = player3; } catch (Exception e1) { Debug.Log("error:" + e1.ToString()); } IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); System.Net.IPAddress hostAddress = hostEntry.AddressList[0]; Debug.Log(hostEntry.HostName); //m_hostAddress = hostAddress.ToString (); GameObject go = new GameObject("Network"); m_transport = go.AddComponent <TransportTCP>(); m_transport.RegisterEventHandler(OnEventHandling); m_message = new List <string> [CHAT_MEMBER_NUM]; for (int i = 0; i < CHAT_MEMBER_NUM; ++i) { m_message[i] = new List <string>(); } }
void Awake() { m_mode = Mode.SelectHost; hostType = HostType.None; serverAddress = ""; // Network 클래스의 컴포넌트 취득. GameObject obj = new GameObject("Network"); m_transport = obj.AddComponent <TransportTCP>(); DontDestroyOnLoad(obj); // 호스트명을 가져옵니다. string hostname = Dns.GetHostName(); // 호스트명에서 IP주소를 가져옵니다. IPAddress[] adrList = Dns.GetHostAddresses(hostname); serverAddress = adrList[0].ToString(); foreach (IPAddress ip in adrList) //IP v4 { if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { serverAddress = ip.ToString(); } } }
//클라이언트에서 사용할 때. public NetworkController(string serverAddress) { m_hostType = HostType.Client; GameObject nObj = GameObject.Find("Network"); m_network = nObj.GetComponent <TransportTCP>(); m_network.Connect(serverAddress, USE_PORT); }
//서버에서 사용할 때. public NetworkController() { m_hostType = HostType.Server; GameObject nObj = GameObject.Find("Network"); m_network = nObj.GetComponent <TransportTCP>(); m_network.StartServer(USE_PORT, 1); }
// Use this for initialization void Start() { ////ResultChecker.WinnerTest(); m_serverPlayer = null; m_clientPlayer = null; m_timer = 0; m_isSendAction = false; m_isReceiveAction = false; // 초기화합니다. for (int i = 0; i < m_inputData.Length; ++i) { m_inputData[i].rpsKind = RPSKind.None; m_inputData[i].attackInfo.actionKind = ActionKind.None; m_inputData[i].attackInfo.actionTime = 0.0f; } // 아직 동작시키지 않습니다. m_gameState = GameState.None; for (int i = 0; i < m_score.Length; ++i) { m_score[i] = 0; } // 통신 모듈 작성. GameObject go = new GameObject("Network"); if (go != null) { TransportTCP transport = go.AddComponent <TransportTCP>(); if (transport != null) { transport.RegisterEventHandler(EventCallback); } DontDestroyOnLoad(go); } // 호스트명 가져오기. string hostname = Dns.GetHostName(); // 호스트명에서 IP주소를 가져옵니다. IPAddress[] adrList = Dns.GetHostAddresses(hostname); m_serverAddress = adrList[0].ToString(); foreach (IPAddress ip in adrList) //IP v4 { if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { m_serverAddress = ip.ToString(); } } }
void Start() { httpManager = new HTTPManager(); userInfo = GameObject.Find("DataObject").GetComponent <UserInfo>(); socket = GetComponent <TransportTCP>(); Debug.Log("유저 : " + userInfo.userData.token); socket.Connect(address, port); // StartCoroutine(ChatTest()); }
// Start is called before the first frame update void Start() { DontDestroyOnLoad(gameObject); transportUDP = GetComponent <TransportUDP>(); transportTCP = GetComponent <TransportTCP>(); ConnectIP(); StartCoroutine(TestReceiver()); }
// Use this for initialization void Start() { GameObject network = new GameObject("Network"); transport = network.AddComponent <TransportTCP>(); transport.RegisterEventHandler(OnEventHandling); IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); System.Net.IPAddress hostAddress = hostEntry.AddressList[0]; StartCoroutine(UIroutine()); }
// Use this for initialization void Start() { // Network 클래스의 컴포넌트 가져오기. GameObject obj = GameObject.Find("Network"); m_transport = obj.GetComponent <TransportTCP>(); if (m_transport != null) { m_transport.RegisterEventHandler(EventCallback); } // 게임을 초기화합니다. Reset(); isGameOver = false; timer = turnTime; }
void Awake () { m_mode = Mode.SelectHost; hostType = HostType.None; serverAddress = ""; // Network 클래스의 컴포넌트 취득. GameObject obj = new GameObject("Network"); m_transport = obj.AddComponent<TransportTCP>(); DontDestroyOnLoad(obj); // 호스트명을 가져옵니다. string hostname = Dns.GetHostName(); // 호스트명에서 IP주소를 가져옵니다. IPAddress[] adrList = Dns.GetHostAddresses(hostname); serverAddress = adrList[0].ToString(); }
// Use this for initialization void Start() { // Transportクラスのコンポーネントを取得. #if USE_TRANSPORT_TCP GameObject obj = GameObject.Instantiate(transportTcpPrefab) as GameObject; m_transport = obj.GetComponent <TransportTCP>(); #else GameObject obj = GameObject.Instantiate(transportUdpPrefab) as GameObject; m_transport = obj.GetComponent <TransportUDP>(); #endif IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); System.Net.IPAddress hostAddress = hostEntry.AddressList[0]; Debug.Log(hostEntry.HostName); m_strings = hostAddress.ToString(); }
// Use this for initialization void Start() { IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); System.Net.IPAddress hostAddress = hostEntry.AddressList[0]; Debug.Log(hostEntry.HostName); m_hostAddress = hostAddress.ToString (); GameObject go = new GameObject("Network"); m_transport = go.AddComponent<TransportTCP>(); m_transport.RegisterEventHandler(OnEventHandling); m_message = new List<string>[CHAT_MEMBER_NUM]; for (int i = 0; i < CHAT_MEMBER_NUM; ++i) { m_message[i] = new List<string>(); } }
void Awake() { m_mode = Mode.SelectHost; hostType = HostType.None; serverAddress = ""; // Network 클래스의 컴포넌트 취득. GameObject obj = new GameObject("Network"); m_transport = obj.AddComponent <TransportTCP>(); DontDestroyOnLoad(obj); // 호스트명을 가져옵니다. string hostname = Dns.GetHostName(); // 호스트명에서 IP주소를 가져옵니다. IPAddress[] adrList = Dns.GetHostAddresses(hostname); serverAddress = adrList[0].ToString(); }
// Use this for initialization void Start() { // Attach gameObject m_messageTextBox = GameObject.Find("MessageText").GetComponent <Text> (); inputField = GameObject.Find("InputField").GetComponent <InputField> (); // parameter initialize m_messages = new List <String> (); // Setup Network m_hostAddress = GetServerIPAddress(); GameObject go = new GameObject("Network"); m_transport = go.AddComponent <TransportTCP> (); m_transport.RegisterEventHandler(OnEventHandling); }
// Use this for initialization void Start() { IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); System.Net.IPAddress hostAddress = hostEntry.AddressList[0]; Debug.Log(hostEntry.HostName); m_hostAddress = hostAddress.ToString(); Debug.Log(m_hostAddress); GameObject go = new GameObject("Network"); m_transport = go.AddComponent <TransportTCP>(); m_transport.RegisterEventHandler(OnEventHandling); m_message = new List <string> [CHAT_MEMBER_NUM]; for (int i = 0; i < CHAT_MEMBER_NUM; ++i) { m_message[i] = new List <string>(); } }
// Use this for initialization void Start() { IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); System.Net.IPAddress hostAddress = hostEntry.AddressList[0]; Debug.Log(hostEntry.HostName); m_hostAddress = hostAddress.ToString(); // 얻은 주소체계를 모두 출력 string ClientIP = string.Empty; Debug.Log("hostEntry.AddressList.Length : " + hostEntry.AddressList.Length); for (int i = 0; i < hostEntry.AddressList.Length; i++) { ClientIP = hostEntry.AddressList[i].ToString(); Debug.Log(i + ", ClientIP : " + ClientIP + " " + hostEntry.AddressList[i].AddressFamily); //if(hostEntry.AddressList[i].AddressFamily == AddressFamily.InterNetwork) //{ // // 실제 접속할 IP // ClientIP = hostEntry.AddressList[i].ToString(); //} } GameObject go = new GameObject("Network"); m_transport = go.AddComponent <TransportTCP>(); m_transport.RegisterEventHandler(OnEventHandling); m_message = new List <string> [CHAT_MEMBER_NUM]; for (int i = 0; i < CHAT_MEMBER_NUM; ++i) { m_message[i] = new List <string>(); } }
// Use this for initialization void Start() { // Transport 클래스의 컴포넌트를 가져온다. #if USE_TRANSPORT_TCP GameObject obj = GameObject.Instantiate(transportTcpPrefab) as GameObject; m_transport = obj.GetComponent <TransportTCP>(); #else GameObject obj = GameObject.Instantiate(transportUdpPrefab) as GameObject; m_transport = obj.GetComponent <TransportUDP>(); #endif IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); System.Net.IPAddress hostAddress = hostEntry.AddressList[0]; foreach (IPAddress ip in hostEntry.AddressList) //IP v4 { if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { hostAddress = ip; } } Debug.Log(hostEntry.HostName); m_strings = hostAddress.ToString(); }
// Start is called before the first frame update void Start() { transportTCP = GetComponent <TransportTCP>(); ConnectIP(); }
// Start is called before the first frame update void Start() { transportUDP = GetComponent <TransportUDP>(); transportTCP = GetComponent <TransportTCP>(); }
// Start is called before the first frame update void Start() { m_transport = GetComponent <TransportTCP>(); m_transport.RegisterEventHandler(OnEventHandling); }
// Use this for initialization void Start () { // Network 클래스의 컴포넌트 가져오기. GameObject obj = GameObject.Find("Network"); m_transport = obj.GetComponent<TransportTCP>(); if (m_transport != null) { m_transport.RegisterEventHandler(EventCallback); } // 게임을 초기화합니다. Reset(); isGameOver = false; timer = turnTime; }
// Use this for initialization void Start() { transport = networkObj.GetComponent <TransportTCP>(); }
// Use this for initialization void Start() { transport = networkObj.GetComponent <TransportTCP>(); //Debug.Log(address.ToString()); }