• 大小: 526KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-20
  • 语言: 其他
  • 标签:

资源简介

j2me手要移动开发技术雷电游戏.rar,j2me手要移动开发技术雷电游戏.rar

资源截图

代码片段和文件信息

import java.io.IOException;
import javax.microedition.media.Manager;
import javax.microedition.media.MediaException;
import javax.microedition.media.Player;
import java.io.InputStream;
public class Audio
{
    public static final int TOP_SCORE = 0;
    public static final int NEW_Player = 1;
    public static final int FAIL = 2;
    public static final int BONUS = 3;
    public static final int EXPLOSION = 4;
    public static final int DEAD = 5;
    public static final int WIN = 6;
    public static final int START = 7;
    protected static Player[]sounds = new Player[8];

    protected static final String TYPE_WAV = “audio/wav“;
    protected static final String TYPE_MIDI = “audio/midi“;
    private static Audio instance;    
    static Audio getInstance()
    {
        if (instance == null)
        {
            instance = new Audio();
        }
        return instance;
    }
    private Audio(){}    
    public void playSound(int snd)
    {

            // No player create one
            if (sounds[snd] == null)
            {
                createSound(snd);
            }
            // Start player
            Player player = sounds[snd];
            if (player != null)
            {
                try
                {
                    player.start();
                   
                }
                catch (MediaException e)
                {
                    e.printStackTrace();
                }
            }
     
    }
    /**
     * Stops specified sound if it is playing.
     * @param snd The id of the sound to stop.
     */
    public void stopSound(int snd)
    {
        if (sounds[snd] != null)
        {
            try
            {
                sounds[snd].stop();
            }
            catch (MediaException e)
            {
                e.printStackTrace();
            }
        }
    }
    /**
     * Stops all sounds and cleans up resources.
     */
    public void shutdown()
    {
        for (int i = 0; i < sounds.length; i++)
        {
            stopSound(i);
            if (sounds[i] != null)
            {
                sounds[i].deallocate();
            }
        }
    }
    /**
     * Creates a player for specified sound
     * and popuplates the Player array.
     * @param snd The sound to create
     */
    protected void createSound(int snd)
    {
        try
        {
            String rsc = “/TopScore.mid“;
            String type = TYPE_MIDI;
            switch (snd)
            {
                case TOP_SCORE:
                    type = TYPE_MIDI;
                    rsc = “/TopScore.mid“;
                    break;
                case NEW_Player:
                    type = TYPE_MIDI;
                    rsc = “/New.mid“;
                    break;
                case FAIL:
                    type = TYPE_MIDI;
                    rsc = “/Fail.mid“;
                    break;

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        119  2008-09-08 21:33  雷电游戏\Raiden\project.properties

     文件        174  2008-09-08 21:33  雷电游戏\Raiden\bin\MANIFEST.MF

     文件        222  2008-09-08 21:33  雷电游戏\Raiden\bin\Raiden.jad

     文件       2910  2008-09-08 21:33  雷电游戏\Raiden\classes\Audio.class

     文件       1622  2008-09-08 21:33  雷电游戏\Raiden\classes\Bonus.class

     文件       1458  2008-09-08 21:33  雷电游戏\Raiden\classes\Bullet.class

     文件       2927  2008-09-08 21:33  雷电游戏\Raiden\classes\Enemy1.class

     文件       2739  2008-09-08 21:33  雷电游戏\Raiden\classes\Enemy2.class

     文件       2272  2008-09-08 21:33  雷电游戏\Raiden\classes\Enemy3456.class

     文件       1152  2008-09-08 21:33  雷电游戏\Raiden\classes\MenuCanvas$PersistenceFlagItem.class

     文件       1531  2008-09-08 21:33  雷电游戏\Raiden\classes\MenuCanvas$RaidenMenuPainter.class

     文件       8971  2008-09-08 21:33  雷电游戏\Raiden\classes\MenuCanvas.class

     文件       2242  2008-09-08 21:33  雷电游戏\Raiden\classes\Player.class

     文件      12137  2008-09-08 21:33  雷电游戏\Raiden\classes\RaidenCanvas.class

     文件       1149  2008-09-08 21:33  雷电游戏\Raiden\classes\RaidenMIDlet$1.class

     文件       9582  2008-09-08 21:33  雷电游戏\Raiden\classes\RaidenMIDlet.class

     文件       5093  2008-09-08 21:33  雷电游戏\Raiden\classes\SoftButtonControl.class

     文件       1573  2008-09-08 21:33  雷电游戏\Raiden\classes\SplashScreen.class

     文件       1970  2008-09-08 21:33  雷电游戏\Raiden\classes\menu\BinaryPageItem.class

     文件       8400  2008-09-08 21:33  雷电游戏\Raiden\classes\menu\DefaultMenuPainter.class

     文件        163  2008-09-08 21:33  雷电游戏\Raiden\classes\menu\ItemAction.class

     文件       1277  2008-09-08 21:33  雷电游戏\Raiden\classes\menu\Menu$1.class

     文件       8115  2008-09-08 21:33  雷电游戏\Raiden\classes\menu\Menu.class

     文件        239  2008-09-08 21:33  雷电游戏\Raiden\classes\menu\MenuListener.class

     文件       3595  2008-09-08 21:33  雷电游戏\Raiden\classes\menu\MenuPage.class

     文件        292  2008-09-08 21:33  雷电游戏\Raiden\classes\menu\MenuPainter.class

     文件       3331  2008-09-08 21:33  雷电游戏\Raiden\classes\menu\PageItem.class

     文件       7675  2008-09-08 21:33  雷电游戏\Raiden\classes\popup\Popup.class

     文件        146  2008-09-08 21:33  雷电游戏\Raiden\classes\popup\PopupListener.class

     文件       3393  2006-01-20 21:04  雷电游戏\Raiden\res\audio_off.png

............此处省略101个文件信息

评论

共有 条评论

相关资源