Exemplo n.º 1
0
    // 更新本地界面和数据,以Update开头
    void UpdateUserInfo(TigerUserInfo usrInfo)
    {
        // 刷新数据
        m_clerk.UId = usrInfo.UserId;
        if (m_clerk.Gold != 0 && m_clerk.Gold != usrInfo.Gold)
        {
            DebugConsole.Log("Gold cant match!!!");
        }
        else
        {
            DebugConsole.Log("Gold can match!!!");
        }
        m_clerk.Gold  = usrInfo.Gold;
        m_clerk.Login = true;

        // 以下代码用于刷新界面
        m_clerk.Bet   = m_clerk.Bet;
        m_clerk.Lines = m_clerk.Lines;
    }
Exemplo n.º 2
0
    public void Execute(ProtoPacket packet)
    {
        ProtoNet.WriteLog("handle cmd from server:" + packet.cmdId);
        switch (packet.cmdId)
        {
        case Constants.Tiger_QuickLoginInfo:    // QuickLoginInfo返回
        {
            TigerUserInfo usrInfo = (TigerUserInfo)packet.proto;

            /*
             * SlotClientNet.WriteLog("Recv proto packet[UserInfo]:\nid=" +
             *  usrInfo.user_id + "\ngold=" + usrInfo.gold);
             */
            UpdateUserInfo(usrInfo);
        }
        break;

        case Constants.Tiger_Spin:
        {
            TigerResp tigerResp = (TigerResp)packet.proto;

            /*
             * SlotClientNet.WriteLog("Recv proto packet[TigerResp]:\ntiger_no=" +
             *  tigerResp.tiger_no +
             *  "\nseq_no=" + tigerResp.seq_no +
             *  "\npos=" + tigerResp.pos.ToString() +
             *  "\nbonus=" + tigerResp.bonus +
             *  "\npos=" + tigerResp.pos);*/

            UpdateTigerResp(tigerResp);
        }
        break;

        case Constants.Reconnect:
        {
            if (packet.msgId == 1)
            {
                ProtoNet.WriteLog("Reconnecting...");
                // 3s后Display中重连
                m_clerk.Net.CheckReconnect(3);
            }
            else if (packet.msgId == 2)
            {
                ProtoNet.WriteLog("Reconnecting successfully.");
            }
            else
            {
                ProtoNet.WriteLog("Reconnecting successfully:" + packet.msgId);
            }
        }
        break;

        case Constants.Error:
        {
            ProtoNet.WriteLog("Reconnecting...");
        }
        break;

        default:
            ProtoNet.WriteLog("Unknown send cmd");
            break;
        }
    }