/// <summary>
        ///
        /// </summary>
        /// <param name="msg"></param>
        private void OnS2C_Login(ProtoBuf.IExtensible msg)
        {
            UnityEngine.Debug.Log("SystemProtoBufController------>OnS2C_LoginResponse()");
            clientmsg.s2c_login loginResponse = msg as clientmsg.s2c_login;

            Hashtable hashtable = new Hashtable();

            hashtable["protomsg"] = loginResponse;
            AWEvent evt = new AWEvent(AWEvent.LOGIN, hashtable);

            this.sfs.DispatchEvent(evt);
        }
Esempio n. 2
0
    public void OnLoginLoginServer(BaseEvent evt)
    {
        //awnet
        clientmsg.s2c_login loginresponse = (clientmsg.s2c_login)evt.Params["protomsg"];
        string gateServerIP   = loginresponse.gsip;
        uint   gateServerPort = loginresponse.gsport;

        Global.uid = loginresponse.uaid;
        //NGUIDebug.Log("Recv GateInfo IP: " + gateServerIP + "    Recv GateInfo Port: " + gateServerPort);

        switch (loginresponse.loginresult.ToString())
        {
        case "login_success":
            awnet.Disconnect();
            awnetgate.Connect(gateServerIP, (int)gateServerPort);
            break;

        case "login_accounterror":
            Debug.LogError("user and password     error");
            break;

        case "login_fail":
            Debug.LogError("login   fail");
            awnet.Disconnect();
            Login_Server();
            awnetgate.Connect(gateServerIP, (int)gateServerPort);
            break;
        }
        if (loginresponse.loginresult.ToString() == "login_success")
        {
            awnet.Disconnect();
            awnetgate.Connect(gateServerIP, (int)gateServerPort);
        }
        else
        {
            Debug.LogError("username...... error");
        }
    }