コード例 #1
0
        /// <summary>
        ///  initializes a transition with duration and incoming scene
        /// </summary>
        public virtual bool initWithDuration(float t, CCScene scene)
        {
            if (scene == null)
            {
                throw (new ArgumentNullException("scene", "Target scene must not be null"));
            }

            if (base.init())
            {
                m_fDuration = t;

                // retain
                m_pInScene   = scene;
                m_pOutScene  = CCDirector.sharedDirector().runningScene;
                m_eSceneType = ccSceneFlag.ccTransitionScene;

                if (m_pInScene == m_pOutScene)
                {
                    throw (new ArgumentException("scene", "Target and source scenes must be different"));
                }

                // disable events while transitions
                CCTouchDispatcher.sharedDispatcher().IsDispatchEvents = false;
                this.sceneOrder();

                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
 public static CCTouchDispatcher sharedDispatcher()
 {
     if (CCTouchDispatcher.pSharedDispatcher == null)
     {
         CCTouchDispatcher.pSharedDispatcher = new CCTouchDispatcher();
         CCTouchDispatcher.pSharedDispatcher.init();
     }
     return(CCTouchDispatcher.pSharedDispatcher);
 }
コード例 #3
0
        private void setNewScene(float dt)
        {
            base.unschedule(new SEL_SCHEDULE(this.setNewScene));
            CCDirector cCDirector = CCDirector.sharedDirector();

            this.m_bIsSendCleanupToScene = cCDirector.isSendCleanupToScene();
            cCDirector.replaceScene(this.m_pInScene);
            CCTouchDispatcher.sharedDispatcher().IsDispatchEvents = true;
            this.m_pOutScene.visible = true;
        }
コード例 #4
0
        /// <summary>
        /// singleton of the CCTouchDispatcher
        /// </summary>
        public static CCTouchDispatcher sharedDispatcher()
        {
            // synchronized ??
            if (pSharedDispatcher == null)
            {
                pSharedDispatcher = new CCTouchDispatcher();
                pSharedDispatcher.init();
            }

            return(pSharedDispatcher);
        }
コード例 #5
0
        /// <summary>
        /// singleton of the CCTouchDispatcher
        /// </summary>
        public static CCTouchDispatcher sharedDispatcher()
        {
            // synchronized ??
            if (pSharedDispatcher == null)
            {
                pSharedDispatcher = new CCTouchDispatcher();
                pSharedDispatcher.init();
            }

            return pSharedDispatcher;
        }
コード例 #6
0
        public void setOpenGLView()
        {
            this.m_obWinSizeInPoints = CCApplication.sharedApplication().getSize();
            this.m_obWinSizeInPixels = new CCSize(this.m_obWinSizeInPoints.width * this.m_fContentScaleFactor, this.m_obWinSizeInPoints.height * this.m_fContentScaleFactor);
            this.setGLDefaultValues();
            if (this.m_fContentScaleFactor != 1f)
            {
                this.updateContentScaleFactor();
            }
            CCTouchDispatcher cCTouchDispatcher = CCTouchDispatcher.sharedDispatcher();

            CCApplication.sharedApplication().TouchDelegate = cCTouchDispatcher;
            cCTouchDispatcher.IsDispatchEvents = true;
        }
コード例 #7
0
ファイル: CCLayer.cs プロジェクト: chengcong/cocos2d-xna
        public override void onExit()
        {
            if (this.m_bIsTouchEnabled)
            {
                CCTouchDispatcher.sharedDispatcher().removeDelegate(this);
            }
            if (this.m_bIsAccelerometerEnabled)
            {
                throw new NotImplementedException();
            }
            bool mBIsKeypadEnabled = this.m_bIsKeypadEnabled;

            base.onExit();
        }
コード例 #8
0
        private void setNewScene(float dt)
        {
            // [self unschedule:_cmd];
            // "_cmd" is a local variable automatically defined in a method
            // that contains the selector for the method
            this.unschedule(this.setNewScene);
            CCDirector director = CCDirector.sharedDirector();

            // Before replacing, save the "send cleanup to scene"
            m_bIsSendCleanupToScene = director.isSendCleanupToScene();
            director.replaceScene(m_pInScene);
            // enable events while transitions
            CCTouchDispatcher.sharedDispatcher().IsDispatchEvents = true;
            // issue #267
            m_pOutScene.visible = true;
        }
コード例 #9
0
        public void setOpenGLView()
        {
            // set size
            m_obWinSizeInPoints = CCApplication.sharedApplication().getSize();
            m_obWinSizeInPixels = new CCSize(m_obWinSizeInPoints.width * m_fContentScaleFactor, m_obWinSizeInPoints.height * m_fContentScaleFactor);
            setGLDefaultValues();

            if (m_fContentScaleFactor != 1)
            {
                updateContentScaleFactor();
            }

            CCTouchDispatcher pTouchDispatcher = CCTouchDispatcher.sharedDispatcher();

            CCApplication.sharedApplication().TouchDelegate = pTouchDispatcher;
            pTouchDispatcher.IsDispatchEvents = true;
        }
コード例 #10
0
ファイル: Director.cs プロジェクト: liwq-net/liwq718
        public virtual bool Init()
        {
            const double DefaultFPS = 60.0;

            this._animationInterval = 1.0 / DefaultFPS;

            this.IsPaused = false;
            this._isPurgeDirecotorInNextLoop = false;
            this._contentScaleFactor         = 1.0f;

            // Set default projection (3D)
            this._projection = DirectorProjection.ProjectionDefault;
            this.Projection  = DirectorProjection.ProjectionDefault;

            Application.SharedApplication.ScreenScaleFactor = this.ContentScaleFactor;
            Application.SharedApplication.TouchDelegate     = CCTouchDispatcher.sharedDispatcher();
            CCTouchDispatcher.sharedDispatcher().IsDispatchEvents = true;

            return(true);
        }
コード例 #11
0
ファイル: CCLayer.cs プロジェクト: liwq-net/liwq718
        public override void onExit()
        {
            if (m_bIsTouchEnabled)
            {
                CCTouchDispatcher.sharedDispatcher().removeDelegate(this);
            }

            // remove this layer from the delegates who concern Accelerometer Sensor
            if (m_bIsAccelerometerEnabled)
            {
                ///@todo
                throw new NotImplementedException();
            }

            // remove this layer from the delegates who concern the kaypad msg
            if (m_bIsKeypadEnabled)
            {
            }

            base.onExit();
        }
コード例 #12
0
ファイル: CCDirector.cs プロジェクト: HarkDev/cocos2d-xna
        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;
        }
コード例 #13
0
ファイル: CCLayer.cs プロジェクト: liwq-net/liwq718
        /// <summary>
        /// @todo
        /// </summary>
        //virtual void didAccelerate(CCAcceleration* pAccelerationValue) {CC_UNUSED_PARAM(pAccelerationValue);}

        /** If isTouchEnabled, this method is called onEnter. Override it to change the
         *  way CCLayer receives touch events.
         *  ( Default: CCTouchDispatcher::sharedDispatcher()->addStandardDelegate(this,0); )
         *  Example:
         *  void CCLayer::registerWithTouchDispatcher()
         *  {
         *  CCTouchDispatcher::sharedDispatcher()->addTargetedDelegate(this,INT_MIN+1,true);
         *  }
         *  @since v0.8.0
         */
        public virtual void registerWithTouchDispatcher()
        {
            ///@todo
            CCTouchDispatcher.sharedDispatcher().addStandardDelegate(this, 0);
        }
コード例 #14
0
ファイル: CCMenu.cs プロジェクト: chengcong/cocos2d-xna
 public override void registerWithTouchDispatcher()
 {
     CCTouchDispatcher.sharedDispatcher().addTargetedDelegate(this, -128, true);
 }
コード例 #15
0
ファイル: CCMenu.cs プロジェクト: xwfh2000/cocos2d-x-for-xna
 public override void registerWithTouchDispatcher()
 {
     CCTouchDispatcher.sharedDispatcher().addTargetedDelegate(this, kCCMenuTouchPriority, true);
 }
コード例 #16
0
 public virtual void registerWithTouchDispatcher()
 {
     CCTouchDispatcher.sharedDispatcher().addTargetedDelegate(this, 0, false);
 }