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

📄 gamecanvas.java

📁 一款一个益智类的手机游戏源码
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                        isPause = false;
                        Excute019Menu(0);
                        break;
                    }
                    break label0;
                }
                switch(i)
                {
                default:
                    break;
                case -1:
         selected019Menu = selected019Menu > 0 ? selected019Menu - 1 : 3;
                    break label0;
                case -2:
         selected019Menu = selected019Menu < 3 ? selected019Menu + 1 : 0;
                    break label0;
                case -4:
                case -3:
                    if(selected019Menu == 1)
                    {
                        volume = volume >= 1 ? 0 : 1;
                    }
                    break;
                case -7:
                    Excute019Menu(selected019Menu);
                    break;
                case 35: // '#'
                case 42: // '*'
                case 49: // '1'
                    Excute019Menu(0);
                    break;
                case 50: // '2'
                    Excute019Menu(1);
                    break;
                case 51: // '3'
                    Excute019Menu(2);
                    break;
                case 52: // '4'
                    Excute019Menu(3);
                    break;
                }
                break;
            }
            break;
        case 6: // '\006'
        case 7: // '\007'
            switch(i)
            {
            case -7:
            case -6:
                initReturnMenuFromSub();
                break;
            }
            break;
        case 4: // '\004'
            if(method == 0)
            {
                switch(i)
                {
                default:
                    break;
                case -2:
                    method_target = method_target < 3 ? method_target + 1 : 1;
                    break label0;
                case -1:
                    method_target = method_target > 1 ? method_target - 1 : 3;
                    break label0;
                case -7:
                    method = method_target;
                    if(method_target == 2)
                    {
                        getImage(3, 803, "/methodinfo.png");
                        break label0;
                    }
                    if(method_target == 3)
                    {
                        getImage(3, 1137, "/keyhelp.png");
                    }
                    break;
                case 49: // '1'
                    method = 1;
                    break;
                case 50: // '2'
                    method = 2;
                    getImage(3, 803, "/methodinfo.png");
                    break;
                case 51: // '3'
                    method = 3;
                    getImage(3, 1137, "/keyhelp.png");
                    break;
                case -6:
                    initReturnMenuFromSub();
                    nullImage(3);
                    break;
                }
                break;
            }
            if(method == 1)
            {
                switch(i)
                {
                case -1:
                    story_start = story_start >= 1 ? story_start - 1 : 0;
                    break;
                case -2:
                    story_start = story_start >= 5 ? 5 : story_start + 1;
                    break;
                case -7:
                case -6:
                    method = 0;
                    break;
                }
                break;
            }
            if(method ==2)
            {
              switch(i)
              {
              case -1:
                  info_start = info_start >= 1 ? info_start - 1 : 0;
                  break;
              case -2:
                  info_start = info_start >= 5 ? 5 : info_start + 1;
                  break;
              case -7:
              case -6:
                  method = 0;
                  break;
              }
                break;
            }
            if(method != 2 && method != 3)
            {
                break;
            }
            switch(i)
            {
            case -7:
            case -6:
                method = 0;
                break;
            }
            break;
        case 0: // '\0'
            setMenuMode((byte)1);
            nullImage(2);
            break;
        case 5: // '\005'
            switch(i)
            {
            case -5:
            default:
                break;
            case -2:
            case -1:
                if(env_target == 0)
                {
                    volume = volume >= 1 ? 0 : 1;
                } else
                {
                    isLightOn = !isLightOn;
                    backLightOnOff();
                }
                break;
            case -4:
            case -3:
                env_target = env_target == 0 ? 1 : 0;
                break;
            case -7:
            case -6:
                initReturnMenuFromSub();
                break;
            }
            break;
        }
         }
     */

    public void initReturnMenuFromSub()
    {
        setMenuMode( (byte) 1);
        imgCount = imgNum[1];
        nullImage(2);
    }

    public void drawGameLogo(Graphics g)
    {
        clipAFillRect(g, 0, 0, WIDTH, HEIGHT, 0);
        getImage(2, 1075, "/half_back1.png");
        getImage(7, 1176, "/half_back2.png");
        getImage(8, 1177, "/crygirl.png");
        gm.drawLogo(g, img[2], img[7], img[8]);
        /*
                 clipAFillRect(g, 0, 0, WIDTH, HEIGHT, 0);
                 //clipAdrawImage(g, img[2], half_width - 58, half_height - 58, 116, 100, 58, 58);
                 g.setClip(half_width - 58, half_height - 58, 116, 100);
                 g.drawImage(img[2], half_width - 58, half_height - 58, 20);
         */
    }

    public void drawBackGround(Graphics g)
    {
        g.setClip(0, 0, WIDTH, HEIGHT);
        int i = 0;
        int k = 154;
        int l = 11;
        while (i < 4)
        {
            g.setColor(0, k, 255);
            g.fillRect(0, l * i++, WIDTH, l);
            k += 20;
        }
        g.setColor(112, 215, 255);
        g.fillRect(0, l * 4, WIDTH, HEIGHT - l * 4);
        l = aniCount <= 2 ? ( (int) (aniCount)) : 4 - aniCount;
        if (4 < aniCount)
        {
            aniCount = 0;
        }
        else
        {
            aniCount++;
        }
        for (int i1 = cloud.length - 1; i1 >= 0; i1--)
        {
            int j = 2 + cloud[i1][2];
            cloud[i1][0] += cloud[i1][3] * l;
            clipAdrawImage(g, img[1], cloud[i1][0], cloud[i1][1], menuLoc[j][2],
                           menuLoc[j][3], menuLoc[j][0], menuLoc[j][1]);
            cloud[i1][0] = cloud[i1][0] <= WIDTH ? cloud[i1][0] : -20;
        }

        clipAdrawImage(g, img[0], 0, HEIGHT - menuLoc[7][3], menuLoc[7][2],
                       menuLoc[7][3], menuLoc[7][0], menuLoc[7][1]);
    }

    public void drawMainMenu(Graphics g)
    {
        String as[] =
            {
            "1. 开始游戏", "2. 继续游戏", "3. 游戏帮助", "4. 环境设置", "5. 查看分数", "6. 关于游戏",
            "7. 退出游戏"
        };
        drawBackGround(g);
        clipAdrawImage(g, img[1], WIDTH / 2 - menuLoc[0][2] / 2, 3,
                       menuLoc[0][2], menuLoc[0][3], menuLoc[0][0],
                       menuLoc[0][1]);
        int i = menu_start <= 0 ? 0 : 1;
        clipAdrawImage(g, img[1], half_width + menuLoc[5 + i][4],
                       half_height + menuLoc[5 + i][5], menuLoc[5 + i][2],
                       menuLoc[5 + i][3], menuLoc[5 + i][0], menuLoc[5 + i][1]);
        i = 3 + menuLoc[0][3] + 3;
        g.setColor(0, 0, 0);
        for (int j = menu_start; j < menu_start + 5; j++)
        {
            if (j == menu_target)
            {
                clipAdrawImage(g, img[1], half_width - 30 - 16,
                               i + 6 + (j - menu_start) * 16, menuLoc[1][2],
                               menuLoc[1][3], menuLoc[1][0], menuLoc[1][1]);
            }
            g.setClip(half_width - 30, i + 7 + (j - menu_start) * 16, 90, 16);
            g.drawString(as[j], half_width - 30, i + 7 + (j - menu_start) * 16,
                         20);
        }

        as = null;
        playSound("/menu.ott", 1, 0);
    }

    public void drawKeyhelp(Graphics g)
    {
        drawBackGround(g);
        Font currentFont = Font.getFont(Font.FACE_SYSTEM,
                                        Font.STYLE_PLAIN, Font.SIZE_SMALL);
        g.setFont(currentFont);
        clipAdrawImage(g, img[3], half_width - 28, 2, 56, 20, 0, 0);
        /*
             clipAdrawImage(g, img[3], half_width - 53, half_height - 37, 106, 75, 0, 20);
         */
        g.setClip(0, 25, WIDTH, HEIGHT - 30);
        g.setColor(0);
        String[] tips =
            {
            "方向键左:逆时针旋转", "方向键右:顺时针旋转", "方向键下:向后退",
            "方向键上:向前进", "数字键4: 向左走", "数字键6: 向右走", "数字键2: 向上走",
            "数字键1: 左上走", "数字键3: 右上走 ", "数字键7: 左下走", "数字键9: 右下走",
            "功能左键/8:装弹", "功能右键/5:发射", "#键: 暂停", "*键: 菜单选项",
            "            ", "数字鱼客服电话: ", "  0755-26978118",
            "客服 E-MAIL: ", "  help@digifun.cn",

        };
        g.setColor(0, 0, 0);
        for (int i = 0; i <= 19; i++)
        {
            g.drawString(tips[i], 2, y3 + i * 15, 20);
        }
        if (timeCount % 4 == 0)
        {
            y3 -= 15;
        }

        playSound("/menu.ott", 1, 0);
        g.setFont(Font.getDefaultFont());
        draw019UpMenu(g);
    }

    private void draw019UpMenu(Graphics g)
    {
        // System.out.println("into function draw019UpMenu");
        g.setClip(0, HEIGHT - 16, 45, 16);
        g.setColor(0);
        g.drawString("返回", 4, HEIGHT - 16, 20);
        /*
                 g.setColor(0xffffff);
                 g.drawString("019Menu_B", 3, HEIGHT - 16, 20);
         */
    }

    public void drawGameQuestion(Graphics g)
    {
        clipAFillRect(g, 0, 0, WIDTH, HEIGHT, 0);
        /*
                 clipAdrawImage(g, img[2], half_width - 31, 3, 63, 17, 0, 0);
             clipAdrawImage(g, img[2], half_width - 57, half_height - 20, 114, 36, 0, 17);
                 g.setClip(0, HEIGHT - 17, 40, 17);
         */
        //g.setClip(0, HEIGHT - 17, 40, 17);
        //g.setColor(0,0,0);
        //g.fillRect(0,0,getWidth(),getHeight());
        Font currentFont = Font.getFont(Font.FACE_SYSTEM,
                                        Font.STYLE_PLAIN, Font.SIZE_SMALL);
        g.setFont(currentFont);
        g.setColor(255, 255, 255);
        g.drawString("发行:", 2, 5, g.TOP | g.LEFT);
        g.drawString(" 数字鱼", 5, 20, g.TOP | g.LEFT);
        g.drawString(" www.digifun.cn", 5, 35, g.TOP | g.LEFT);
        g.drawString(" 卡美星达", 5, 50, g.TOP | g.LEFT);
        g.drawString("制作: ", 2, 65, g.TOP | g.LEFT);
        g.drawString(" MOJSES", 5, 80, g.TOP | g.LEFT);
        g.drawString("返回", 3, HEIGHT - 16, 20);
    }

    public void drawRankingView(Graphics g)
    {
        drawBackGround(g);
        int ai[] = new int[12];
        getRank(ai);
        orderArray(ai);
        g.setClip(0, 0, WIDTH, HEIGHT);
        g.setColor(0, 0, 0);
        for (int i = 0; i < 10; i++)
        {
            g.drawString(String.valueOf(i / 2 + 1), half_width - 52,
                         (half_height - 44) + 9 * i, 20);
            String s = String.valueOf(ai[i]);
            // g.drawString(s, half_width - 16 - s.length() * 8, (half_height - 44) + 9 * i, 20);
            s = null;
            i++;
            s = String.valueOf(ai[i] * 100);
            g.drawString(s, (half_width + 57) - s.length() * 8,
                         (half_height - 44 - 9) + 9 * i, 20);
        }
        ai = null;
        Object obj = null;
        g.setColor(225, 0, 0);
        /*
                 g.drawString("No.", half_width - 59, 3, 20);
                 g.drawString("Lev.", half_width - 36, 3, 20);
                 g.drawString("Score", half_width + 23, 3, 20);
         */
        g.drawString("排行榜", half_width, 3, g.TOP | g.HCENTER);
        draw019UpMenu(g);
        playSound("/menu.ott", 1, 0);
    }

    public void drawProlog(Graphics g)
    {
        //   System.out.println("into function drawProlog");
        if (imgCount == 0)
        {
            gm.drawBack(g, 0);
            clipAdrawImage(g, img[5], half_width - 28, half_height - 40, 56, 46,
                           0, 0);
            gm.drawBackVine(g, img[6], img[7], 0, 19);
            g.setColor(255, 255, 255);
            g.setClip(half_width - 52, half_height + 18, 90, 32);
            g.drawString("亚当!", half_width - 52, half_height + 18, 20);
            g.drawString("快救救我啊~!", half_width - 52, half_height + 34, 20);
            nullImage(5);
        }
        else
        if (imgCount == 2)
        {
            clipAFillRect(g, half_width - 58, half_height - 58, 116, 69, 36864);
            gm.drawBackVine(g, img[6], img[7], 0, 19);
            clipAdrawImage(g, img[8], half_width - 13, half_height - 53, 61, 65,
                        

⌨️ 快捷键说明

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