BBGamelib.CCScheduler.update C# (CSharp) Method

update() public method

public update ( float dt ) : void
dt float
return void
		public void update(float dt){
			if (_paused)
				return;
			updateHashLocked = true;
			if (!FloatUtils.EQ(_timeScale , 1.0f))
				dt *= _timeScale;
			
			// Iterate all over the Updates selectors
			// updates with priority < 0
			{
				
				for( utNode<tListEntry> tmp = updatesNeg.head; tmp != null ; tmp = tmp.next ) {
					utNode<tListEntry> entry = tmp;
					if(! entry.obj.paused && !entry.obj.markedForDeletion){
						entry.obj.impMethod.Invoke(dt);
					}
				}
			}
			// updates with priority == 0
			{
				for( utNode<tListEntry> tmp = updates0.head; tmp != null ; tmp = tmp.next ) {
					utNode<tListEntry> entry = tmp;
					if(! entry.obj.paused && !entry.obj.markedForDeletion)
						entry.obj.impMethod.Invoke(dt);
				}
			}
			// updates with priority > 0
			{
				
				for( utNode<tListEntry> tmp = updatesPos.head; tmp != null ; tmp = tmp.next ) {
					utNode<tListEntry> entry = tmp;
					if(! entry.obj.paused && !entry.obj.markedForDeletion)
						entry.obj.impMethod.Invoke(dt);
				}
			}

//			 Iterate all over the custom selectors (CCTimers)
			if(hashForTimers.Any()){
				var enumerator = new Dictionary<int, tHashTimerEntry>(hashForTimers).GetEnumerator();
				while (enumerator.MoveNext()) {
					var elt = enumerator.Current.Value;
					currentTarget = elt;
					currentTargetSalvaged = false;
					if( ! currentTarget.paused){
						for(elt.timerIndex = 0; elt.timerIndex < elt.timers.Count; elt.timerIndex ++ ){
							elt.currentTimer = elt.timers[elt.timerIndex];
							elt.currentTimerSalvaged = false;
							elt.currentTimer.update(dt);
							elt.currentTimer = null;
						}
					}
					if(currentTargetSalvaged && currentTarget.timers.Count == 0)
						removeHashElement(currentTarget);
				}
			}

			
			for (utNode<tListEntry> tmp = updatesNeg.head; tmp != null; tmp = tmp.next) {
				utNode<tListEntry> entry = tmp;
				if(entry.obj.markedForDeletion){
					removeUpdatesFromHash(entry);
				}
			}
			
			for (utNode<tListEntry> tmp = updates0.head; tmp != null; tmp = tmp.next) {
				utNode<tListEntry> entry = tmp;
				if(entry.obj.markedForDeletion){
					removeUpdatesFromHash(entry);
				}
			}

			
			for (utNode<tListEntry> tmp = updatesPos.head; tmp != null; tmp = tmp.next) {
				utNode<tListEntry> entry = tmp;
				if(entry.obj.markedForDeletion){
					removeUpdatesFromHash(entry);
				}
			}
			updateHashLocked = false;
			currentTarget = null;
		}
		#endregion

Usage Example

コード例 #1
0
        //
        // Draw the Scene
        //
        public void drawScene()
        {
            if (_displayError && _lastError != null)
            {
                return;
            }
            try{
                /* calculate "global" dt */
                calculateDeltaTime();

                /* tick before glClear: issue #533 */
                if (!_isPaused)
                {
                    _scheduler.update(_dt);
                }

                /* to avoid flickr, nextScene MUST be here: after tick and before draw.
                 * XXX: Which bug is this one. It seems that it can't be reproduced with v0.9 */
                if (_nextScene != null)
                {
                    setNextScene();
                }


                //			DateTime t3 = DateTime.Now;
                _globolRendererSortingOrder = _startGlbolRendererSortingOrder;
                if (_runningScene != null)
                {
                    _runningScene.visit();
                }
            }catch (Exception e) {
                CCDebug.Log(e.ToString());
                if (_displayError)
                {
                    _lastError = e;
                    throw e;
                }
                else
                {
                    Application.Quit();
                }
            }
            showState();

//			_totalFrames++;
        }