Example #1
0
        public void onEnterMainGame()
        {
            Debug.Log("点击登录");
            AccountInfo info = new AccountInfo();

            info.UID = labelUID.text;
            info.PWD = labelPWD.text;
            ErrorCode code = CheckUserInfo(info);

            if (code != ErrorCode.OK)
            {
                UIManager.Instance.ShowMessage(code.Description(), MessageBoxEnum.Style.Ok, null);
                return;
            }
            bool isConnect = NetManager.Instance.IsConnected;

            if (!isConnect)
            {
                //isConnect = NetManager.Instance.Connect(true, "127.0.0.1", 40056);
                isConnect = NetManager.Instance.Connect(true, Boot.Instance.Ip, 40056);
            }

            if (isConnect)
            {
                //ModelManager.Instance.Get<LoginModel>().RegisterLogon(info);
                ModelManager.Instance.Get <LoginModel>().Logon(info);
                //StartCoroutine(LoginSuscess());
                //UIManager.Instance.ShowView<MainMenuView>();
            }
            else
            {
                UIManager.Instance.ShowMessage(ErrorCode.NET_CONNECT_FAIL.Description(), MessageBoxEnum.Style.Ok, null);
            }
        }
Example #2
0
        public ErrorCodeDto(ErrorCode errorCode, object[] values = null)
        {
            // Otherwise, get message from Enum descriptor
            var message = errorCode.Description();

            // If enum description is empty, do not return that code to the client
            if (string.IsNullOrEmpty(message))
            {
                errorCode = ErrorCode.Default;
            }

            // Format message with any provided values
            if (values?.Any() == true)
            {
                message = string.Format(message, values);
            }

            Message = message;
            Code    = (int)errorCode;
            Params  = values;
        }