Beispiel #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);
            }
        }
        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;
        }
Beispiel #3
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;
        }
Beispiel #4
0
        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();
        }
Beispiel #5
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;
        }
Beispiel #6
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;
        }
Beispiel #7
0
        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);
        }
Beispiel #8
0
        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();
        }
Beispiel #9
0
        /// <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);
        }
Beispiel #10
0
 public override void registerWithTouchDispatcher()
 {
     CCTouchDispatcher.sharedDispatcher().addTargetedDelegate(this, -128, true);
 }
Beispiel #11
0
 public override void registerWithTouchDispatcher()
 {
     CCTouchDispatcher.sharedDispatcher().addTargetedDelegate(this, kCCMenuTouchPriority, true);
 }
Beispiel #12
0
 public virtual void registerWithTouchDispatcher()
 {
     CCTouchDispatcher.sharedDispatcher().addTargetedDelegate(this, 0, false);
 }