ruizi 发表于 2013-2-27 09:27

通过导入一个包,可以拖拉控件到窗口上,也成功取到了上面的值,部分代码晒给大家

using UnityEngine;
using System.Collections.Generic;
using Bitverse.Unity.Gui;

public class Demo : MonoBehaviour {

    private BitTextField _text;
    private BitLabel _result;
    // Use this for initialization
   private void Start () {
      Component[] windows=gameObject.GetComponents(typeof(BitWindow));
      BitWindow window=null;
      for(int i=0;i<windows.Length;i++)
      {
            if(windows.name=="calculator")
            {
                window=(BitWindow)windows;
            }
      }   
      if(window==null)
            {
                  Debug.LogError("Main window not found");
                  return;
            }
            _result=window.FindControl<BitLabel>("lbname");
            _text=window.FindControl<BitTextField>("name");
            BitButton b;
            b=window.FindControl<BitButton>("bt1");
            b.MouseClick+=contentClick;
            
            
      
    }
    public void contentClick(object sender , MouseEventArgs e)
            {
                _result.Content.text=_text.Content.text;
            }
   
    // Update is called once per frame
    public void Update () {
   
    }
}{:2_31:}

EIBEN 发表于 2017-2-18 13:27

很不错

质. 发表于 2017-2-18 14:17

楼主是超人

质. 发表于 2017-2-18 14:13

难得一见的好帖

VinooO 发表于 2017-2-18 14:03

很好哦

gold0506 发表于 2017-2-18 14:03

LZ真是人才

Ryan 发表于 2017-3-31 21:35

很不错

dajiangaok 发表于 2017-3-31 22:12

楼主是超人

ffanyboy 发表于 2017-3-31 22:13

顶顶多好

ITpontiff 发表于 2017-3-31 21:48

难得一见的好帖
页: [1] 2 3 4 5 6 7 8 9
查看完整版本: 通过导入一个包,可以拖拉控件到窗口上,也成功取到了上面的值,部分代码晒给大家