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

📄 manager.java

📁 一款一个益智类的手机游戏源码
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                    int l = nativeLoc[8][i / 4][3] / 2;
                    clipAdrawImage(g, image, natives[j1][0] - j,
                                   natives[j1][1] - l, nativeLoc[8][i / 4][2],
                                   nativeLoc[8][i / 4][3],
                                   nativeLoc[8][i / 4][0],
                                   nativeLoc[8][i / 4][1]);
                    natives[j1][3]++;
                    break;

                case 8: // '\b'
                    int k = nativeLoc[8][i / 4][2] / 2;
                    int i1 = nativeLoc[8][i / 4][3] / 2;
                    clipAdrawImage(g, image, natives[j1][0] - k,
                                   natives[j1][1] - i1, nativeLoc[9][i / 4][2],
                                   nativeLoc[9][i / 4][3],
                                   nativeLoc[9][i / 4][0],
                                   nativeLoc[9][i / 4][1]);
                    natives[j1][3]++;
                    break;
            }
        }

    }

    public void drawInsulted(Graphics g, Image image, Image image1,
                             Image image2)
    {
        int i = subSituCount % 2;
        drawBack(g, 0);
        clipAdrawImage(g, image2, half_width + insultedLoc[i][4],
                       half_height + insultedLoc[i][5], insultedLoc[i][2],
                       insultedLoc[i][3], insultedLoc[i][0], insultedLoc[i][1]);
        drawBackVine(g, image, image1, 0, 0);
        playSound("/movevine.ott", 8, 1);
    }

    public void drawItem(Graphics g, Image image)
    {
        if (item == null)
        {
            return;
        }
        for (int i = item.length - 1; i >= 0; i--)
        {
            if (item[i][2] == 0)
            {
                clipAdrawImage(g, image, item[i][1] * 5 - 3, item[i][0] * 5 - 5,
                               7, 10, 36, 25);
            }
        }

    }

    public void drawGameInfo(Graphics g, Image image)
    {
        int i = (nativeNum - dieNativeNum) / 10;
        int j = (nativeNum - dieNativeNum) % 10;
        int k = WIDTH - 3 - gameInfoNumLoc[j][2];
        int l = HEIGHT - 14;
        clipAdrawImage(g, image, k, l, gameInfoNumLoc[j][2],
                       gameInfoNumLoc[j][3], gameInfoNumLoc[j][0],
                       gameInfoNumLoc[j][1]);
        if (0 < i)
        {
            k = k - gameInfoNumLoc[i][2] - 2;
            clipAdrawImage(g, image, k, l, gameInfoNumLoc[i][2],
                           gameInfoNumLoc[i][3], gameInfoNumLoc[i][0],
                           gameInfoNumLoc[i][1]);
        }
        k = k - gameInfoLoc[3][2] - 2;
        clipAdrawImage(g, image, k, l, gameInfoLoc[3][2], gameInfoLoc[3][3],
                       gameInfoLoc[3][0], gameInfoLoc[3][1]);
        byte byte0 = bullet >= 0 ? bullet : 0;
        k = k - gameInfoNumLoc[byte0][2] - 2;
        clipAdrawImage(g, image, k, l, gameInfoNumLoc[byte0][2],
                       gameInfoNumLoc[byte0][3], gameInfoNumLoc[byte0][0],
                       gameInfoNumLoc[byte0][1]);
        k = k - gameInfoLoc[2][2] - 2;
        clipAdrawImage(g, image, k, l, gameInfoLoc[2][2], gameInfoLoc[2][3],
                       gameInfoLoc[2][0], gameInfoLoc[2][1]);
        i = cartridge / 10;
        j = cartridge % 10;
        k = k - gameInfoNumLoc[j][2] - 2;
        clipAdrawImage(g, image, k, l, gameInfoNumLoc[j][2],
                       gameInfoNumLoc[j][3], gameInfoNumLoc[j][0],
                       gameInfoNumLoc[j][1]);
        if (0 < i)
        {
            k = k - gameInfoNumLoc[i][2] - 2;
            clipAdrawImage(g, image, k, l, gameInfoNumLoc[i][2],
                           gameInfoNumLoc[i][3], gameInfoNumLoc[i][0],
                           gameInfoNumLoc[i][1]);
        }
        k = k - gameInfoLoc[1][2] - 2;
        clipAdrawImage(g, image, k, l, gameInfoLoc[1][2], gameInfoLoc[1][3],
                       gameInfoLoc[1][0], gameInfoLoc[1][1]);
        k = 2;
        l = 2;
        clipAdrawImage(g, image, k, l, gameInfoLoc[0][2], gameInfoLoc[0][3],
                       gameInfoLoc[0][0], gameInfoLoc[0][1]);
        j = life % 10;
        k = k + gameInfoLoc[0][2] + 2;
        clipAdrawImage(g, image, k, l, gameInfoNumLoc[j][2],
                       gameInfoNumLoc[j][3], gameInfoNumLoc[j][0],
                       gameInfoNumLoc[j][1]);
        g.setClip(0, HEIGHT - 16, 40, 16);
        /*
                 g.setColor(0);
                 g.drawString("aa", 4, HEIGHT - 16, 20);
                 g.setColor(0xffffff);
                 g.drawString("GameInfo_B", 3, HEIGHT - 16, 20);
         */
    }

    public void drawLevelUp(Graphics g, Image image, Image image1, Image image2)
    {
        Font currentFont = Font.getFont(Font.FACE_SYSTEM,
                                        Font.STYLE_PLAIN, Font.SIZE_SMALL);
        g.setFont(currentFont);

        resultCount = resultCount <= 4 ? (byte) (resultCount + 1) : 0;
        drawBack(g, 1);
        clipAdrawImage(g, image, half_width - 58, half_height - 58, 58, 69, 0,
                       0);
        clipAdrawImage(g, image1, half_width - 0, half_height - 58, 58, 69, 0,
                       0);

        clipAdrawImage(g, image2, half_width - 56, half_height + 16, 9, 8, 40,
                       0);
        clipAdrawImage(g, image2, half_width - 38, half_height + 16, 2, 7, 54,
                       59);
        int i = !lifeBonus ? 0 : 1;
        int j = drawResultNumber(g, image2, i, half_width - 30,
                                 half_height + 16);
        clipAdrawImage(g, image2, j + 8, half_height + 16, 2, 7, 53, 37);

        clipAdrawImage(g, image2, half_width - 58, half_height + 28, 11, 11, 25,
                       14);
        clipAdrawImage(g, image2, half_width - 38, half_height + 31, 2, 7, 54,
                       59);
        j = drawResultNumber(g, image2, dieNativeNum, half_width - 30,
                             half_height + 31);
        j++;
        clipAdrawImage(g, image2, j + 8, half_height + 31, 2, 7, 53, 37);
        j += 4;
        clipAdrawImage(g, image2, j + 8, half_height + 31, 5, 6, 43, 52);
        j += 3;
        drawResultNumber(g, image2, 100, j + 8, half_height + 32);
        if (scoreBonus)
        {
            //clipAdrawImage(g, image2, half_width - 20, half_height, 40, 7, 0, 51);
            g.setColor(255, 255, 255);
            g.setClip(0, half_height + 18, 100, 46);
            g.drawString("奖励分: ", 2, half_height + 44, 20);
            drawResultNumber(g, image2, 1000, half_width - 20, half_height + 48);
        }

        /*
             clipAdrawImage(g, image2, half_width - 56, half_height + 15, 11, 7, 26, 0);
             clipAdrawImage(g, image2, half_width - 41, half_height + 15, 30, 7, 0, 43);
             clipAdrawImage(g, image2, half_width + 2, half_height + 16, 9, 8, 40, 0);
             clipAdrawImage(g, image2, half_width + 15, half_height + 16, 2, 7, 54, 59);
                 int i = !lifeBonus ? 0 : 1;
             int j = drawResultNumber(g, image2, i, half_width + 18, half_height + 16);
             clipAdrawImage(g, image2, j + 1, half_height + 16, 2, 7, 53, 37);
             clipAdrawImage(g, image2, half_width - 56, half_height + 26, 30, 7, 0, 43);
                 if(scoreBonus)
                 {
            //clipAdrawImage(g, image2, half_width - 20, half_height, 40, 7, 0, 51);
            drawResultNumber(g, image2, 1000, half_width, half_height + 27);
                 }
             clipAdrawImage(g, image2, half_width - 56, half_height + 37, 27, 6, 0, 37);
             clipAdrawImage(g, image2, half_width + 2, half_height + 35, 11, 11, 25, 14);
             clipAdrawImage(g, image2, half_width + 15, half_height + 38, 2, 7, 54, 59);
                 j = drawResultNumber(g, image2, dieNativeNum, half_width + 18, half_height + 38);
                 j++;
                 clipAdrawImage(g, image2, j, half_height + 38, 2, 7, 53, 37);
                 j += 4;
                 clipAdrawImage(g, image2, j, half_height + 38, 5, 6, 43, 52);
                 j += 3;
                 drawResultNumber(g, image2, 100, j, half_height + 39);
             clipAdrawImage(g, image2, half_width - 56, half_height + 46, 19, 7, 0, 58);
             clipAdrawImage(g, image2, half_width - 34, half_height + 47, 27, 6, 0, 37);
             j = drawResultNumber(g, image2, score * 100, half_width, half_height + 48);
                 clipAdrawImage(g, image2, half_width + 23, half_height - 50, gameInfoLoc[4][2], gameInfoLoc[4][3], gameInfoLoc[4][0], gameInfoLoc[4][1]);
         */
        if (soundCount++ == 0)
        {
            playSound("/new_stage.ott", 11, 1);
        }
        g.setFont(Font.getDefaultFont());
    }

    public void drawLevelUpNext(Graphics g, Image image)
    {
        Font currentFont = Font.getFont(Font.FACE_SYSTEM,
                                        Font.STYLE_PLAIN, Font.SIZE_SMALL);
        g.setFont(currentFont);

        clipAFillRect(g, 0, half_height + 11, WIDTH,
                      (HEIGHT - half_height) + 11, 0);
        g.setColor(255, 255, 255);
        g.setClip(half_width - 52, half_height + 18, 100, 32);
        g.drawString("关卡: ", half_width - 50, half_height + 20, 20);
        drawResultNumber(g, image, userLevel, half_width + 5, half_height + 26);

        clipAdrawImage(g, image, half_width - 50, half_height + 35, 11, 11, 25,
                       14);
        clipAdrawImage(g, image, half_width + 5, half_height + 36, 2, 7, 54, 59);
        int i = drawResultNumber(g, image, nativeNum, half_width + 9,
                                 half_height + 36);
        dieNativeNum = 0;
        clipAdrawImage(g, image, i + 1, half_height + 36, 2, 7, 53, 37);

        clipAdrawImage(g, image, half_width - 50, half_height + 49, 6, 8, 48,
                       58);
        clipAdrawImage(g, image, half_width + 5, half_height + 49, 2, 7, 54, 59);
        int j = 0;
        if (item != null)
        {
            j = item.length;
        }
        i = drawResultNumber(g, image, j, half_width + 9, half_height + 49);
        clipAdrawImage(g, image, i + 1, half_height + 49, 2, 7, 53, 37);

        /*
             clipAdrawImage(g, image, half_width - 50, half_height + 37, 29, 8, 19, 58);
             clipAdrawImage(g, image, half_width - 10, half_height + 35, 11, 11, 25, 14);
             clipAdrawImage(g, image, half_width + 5, half_height + 36, 2, 7, 54, 59);
             int i = drawResultNumber(g, image, nativeNum, half_width + 9, half_height + 36);
                 dieNativeNum = 0;
             clipAdrawImage(g, image, i + 1, half_height + 36, 2, 7, 53, 37);
             clipAdrawImage(g, image, half_width - 50, half_height + 49, 21, 6, 33, 44);
             clipAdrawImage(g, image, half_width - 10, half_height + 49, 6, 8, 48, 58);
             clipAdrawImage(g, image, half_width + 5, half_height + 49, 2, 7, 54, 59);
                 int j = 0;
                 if(item != null)
                 {
            j = item.length;
                 }
             i = drawResultNumber(g, image, j, half_width + 9, half_height + 49);
             clipAdrawImage(g, image, i + 1, half_height + 49, 2, 7, 53, 37);
         */
        g.setFont(Font.getDefaultFont());
    }

    public void drawGameSucc(Graphics g, Image image, Image image1,
                             Image image2)
    {
        drawBack(g, 1);
        clipAdrawImage(g, image, half_width - 58, half_height - 58, 60, 69, 0,
                       0);
        clipAdrawImage(g, image1, half_width + 2, half_height - 58, 56, 69, 0,
                       0);
        clipAdrawImage(g, image, half_width - 52, half_height + 16, 60, 10, 0,
                       71);
        clipAdrawImage(g, image1, half_width + 8, half_height + 16, 53, 10, 0,
                       71);
        clipAdrawImage(g, image2, half_width - 27, half_height + 36,
                       gameInfoLoc[8][2], gameInfoLoc[8][3], gameInfoLoc[8][0],
                       gameInfoLoc[8][1]);
        drawResultNumber(g, image2, score * 100,
                         (half_width - 27) + gameInfoLoc[8][2] + 5,
                         half_height + 36);
        dieNativeNum = 0;
        if (soundCount == 0)
        {
            playSound("/ending.ott", 13, 1);
        }
        soundCount = 1;
    }

    public void drawRestart(Graphics g, Image image, Image image1, Image image2,
                            Image image3)
    {
        resultCount = resultCount <= 4 ? (byte) (resultCount + 1) : 0;
        drawBack(g, 0);
        drawBackVine(g, image, image1, 0, 0);
        clipAdrawImage(g, image2, half_width - 46, half_height - 58, 72, 69, 0,
                       0);
        g.setColor(255, 255, 255);
        g.setClip(half_width - 52, half_height + 18, 100, 32);
        g.drawString("呜呜~", half_width - 52, half_height + 18, 20);
        g.drawString("一定要努力啊!?", half_width - 52, half_height + 34, 20);
        if (soundCount++ == 0)
        {
            playSound("/fail.ott", 10, 1);
        }
    }

    public int drawResultNumber(Graphics g, Image image, int i, int j, int k)
    {
        int l = i;
        int i1 = 1;
        do
        {
            l /= 10;
            if (l == 0)
            {
                break;
            }
            i1++;
        }
        while (true);
        l = i;
        int j1 = i1 * 3;
        int k1 = j1;
        j += j1;
        do
        {
            int l1 = l % 10;
            l /= 10;
            j1 -= 5;
            g.setClip(j + j1, k, 4, 6);
            g.drawImage(image, (j + j1) - l1 * 5 - 0, k - 8, 20);
        }
        while (l != 0);
        return j + k1;
    }

    public void drawGameOver(Graphics g, Image image, Image image1,
                             Image image2, Image image3)
    {
        drawBack(g, 1);
        drawBackVine(g, image, image1, 0, 0);
        clipAdrawImage(g, image2, half_width - 42, half_height - 58, 58, 69, 0,
                       0);
        clipAdrawImage(g, image2, half_width - 38, half_height + 16, 33, 10, 0,
                       69);
        clipAdrawImage(g, image2, half_width + 3, half_height + 16, 32, 9, 32,
                       70);
        //F clipAdrawImage(g, image3, half_width - 27, half_height + 36, gameInfoLoc[8][2], gameInfoLoc[8][3], gameInfoLoc[8][0], gameInfoLoc[8][1]);
        drawResultNumber(g, image3, score * 100,
                         (half_width - 27) + gameInfoLoc[8][2] + 5,
                         half_height + 36);
        if (soundCount++ == 0)
        {
            playSound("/gameover.ott", 12, 1);
        }
    }

    public void drawLogo(Graphics g, Image image, Image image1, Image image2)
    {
        clipAFillRect(g, half_width - 58, half_height - 58, 116, 78, 29184);
        clipAdrawImage(g, image, half_width - 58, half_height - 58, 58, 90, 0,
                       0);
        clipAdrawImage(g, image1, half_width - 0, half_height - 58, 58, 90, 0,
                       0);
        clipAdrawImage(g, image2, half_width - 46, half_height - 38, 72, 85, 0,
                       0);
    }

    public void dragedGirl(Graphics g, Image image, Image image1, Image image2)
    {
        drawBack(g, 0);
        clipAdrawImage(g, image2, (half_width - 40) + 6 * subSituCount,
                       half_height - 35, 56, 46, 0, 0);
        drawBackVine(g, image, image1, 0, 0);
        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);
        if (soundCount++ < 3)
        {
            playSound("/eve.ott", 14, 1);
        }
    }

    public void drawBack(Graphics g, int i)
    {
        clipAFillRect(g, 0, 0, WIDTH, HEIGHT, 0);
        if (i == 0)
        {
            clipAFillRect(g, half_width - 58, half_height - 58, 116, 69, 29184);
        }
        else
        if (i == 1)
        {
            clipAFillRect(g, half_width - 58, half_height - 58, 116, 69,
                          0xffffff);
        }
    }

    public void drawBackVine(Graphics g, Image image, Image image1, int i,
                             int j)
    {
        clipAdrawImage(g, image, half_width - 58, half_height - 58, 58, 69, i,
                       j);
        clipAdrawImage(g, image1, half_width - 0, half_height - 58, 58, 69, i,
                       j);
    }

    private void clipAFillRect(Graphics g, int i, int j, int k, int l, int i1)
    {
        g.setColor(i1);
        g.setClip(i, j, k, l);
        g.fillRect(i, j, k, l);
    }

    private void clipAdrawImage(Graphics g, Image image, int i, int j, int k,
                                int l, int i1,
                                int j1)
    {
        g.setClip(i, j, k, l);
        g.drawImage(image, i - i1, j - j1, 20);
    }

    public void loadMap()
    {
        try
        {
            InputStream inputstream = getClass().getResourceAsStream("/" +
                String.valueOf(directOfInRoad / 2) + ".png");
            //InputStream inputstream = getClass().getResourceAsStream("/2");
            byte abyte0[] = new byte[494];
            inputstream.read(abyte0, 0, abyte0.length);
            inputstream.close();
            int i = 0;
            for (int j = 0; j < 19; j++)
            {
                for (int k = 0; k < 13; k++)
                {
                    treeMap[j][k][0] = (byte) (abyte0[i++] & 0xff);
                    treeMap[j][k][1] = (byte) (abyte0[i++] & 0xff);
                }

            }

            abyte0 = null;
  

⌨️ 快捷键说明

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