示例#1
0
    private void OnEnable()
    {
        matchButton.onClick.AddListener(
            () =>
        {
            EventManager.Instance.Raise("try-lobby", new IntParam(1));
            connectText.text = "Reaching Lobby...";
            errorConfirmButton.gameObject.SetActive(false);
            transitioner.GoOneWay(mainTrans, connectTrans);
        });

        trainButton.onClick.AddListener(
            () =>
        {
            EventManager.Instance.Raise("request-scene", new IntParam(1));
        });

        errorConfirmButton.onClick.AddListener(() => transitioner.GoOneWay(connectTrans, mainTrans));

        if (EventManager.Instance != null)
        {
            EventManager.Instance.Subscribe("lobby-error", onLobbyErrorListener);
            EventManager.Instance.Subscribe("try-connect", onTryConnectListener);
            EventManager.Instance.Subscribe("try-connect-timeout", onTryConnectTimeoutListener);
            EventManager.Instance.Subscribe("connect", connectListener);
        }
    }