Ejemplo n.º 1
0
 public void EnableConfirmationCanvas()
 {
     if (!isNameBeingUsed(NameInputField.GetInputField().name))
     {
         confirmCanvas.enabled = true;
         text.text             = "Are you sure you want to give the \n name " + NameInputField.GetInputField().name + " ?";
     }
 }
Ejemplo n.º 2
0
        public void RenameStart(UnitListObject parent)
        {
            ClearRename();

            RenameObject = parent;
            RenameField.SetParent(parent.transform, false);
            RenameField.gameObject.SetActive(true);
            RenameField.GetComponent <LayoutElement>().enabled = true;

            NameInputField.SetValue(parent.Source.NoPrefixName);
            PrefixInputField.SetValue(parent.Source.PrefixName);

            NameInputField.InputFieldUi.ActivateInputField();
        }
Ejemplo n.º 3
0
	void Start ()
	{
		System.Random rand = new System.Random();
		NameInputField.GetComponent<InputField>().text = "Player_" + rand.Next(9999);
		Instance = this;

		MainMenu.SetActive ( true );

//		for ( int i = 0; i < this.MainMenu.transform.childCount; i++ )
//			this.MainMenu.transform.GetChild ( i ).gameObject.SetActive ( true );

		ConnectMenu.SetActive ( false );
		
		DontDestroyOnLoad ( gameObject );
	}
Ejemplo n.º 4
0
	public void ACCESS_HOST_MENU_BUTTON ()
	{
		
		this.MainMenu.SetActive ( false );

		try
		{

			GameObject serverGameObject = Instantiate ( this.ServerPrefab ) as GameObject;

			if ( serverGameObject != null )
			{

				Server s = serverGameObject.GetComponent <Server> ();

				s.Init ();

				GameObject clientGameObject = Instantiate ( ClientPrefab );
				
				clientGameObject.name = "Host";

				if ( clientGameObject != null )
				{
					Client c = clientGameObject.GetComponent <Client> ();

					c.IsHost = true;
					
					c.ClientName = NameInputField.GetComponent <InputField> ().text;

					if ( c.ClientName == null || c.ClientName == "" || c.ClientName == "Name" )
					{
						c.ClientName = "Host";
					}
					
					c.ConnectToServer ( "localhost", 6321 ); // we're the server, connect to ourself
					// don't hardcode the port.

				}

			}

		} catch ( Exception e )
		{
			Debug.Log ( e.Message );
		}
		
	}
Ejemplo n.º 5
0
	public void CONNECT_TO_SERVER ()
	{
		 
		string hostAddress = this.HostAddressInputField.GetComponent <InputField> ().text;

		if ( hostAddress == null || hostAddress == "" )
			hostAddress = "localhost";

		try
		{

			GameObject clientGameObject = Instantiate ( ClientPrefab );

			clientGameObject.name = "Client";

			if ( clientGameObject != null )
			{
				Client c = clientGameObject.GetComponent <Client> ();
				
				c.IsHost = false;

				c.ClientName = NameInputField.GetComponent <InputField> ().text;

				if ( c.ClientName == null || c.ClientName == "" || c.ClientName == "Name" )
				{
					c.ClientName = "Client";
				}
				
				c.ConnectToServer ( hostAddress, 6321 ); // don't hardcode the port.
				
				this.ConnectMenu.SetActive ( false );
				
			}
		} catch ( Exception e )
		{
			Debug.Log ( e.Message );
		}
		
	}
Ejemplo n.º 6
0
 void Start()
 {
     inputField = this;
 }
Ejemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     ButtonText    = this.GetComponent <Text>();
     NameSetScript = NameManager.GetComponent <NameInputField>();
 }