Beispiel #1
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = CCDirector.SharedDirector.WinSize;

            CCProgressTo to1 = new CCProgressTo(2, 100);
            CCProgressTo to2 = new CCProgressTo(2, 100);

            CCProgressTimer left = new CCProgressTimer(s_pPathSister1);

            left.Type = CCProgressTimerType.Bar;
            //    Setup for a bar starting from the left since the midpoint is 0 for the y
            left.Midpoint = new CCPoint(0, 0);
            //    Setup for a horizontal bar since the bar change rate is 0 for y meaning no horizontaly change
            left.BarChangeRate = new CCPoint(0, 1);
            AddChild(left);
            left.Position = new CCPoint(100, s.Height / 2);
            left.RunAction(new CCRepeatForever(to1));

            CCProgressTimer right = new CCProgressTimer(s_pPathSister2);

            right.Type = CCProgressTimerType.Bar;
            //    Setup for a bar starting from the left since the midpoint is 0 for the y
            right.Midpoint = new CCPoint(0, 1);
            //    Setup for a horizontal bar since the bar change rate is 0 for y meaning no horizontaly change
            right.BarChangeRate = new CCPoint(0, 1);
            AddChild(right);
            right.Position = new CCPoint(s.Width - 100, s.Height / 2);
            right.RunAction(new CCRepeatForever(to2));
        }
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = CCDirector.SharedDirector.WinSize;

            CCProgressTo action = new CCProgressTo(2, 100);

            /**
             *  Our image on the left should be a radial progress indicator, clockwise
             */
            CCProgressTimer left = new CCProgressTimer(new CCSprite(s_pPathBlock));

            left.Type = CCProgressTimerType.Radial;
            AddChild(left);
            left.Midpoint = new CCPoint(0.25f, 0.75f);
            left.Position = new CCPoint(100, s.Height / 2);
            left.RunAction(new CCRepeatForever((CCActionInterval)action.Copy()));

            /**
             *  Our image on the left should be a radial progress indicator, counter clockwise
             */
            CCProgressTimer right = new CCProgressTimer(new CCSprite(s_pPathBlock));

            right.Type     = CCProgressTimerType.Radial;
            right.Midpoint = new CCPoint(0.75f, 0.25f);

            /**
             *  Note the reverse property (default=NO) is only added to the right image. That's how
             *  we get a counter clockwise progress.
             */
            AddChild(right);
            right.Position = new CCPoint(s.Width - 100, s.Height / 2);
            right.RunAction(new CCRepeatForever((CCActionInterval)action.Copy()));
        }
Beispiel #3
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            var progressTo = new CCProgressTo(2, 100);

            /**
             *  Our image on the left should be a radial progress indicator, clockwise
             */
            CCProgressTimer left = new CCProgressTimer(new CCSprite(s_pPathBlock));

            left.Type = CCProgressTimerType.Radial;
            AddChild(left);
            left.Midpoint = new CCPoint(0.25f, 0.75f);
            left.Position = new CCPoint(100, s.Height / 2);
            left.RepeatForever(progressTo);

            /**
             *  Our image on the left should be a radial progress indicator, counter clockwise
             */
            CCProgressTimer right = new CCProgressTimer(new CCSprite(s_pPathBlock));

            right.Type     = CCProgressTimerType.Radial;
            right.Midpoint = new CCPoint(0.75f, 0.25f);

            /**
             *  Note the reverse property (default=NO) is only added to the right image. That's how
             *  we get a counter clockwise progress.
             */
            AddChild(right);
            right.Position = new CCPoint(s.Width - 100, s.Height / 2);
            right.RepeatForever(progressTo);
        }
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            var progressTo = new CCProgressTo(2, 100);

            CCProgressTimer left = new CCProgressTimer(s_pPathSister1);

            left.Type = CCProgressTimerType.Bar;
            //    Setup for a bar starting from the left since the midpoint is 0 for the y
            left.Midpoint = new CCPoint(0, 0);
            //    Setup for a horizontal bar since the bar change rate is 0 for y meaning no horizontaly change
            left.BarChangeRate = new CCPoint(0, 1);
            AddChild(left);
            left.Position = new CCPoint(100, s.Height / 2);
            left.RepeatForever(progressTo);

            CCProgressTimer right = new CCProgressTimer(s_pPathSister2);

            right.Type = CCProgressTimerType.Bar;
            //    Setup for a bar starting from the left since the midpoint is 0 for the y
            right.Midpoint = new CCPoint(0, 1);
            //    Setup for a horizontal bar since the bar change rate is 0 for y meaning no horizontaly change
            right.BarChangeRate = new CCPoint(0, 1);
            AddChild(right);
            right.Position = new CCPoint(s.Width - 100, s.Height / 2);
            right.RepeatForever(progressTo);
        }
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            var progressTo = new CCProgressTo(6, 100);
            var tint       = new CCSequence(new CCTintTo(1, 255, 0, 0),
                                            new CCTintTo(1, 0, 255, 0),
                                            new CCTintTo(1, 0, 0, 255));
            var fade = new CCSequence(new CCFadeTo(1.0f, 0),
                                      new CCFadeTo(1.0f, 255));

            CCProgressTimer left = new CCProgressTimer(new CCSprite(s_pPathSister1));

            left.Type = CCProgressTimerType.Bar;

            //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
            left.Midpoint = new CCPoint(0.5f, 0.5f);
            //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
            left.BarChangeRate = new CCPoint(1, 0);
            AddChild(left);
            left.Position = new CCPoint(100, s.Height / 2);
            left.RepeatForever(progressTo);
            left.RepeatForever(tint);

            left.AddChild(new CCLabel("Tint", "arial", 20.0f, CCLabelFormat.SpriteFont));

            CCProgressTimer middle = new CCProgressTimer(new CCSprite(s_pPathSister2));

            middle.Type = CCProgressTimerType.Bar;
            //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
            middle.Midpoint = new CCPoint(0.5f, 0.5f);
            //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
            middle.BarChangeRate = new CCPoint(1, 1);
            AddChild(middle);
            middle.Position = new CCPoint(s.Width / 2, s.Height / 2);
            middle.RepeatForever(progressTo);
            middle.RepeatForever(fade);

            middle.AddChild(new CCLabel("Fade", "arial", 20.0f, CCLabelFormat.SpriteFont));

            CCProgressTimer right = new CCProgressTimer(new CCSprite(s_pPathSister2));

            right.Type = CCProgressTimerType.Bar;
            //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
            right.Midpoint = new CCPoint(0.5f, 0.5f);
            //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
            right.BarChangeRate = new CCPoint(0, 1);
            AddChild(right);
            right.Position = new CCPoint(s.Width - 100, s.Height / 2);
            right.RepeatForever(progressTo);
            right.RepeatForever(tint);
            right.RepeatForever(fade);

            right.AddChild(new CCLabel("Tint and Fade", "arial", 20.0f, CCLabelFormat.SpriteFont));
        }
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = CCDirector.SharedDirector.WinSize;

            CCProgressTo to   = new CCProgressTo(6, 100);
            CCAction     tint = CCSequence.FromActions(new CCTintTo(1, 255, 0, 0),
                                                       new CCTintTo(1, 0, 255, 0),
                                                       new CCTintTo(1, 0, 0, 255));
            CCAction fade = CCSequence.FromActions(new CCFadeTo(1.0f, 0),
                                                   new CCFadeTo(1.0f, 255));

            CCProgressTimer left = new CCProgressTimer(new CCSprite(s_pPathSister1));

            left.Type = CCProgressTimerType.Bar;

            //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
            left.Midpoint = new CCPoint(0.5f, 0.5f);
            //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
            left.BarChangeRate = new CCPoint(1, 0);
            AddChild(left);
            left.Position = new CCPoint(100, s.Height / 2);
            left.RunAction(new CCRepeatForever((CCActionInterval)to.Copy()));
            left.RunAction(new CCRepeatForever((CCActionInterval)tint.Copy()));

            left.AddChild(new CCLabelTTF("Tint", "arial", 20.0f));

            CCProgressTimer middle = new CCProgressTimer(new CCSprite(s_pPathSister2));

            middle.Type = CCProgressTimerType.Bar;
            //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
            middle.Midpoint = new CCPoint(0.5f, 0.5f);
            //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
            middle.BarChangeRate = new CCPoint(1, 1);
            AddChild(middle);
            middle.Position = new CCPoint(s.Width / 2, s.Height / 2);
            middle.RunAction(new CCRepeatForever((CCActionInterval)to.Copy()));
            middle.RunAction(new CCRepeatForever((CCActionInterval)fade.Copy()));

            middle.AddChild(new CCLabelTTF("Fade", "arial", 20.0f));

            CCProgressTimer right = new CCProgressTimer(new CCSprite(s_pPathSister2));

            right.Type = CCProgressTimerType.Bar;
            //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
            right.Midpoint = new CCPoint(0.5f, 0.5f);
            //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
            right.BarChangeRate = new CCPoint(0, 1);
            AddChild(right);
            right.Position = new CCPoint(s.Width - 100, s.Height / 2);
            right.RunAction(new CCRepeatForever((CCActionInterval)to.Copy()));
            right.RunAction(new CCRepeatForever((CCActionInterval)tint.Copy()));
            right.RunAction(new CCRepeatForever((CCActionInterval)fade.Copy()));

            right.AddChild(new CCLabelTTF("Tint and Fade", "arial", 20.0f));
        }
Beispiel #7
0
        public CCProgressTimer InitProgressTimer(CCSize viewSize)
        {
            _progressTimer = new CCProgressTimer("bluePx.png");

            _progressTimer.Type          = CCProgressTimerType.Bar;
            _progressTimer.ScaleX        = viewSize.Width - 8;
            _progressTimer.ScaleY        = 4;
            _progressTimer.Percentage    = 100.0f;
            _progressTimer.BarChangeRate = new CCPoint(1, 0);

            return(_progressTimer);
        }
Beispiel #8
0
        private void InitProgressTimer(CCSizeI size)
        {
            _progressTimer = new CCProgressTimer("bluePx.png");

            _progressTimer.Type   = CCProgressTimerType.Bar;
            _progressTimer.ScaleX = size.Width - 20;
            _progressTimer.ScaleY = 4;
            //_progressTimer.AnchorPoint = new CCPoint(1.0f, 0.5f);
            _progressTimer.Percentage    = 100.0f;
            _progressTimer.BarChangeRate = new CCPoint(1, 0);
            AddChild(_progressTimer);
        }
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            var progressTo = new CCProgressTo(6, 100);

            CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFrames("zwoptex/grossini.plist");

            CCSprite sprite = new CCSprite("grossini_dance_01.png");

            CCProgressTimer left = new CCProgressTimer(sprite);

            left.Type = CCProgressTimerType.Bar;
            //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
            left.Midpoint = new CCPoint(0.5f, 0.5f);
            //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
            left.BarChangeRate = new CCPoint(1, 0);
            AddChild(left);
            left.Position = new CCPoint(100, s.Height / 2);
            left.RepeatForever(progressTo);

            CCProgressTimer middle = new CCProgressTimer(new CCSprite("grossini_dance_02.png"));

            middle.Type = CCProgressTimerType.Bar;
            //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
            middle.Midpoint = new CCPoint(0.5f, 0.5f);
            //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
            middle.BarChangeRate = new CCPoint(1, 1);
            AddChild(middle);
            middle.Position = new CCPoint(s.Width / 2, s.Height / 2);
            middle.RepeatForever(progressTo);

            CCProgressTimer right = new CCProgressTimer(new CCSprite("grossini_dance_03.png"));

            right.Type = CCProgressTimerType.Radial;
            //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
            right.Midpoint = new CCPoint(0.5f, 0.5f);
            //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
            right.BarChangeRate = new CCPoint(0, 1);
            AddChild(right);
            right.Position = new CCPoint(s.Width - 100, s.Height / 2);
            right.RepeatForever(progressTo);
        }
Beispiel #10
0
        private void InitProgressTimer(CCSizeI size)
        {
            _progressTimer = new CCProgressTimer(new CCSprite(bluePx));

            _progressTimer.Type = CCProgressTimerType.Bar;
            // _progressTimer.SkewX
            //_progressTimer.ContentSize = new CCSize(size.Width, 8);
            _progressTimer.Midpoint = new CCPoint(0.5f, 0.5f);
            _progressTimer.ScaleY   = 2;
            //Device.OnPlatform(null, Android: () => { _progressTimer.ScaleY = 4; _progressTimer.ScaleX = 2; });

            //_progressTimer.ScaleX = size.Width - 40;
            //_progressTimer.ScaleY = 4;
            //_progressTimer.AnchorPoint = new CCPoint(1.0f, 0.5f);
            //_progressTimer.Percentage = 100.0f;
            _progressTimer.BarChangeRate = new CCPoint(1, 0);
            AddChild(_progressTimer);
        }
Beispiel #11
0
        //OLD_TRANSITION_CREATE_FUNC(CCTransitionProgressRadialCCW)
        //TRANSITION_CREATE_FUNC(CCTransitionProgressRadialCCW)

        protected override CCProgressTimer ProgressTimerNodeWithRenderTexture(CCRenderTexture texture)
        {
            CCSize size = CCDirector.SharedDirector.WinSize;

            CCProgressTimer node = new CCProgressTimer(texture.Sprite);

            // but it is flipped upside down so we flip the sprite
            //node.Sprite.IsFlipY = true;
            node.Type = CCProgressTimerType.Radial;

            //    Return the radial type that we want to use
            node.ReverseDirection = false;
            node.Percentage       = 100;
            node.Position         = new CCPoint(size.Width / 2, size.Height / 2);
            node.AnchorPoint      = new CCPoint(0.5f, 0.5f);

            return(node);
        }
Beispiel #12
0
        public override void OnEnter()
        {
            base.OnEnter();

            SetupTransition();

            // create a transparent color layer
            // in which we are going to add our rendertextures
            CCSize size = CCDirector.SharedDirector.WinSize;

            // create the second render texture for outScene
            CCRenderTexture texture = new CCRenderTexture((int)size.Width, (int)size.Height);

            texture.Sprite.AnchorPoint = new CCPoint(0.5f, 0.5f);
            texture.Position           = new CCPoint(size.Width / 2, size.Height / 2);
            texture.AnchorPoint        = new CCPoint(0.5f, 0.5f);

            // render outScene to its texturebuffer
            texture.Clear(0, 0, 0, 1);
            texture.Begin();
            m_pSceneToBeModified.Visit();
            texture.End();

            //    Since we've passed the outScene to the texture we don't need it.
            if (m_pSceneToBeModified == m_pOutScene)
            {
                HideOutShowIn();
            }

            //    We need the texture in RenderTexture.
            CCProgressTimer node = ProgressTimerNodeWithRenderTexture(texture);

            // create the blend action
            CCSequence layerAction = CCSequence.FromActions(
                new CCProgressFromTo(m_fDuration, m_fFrom, m_fTo),
                new CCCallFunc(Finish)
                );

            // run the blend action
            node.RunAction(layerAction);

            // add the layer (which contains our two rendertextures) to the scene
            AddChild(node, 2, kCCSceneRadial);
        }
Beispiel #13
0
        protected override CCProgressTimer ProgressTimerNodeWithRenderTexture(CCRenderTexture texture)
        {
            CCSize size = CCDirector.SharedDirector.WinSize;

            CCProgressTimer node = new CCProgressTimer(texture.Sprite);

            // but it is flipped upside down so we flip the sprite
            //node.Sprite.IsFlipY = true;
            node.Type = CCProgressTimerType.Bar;

            node.Midpoint      = new CCPoint(0.5f, 0.5f);
            node.BarChangeRate = new CCPoint(1, 1);

            node.Percentage  = 100;
            node.Position    = new CCPoint(size.Width / 2, size.Height / 2);
            node.AnchorPoint = new CCPoint(0.5f, 0.5f);

            return(node);
        }
Beispiel #14
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = CCDirector.SharedDirector.WinSize;

            CCProgressTo to = new CCProgressTo(6, 100);

            CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFramesWithFile("zwoptex/grossini.plist");

            CCProgressTimer left = new CCProgressTimer(new CCSprite("grossini_dance_01.png"));

            left.Type = CCProgressTimerType.Bar;
            //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
            left.Midpoint = new CCPoint(0.5f, 0.5f);
            //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
            left.BarChangeRate = new CCPoint(1, 0);
            AddChild(left);
            left.Position = new CCPoint(100, s.Height / 2);
            left.RunAction(new CCRepeatForever((CCActionInterval)to.Copy()));

            CCProgressTimer middle = new CCProgressTimer(new CCSprite("grossini_dance_02.png"));

            middle.Type = CCProgressTimerType.Bar;
            //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
            middle.Midpoint = new CCPoint(0.5f, 0.5f);
            //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
            middle.BarChangeRate = new CCPoint(1, 1);
            AddChild(middle);
            middle.Position = new CCPoint(s.Width / 2, s.Height / 2);
            middle.RunAction(new CCRepeatForever((CCActionInterval)to.Copy()));

            CCProgressTimer right = new CCProgressTimer(new CCSprite("grossini_dance_03.png"));

            right.Type = CCProgressTimerType.Radial;
            //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
            right.Midpoint = new CCPoint(0.5f, 0.5f);
            //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
            right.BarChangeRate = new CCPoint(0, 1);
            AddChild(right);
            right.Position = new CCPoint(s.Width - 100, s.Height / 2);
            right.RunAction(new CCRepeatForever((CCActionInterval)to.Copy()));
        }
Beispiel #15
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = CCDirector.SharedDirector.WinSize;

            CCProgressTo to = new CCProgressTo(2, 100);

            CCProgressTimer left = new CCProgressTimer(new CCSprite(s_pPathSister1));

            left.Type = CCProgressTimerType.Bar;

            //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
            left.Midpoint = new CCPoint(0.5f, 0.5f);
            //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
            left.BarChangeRate = new CCPoint(1, 0);
            AddChild(left);
            left.Position = new CCPoint(100, s.Height / 2);
            left.RunAction(new CCRepeatForever((CCActionInterval)to.Copy()));

            CCProgressTimer middle = new CCProgressTimer(new CCSprite(s_pPathSister2));

            middle.Type = CCProgressTimerType.Bar;
            //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
            middle.Midpoint = new CCPoint(0.5f, 0.5f);
            //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
            middle.BarChangeRate = new CCPoint(1, 1);
            AddChild(middle);
            middle.Position = new CCPoint(s.Width / 2, s.Height / 2);
            middle.RunAction(new CCRepeatForever((CCActionInterval)to.Copy()));

            CCProgressTimer right = new CCProgressTimer(new CCSprite(s_pPathSister2));

            right.Type = CCProgressTimerType.Bar;
            //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
            right.Midpoint = new CCPoint(0.5f, 0.5f);
            //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
            right.BarChangeRate = new CCPoint(0, 1);
            AddChild(right);
            right.Position = new CCPoint(s.Width - 100, s.Height / 2);
            right.RunAction(new CCRepeatForever((CCActionInterval)to.Copy()));
        }
        public override void onEnter()
        {
            base.onEnter();

            CCSize s = CCDirector.sharedDirector().getWinSize();

            CCProgressTo to1 = CCProgressTo.actionWithDuration(2, 100);
            CCProgressTo to2 = CCProgressTo.actionWithDuration(2, 100);

            CCProgressTimer left = CCProgressTimer.progressWithFile(s_pPathSister1);

            left.Type = CCProgressTimerType.kCCProgressTimerTypeRadialCW;
            addChild(left);
            left.position = new CCPoint(100, s.height / 2);
            left.runAction(CCRepeatForever.actionWithAction(to1));

            CCProgressTimer right = CCProgressTimer.progressWithFile(s_pPathBlock);

            right.Type = CCProgressTimerType.kCCProgressTimerTypeRadialCCW;
            addChild(right);
            right.position = new CCPoint(s.width - 100, s.height / 2);
            right.runAction(CCRepeatForever.actionWithAction(to2));
        }
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            var progressTo = new CCProgressTo(2, 100);

            CCProgressTimer left = new CCProgressTimer(s_pPathSister1);

            left.Type = CCProgressTimerType.Radial;
            AddChild(left);
            left.Position = new CCPoint(100, s.Height / 2);
            left.RepeatForever(progressTo);

            CCProgressTimer right = new CCProgressTimer(s_pPathBlock);

            right.Type             = CCProgressTimerType.Radial;
            right.ReverseDirection = true;
            AddChild(right);
            right.Position = new CCPoint(s.Width - 100, s.Height / 2);
            right.RepeatForever(progressTo);
        }
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = CCDirector.SharedDirector.WinSize;

            CCProgressTo to1 = new CCProgressTo(2, 100);
            CCProgressTo to2 = new CCProgressTo(2, 100);

            CCProgressTimer left = new CCProgressTimer(s_pPathSister1);

            left.Type = CCProgressTimerType.Radial;
            AddChild(left);
            left.Position = new CCPoint(100, s.Height / 2);
            left.RunAction(new CCRepeatForever(to1));

            CCProgressTimer right = new CCProgressTimer(s_pPathBlock);

            right.Type            = CCProgressTimerType.Radial;
            right.ReverseProgress = true;
            AddChild(right);
            right.Position = new CCPoint(s.Width - 100, s.Height / 2);
            right.RunAction(new CCRepeatForever(to2));
        }
        protected override CCProgressTimer ProgressTimerNodeWithRenderTexture(CCRenderTexture texture)
        {
            var bounds = Layer.VisibleBoundsWorldspace;

            CCProgressTimer node = new CCProgressTimer(texture.Sprite);

            // but it is flipped upside down so we flip the sprite
            //node.Sprite.IsFlipY = true;
            node.Type = CCProgressTimerType.Radial;

            //    Return the radial type that we want to use
            node.ReverseDirection = true;
            node.Percentage = 100;
            node.Position = new CCPoint(bounds.Origin.X + bounds.Size.Width / 2, bounds.Size.Height / 2);
            node.AnchorPoint = CCPoint.AnchorMiddle;

            return node;
        }
Beispiel #20
0
        public GameSceneLayer()
        {
            CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFramesWithFile("crystals.plist");
            SetupBackground();

            var boardSize  = new CCPoint(Constants.KGemSize * Constants.KBoardWidth / 2f, Constants.KGemSize * Constants.KBoardHeight / 2f);
            var screenSize = new CCPoint(CCDirector.SharedDirector.WinSize.Width / 2f, CCDirector.SharedDirector.WinSize.Height / 2f);
            var timerScale = 1f;

#if WINDOWS_PHONE || ANDROID
            timerScale         = 0.6f;
            _fieldPositionZero = (screenSize - boardSize);
#else
            _fieldPositionZero = (screenSize - boardSize);
#endif

            _gameHeader = new CCNode()
            {
                Position    = new CCPoint(0, 200),
                AnchorPoint = new CCPoint(0, 0),
            };

            var header = new CCSprite(@"GameScene\header.png");
            header.ScaleX      = CCDirector.SharedDirector.WinSize.Width / header.ContentSize.Width;
            header.Position    = new CCPoint(0, CCDirector.SharedDirector.WinSize.Height);
            header.AnchorPoint = new CCPoint(0, 1);
            _gameHeader.AddChild(header);


            CCSprite timerBackground = new CCSprite(@"GameScene\timebar_bg.png")
            {
                Scale = timerScale
            };
            timerBackground.Position    = new CCPoint(CCDirector.SharedDirector.WinSize.Width / 2, CCDirector.SharedDirector.WinSize.Height - header.ContentSize.Height);
            timerBackground.AnchorPoint = new CCPoint(0.5f, 0f);
            _gameHeader.AddChild(timerBackground);

            _timer = new CCProgressTimer(@"GameScene\timebar.png")
            {
                Scale = timerScale
            };
            _timer.Position      = timerBackground.Position;
            _timer.AnchorPoint   = timerBackground.AnchorPoint;
            _timer.Midpoint      = new CCPoint(0, 0.5f);
            _timer.Type          = CCProgressTimerType.Bar;
            _timer.Percentage    = 100;
            _timer.BarChangeRate = new CCPoint(1, 0);
            _gameHeader.AddChild(_timer);

            _scoreLabel             = new CCLabelBMFont("0", @"Fonts\scorefont.fnt");
            _scoreLabel.Position    = new CCPoint(CCDirector.SharedDirector.WinSize.Width - 24, CCDirector.SharedDirector.WinSize.Height - 24);
            _scoreLabel.AnchorPoint = new CCPoint(1f, 1f);
            _gameHeader.AddChild(_scoreLabel);

            AddChild(_gameHeader);

            _isGameOver         = false;
            _isDisplayingHint   = false;
            _startTime          = DateTime.Now.AddMilliseconds(Constants.KIntroTime);
            _lastMoveTime       = DateTime.Now;
            _numConsecutiveGems = 0;
            _isPowerPlay        = false;
            _endTimerStarted    = false;
            _score = 0;
            SetupBoard();

            _particleLayer  = new CCParticleBatchNode("Particles/taken-gem.png", 250);
            _gameBoardLayer = new CCNode();
            _hintLayer      = new CCNode();
            _shimmerLayer   = new CCNode();
            _effectsLayer   = new CCNode();

            AddChild(_shimmerLayer, -1);
            AddChild(_particleLayer, 1);
            AddChild(_gameBoardLayer, 0);
            AddChild(_hintLayer, 3);
            AddChild(_effectsLayer, 2);
            SetupShimmer();

            Scheduler.ScheduleUpdateForTarget(this, 1, false);
            TouchEnabled = true;
        }
        protected override CCProgressTimer ProgressTimerNodeWithRenderTexture(CCRenderTexture texture)
        {
            var bounds = Layer.VisibleBoundsWorldspace;

            CCProgressTimer node = new CCProgressTimer(texture.Sprite);

            // but it is flipped upside down so we flip the sprite
            //node.Sprite.IsFlipY = true;
            node.Type = CCProgressTimerType.Bar;

            node.Midpoint = new CCPoint(0.5f, 0.5f);
            node.BarChangeRate = new CCPoint(1, 1);

            node.Percentage = 100;
            node.Position = new CCPoint(bounds.Origin.X + bounds.Size.Width / 2, bounds.Size.Height / 2);
            node.AnchorPoint = CCPoint.AnchorMiddle;

            return node;
        }
        //OLD_TRANSITION_CREATE_FUNC(CCTransitionProgressRadialCCW)
        //TRANSITION_CREATE_FUNC(CCTransitionProgressRadialCCW)

        protected override CCProgressTimer ProgressTimerNodeWithRenderTexture(CCRenderTexture texture)
        {
            CCSize size = CCDirector.SharedDirector.WinSize;

            CCProgressTimer node = new CCProgressTimer(texture.Sprite);

            // but it is flipped upside down so we flip the sprite
            //node.Sprite.IsFlipY = true;
            node.Type = CCProgressTimerType.Radial;

            //    Return the radial type that we want to use
            node.ReverseDirection = false;
            node.Percentage = 100;
            node.Position = new CCPoint(size.Width / 2, size.Height / 2);
            node.AnchorPoint = new CCPoint(0.5f, 0.5f);

            return node;
        }
        protected override CCProgressTimer ProgressTimerNodeWithRenderTexture(CCRenderTexture texture)
        {
            CCSize size = CCDirector.SharedDirector.WinSize;

            CCProgressTimer node = new CCProgressTimer(texture.Sprite);

            // but it is flipped upside down so we flip the sprite
            //node.Sprite.IsFlipY = true;
            node.Type = CCProgressTimerType.Bar;

            node.Midpoint = new CCPoint(0.5f, 0.5f);
            node.BarChangeRate = new CCPoint(1, 1);

            node.Percentage = 100;
            node.Position = new CCPoint(size.Width / 2, size.Height / 2);
            node.AnchorPoint = new CCPoint(0.5f, 0.5f);

            return node;
        }