예제 #1
0
        public bool init()
        {
            m_pTargets = new Dictionary <CCObject, tHashElement>();
            CCScheduler.sharedScheduler().scheduleUpdateForTarget(this, 0, false);

            return(true);
        }
예제 #2
0
 public void unschedule(SEL_SCHEDULE selector)
 {
     if (selector != null)
     {
         CCScheduler.sharedScheduler().unscheduleSelector(selector, this);
     }
 }
예제 #3
0
파일: Node.cs 프로젝트: liwq-net/liwq718
 /// <summary>
 /// unschedules a custom selector.
 /// </summary>
 public void unschedule(SEL_SCHEDULE selector)
 {
     // explicit nil handling
     if (selector != null)
     {
         CCScheduler.sharedScheduler().unscheduleSelector(selector, this);
     }
 }
예제 #4
0
 public static CCScheduler sharedScheduler()
 {
     if (g_sharedScheduler == null)
     {
         g_sharedScheduler = new CCScheduler();
         g_sharedScheduler.init();
     }
     return(g_sharedScheduler);
 }
예제 #5
0
 public override void Update(GameTime gameTime)
 {
     this.ProcessTouch();
     if (!CCDirector.sharedDirector().isPaused)
     {
         CCScheduler.sharedScheduler().tick((float)gameTime.ElapsedGameTime.TotalSeconds);
     }
     base.Update(gameTime);
 }
예제 #6
0
 /// <summary>
 /// Allows the game component to update its non-visible state. This method is invoked continuously
 /// in a stream of state updates.
 /// </summary>
 /// <param name="gameTime">This is the current game time.</param>
 public override void Update(GameTime gameTime)
 {
     // Process touch events
     ProcessTouch();
     if (!CCDirector.sharedDirector().isPaused)
     {
         CCScheduler.sharedScheduler().tick((float)gameTime.ElapsedGameTime.TotalSeconds);
         //m_fDeltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;
     }
     base.Update(gameTime);
 }
예제 #7
0
 public CCTimer(CCScheduler scheduler, SelectorProtocol target, SEL_SCHEDULE selector, float seconds, uint repeat, float delay)
 {
     _scheduler = scheduler;
     Target = target;
     Selector = selector;
     Elapsed = -1;
     OriginalInterval = seconds;
     Interval = seconds;
     m_fDelay = delay;
     m_bUseDelay = delay > 0f;
     m_nRepeat = repeat;
     m_bRunForever = m_nRepeat == uint.MaxValue;
 }
예제 #8
0
        public virtual bool Init()
        {
            // scenes
            m_pRunningScene = null;
            m_pNextScene = null;

            m_pNotificationNode = null;

            m_dOldAnimationInterval = m_dAnimationInterval = 1.0 / kDefaultFPS;

            // Set default projection (3D)
            m_eProjection = ccDirectorProjection.kCCDirectorProjectionDefault;

            // projection delegate if "Custom" projection is used
            m_pProjectionDelegate = null;

            // FPS
            m_fAccumDt = 0.0f;
            m_fFrameRate = 0.0f;
            m_pFPSLabel = null;
            m_pSPFLabel = null;
            m_pDrawsLabel = null;
            m_bDisplayStats = false;
            m_uTotalFrames = m_uFrames = 0;

            // paused ?
            m_bPaused = false;

            // purge ?
            m_bPurgeDirecotorInNextLoop = false;

            m_obWinSizeInPixels = m_obWinSizeInPoints = CCSize.Zero;

            //m_pobOpenGLView = null;

            m_fContentScaleFactor = 1.0f;

            // scheduler
            m_pScheduler = new CCScheduler();
            // action manager
            m_pActionManager = new CCActionManager();
            m_pScheduler.ScheduleUpdateForTarget(m_pActionManager, CCScheduler.kCCPrioritySystem, false);
            // touchDispatcher
            m_pTouchDispatcher = new CCTouchDispatcher();
            m_pTouchDispatcher.Init();

            // KeypadDispatcher
            m_pKeypadDispatcher = new CCKeypadDispatcher();

            // Accelerometer
            #if !PSM &&!NETFX_CORE
            m_pAccelerometer = new CCAccelerometer();
            #endif
            // create autorelease pool
            //CCPoolManager::sharedPoolManager()->push();

            m_NeedsInit = false;
            return true;
        }
예제 #9
0
파일: Node.cs 프로젝트: liwq-net/liwq718
 /// <summary>
 /// schedules the "update" selector with a custom priority. This selector will be called every frame.
 /// Scheduled selectors with a lower priority will be called before the ones that have a higher value.
 /// Only one "update" selector could be scheduled per node (You can't have 2 'update' selectors).
 /// @since v0.99.3
 /// </summary>
 /// <param name="priority"></param>
 public void scheduleUpdateWithPriority(int priority)
 {
     CCScheduler.sharedScheduler().scheduleUpdateForTarget(this, priority, !IsRunning);
 }
예제 #10
0
 public static void purgeSharedScheduler()
 {
     g_sharedScheduler = null;
 }
예제 #11
0
파일: Node.cs 프로젝트: liwq-net/liwq718
 /// <summary>
 ///  unschedules the "update" method.
 /// @since v0.99.3
 /// </summary>
 public void unscheduleUpdate()
 {
     CCScheduler.sharedScheduler().unscheduleUpdateForTarget(this);
 }
예제 #12
0
 /// <summary>
 /// purges the shared action manager. It releases the retained instance.
 /// because it uses this, so it can not be static
 /// @since v0.99.0
 /// </summary>
 public void purgeSharedManager()
 {
     CCScheduler.sharedScheduler().unscheduleAllSelectorsForTarget(this);
     g_sharedActionManager = null;
 }
예제 #13
0
 /** Initializes a timer with a target, a selector and an interval in seconds.
  *  Target is not needed in c#, it is just for compatibility.
  */
 public CCTimer(CCScheduler scheduler, SelectorProtocol target, SEL_SCHEDULE selector, float seconds)
     : this(scheduler, target, selector, seconds, 0, 0)
 {
 }
예제 #14
0
 /** purges the shared scheduler. It releases the retained instance.
  @since v0.99.0
  */
 public static void purgeSharedScheduler()
 {
     g_sharedScheduler = null;
 }
예제 #15
0
        /** returns a shared instance of the Scheduler */
        public static CCScheduler sharedScheduler()
        {
            if (g_sharedScheduler == null)
            {
                g_sharedScheduler = new CCScheduler();
                g_sharedScheduler.init();
            }

            return g_sharedScheduler;
        }
예제 #16
0
        public CCNode()
        {
            m_fScaleX = 1.0f;
            m_fScaleY = 1.0f;
            m_bIsVisible = true;
            m_nTag = kCCNodeTagInvalid;

            m_tTransform = CCAffineTransform.Identity;
            m_bIsInverseDirty = true;

            // set default scheduler and actionManager
            CCDirector director = CCDirector.SharedDirector;
            m_pActionManager = director.ActionManager;
            m_pScheduler = director.Scheduler;
        }
예제 #17
0
파일: Node.cs 프로젝트: liwq-net/liwq718
 /// <summary>
 /// pauses all scheduled selectors and actions.
 /// Called internally by onExit
 /// </summary>
 public void pauseSchedulerAndActions()
 {
     CCScheduler.sharedScheduler().pauseTarget(this);
     CCActionManager.sharedManager().pauseTarget(this);
 }
예제 #18
0
파일: Node.cs 프로젝트: liwq-net/liwq718
 /// <summary>
 /// resumes all scheduled selectors and actions.
 /// Called internally by onEnter
 /// </summary>
 public void resumeSchedulerAndActions()
 {
     CCScheduler.sharedScheduler().resumeTarget(this);
     CCActionManager.sharedManager().resumeTarget(this);
 }
예제 #19
0
파일: Node.cs 프로젝트: liwq-net/liwq718
 /// <summary>
 /// unschedule all scheduled selectors: custom selectors, and the 'update' selector.
 /// Actions are not affected by this method.
 /// @since v0.99.3
 /// </summary>
 public void unscheduleAllSelectors()
 {
     CCScheduler.sharedScheduler().unscheduleAllSelectorsForTarget(this);
 }
예제 #20
0
파일: Node.cs 프로젝트: liwq-net/liwq718
 /// <summary>
 /// schedules a custom selector with an interval time in seconds.
 ///If time is 0 it will be ticked every frame.
 ///If time is 0, it is recommended to use 'scheduleUpdate' instead.
 ///If the selector is already scheduled, then the interval parameter
 ///will be updated without scheduling it again.
 /// </summary>
 public void schedule(SEL_SCHEDULE selector, float interval)
 {
     CCScheduler.sharedScheduler().scheduleSelector(selector, this, interval, !IsRunning);
 }