コード例 #1
0
 void Update()
 {
     if (m_timerDelay != null)
     {
         m_timerDelay.Update(Time.deltaTime);
     }
 }
コード例 #2
0
ファイル: UIMatch.cs プロジェクト: Avatarchik/LockStepDemo
 void FixedUpdate()
 {
     if (m_pingTime != null)
     {
         m_pingTime.Update(Time.fixedDeltaTime);
     }
 }
コード例 #3
0
    public void FixedUpdate(float fDeltaTime)
    {
        if (!m_init)
        {
            return;
        }

        m_curTime += fDeltaTime;
        if (m_timer != null)
        {
            m_timer.Update(fDeltaTime);
        }
    }
コード例 #4
0
    override public void GameUpdate(IM.Number fDeltaTime)
    {
        base.GameUpdate(fDeltaTime);

        if (!NGUITools.GetActive(panel.gameObject) && !GameSystem.Instance.mClient.pause)
        {
            NGUITools.SetActive(panel.gameObject, true);
            timer.stop = false;
        }

        if (timer != null)
        {
            timer.Update((float)fDeltaTime);
        }
    }
コード例 #5
0
    public void OnUpdate(float fDeltaTime)
    {
        if (!m_bZoomState)
        {
            return;
        }

        if (m_timerStay != null)
        {
            m_timerStay.Update(fDeltaTime);
        }

        float fZPosition   = transform.position.z;
        float fDistToMoveZ = m_zoomTarget.position.z - m_curZoomParam.m_fZDistToTarget - transform.position.z;

        if (fDistToMoveZ > 0.0f)
        {
            fZPosition += m_curZoomParam.m_fZoomSpeed * fDeltaTime;
        }
        else
        {
            if (m_timerStay != null)
            {
                m_timerStay.stop = false;
            }
        }

        float fYPosition   = transform.position.y;
        float fDistToMoveY = transform.position.y - m_curZoomParam.m_fYDistToTarget;

        if (fDistToMoveY > 0.0f)
        {
            fYPosition -= m_fYSpeed * fDeltaTime;
        }
        //float fXPosition = Mathf.Lerp(transform.position.x, m_zoomTarget.transform.position.x, 0.5f);
        float fXPosition = Mathf.MoveTowards(transform.position.x, m_zoomTarget.transform.position.x, 0.1f);

        transform.position = new Vector3(fXPosition, fYPosition, fZPosition);

        float fCurAngle   = Vector3.Angle(Vector3.forward, transform.forward);
        float fNextAngle  = fCurAngle + m_fDeg * fDeltaTime;
        float fDeltaAngle = (fNextAngle - m_curZoomParam.m_fTargetAngle);

        if (fDeltaAngle > 0.0f)
        {
            transform.rotation = Quaternion.Euler(fNextAngle, 0.0f, 0.0f);
        }
    }
コード例 #6
0
 public void Update(float deltaTime)
 {
     //update sound timer
     for (int idx = m_soundsToPlay.Count - 1; idx >= 0; idx--)
     {
         GameUtils.Timer4View timer = m_soundsToPlay[idx];
         if (timer == null)
         {
             continue;
         }
         timer.Update(deltaTime);
         if (timer.stop)
         {
             m_soundsToPlay.RemoveAt(idx);
         }
     }
 }
コード例 #7
0
    override public void ViewUpdate(float deltaTime)
    {
        base.ViewUpdate(deltaTime);

        m_timer.Update(deltaTime);

        if (m_trackPlayer != null)
        {
            m_trackPlayer.Update((float)deltaTime);
        }

        if (m_trackPlayer.m_play)
        {
            return;
        }

        m_stateMachine.SetState(State.ePlayerCloseUp);
    }
コード例 #8
0
    public override void GameUpdate(IM.Number deltaTime)
    {
        base.GameUpdate(deltaTime);

        UBasketball ball = match.mCurScene.mBall;

        if (!passing && ball.m_ballState == BallState.eUseBall_Pass)
        {
            passing = true;
            passer  = ball.m_actor;
        }
        else if (passing && ball.m_ballState == BallState.eUseBall_Pass)
        {
            passing = false;
            OnPassed();
        }

        match.HighlightButton(1, in_tutorial && (IsCommandValid(Command.Pass) || IsCommandValid(Command.RequireBall)));

        if (timer != null)
        {
            timer.Update(RealTime.deltaTime);
        }
    }
コード例 #9
0
    public void Update()
    {
        if (m_timerHideName != null)
        {
            m_timerHideName.Update(Time.deltaTime);
        }

        if (m_owner == null || m_goPlayerInfo == null)
        {
            return;
        }

        PlayerState.State playerState = m_owner.m_StateMachine.m_curState.m_eState;
        if (m_owner.m_bWithBall && m_uiState != null)
        {
            //m_uiState.gameObject.SetActive(true);
            //m_uiState.spriteName = "Ball";
        }
        else if (playerState == PlayerState.State.eStolen ||
                 playerState == PlayerState.State.eCrossed)
        {
            m_uiState.gameObject.SetActive(true);
            m_uiState.spriteName = "Exclam";
        }
        else
        {
            m_uiState.gameObject.SetActive(false);
            m_uiState.spriteName = "None";
        }

        if (!m_bWithBall && m_owner.m_bWithBall)                // Player get ball
        {
            // Show
            m_uiPosition.transform.localPosition = m_oriPositionPos;
            NGUITools.SetActive(m_uiName.gameObject, true);
            m_uiName.alpha         = 1f;
            m_nameFadeAway.enabled = false;
            // Begin countdown
            m_timerHideName.Reset();
            m_timerHideName.stop = false;
        }
        else if (m_bWithBall && !m_owner.m_bWithBall)           // Player lose ball
        {
            // Fade away instantly
            m_timerHideName.stop = true;
            OnTimerHideName();
        }

        m_bWithBall = m_owner.m_bWithBall;

        UIManager uiMgr = GameSystem.Instance.mClient.mUIManager;

        if (uiMgr == null || uiMgr.m_uiCamera == null)
        {
            return;
        }

        GameMatch curMatch = GameSystem.Instance.mClient.mCurMatch;

        if (curMatch != null && curMatch.m_uiInGamePanel != null)
        {
            {
                m_goPlayerInfo.transform.parent        = curMatch.m_uiInGamePanel.transform;
                m_goPlayerInfo.transform.localPosition = Vector3.zero;
                m_goPlayerInfo.transform.localScale    = Vector3.one;
            }

            {
                m_goState.transform.parent        = curMatch.m_uiInGamePanel.transform;
                m_goState.transform.localPosition = Vector3.zero;
                m_goState.transform.localScale    = Vector3.one;
            }
        }

        Vector3 viewPos     = Camera.main.WorldToViewportPoint(m_owner.transform.position);
        Vector3 viewHeadPos = Camera.main.WorldToViewportPoint(m_owner.model.head.position);

        Vector3 worldPos = uiMgr.m_uiCamera.GetComponent <Camera>().ViewportToWorldPoint(viewPos);
        Vector3 posHead  = Vector3.zero;

        Vector3 worldHeadPos = uiMgr.m_uiCamera.GetComponent <Camera>().ViewportToWorldPoint(viewHeadPos);

        m_goPlayerInfo.transform.position = worldHeadPos;
        posHead = m_goPlayerInfo.transform.localPosition;

        m_goPlayerInfo.transform.position = worldPos;
        Vector3 pos = m_goPlayerInfo.transform.localPosition;

        pos.x = Mathf.FloorToInt(pos.x);
        pos.y = Mathf.FloorToInt(pos.y);
        pos.z = 0.0f;
        m_goPlayerInfo.transform.localPosition = pos;

        m_YState = (posHead.y - pos.y) + 50.0f;

        m_goState.transform.position      = worldPos;
        m_uiState.transform.localPosition = Vector3.up * m_YState;

        pos   = m_goState.transform.localPosition;
        pos.x = Mathf.FloorToInt(pos.x);
        pos.y = Mathf.FloorToInt(pos.y);
        pos.z = 2.0f;
        m_goState.transform.localPosition = pos;
    }
コード例 #10
0
    public void Update()
    {
        if (curStep == null && readyStep != null)
        {
            if (string.IsNullOrEmpty(readyStep.uiName) || IsUIVisible(readyStep.uiName, readyStep.highlightButton))
            {
                GuideStep stepToRun = readyStep;
                readyStep = null;
                RunStep(stepToRun);
            }
        }
        else if (curStep != null)
        {
            bool isUIVisible     = IsUIVisible(curStep.uiName);
            bool isButtonCovered = !IsUIVisible(curStep.uiName, curStep.highlightButton);

            if (curStep.conditions.Contains(GuideStep.CompleteCondition.EndWithUI) && !isUIVisible)
            {
                EndCurStep();
            }
            else
            {
                if (isUIVisible)
                {
                    if (!guideHiding && isButtonCovered)
                    {
                        Hide(true);
                    }
                    else if (guideHiding && !isButtonCovered)
                    {
                        Hide(false);
                    }

                    Animator animator = basePanel.FindChild(curStep.uiName).GetComponent <Animator>();
                    if (showTipAfterAnimating && !IsAnimating(animator))
                    {
                        ShowTip(curStep);
                        showTipAfterAnimating = false;
                    }
                }
                else
                {
                    //Interrupted
                    ModuleClear();
                }
            }
        }

        if (timerFinishStep != null)
        {
            timerFinishStep.Update(Time.deltaTime);
        }

        if (toListenPractiseGuide)
        {
            GameMatch_Practise match = GameSystem.Instance.mClient.mCurMatch as GameMatch_Practise;
            if (match != null)
            {
                PractiseBehaviourGuide behaviour = match.practise_behaviour as PractiseBehaviourGuide;
                if (behaviour != null)
                {
                    Transform tmBasePanel  = GameSystem.Instance.mClient.mUIManager.m_uiRootBasePanel.transform;
                    Transform tmBackButton = tmBasePanel.FindChild("UIPractise(Clone)/ButtonBack(Clone)");
                    if (tmBackButton != null)
                    {
                        NGUITools.SetActive(tmBackButton.gameObject, false);
                    }
                    behaviour.onOver     += OnPractiseGuideOver;
                    toListenPractiseGuide = false;
                }

                PractiseBehaviourSkillGuide behaviour1 = match.practise_behaviour as PractiseBehaviourSkillGuide;
                if (behaviour1 != null)
                {
                    behaviour1.onOver    += OnPractiseGuideOver;
                    toListenPractiseGuide = false;
                }
            }
        }
    }
コード例 #11
0
ファイル: Spark.cs プロジェクト: Avatarchik/LockStepDemo
 public void Update(float fDeltaTime)
 {
     m_sparkTimer.Update(fDeltaTime);
 }
コード例 #12
0
 public override void ViewUpdate(float fDeltaTime)
 {
     base.ViewUpdate(fDeltaTime);
     timer1.Update(fDeltaTime);
 }
コード例 #13
0
    void Update()
    {
        for (int i = updatePreclist.Count - 1; i >= 0; i--)
        {
            UpdatePrec up = updatePreclist[i];
            up.curTime += Time.deltaTime;
            if (up.curTime > updatePreclist[i].targetTime)
            {
                up.PrecValue--;
                up.curTime = 0.0f;
                up.loadingItem.percentage++;
                LuaComponent loadingItem = up.loadingItem.transform.GetComponent <LuaComponent>();
                if (loadingItem.table != null)
                {
                    loadingItem.table.Set("loadingState", CommonFunction.GetConstString("STR_LOADING") + up.loadingItem.percentage + "%");
                }
            }
            if (up.PrecValue == 0)
            {
                if (m_curLoadingCmd != null)
                {
                    if (up.loadingItem.ri != null)
                    {
                        if (up.loadingItem.ri.acc_id == MainPlayer.Instance.AccountID)
                        {
                            m_curLoadingCmd.m_bDone = true;
                        }
                    }
                    else
                    {
                        m_curLoadingCmd.m_bDone = true;
                    }
                }

                updatePreclist.RemoveAt(i);
            }
        }

        _InitGameMsgHandler();

        //loading queue process
        if (m_curLoadingCmd == null && m_loadingQueue.Count != 0)
        {
            m_curLoadingCmd = m_loadingQueue.Dequeue();
            m_curLoadingCmd.Execute();
        }
        if (m_curLoadingCmd != null && m_curLoadingCmd.m_bDone)
        {
            if (m_curLoadingCmd.m_bFinalCmd)
            {
                m_curLoadingStep = LoadingStep.eLoadingComplete;
            }
            m_curLoadingCmd = null;
        }
        if (m_curLoadingStep == LoadingStep.eInit)
        {
            return;
        }

        if (m_wait != null)
        {
            m_wait.Update(Time.deltaTime);
        }

        GameMatch_PVP match = GameSystem.Instance.mClient.mCurMatch as GameMatch_PVP;

        if (match == null)
        {
            if (m_curLoadingStep == LoadingStep.eLoadingComplete)
            {
                if (onComplete != null)
                {
                    onComplete();
                }
                Object.Destroy(gameObject);
            }
        }
        else
        {
            if (m_curLoadingStep == LoadingStep.eLoadedScene && match.m_bPlayerDataReady && !m_pvpLoadPlayer)
            {
                LoadCharacter(GameSystem.Instance.mClient.mPlayerManager, match);
                m_pvpLoadPlayer = true;
            }

            if (m_curLoadingStep == LoadingStep.eLoadedPlayers && !m_pvpLoadUI)
            {
                LoadUI(match);
                m_pvpLoadUI = true;
            }

            if (m_curLoadingStep == LoadingStep.eLoadingComplete && !m_pvpLoadComplete)
            {
                if (onComplete != null)
                {
                    onComplete();
                }
                m_pvpLoadComplete = true;
                GameMsgSender.SendLoadingComplete(match.GetMatchType());
            }

            if (m_curLoadingStep == LoadingStep.eLoadingComplete && disConnected)
            {
                disConnected = false;
                ShowOffLine();
            }

            if (m_delayDestroy && !MainPlayer.Instance.inPvpJoining)
            {
//               if( m_delayLoadLua != null)
//               {
//                   m_delayLoadLua.ForEach((LuaComponent item) =>
//                                 {
//                                     item.table.Set("loadingState", CommonFunction.GetConstString("STR_LOAD_COMPLETE"));
//                                     item.table.Set("loadDone", true);
//                                 });

//               }
                Object.Destroy(gameObject);
            }
        }
    }