Exemplo n.º 1
0
        private void InitBug1159Layer()
        {
                CCSize s = Layer.VisibleBoundsWorldspace.Size;

                CCLayerColor background = new CCLayerColor(new CCColor4B(255, 0, 255, 255));
                AddChild(background);

                CCLayerColor sprite_a = new CCLayerColor(new CCColor4B(255, 0, 0, 255));
                sprite_a.AnchorPoint = new CCPoint(0.5f, 0.5f);
                sprite_a.IgnoreAnchorPointForPosition = true;
                sprite_a.Position = new CCPoint(0.0f, s.Height / 2);
                AddChild(sprite_a);

                sprite_a.RunAction(new CCRepeatForever ((CCFiniteTimeAction)new CCSequence(
                                                                       new CCMoveTo (1.0f, new CCPoint(1024.0f, 384.0f)),
                                                                       new CCMoveTo (1.0f, new CCPoint(0.0f, 384.0f)))));

                CCLayerColor sprite_b = new CCLayerColor(new CCColor4B(0, 0, 255, 255));
                sprite_b.AnchorPoint = new CCPoint(0.5f, 0.5f);
                sprite_b.IgnoreAnchorPointForPosition = true;
                sprite_b.Position = new CCPoint(s.Width / 2, s.Height / 2);
                AddChild(sprite_b);

                CCMenuItemLabelTTF label = new CCMenuItemLabelTTF(new CCLabelTtf("Flip Me", "Helvetica", 24), callBack);
                CCMenu menu = new CCMenu(label);
                menu.Position = new CCPoint(s.Width - 200.0f, 50.0f);
                AddChild(menu);

        }
Exemplo n.º 2
0
        public TestScene()
            : base(AppDelegate.SharedWindow)
        {
            contentLayer = new CCLayer();
            AddChild(contentLayer, MENU_LEVEL);

            //add the menu item for back to main menu
            var label = new CCLabelTtf("MainMenu", "arial", 30);
            pMenuItem = new CCMenuItemLabelTTF(label, MainMenuCallback);

            pMenu = new CCMenu(pMenuItem);

            pMenu.Name = "MainMenu";
            contentLayer.AddChild(pMenu, MENU_LEVEL);
        }
Exemplo n.º 3
0
        public CocosDenshionTest()
        {
            testMenu = null;
            beginPos = new CCPoint(0,0);
            soundId = 0;

            string[] testItems = {
                "Play background music",
                "Stop background music",
                "Pause background music",
                "Resume background music",
                "Rewind background music",
                "Is background music playing",
                "Play effect",
                "Play effect repeatly",
                "Stop effect",
                "Unload effect",
                "Add background music volume",
                "Sub background music volume",
                "Add effects volume",
                "Sub effects volume"
            };

            testMenu = new CCMenu(null);
            testMenuItems = new List<CCMenuItem>();

            for(int i=0; i < testItems.Count(); ++i)
            {
                CCLabelTtf label = new CCLabelTtf(testItems[i], "arial", 24);
                CCMenuItemLabelTTF menuItem = new CCMenuItemLabelTTF(label, MenuCallback);
                testMenu.AddChild(menuItem, i + 10000);
                testMenuItems.Add(menuItem);
            }

            AddChild(testMenu);

            // preload background music and effect
            CCSimpleAudioEngine.SharedEngine.PreloadBackgroundMusic(CCFileUtils.FullPathFromRelativePath(MUSIC_FILE));
            CCSimpleAudioEngine.SharedEngine.PreloadEffect(CCFileUtils.FullPathFromRelativePath(EFFECT_FILE));

            // set default volume
            CCSimpleAudioEngine.SharedEngine.EffectsVolume = 0.5f;
            CCSimpleAudioEngine.SharedEngine.BackgroundMusicVolume = 0.5f;

            Camera = AppDelegate.SharedCamera;
        }
Exemplo n.º 4
0
        protected override void AddedToScene() {
            base.AddedToScene();

            var _menuPos = new CCPoint(Settings.ScreenSize.Center);

            CCLabelTtf labelStartGame = GetMenuLabel("Start Game");
            CCMenuItem itemStart = new CCMenuItemLabelTTF(labelStartGame, StartGame);

            CCLabelTtf labelExit = GetMenuLabel("Exit Game");
            CCMenuItem itemExit = new CCMenuItemLabelTTF(labelExit, ExitGame);


            MainMenu = new CCMenu(itemStart, itemExit) {Position = _menuPos};
            MainMenu.AlignItemsVertically(15);

            AddChild(MainMenu);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        public TestController()
        {
            // Add close menu
            closeMenuItem = new CCMenuItemImage(TestResource.s_pPathClose, TestResource.s_pPathClose, CloseCallback);
            closeMenu = new CCMenu(closeMenuItem);

            CCMenuItemFont.FontName = "MarkerFelt";
            CCMenuItemFont.FontSize = 22;


            #if !PSM && !WINDOWS_PHONE
            #if NETFX_CORE
            versionLabel = new CCLabelTtf("v" + this.GetType().GetAssemblyName().Version.ToString(), "arial", 30);
            #else
            versionLabel = new CCLabelTtf("v" + this.GetType().Assembly.GetName().Version.ToString(), "arial", 30);
            #endif
            AddChild(versionLabel, 20000);
            #endif

            // Add test list menu
            testListMenu = new CCMenu();
            for (int i = 0; i < (int)(TestCases.TESTS_COUNT); ++i)
            {
                CCLabelTtf label = new CCLabelTtf(Tests.g_aTestNames[i], "arial", 50);
                CCMenuItem menuItem = new CCMenuItemLabelTTF(label, MenuCallback);

				testListMenu.AddChild(menuItem, i + MENU_ITEM_Z_ORDER);
                testListMenuItems.Add(menuItem);
            }

            #if XBOX || OUYA
            CCSprite sprite = new CCSprite("Images/aButton");
            AddChild(sprite, 10001);
            menuIndicator = sprite;
            #endif

            AddChild(testListMenu);
            AddChild(closeMenu, 1);
        }