52 lines
852 B
C#
52 lines
852 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Net;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class GetServerIp : MonoBehaviour
|
|
{
|
|
|
|
public Button button;
|
|
public InputField input;
|
|
public GameObject player;
|
|
public GameObject enemy;
|
|
|
|
IPAddress ip;
|
|
|
|
public IPAddress GetIP()
|
|
{
|
|
return ip;
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
ip = IPAddress.None;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
try
|
|
{
|
|
ip = IPAddress.Parse(input.text);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public void ButtonPressed()
|
|
{
|
|
ip = IPAddress.Parse(input.text);
|
|
gameObject.SetActive(false);
|
|
player.SetActive(true);
|
|
enemy.SetActive(true);
|
|
}
|
|
|
|
|
|
|
|
}
|