예제 #1
0
    void Start()
    {
        _networkClient     = NetworkClient._instance;
        _uiRole1           = transform.Find("SelectRole-role1").GetComponent <UIButton>();
        _uiRole1.isEnabled = false;
        _uiRole2           = transform.Find("SelectRole-role2").GetComponent <UIButton>();
        _uiRole2.isEnabled = false;
        _uiRole3           = transform.Find("SelectRole-role3").GetComponent <UIButton>();
        _uiRole3.isEnabled = false;
        _listUIbutton.Add(_uiRole1);
        _listUIbutton.Add(_uiRole2);
        _listUIbutton.Add(_uiRole3);

        _uiRegis = transform.Find("SelectRole-Regis").GetComponent <UIButton>();

        _buttonRole1 = EventCenter.RegisterButtonEvent("SelectRole-role1", new SelectRole_LoginExcute()) as SelectRole_LoginExcute;
        _buttonRole1.data.Add("1", 0);
        _buttonRole2 = EventCenter.RegisterButtonEvent("SelectRole-role2", new SelectRole_LoginExcute()) as SelectRole_LoginExcute;
        _buttonRole2.data.Add("1", 1);
        _buttonRole3 = EventCenter.RegisterButtonEvent("SelectRole-role3", new SelectRole_LoginExcute()) as SelectRole_LoginExcute;
        _buttonRole3.data.Add("1", 2);

        _buttonRegis = EventCenter.RegisterButtonEvent("SelectRole-Regis", new SelectRole_RegisExcute()) as SelectRole_RegisExcute;
        _buttonBack  = EventCenter.RegisterButtonEvent("SelectRole-Back", new SelectRole_BackExcute()) as SelectRole_BackExcute;
        Show();
    }
예제 #2
0
    private void OnDestroy()
    {
        _uiRole1 = null;
        _uiRole2 = null;
        _uiRole3 = null;
        EventCenter.UnRegisterButtonEvent("SelectRole-role1");
        EventCenter.UnRegisterButtonEvent("SelectRole-role2");
        EventCenter.UnRegisterButtonEvent("SelectRole-role3");
        EventCenter.UnRegisterButtonEvent("SelectRole-Regis");
        EventCenter.UnRegisterButtonEvent("SelectRole-Back");

        _buttonRole1 = null;
        _buttonRole2 = null;
        _buttonRole3 = null;
        _buttonRegis = null;
        _buttonBack  = null;

        _listUIbutton  = null;
        _networkClient = null;
    }