public void ObserverUpdate(ISubject subject, System.Object arg)
 {
     mCurrentBeatType = (EnumBeatType)arg;
     mBeatManager     = subject;
     print(mCurrentBeatType);
     //print (Time.frameCount);
 }
    //订阅主题数据
    void IObserver.ObserverUpdate(ISubject subject, System.Object arg)
    {
        if (mBarCount == 0)
        {
            mIsFirstEvaluation = true;
        }

        mCurrentBeatType = (EnumBeatType)arg;
        mBeatManager     = subject;
        mBeatCount++;
        if (mCurrentBeatType == EnumBeatType.DOWNBEAT)
        {
            mBarCount++;
        }
        //print (mCurrentBeatType);			//test
    }
    // Update is called once per frame
    void Update()
    {
        if (mIsGameStart)
        {
            mDeltaTime = Time.deltaTime;
            mBarIimer  = mBarIimer + mDeltaTime;
        }
        else
        {
        }
        //每过一个节拍的时间通知一次观察者
        if (mBarIimer > mBeatSeconds * mBeatTurningPoint)
        {
            mBeatTurningPoint++;
            switch (mCurrentBarType)
            {
            case EnumBarType.BEAT_1_4:
                mCurrentBeatType = EnumBeatType.DOWNBEAT;
                mTimes           = 1;
                if (mBarIimer + mBeatSeconds - mBeatSeconds * mSameBarNumber - mBarTurningPoint > 0)
                {
                    if (mCurrentBar < mListCount - 1)
                    {
                        mCurrentBarType = mListSameBarsAttribute[++mCurrentBar].BarType;
                        mSameBarNumber  = mListSameBarsAttribute[mCurrentBar].SameBarsNumber;
                    }
                    else
                    {
                        mIsGameOver = true;
                    }
                    mBarTurningPoint = mBarIimer + mBeatSeconds - mDeltaTime;
                }
                if (mBarIimer + mBeatSeconds - mBarTurningPoint > 0)
                {
                    mCurrentBarIndex++;
                }
                break;

            case EnumBarType.BEAT_2_4:
                switch (mTimes)
                {
                case 1:
                    mCurrentBeatType = EnumBeatType.DOWNBEAT;
                    mTimes++;
                    if (mBarIimer + 2 * mBeatSeconds - mBarTurningPoint > 0)
                    {
                        mCurrentBarIndex++;
                    }

                    break;

                case 2:
                    mCurrentBeatType = EnumBeatType.UPBEAT;
                    mTimes           = 1;
                    if (mBarIimer + mBeatSeconds - mBeatSeconds * 2 * mSameBarNumber - mBarTurningPoint > 0)
                    {
                        if (mCurrentBar < mListCount - 1)
                        {
                            mCurrentBarType = mListSameBarsAttribute[++mCurrentBar].BarType;
                            mSameBarNumber  = mListSameBarsAttribute[mCurrentBar].SameBarsNumber;
                        }
                        else
                        {
                            mIsGameOver = true;
                        }
                        mBarTurningPoint = mBarIimer + mBeatSeconds - mDeltaTime;
                    }
                    break;
                }
                break;

            case EnumBarType.BEAT_3_4:
                switch (mTimes)
                {
                case 1:
                    mCurrentBeatType = EnumBeatType.DOWNBEAT;
                    mTimes++;
                    if (mBarIimer + 3 * mBeatSeconds - mBarTurningPoint > 0)
                    {
                        mCurrentBarIndex++;
                    }
                    break;

                case 2:
                    mCurrentBeatType = EnumBeatType.UPBEAT;
                    mTimes++;
                    break;

                case 3:
                    mCurrentBeatType = EnumBeatType.UPBEAT;
                    mTimes           = 1;
                    if (mBarIimer + mBeatSeconds - mBeatSeconds * 3 * mSameBarNumber - mBarTurningPoint > 0)
                    {
                        if (mCurrentBar < mListCount - 1)
                        {
                            mCurrentBarType = mListSameBarsAttribute[++mCurrentBar].BarType;
                            mSameBarNumber  = mListSameBarsAttribute[mCurrentBar].SameBarsNumber;
                        }
                        else
                        {
                            mIsGameOver = true;
                        }
                        mBarTurningPoint = mBarIimer + mBeatSeconds - mDeltaTime;
                    }


                    break;
                }

                break;


            case EnumBarType.BEAT_3_8:
                switch (mTimes)
                {
                case 1:
                    mCurrentBeatType = EnumBeatType.DOWNBEAT;
                    mTimes++;
                    if (mBarIimer + 3 * mBeatSeconds - mBarTurningPoint > 0)
                    {
                        mCurrentBarIndex++;
                    }
                    break;

                case 2:
                    mCurrentBeatType = EnumBeatType.UPBEAT;
                    mTimes++;
                    break;

                case 3:
                    mCurrentBeatType = EnumBeatType.UPBEAT;
                    mTimes           = 1;
                    if (mBarIimer + mBeatSeconds - mBeatSeconds * 3 * mSameBarNumber - mBarTurningPoint > 0)
                    {
                        if (mCurrentBar < mListCount - 1)
                        {
                            mCurrentBarType = mListSameBarsAttribute[++mCurrentBar].BarType;
                            mSameBarNumber  = mListSameBarsAttribute[mCurrentBar].SameBarsNumber;
                        }
                        else
                        {
                            mIsGameOver = true;
                        }
                        mBarTurningPoint = mBarIimer + mBeatSeconds - mDeltaTime;
                    }

                    break;
                }

                break;

            case EnumBarType.BEAT_4_4:
                switch (mTimes)
                {
                case 1:
                    mCurrentBeatType = EnumBeatType.DOWNBEAT;
                    mTimes++;
                    if (mBarIimer + 4 * mBeatSeconds - mBarTurningPoint > 0)
                    {
                        mCurrentBarIndex++;
                    }
                    break;

                case 2:
                    mCurrentBeatType = EnumBeatType.UPBEAT;
                    mTimes++;
                    break;

                case 3:
                    mCurrentBeatType = EnumBeatType.OFFBEAT;
                    mTimes++;
                    break;

                case 4:
                    mCurrentBeatType = EnumBeatType.UPBEAT;
                    mTimes           = 1;
                    if (mBarIimer + mBeatSeconds - mBeatSeconds * 4 * mSameBarNumber - mBarTurningPoint > 0)
                    {
                        if (mCurrentBar < mListCount - 1)
                        {
                            mCurrentBarType = mListSameBarsAttribute[++mCurrentBar].BarType;
                            mSameBarNumber  = mListSameBarsAttribute[mCurrentBar].SameBarsNumber;
                        }
                        else
                        {
                            mIsGameOver = true;
                        }
                        mBarTurningPoint = mBarIimer + mBeatSeconds - mDeltaTime;
                    }
                    break;
                }
                break;

            case EnumBarType.BEAT_6_8:
                switch (mTimes)
                {
                case 1:
                    mCurrentBeatType = EnumBeatType.DOWNBEAT;
                    mTimes++;
                    if (mBarIimer + 6 * mBeatSeconds - mBarTurningPoint > 0)
                    {
                        mCurrentBarIndex++;
                    }
                    break;

                case 2:
                    mCurrentBeatType = EnumBeatType.UPBEAT;
                    mTimes++;
                    break;

                case 3:
                    mCurrentBeatType = EnumBeatType.UPBEAT;
                    mTimes++;
                    break;

                case 4:
                    mCurrentBeatType = EnumBeatType.OFFBEAT;
                    mTimes++;
                    break;

                case 5:
                    mCurrentBeatType = EnumBeatType.UPBEAT;
                    mTimes++;
                    break;

                case 6:
                    mCurrentBeatType = EnumBeatType.UPBEAT;
                    mTimes           = 1;
                    if (mBarIimer + mBeatSeconds - mBeatSeconds * 6 * mSameBarNumber - mBarTurningPoint > 0)
                    {
                        if (mCurrentBar < mListCount - 1)
                        {
                            mCurrentBarType = mListSameBarsAttribute[++mCurrentBar].BarType;
                            mSameBarNumber  = mListSameBarsAttribute[mCurrentBar].SameBarsNumber;
                        }
                        else
                        {
                            mIsGameOver = true;
                        }
                        mBarTurningPoint = mBarIimer + mBeatSeconds - mDeltaTime;
                    }

                    break;
                }

                break;

                //	case EnumBarType.OTHER_BEAT:
            }
            NotifyObserver(mCurrentBeatType);
            //print (mCurrentBarIndex);
            //print (IsGameOver);
        }
    }