Пример #1
0
        /// <summary>
        /// Makes the layer to match properties set by the Settings page
        /// </summary>
        /// <returns>A new layer always.</returns>
        public static CCLayer MakeLayer()
        {
            var ret = new CCLayerGradient(CCColor4B.Blue, CCColor4B.AliceBlue);
            var tracer = new DragSprite("puck");
            tracer.Position = new CCPoint((float)App.screenSize.Width/2.0f, (float)App.screenSize.Height/2.0f);
            var dragger = new CCEventListenerTouchAllAtOnce();
            // the official Air Hockey sample attaches the listener to the game board
            // and loops through all the sprites each time to see if they are affected
            dragger.OnTouchesBegan = tracer.OnTouchesBegan;
            dragger.OnTouchesMoved = tracer.OnTouchesMoved;
            dragger.OnTouchesEnded = tracer.OnTouchesEnded;
            dragger.OnTouchesCancelled = tracer.OnTouchesEnded;
            tracer.AddEventListener(dragger);

            ret.AddChild(tracer);
            return ret;
        }
Пример #2
0
        public LayerGradient()
        {
            gradientLayer = new CCLayerGradient(new CCColor4B(255, 0, 0, 255), new CCColor4B(0, 255, 0, 255), new CCPoint(0.9f, 0.9f));

            AddChild(gradientLayer, 0, kTagLayer);

			// Register Touch Event
			var touchListener = new CCEventListenerTouchAllAtOnce();
			touchListener.OnTouchesMoved = onTouchesMoved;
			AddEventListener(touchListener);

            CCLabelTtf label1 = new CCLabelTtf("Compressed Interpolation: Enabled", "arial", 26);
            CCLabelTtf label2 = new CCLabelTtf("Compressed Interpolation: Disabled", "arial", 26);
            CCMenuItemLabelTTF item1 = new CCMenuItemLabelTTF(label1);
            CCMenuItemLabelTTF item2 = new CCMenuItemLabelTTF(label2);
            CCMenuItemToggle item = new CCMenuItemToggle((toggleItem), item1, item2);

            menu = new CCMenu(item);
            AddChild(menu);
        }
Пример #3
0
        public LayerGradient()
        {
            //gradientLayer = new CCLayerGradient(new CCColor4B(255, 0, 0, 255), new CCColor4B(0, 255, 0, 255), new CCPoint(0.9f, 0.9f));

            gradientLayer = new CCLayerGradient(CCColor4B.Red, CCColor4B.Green);
            gradientLayer.UpdateColor();
            //gradientLayer.StartOpacity = 127;
            //gradientLayer.EndOpacity = 127;
            AddChild(gradientLayer, 0, kTagLayer);

			// Register Touch Event
			var touchListener = new CCEventListenerTouchAllAtOnce();
			touchListener.OnTouchesMoved = onTouchesMoved;
			AddEventListener(touchListener);

            var label1 = new CCLabel("Compressed Interpolation: Enabled", "arial", 26, CCLabelFormat.SpriteFont);
            var label2 = new CCLabel("Compressed Interpolation: Disabled", "arial", 26, CCLabelFormat.SpriteFont);
            var item1 = new CCMenuItemLabel(label1);
            var item2 = new CCMenuItemLabel(label2);
            var item = new CCMenuItemToggle((toggleItem), item1, item2);

            menu = new CCMenu(item);
            AddChild(menu);
        }