Beispiel #1
0
 // Use this for initialization
 void Start()
 {
     CreateInstance(this);
     DontDestroyOnLoad(this);
     H5Manager.Instance().GetGameSessionResetCallBack().Add(OnGameSessionReset);
     if (H5Manager.Instance().GetGameSession() != null)
     {
         OnGameSessionReset(H5Manager.Instance().GetGameSession());
     }
 }
Beispiel #2
0
    public void OnLoginAckPlayerGameStart(byte[] pBuf)
    {
        GameProto.LoginAckPlayerGameStart oRet = GameProto.LoginAckPlayerGameStart.Parser.ParseFrom(pBuf);
        if (oRet == null)
        {
            H5Helper.H5LogStr("OnLoginAckPlayerGameStart error parse");
            return;
        }
        H5Helper.H5LogStr("game start : " + oRet.DwResult.ToString());

        H5Manager.Instance().ConnectGame(oRet.SzListenIp, (ushort)oRet.DwPlayerPort);
    }
Beispiel #3
0
    public void OnDestroy()
    {
        if (m_pSession != null)
        {
            m_pSession.m_pfOnConnect.Remove(OnConnect);
            m_pSession.m_pfOnError.Remove(OnError);
            m_pSession.m_pfOnClose.Remove(OnClose);

            m_pSession.UnRegistMessage("GameProto.PlayerRequestGameTest");
        }
        H5Manager.Instance().GetGameSessionResetCallBack().Remove(OnGameSessionReset);
    }
Beispiel #4
0
    public void OnDestroy()
    {
        if (m_pSession != null)
        {
            m_pSession.m_pfOnConnect.Remove(OnConnect);
            m_pSession.m_pfOnError.Remove(OnError);
            m_pSession.m_pfOnClose.Remove(OnClose);

            m_pSession.UnRegistMessage("GameProto.LoginAckPlayerServerId");
            m_pSession.UnRegistMessage("GameProto.LoginAckPlayerLoginResult");
            m_pSession.UnRegistMessage("GameProto.LoginAckPlayerMakeTeam");
            m_pSession.UnRegistMessage("GameProto.LoginAckPlayerGameStart");
        }
        H5Manager.Instance().GetLoginSessionResetCallBack().Remove(OnLoginSessionReset);
    }
Beispiel #5
0
    public void InvitePlayer()
    {
        GameProto.PlayerRequestLoginInviteTeam oTeam = new GameProto.PlayerRequestLoginInviteTeam();
        oTeam.QwPlayerId = m_qwPlayerId;
        byte[]          pData   = new byte[1024];
        FxNet.NetStream pStream = new FxNet.NetStream(FxNet.NetStream.ENetStreamType.ENetStreamType_Write, pData, 1024);
        pStream.WriteString("GameProto.PlayerRequestLoginInviteTeam");
        byte[] pProto = new byte[oTeam.CalculateSize()];
        Google.Protobuf.CodedOutputStream oStream = new Google.Protobuf.CodedOutputStream(pProto);
        oTeam.WriteTo(oStream);
        pStream.WriteData(pProto, (uint)pProto.Length);

        H5Manager.Instance().GetLoginSession().Send(pData, 1024 - pStream.GetLeftLen());

        //m_pSession.Send(pData, 1024 - pStream.GetLeftLen());
    }
Beispiel #6
0
    public void OnLoginAckPlayerLoginResult(byte[] pBuf)
    {
        GameProto.LoginAckPlayerLoginResult oRet = GameProto.LoginAckPlayerLoginResult.Parser.ParseFrom(pBuf);
        if (oRet == null)
        {
            SampleDebuger.Log("OnTest error parse");
            return;
        }

        SampleDebuger.Log("login ret : " + oRet.DwResult.ToString());

        AssetBundleLoader.Instance().LoadLevelAsset(GameConstant.g_szLobbyScene, delegate()
        {
            if (!string.IsNullOrEmpty(PlayerData.Instance().proGameIp))
            {
                H5Manager.Instance().ConnectGame(PlayerData.Instance().proGameIp, PlayerData.Instance().proGamePort);
            }
        }
                                                    );
    }
Beispiel #7
0
 // Use this for initialization
 void Start()
 {
     H5Manager.Instance().GetLoginSessionResetCallBack().Add(OnLoginSessionReset);
 }
Beispiel #8
0
 public void GameStart()
 {
     H5Manager.Instance().ConnectLogin();
 }
Beispiel #9
0
 public void GameStart()
 {
     GameInstance.Instance().SetServerInfo(m_pServerInfo);
     H5Manager.Instance().ConnectLogin();
 }
Beispiel #10
0
 // Use this for initialization
 void Start()
 {
     CreateInstance(this);
     DontDestroyOnLoad(this);
     H5Manager.Instance().GetLoginSessionResetCallBack().Add(OnLoginSessionReset);
 }
Beispiel #11
0
 // Use this for initialization
 void Start()
 {
     DontDestroyOnLoad(this);
     H5Manager.Instance().GetGameSessionResetCallBack().Add(OnGameSessionReset);
 }