Example #1
0
        public void Stop()
        {
            mGameState = FSPGameState.None;

            if (mClient != null)
            {
                mClient.Close();
                mClient = null;
            }

            if (mFrameCtrl != null)
            {
                mFrameCtrl.Close();
                mFrameCtrl = null;
            }

            mFrameListener = null;
            mFrameBuffer.Clear();
            mIsRunning = false;

            onGameBegin    = null;
            onRoundBegin   = null;
            onControlStart = null;
            onGameEnd      = null;
            onRoundEnd     = null;
        }
Example #2
0
        public void Start(FSPParam param, uint playerId)
        {
            m_Param        = param;
            m_MinePlayerId = playerId;
            LOG_TAG        = "FSPManager[" + playerId + "]";

            Debuger.Log();

            if (m_Param.useLocal)
            {
                m_LockedFrameIndex = param.maxFrameId;
            }
            else
            {
                m_Client = new FSPClient();
                m_Client.Init(m_Param.sid);
                m_Client.SetFSPAuthInfo(param.authId);
                m_Client.SetFSPListener(OnFSPListener);

                m_Client.Connect(param.host, param.port);
                m_Client.VerifyAuth();

                m_LockedFrameIndex = m_Param.clientFrameRateMultiple - 1;
            }

            m_IsRunning = true;
            m_GameState = FSPGameState.Create;

            m_FrameBuffer       = new DictionarySafe <int, FSPFrame>();
            m_CurrentFrameIndex = 0;

            m_FrameCtrl = new FSPFrameController();
            m_FrameCtrl.Start(param);
        }
Example #3
0
        public void Start(FSPParam param, uint playerId)
        {
            mParam        = param;
            mMinePlayerId = playerId;
            LOG_TAG       = "FSPManager[" + playerId + "]";

            if (!mParam.useLocal)
            {
                mClientLockedFrame = mParam.clientFrameRateMultiple - 1;

                mClient = new FSPClient();
                mClient.SetSessionId((ushort)param.sid);
                mClient.SetFSPAuthInfo(param.authId);
                mClient.Connect(param.host, param.port);
                mClient.SetFSPListener(OnFSPListener);
                mClient.VerifyAuth();
            }
            else
            {
                mClientLockedFrame = param.maxFrameId;
            }

            mFrameCtrl = new FSPFrameController();
            mFrameCtrl.Start(param);

            mFrameBuffer = new DictionaryExt <int, FSPFrame>();

            mIsRunning         = true;
            mGameState         = FSPGameState.Create;
            mCurrentFrameIndex = 0;
        }