Example #1
0
    void Start()
    {
        if (ReferenceEquals(app, null))
        {
            app = new HelloUnity();
            app.loadEngine();

            app.RtcEngine.OnError = onError;
            app.RtcEngine.OnJoinChannelSuccess = onJoinChannelSuccess;
        }

        if (name.Equals("JoinButton"))
        {
            MessageText       = GameObject.Find("messageText").GetComponent <Text> ();
            ChannelInputField = GameObject.Find("channelName").GetComponent <InputField> ();
            JoinButton        = GameObject.Find("JoinButton").GetComponent <Button> ();

            MessageText.gameObject.SetActive(false);
            if (int.Parse(ChannelName) == 0)
            {
                ChannelName = Random.Range(1, 1000000).ToString();
            }
            ChannelInputField.text = ChannelName;
            JoinButton.enabled     = true;

            IsJoiningChannel = false;
        }
        else
        {
            LeaveButton         = GameObject.Find("LeaveButton").GetComponent <Button> ();
            LeaveButton.enabled = true;
        }
    }
Example #2
0
    public void onLeaveButtonClicked()
    {
        LeaveButton.GetComponent <Home> ().enabled = false;

        //if (app != null) {
        if (!ReferenceEquals(app, null))
        {
            app.leaveChannel();
            app.unloadEngine();
            app = null;
            SceneManager.LoadScene("HomeScene", LoadSceneMode.Single);
        }
    }