ZYUserMassege

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

/// <summary>
/// 用户姓名、性别和年龄的信息界面
/// </summary>
///
public class ZYUserMassege : MonoBehaviour
{
public GameObject nameG;
public GameObject agea;
public GameObject boy,nv;
public Text ageControl;

string name;
int age;
string sex;

void Start()
{
}
public void OnBoyButtonClick()
{
boy.SetActive(true);
nv.SetActive(false);
sex = "boy";
}
public void OnGirlButtonClick()
{
boy.SetActive(false);
nv.SetActive(true);
sex = "girl";
}
public void OnHandUpButtonClic()
{
name = nameG.GetComponent<InputField>().text;
age =int.Parse( agea.GetComponent<InputField>().text);
Debug.Log("xingming=" + name + "age=" + age + "xingbie=" + sex);
if (age < 0 && age > 100)
{

ageControl.text = "年龄超出限制,请重新输入";

}
else
{

}
}

}

posted @ 2016-08-31 11:41  Fei非非  阅读(340)  评论(0编辑  收藏  举报