示例#1
0
    // Use this for initialization
    void Start()
    {
        //setting up listener to get the text for post
        var input = gameObject.GetComponent <UnityEngine.UI.InputField>();
        var se    = new UnityEngine.UI.InputField.SubmitEvent();

        se.AddListener(SubmitName);
        input.onEndEdit = se;
    }
示例#2
0
    void Start()
    {
        OnChatRecieved += Chathandler_OnChatRecieved;
        OnSendChat     += Chathandler_OnSendChat;
        textField.text  = "";
        //messages = new string[8];
        instance = this;
        UnityEngine.UI.InputField.SubmitEvent submitEvent = new UnityEngine.UI.InputField.SubmitEvent();
        submitEvent.AddListener(SendChatButton);
        inputField.onEndEdit = submitEvent;

        //inputField.onSubmit.AddListener((value) => { SendChatButton(value); });
    }
示例#3
0
 static public int AddListener(IntPtr l)
 {
     try {
         UnityEngine.UI.InputField.SubmitEvent          self = (UnityEngine.UI.InputField.SubmitEvent)checkSelf(l);
         UnityEngine.Events.UnityAction <System.String> a1;
         LuaDelegation.checkDelegate(l, 2, out a1);
         self.AddListener(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#4
0
文件: World.cs 项目: Ferrohound/Phony
    private void UISetup()
    {
        consoleWindow = GameObject.Instantiate((GameObject)Resources.Load("ConsoleInput"));
        consoleWindow.SetActive(false);
        consoleWindow.transform.SetParent(GameObject.Find("Canvas").transform);
        consoleWindow.GetComponent <RectTransform>().anchoredPosition = new Vector2(-187, -113);
        foreach (UnityEngine.UI.Text c in consoleWindow.GetComponentsInChildren <UnityEngine.UI.Text>())
        {
            if (c.gameObject.name.Equals("Answer"))
            {
                answer = c;
                break;
            }
        }
        var input = consoleWindow.GetComponent <UnityEngine.UI.InputField>();
        var se    = new UnityEngine.UI.InputField.SubmitEvent();

        se.AddListener(SendCommand);
        input.onEndEdit = se;
    }