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

📄 screen.java

📁 手机上的SLG游戏
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                                                try{
                                                        Thread.sleep(2000);
                                                } catch( Exception e ){
                                                        System.out.println(e);
                                                }
                                                g.lock();

                                                status[0] = status[0] / 2;

                                                if( status[0] == 0 ){
                                                        status[0] = 1;
                                                }

                                                mode = 2;
                                                ch_p = sai_num;

                                                resetMode();

                                                drawMapBack();
                                                //g.unlock(true);
                                                //exe();

                                        }

                                } else{

                                        drawWaku( 0, 0, 120, 65, "这个命令不能使用" );
                                        g.unlock(true);
                                        try{
                                                Thread.sleep(2000);
                                        } catch( Exception e ){
                                                System.out.println(e);
                                        }

                                }

                        } else{

                                try{
                                        Thread.sleep(300);
                                } catch( Exception e ){
                                        System.out.println(e);
                                }

                        }

                        // 傾僋僔儑儞帪
                        if( phase == 1 ){

                                // 偙偭偪偐傜偺峌寕
                                myAttack(0);

                                // 憃摢偺寱丄楢懕峌寕
                                if( status[12] == 29 && teki_stat[0] > 0 && status[10] != 5 ){
                                        tame = 1;
                                        myAttack(0);
                                }

                                // 揋偑巰傫偱偄偨傜
                                if( teki_stat[0] <= 0 ){

                                        //return;

                                } else{

                                        // 揋偐傜偺峌寕
                                        tekiAttack();

                                        // 嬀偺奪
                                        if( status[13] == 37 && status[10] != 5 ){
                                                myAttack(0);
                                        }

                                }

                                phase = 0;

                        // 棴傔傞傾僋僔儑儞
                        } else if( phase == 2 ){

                                // 棴傔傞傾僋僔儑儞
                                temp_int = 36;
                                for( int i = 7; i >= 0; i-- ){

                                        drawBattleBack();

                                        g.unlock(true);

                                        try{
                                                Thread.sleep(100);
                                        } catch( Exception e ){
                                                System.out.println(e);
                                        }

                                        g.lock();

                                        if( temp_int == 36 ){
                                                temp_int = 37;
                                        } else{
                                                temp_int = 36;
                                        }

                                }

                                tame++;

                                // 揋偐傜偺峌寕
                                tekiAttack();

                                // 嬀偺奪
                                if( status[13] == 37 && status[10] != 5 ){
                                        myAttack(1);
                                }

                                phase = 0;

                        }

                }

                g.unlock(true);

        }

        // 傾僀僥儉憢偺昞帵(lock偱搉偣丅lock偱曉偡)
        // method showStatus

        private void showStatus(){

                //System.out.println( phase );

                setSoftLabel(SOFT_KEY_1,"");
                setSoftLabel(SOFT_KEY_2,"返回");

                int w_wid = ( getWidth() - 110 ) / 2;
                int w_hei = 18;

                drawWaku( w_wid, 3, 110, 125, "" );
                g.setColor(0x0);
                g.drawString( "血:" + status[0] + "/" + status[6], w_wid+4, w_hei );
                g.drawString( "攻击力:" + status[1] + "+(" + item_pow[status[12]] + "+" + status[19] + ")",
                               w_wid+4, w_hei+13 );
                g.drawString( "防御力:" + status[2] + "+(" + item_pow[status[13]] + "+" + status[20] + ")",
                               w_wid+4, w_hei+26 );
                g.drawString( "等级:" + status[4], w_wid+4, w_hei+39 );
                g.drawString( "经验值:" + status[3], w_wid+4, w_hei+52 );

                g.drawString( "1:记录并结束", w_wid+4, w_hei+65 );
                g.drawString( "2:装备", w_wid+4, w_hei+78 );
                //g.drawString( "3:声音", w_wid+4, w_hei+91 );

                if( mode == 2 ){
                        g.drawString( "0:游戏结束", w_wid+4, w_hei+91 );
                }

                g.unlock(true);
                g.lock();

                try{
                        Thread.sleep(300);
                } catch( Exception e ){
                        System.out.println(e);
                }

                temp_int = wait_action();
                System.out.println(temp_int);
                // 僙乕僽
                if( ( ( 1<<EZDisplay.KEY_1 ) & temp_int ) != 0 ){

                        if( mode != 2 ){

                                drawWaku( 0, 0, 120, 65,
                                          "战斗中不能保存!" );

                                g.unlock(true);

                                try{
                                        Thread.sleep(1000);
                                } catch( Exception e ){
                                        System.out.println(e);
                                }

                                g.lock();

                                drawBattleBack();

                                return;

                        }

                        save_status(1);

                        drawMapBack();
                        drawWaku( 0, 0, 120, 65,
                                  "按任意键就此结束游戏" );
                        g.unlock(true);

                        try{
                                Thread.sleep(1000);
                        } catch( Exception e ){
                                System.out.println(e);
                        }

                        wait_action();

                        //Q.appli.terminate();
                        //Main.quitApp();  //chhsf  返回到标题画面
                        initData();

                        boolean chks = chk_load();
                        if( chks == false ){
                                load_data();
                        }

                        // 婲摦帪偺儌乕僪
                        mode = 0;

                        return;

                // 傾僀僥儉慖戰
                } else if( ( ( 1<<EZDisplay.KEY_2 ) & temp_int ) != 0 ){

                        select_item();

                // 僒僂儞僪ON/OFF
                } else if( ( ( 1<<EZDisplay.KEY_3 ) & temp_int ) != 0 ){
                        //sound_change();

                // 僎乕儉廔椆
                } else if( ( ( 1<<EZDisplay.KEY_0 ) & temp_int ) != 0 ){

                        if( mode == 2 ){
                                //Q.appli.terminate();
                                Main.quitApp();
                                return;
                        }

                // 栠傞
                } else{

                        return;

                }

                showStatus();

        }





    // 僒僀僐儘夋憸偺僉儍僢僔儏僙僢僩
        private void set_sai_image(){

                // 夋憸傪SCRD偐傜庢摼

                int pos = status.length + 1;
                int num = 23;
                for( int i = num - 1; i > 0; i-- ){
                        pos += image_sizes[i-1];
                }

                for( int i = 3; i >= 0; i-- ){

                        try{
                                //MediaImage m = MediaManager.getImage( "scratchpad:///0;pos=" + pos );
                                //m.use();
                                System.out.println(pos);
                                image_sai[i] = Image.createImage("/ss"+i+".png");//m.getImage();
                        } catch( Exception e ){
                            e.printStackTrace();
                                System.out.println(e);
                        }

                        pos += image_sizes[num-1];
                        num++;

                }

        }

        // 夋憸庢摼
        // method get_image
        public Image get_image( int num ){

                // 僉儍僢僔儏偵偁傞偐丠
                for( int i = cash_size - 1; i >= 0; i-- ){

                        if( image_numb[i] == num ){
                                return image_cash[i];
                        }

                }

                // 愭摢偺僉儍僢僔儏傪攋婞偟偰攝楍傪偢傜偡
                if( image_cash[cash_size-1] != null ){
                        image_numb[cash_size-1] = 0;
                        //image_cash[cash_size-1].dispose();
                        image_cash[cash_size-1] = null;
                        System.gc();
                }
                System.arraycopy( image_numb, 0, image_numb, 1, cash_size-1 );
                System.arraycopy( image_cash, 0, image_cash, 1, cash_size-1 );


                // 夋憸傪SCRD偐傜庢摼

                int pos = status.length + 1;
                if( num > 1 ){
                        for( int i = num - 1; i > 0; i-- ){
                                pos += image_sizes[i-1];
                        }
                }

                //Image temp_image = null;

                try{
                        //MediaImage m = MediaManager.getImage( "scratchpad:///0;pos=" + pos );
                        //m.use();
                        image_cash

⌨️ 快捷键说明

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