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 x
            left.Midpoint = new CCPoint(0, 0);
            //    Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change
            left.BarChangeRate = new CCPoint(1, 0);
            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 1 for the x
            right.Midpoint = new CCPoint(1, 0);
            //    Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change
            right.BarChangeRate = new CCPoint(1, 0);
            AddChild(right);
            right.Position = new CCPoint(s.Width - 100, s.Height / 2);
			right.RepeatForever(progressTo);
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Client.Common.Views.HUD.PopulationResource"/> class.
        /// </summary>
        /// <param name="fileName">PNG file name.</param>
        /// <param name="color">Fill color.</param>
        public PopulationResource(string fileName, CCColor3B color)
            : base()
        {
            m_background = new Button(
                fileName,
                fileName,
                OnTouched);

            AddChild(m_background);
            m_background.Sprite.Opacity = 100;
            // picture source
            // <div>Icons made by <a href="http://www.freepik.com" title="Freepik">Freepik</a>
            // from <a href="http://www.flaticon.com" title="Flaticon">www.flaticon.com</a>
            // is licensed by <a href="http://creativecommons.org/licenses/by/3.0/"
            // title="Creative Commons BY 3.0">CC BY 3.0</a></div>
            m_progress = new CCProgressTimer(fileName);
            m_progress.Color = color;
            m_progress.Type = CCProgressTimerType.Bar;
            m_progress.BarChangeRate = new CCPoint(0.0f, 1.0f);
            m_progress.Midpoint = new CCPoint(0.0f, 0.0f);
            m_progress.PositionX = m_background.AnchorPoint.X;
            m_progress.PositionY = m_background.AnchorPoint.Y;

            m_background.AddChild(m_progress);

            Schedule(ShowRessource);
        }
        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 CCControlPotentiometer(string backgroundFile, string progressFile, string thumbFile)
        {
            var trackSprite   = new CCSprite(backgroundFile);
            var thumbSprite   = new CCSprite(thumbFile);
            var progressTimer = new CCProgressTimer(new CCSprite(progressFile));

            minimumValue = 0.0f;
            maximumValue = 1.0f;
            value        = minimumValue;

            ProgressTimer        = progressTimer;
            ThumbSprite          = thumbSprite;
            thumbSprite.Position = progressTimer.Position;

            AddChild(thumbSprite, 2);
            AddChild(progressTimer, 1);
            AddChild(trackSprite);

            ContentSize = trackSprite.ContentSize;

            // Register Touch Event
            var touchListener = new CCEventListenerTouchOneByOne();

            touchListener.IsSwallowTouches = true;

            touchListener.OnTouchBegan = OnTouchBegan;
            touchListener.OnTouchMoved = OnTouchMoved;
            touchListener.OnTouchEnded = OnTouchEnded;

            AddEventListener(touchListener);
        }
        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 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.RepeatForever(progressTo);
			middle.RepeatForever(fade);

            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.RepeatForever(progressTo);
			right.RepeatForever(tint);
			right.RepeatForever(fade);

            right.AddChild(new CCLabelTtf("Tint and Fade", "arial", 20.0f));
        }
示例#6
0
        protected override void InitialiseScenes()
        {
            if (Layer == null || Viewport == null)
            {
                return;
            }

            base.InitialiseScenes();

            SetupTransition();

            // create a transparent color layer
            // in which we are going to add our rendertextures
            var    bounds       = Layer.VisibleBoundsWorldspace;
            CCRect viewportRect = Viewport.ViewportInPixels;

            // create the second render texture for outScene
            CCRenderTexture texture = new CCRenderTexture(bounds.Size, viewportRect.Size);

            texture.Position    = bounds.Center;
            texture.AnchorPoint = CCPoint.AnchorMiddle;

            // Temporarily add render texture to get layer/scene properties
            Layer.AddChild(texture);
            texture.Visible = false;

            // Render outScene to its texturebuffer
            texture.BeginWithClear(0, 0, 0, 1);
            SceneNodeContainerToBeModified.Visit();
            texture.End();

            texture.Visible = true;

            // No longer want to render texture
            RemoveChild(texture);

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

            CCProgressTimer node = ProgressTimerNodeWithRenderTexture(texture);

            // create the blend action
            var layerAction = new CCProgressFromTo(Duration, From, To);

            // add the layer (which contains our two rendertextures) to the scene
            AddChild(node, 2, SceneRadial);

            // run the blend action
            node.RunAction(layerAction);
        }
示例#7
0
        public PlayerBar(CSKEntity player)
        {
            Portrait = player.Portrait;
            Portrait.AnchorPoint = new CCPoint(0, 0);
            AddChild(Portrait);

            LifeBar = new CCProgressTimer("bar/green_health_bar.png");
            LifeBar.Color = CCColor3B.Blue;
            LifeBar.PositionX = Portrait.BoundingBox.Size.Width + 10;
            LifeBar.Type = CCProgressTimerType.Bar;

            LifeBar.AnchorPoint = new CCPoint(0, 0);
            AddChild(LifeBar);
        }
示例#8
0
        protected override void InitialiseScenes()
        {
            if (Layer == null)
            {
                return;
            }

            base.InitialiseScenes();

            SetupTransition();

            // create a transparent color layer
            // in which we are going to add our rendertextures
            var    bounds       = Layer.VisibleBoundsWorldspace;
            CCRect viewportRect = new CCRect(Viewport.Bounds);

            // create the second render texture for outScene
            CCRenderTexture texture = new CCRenderTexture(bounds.Size, viewportRect.Size);

            texture.Sprite.Position    = bounds.Center;
            texture.Sprite.AnchorPoint = CCPoint.AnchorMiddle;


            // Render outScene to its texturebuffer
            texture.BeginWithClear(0, 0, 0, 255);
            var worldTransform = SceneNodeContainerToBeModified.AffineWorldTransform;

            SceneNodeContainerToBeModified.Visit(ref worldTransform);
            texture.End();

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

            CCProgressTimer node = ProgressTimerNodeWithRenderTexture(texture);

            // create the blend action
            var layerAction = new CCProgressFromTo(Duration, From, To);

            // add the layer (which contains our two rendertextures) to the scene
            Layer.AddChild(node, 2);

            // run the blend action
            node.RunAction(layerAction);
        }
示例#9
0
        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);
        }
示例#10
0
        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);
        }
        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);
        }
        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 CCControlPotentiometer(string backgroundFile, string progressFile, string thumbFile)
        {
			var trackSprite = new CCSprite(backgroundFile);
            var thumbSprite = new CCSprite(thumbFile);
            var progressTimer = new CCProgressTimer(new CCSprite(progressFile));

			minimumValue = 0.0f;
			maximumValue = 1.0f;
			value = minimumValue;

			ProgressTimer = progressTimer;
			ThumbSprite = thumbSprite;
			thumbSprite.Position = progressTimer.Position;

			AddChild(thumbSprite, 2);
			AddChild(progressTimer, 1);
			AddChild(trackSprite);

			ContentSize = trackSprite.ContentSize;

			// Register Touch Event
			var touchListener = new CCEventListenerTouchOneByOne();
			touchListener.IsSwallowTouches = true;

			touchListener.OnTouchBegan = OnTouchBegan;
			touchListener.OnTouchMoved = OnTouchMoved;
			touchListener.OnTouchEnded = OnTouchEnded;

            AddEventListener(touchListener);
        }
        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 = false;
            node.Percentage = 100;
            node.Position = new CCPoint(bounds.Origin.X + bounds.Size.Width / 2, bounds.Size.Height / 2);
            node.AnchorPoint = CCPoint.AnchorMiddle;

            return node;
        }
        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;
        }