예제 #1
0
    //点击事件
    void OnClick()
    {
        Ribbon r = Ribbon.Instance;

        r.ClearRibbon();
        //确定添加注册按钮
        GameObject confirmGameobject = Instantiate(r.ButtonPrefab) as GameObject;

        confirmGameobject.transform.parent        = r.GetComponent <RectTransform>();
        confirmGameobject.transform.localPosition = new Vector3(0, 0, 0);
        confirmRegister = confirmGameobject.GetComponent <Button>();
        confirmRegister.onClick.AddListener(OnRegister);

        //添加输入账号框
        GameObject inputAcc = Instantiate(r.InputField) as GameObject;

        inputAcc.transform.parent        = r.GetComponent <RectTransform>();
        inputAcc.transform.localPosition = new Vector3(0, 150, 0);
        account = inputAcc.GetComponent <InputField>();
        account.placeholder.GetComponent <Text>().text = "输入账号";

        //输入密码账号框
        GameObject inputPsd = Instantiate(r.InputField) as GameObject;

        inputPsd.transform.parent        = r.GetComponent <RectTransform>();
        inputPsd.transform.localPosition = new Vector3(0, 75, 0);
        psd = inputPsd.GetComponent <InputField>();
        psd.placeholder.GetComponent <Text>().text = "输入密码";
    }
예제 #2
0
    void OnClick()
    {
        Ribbon r = Ribbon.Instance;

        r.ClearRibbon();
        GameObject datas = Instantiate(Datas) as GameObject;

        datas.transform.parent        = r.GetComponent <RectTransform>();
        datas.transform.localPosition = new Vector3(0, 150, 0);
        selectType = datas.GetComponent <Dropdown>();
        selectType.onValueChanged.AddListener(OnTypeChange);

        //确定添加确认按钮
        GameObject confirmGameobject = Instantiate(r.ButtonPrefab) as GameObject;

        confirmGameobject.transform.parent        = r.GetComponent <RectTransform>();
        confirmGameobject.transform.localPosition = new Vector3(0, 0, 0);
        confirmBtn = confirmGameobject.GetComponent <Button>();
        //confirmBtn.GetComponent<Text>().text = "确认";
        confirmBtn.transform.GetChild(0).GetComponent <Text>().text = "确认";
        confirmBtn.onClick.AddListener(OnConfirm);

        //输入数据
        GameObject inputID = Instantiate(r.InputField) as GameObject;

        inputID.transform.parent        = r.GetComponent <RectTransform>();
        inputID.transform.localPosition = new Vector3(0, 100, 0);
        userId = inputID.GetComponent <InputField>();
        userId.placeholder.GetComponent <Text>().text = "输入用户ID";

        //添加输入账号框
        GameObject inputAcc = Instantiate(r.InputField) as GameObject;

        inputAcc.transform.parent        = r.GetComponent <RectTransform>();
        inputAcc.transform.localPosition = new Vector3(0, 50, 0);
        data = inputAcc.GetComponent <InputField>();
        data.placeholder.GetComponent <Text>().text = "输入修改数据";
        Tips.Instance.OnSuccess("角色需要下线才能更改成功 阵营0为帝国 1为联邦 性别1为男性 2为女性 否则报错");
    }