⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainmenu.java

📁 一款手机游戏
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        	if(isAbout){
            isAbout = false;
            about=0;
        	}
            if(isOption){
            	if(isSound)
            	isSound=false;
            	else if(soundType)
            	soundType=false;
            	else if(isHelp)
            	{
                	isHelp = false;
                	about=0;
                	}
                else{
            	isOption=false;
            	framework.setPosition(50, 75+count1*22);
                }
            }
        }
        if(action == FIRE||keyCode==-6)
        {
        	
            if(!isLevel&&!isOption)
            {   
                switch(count1)
                {
                    case 0:
                        isLevel = true;
                        break; 
                    case 1:
                        isOption = true;
                        framework.setPosition(61,28+count3*35);
                        break;
                    case 2:
                    	isAbout = true;
                    	break;
                    case 3:
                        parent.Exit();
                        break;
                }
            }
            else if(isOption)
            {
            	if(isSound){
            	issoundopen[count4]=!issoundopen[count4];
            	if(issoundopen[2]==false)
            		try{
            			player.stop();
            		}catch(Exception e){}
            	else
            		try{
            			player.start();
            		}catch(Exception e){}
            	}
            	else if(soundType){
            	if(count5==0) {
            		if(issoundopen[2]==true)
            			try{
            				player.stop();
            				player = Manager.createPlayer(getClass().getResourceAsStream("/Sound/"+ random.nextInt()%5 + ".mid"), "audio/midi");
            				player.setLoopCount(-1);
            				player.start();
            			}catch(Exception e){}
            		else ; 
            	}
            	else 
            		isMusic=true;
            	    
            	}
            	else {
            		switch(count3)
            	{
            	case 0:
            		isSound=true;
            		break;
            	case 1:
            		soundType=true;
            		break;
            	case 2:
            		isHelp=true;
            		break;
            	case 3:
            		isOption=false;
            		framework.setPosition(50, 75+count1*22);
            		break;
            	}
            	}
            }
            else
            {
                switch(count2)
                {
                case 0:
                    loadGameDisplay(1, scene.level1_nikuman, scene.level1_toge, 
                            scene.life_1UP, scene.level1);
                    Other.currentLevel = 1;
                    break;
                case 1:
                    loadGameDisplay(2, scene.level2_nikuman, scene.level2_toge, 
                            scene.life_1UP, scene.level2);
                    Other.currentLevel = 2;
                    break;
                case 2:
                    loadGameDisplay(3, scene.level3_nikuman, scene.level3_toge, 
                            scene.life_1UP, scene.level3);
                    Other.currentLevel = 3;
                    break;
                case 3:
                    loadGameDisplay(4, scene.level4_nikuman, scene.level4_toge, 
                            scene.life_1UP, scene.level4);
                    Other.currentLevel = 4;
                    break;
                case 4:
                    loadGameDisplay(5, scene.level5_nikuman, scene.level5_toge, 
                            scene.life_1UP, scene.level5);
                    Other.currentLevel = 5;
                    break;
                case 5:
                    loadGameDisplay(6, scene.level6_nikuman, scene.level6_toge, 
                            scene.life_1UP, scene.level6);
                    Other.currentLevel = 6;
                    break;
                case 6:
                    loadGameDisplay(7, scene.level7_nikuman, scene.level7_toge, 
                            scene.life_1UP, scene.level7);
                    Other.currentLevel = 7;
                    break;
                case 7:
                    loadGameDisplay(8, scene.level8_nikuman, scene.level8_toge, 
                            scene.life_1UP, scene.level8);
                    Other.currentLevel = 8;
                    break;
                case 8:
                    loadGameDisplay(9, scene.level9_nikuman, scene.level9_toge, 
                            scene.life_1UP, scene.level9);
                    Other.currentLevel = 9;
                    break;    
                case 9:
                    loadGameDisplay(10, scene.level10_nikuman, scene.level10_toge, 
                            scene.life_1UP, scene.level10);
                    Other.currentLevel = 10;
                    break; 
                }
            }
        }
        if(action == UP && !isLevel && !isAbout && !isOption)
            if(count1<1) count1 = 3;
            else count1--;
        if(action == UP && !isLevel && !isAbout && isOption && !isSound && !soundType)
            if(count3<1) count3 = 3;
            else count3--;
        if(action == UP && !isLevel && !isAbout && isOption && isSound)
            if(count4<1) count4 = 2;
            else count4--;
        if(action == UP && !isLevel && !isAbout && isOption && soundType)
            if(count5<1) count5 = 1;
            else count5--;
        if(action == DOWN && !isLevel && !isAbout && !isOption)
            if(count1>=3) count1 = 0;
            else count1++;
        if(action == DOWN && !isLevel && !isAbout && isOption && !isSound && !soundType)
            if(count3>=3) count3 = 0;
            else count3++;
        if(action == DOWN && !isLevel && !isAbout && isOption && isSound )
            if(count4>=2) count4 = 0;
            else count4++;
        if(action == DOWN && !isLevel && !isAbout && isOption && soundType )
            if(count5>=1) count5 = 0;
            else count5++;
        if(action == LEFT && isLevel)
            if(count2<1) count2 = 0;
            else count2--;
        if(action == RIGHT && isLevel)
            if(count2>=4) count2 =4;
            else count2++;
    }

    public void run()
    {
        while(true)
        {
            manager.BGScroll(360);            
            if(isAbout==true||isHelp==true)
            	about=(about+1)%540;
            try{
            	Thread.sleep(20);
            	}catch(Exception e){}
            repaint();
            System.gc();
        }
    }
    
    public static void release()
    { // 释放声音对象
        try
        {
            player.close();
            player.deallocate();
            is.close();
            player = null;
            is = null;
        }
        catch(Exception e){}
    }

    
    public static void loadCustomSound() {
        try {
            fileConn =(FileConnection)Connector.open(Browsing.fileURL);
            is = fileConn.openInputStream();
            int length = Browsing.fileURL.length()-3;
            String s = Browsing.fileURL.substring(length);
            if(s.equalsIgnoreCase("mid"))
            	player = Manager.createPlayer(is, "audio/midi");
            else if(s.equalsIgnoreCase("mp3"))
            	player = Manager.createPlayer(is, "audio/mpeg");
            player.setLoopCount(-1);
        } 
        catch(Exception e){}
        System.gc();
    }
    
    private void loadGameDisplay(int lvl, int[][] nikumanPos, int[][] togePos,
            int[][] lifePos, int[] levelNumber)
    {
    	gameDisplay = new GameDisplay(parent,this);
        parent.setDisplayable(gameDisplay);
        gameDisplay.initialize(lvl, nikumanPos, togePos, lifePos, levelNumber);
        System.gc();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -