static void SendPlayerLoginMsg_c(SyncSession session, PlayerLoginMsg_c msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        data.Add("code0", msg.code0);
        data.Add("content", msg.content);
        data.Add("characterid", msg.characterID);
        session.SendMsg("playerloginmsg", data);
    }
Пример #2
0
    public void RecevicePlayerLogin(SyncSession session, PlayerLoginMsg_s e)
    {
        //玩家已登录
        if (m_onLinePlayer.ContainsKey(e.playerID))
        {
            return;
        }

        Debug.Log("RecevicePlayerLogin");

        if (session.player != null)
        {
            Debug.Log("" + session.player.playerID + " 已经登录,不需要重复登录! ");
        }

        //string clauseContent = "ID ='" + e.playerID + "'";
        //var result = DataBaseService.database.Query(c_playerTableName,null, clauseContent, null,null,null,null);

        //if(result.MoveToNext())
        //{
        //    Debug.Log("查询到记录! ");

        //    session.player = GetOldPlayer(result);

        //    result.Close();
        //}
        //else
        //{
        //result.Close();
        //Debug.Log("未查询到记录!");

        session.player = GetNewPlayer();
        Dictionary <string, string> value = new Dictionary <string, string>();

        value.Add("ID", e.playerID);

        //DataBaseService.database.Insert(c_playerTableName, null, value);
        //}

        session.player.playerID = e.playerID;
        session.player.nickName = e.nickName;
        session.player.session  = session;

        PlayerLoginMsg_c msg = new PlayerLoginMsg_c();

        msg.code         = ServiceErrorCode.c_Success;
        msg.characterID  = session.player.characterID;
        msg.ownCharacter = session.player.OwnCharacter;
        msg.diamond      = session.player.Diamond;
        msg.coin         = session.player.Coin;
        ProtocolAnalysisService.SendMsg(session, msg);

        //派发玩家登陆事件
        m_service.OnPlayerLogin(session.player);
    }
Пример #3
0
    static void SendPlayerLoginMsg_c(SyncSession session, PlayerLoginMsg_c msg)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        data.Add("code", msg.code);
        data.Add("characterid", msg.characterID);
        {
            List <object> list = new List <object>();
            for (int i = 0; i < msg.ownCharacter.Count; i++)
            {
                list.Add(msg.ownCharacter[i]);
            }
            data.Add("owncharacter", list);
        }
        data.Add("coin", msg.coin);
        data.Add("diamond", msg.diamond);
        session.SendMsg("playerloginmsg", data);
    }
    public void RecevicePlayerLogin(SyncSession session, PlayerLoginMsg_s e)
    {
        Debug.Log("RecevicePlayerLogin");

        if (session.player != null)
        {
            Debug.Log("" + session.player.playerID + " 已经登录,不需要重复登录! ");
        }

        string clauseContent = "ID ='" + e.playerID + "'";
        var    result        = DataBaseService.database.Query(c_playerTableName, null, clauseContent, null, null, null, null);

        if (result.MoveToNext())
        {
            Debug.Log("查询到记录! ");

            session.player = GetOldPlayer(result);

            result.Close();
        }
        else
        {
            result.Close();
            Debug.Log("未查询到记录!");

            session.player = GetNewPlayer();

            Dictionary <string, string> value = new Dictionary <string, string>();
            value.Add("ID", e.playerID);
            DataBaseService.database.Insert(c_playerTableName, null, value);
        }

        session.player.playerID = e.playerID;
        session.player.session  = session;

        PlayerLoginMsg_c msg = new PlayerLoginMsg_c();

        ProtocolAnalysisService.SendMsg(session, msg);

        //派发玩家登陆事件
        m_service.OnPlayerLogin(session.player);
    }