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

📄 xiyou.java

📁 HappyTreeFriends手机游戏的源代码
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
        s_imgPals = null;

        if (needCreate)
        {
            return Image.createRGBImage(m_imageData, img_w, img_h, true);

            //Image img = Image.createImage(img_w, img_h);
            //DirectUtils.getDirectGraphics(img.getGraphics()).drawPixels(m_imageData, true, 0,
            //                              img_w, 0, 0, img_w, img_h, 0, DirectGraphics.TYPE_INT_8888_ARGB);
            //return img;
        }
        else
        {
            
            return null;
        }
    }

	
	
  
    protected void hideNotify()
    {
        s_pauseRunning = true;

		if(s_gameStatus == DGameStatus.GS_ACTION && !s_isPause)
			{
				s_isPause = true;
			}

	 try
        {
            stopSound();
        }
        catch(Exception e)
        {}
    }

    
    protected void showNotify()
    {
        s_pauseRunning = false;
		
        ClearKey();
    }


public static final int MS_MAINMENU = 0;
public static final int MS_OPTION = 1;
public static final int MS_ABOUT = 2;
public static final int MS_HELP = 3;
public static final int MS_HIGHSCORE = 4;
public static final int MS_CONFIRM = 5;
public static final int MS_SOUND_ON_OFF = 6;
public static final int MS_ENTER_NAME = 7;
public static final int MS_CHOOSE_UNLOCK_LEVEL = 8;

public static final int MS_DEFAULT = MS_MAINMENU;



public static int s_menuStatus = MS_DEFAULT;

public static int s_lastMainMenuSelect = 0;
public static int s_lastBeginIndex = 0;

public static boolean s_updateMenu = true;



//menu img

   //mainmenu
public static Image s_menuBg;
   //other menu
public static Image s_menuBg2;

public static Image s_imgFont[] = new Image[4];


public static Image s_menuArrow;

//for loading 
public static Image s_loadingP;



//for diTU

public static Image img_smallMap;

//for splash 
public static Image s_splash;
public static final int SPLASH_DURATION = 20;
public static final int SPLASH_CREDIT_TOP = 20;
public static final int SPLASH_CREDIT_H = PINGMUDDD.sssCHUANNN_HEIGHT - (SPLASH_CREDIT_TOP << 1);





//for mainmenu

public static final int MAINMENU_LEN = 7;

  


public static final int MAINMENU_LEN_SHOW = 6;
 

public static final int MENU_MAIN_CENTER_W = 86;
public static final int MENU_MAIN_CENTER_H = 90;
public static final int MENU_MAIN_CENTER_Y = 100 + 25;

//general menu
public static final int GER_MENU_W = 150;
public static final int GER_MENU_Y = 150;
public static final int GER_MENU_H = 200;  

//for option 

   //bg

public static final int MS_OPTION_BG_Y = 65 + 27;
public static final int MS_OPTION_BG_W = 160;
public static final int MS_OPTION_BG_X = PINGMUDDD.sssCHUANNN_WIDTH - MS_OPTION_BG_W >> 1;
public static final int MS_OPTION_BG_H = 221;
public static final int MS_OPTION_BG_ARC_W = 20;
public static final int MS_OPTION_TITLE_W = 100;
public static final int MS_OPTION_TITLE_H = 27;
public static final int MS_TITLE_BG_OFFSET_Y = 5;
public static final int MS_TITLE_OFFSET_Y = 4;
public static final int MS_BOX_OFFSET_Y = 30;

//option rects
public static final int MS_OPTION_RECT_H = 70;
public static final int MS_OPTION_IMG_OFFSET_X = 100;
public static final int MS_OPTION_IMG_H = 40;
public static final int MS_OPTION_TWO_RECT_SPACE = 50;

//option words
public static final int MS_OPTION_SOUND_OFFSET_X = 16;
public static final int MS_OPTION_SOUND_OFFSET_Y = 40;
public static final int MS_OPTION_SOUND_ON_OFFSET_X = 30;
public static final int MS_OPTION_SOUND_ON_OFFSET_Y = 60;
public static final int MS_OPTION_VIB_OFFSET_X = 15;
public static final int MS_OPTION_VIB_OFFSET_Y = 26 + 59 + 50;
public static final int MS_OPTION_VIB_ON_OFFSET_X = 30;
public static final int MS_OPTION_VIB_ON_OFFSET_Y =  26 + 54 + 25 + 50;
//for enter name

public static final int MS_CHAR_OFFSET_X = 40 + 26;

public static final int MS_CHAR_OFFSET_Y = 50;


//for high score

public static final int RESET_X = PINGMUDDD.sssCHUANNN_WIDTH -100;
public static final int RESET_Y = PINGMUDDD.sssCHUANNN_HEIGHT - 36;
public static final int RESET_W = 56;
public static final int RESET_H = 25;
public static final int HIGH_SCORE_SCORE_LEFT = PINGMUDDD.sssCHUANNN_WIDTH + GER_MENU_W - 10 >> 1;
public static final int HIGH_SCORE_NAME_LEFT = PINGMUDDD.sssCHUANNN_WIDTH - GER_MENU_W  + 10>> 1;
public static final int HIGH_SCORE_H = 120;
public static final int HIGH_SCORE_STEP_LINE = 20;

//for level
public static final int SHOW_LEVEL = 5;

//for about and help
public static final int MS_ABOUT_CLIP_TOP = MS_OPTION_BG_Y + 5 + 34; 
public static final int MS_ABOUT_CLIP_H = 166;

//for confirm
public static final int MS_CONFIRM_YN_W = 70;
public static final int MS_CONFIRM_YN_H = 28;
public static final int MS_CONFIRM_Y = MS_OPTION_BG_Y + 5 + 80;
public static final int MS_STRING_OFFSET_Y = 6;
public static final int MS_STRING_OFFSET_X = 60;

//for unlock level
public static final int MS_UNLOCK_LEFT = 70;
public static final int MS_UNLOCK_ARROW_LEFT = 50;  
public static final int MS_UNLOCK_TOP = MS_OPTION_BG_Y + 10 + 30;   
public static final int MS_UNLOCK_H = 160;; 

public static final int UNLOCK_LEVEL_LINE_H = 23;

public static final int MS_CHAR_STEP = 18;

//for gs pause
public static final int GS_PAUSE_YELLOW_BG_W = 126;
public static final int GS_PAUSE_YELLOW_BG_H = 70 + 30;  
public static final int GS_PAUSE_BLUE_BG_W = 120;  
public static final int GS_PAUSE_BLUE_BG_H = 64 + 30; 
public static final int GS_PAUSE_WORD_OFFSET_Y = 7;
public static final int GS_PAUSE_GAP = 15 + 8;


public static final int GS_ENTERNAME_GET_W = 160;
public static final int GS_ENTERNAME_GET_H = 30;
public static final int GS_ENTERNAME_TITLE_W = 120;  
public static final int GS_ENTERNAME_TITLE_H = 23;  

   public static final int GS_HIGHSCORE_W = 110;
   public static final int GS_HIGHSCORE_H = 140;     
   public static final int GS_HIGHSCORE_TITLE_H = 23;
   public static final int GS_HIGHSCORE_TEXT_W = 100;  

   

public static final int MENU_BAR_SELECT_H = 13;
public static final int MENU_BAR_NO_SELECT_H = 10;
public static final int MENU_BAR_SPACE_H = 2;

public static int s_beginIndex = 0;




//for general menu
public static int s_ctrMenu = 0;

//color index
public static final int COLOR_YELLOW_BG = 0xF7E7B4;
public static final int COLOR_BLUE_WALL = 0X817EB7;



public static boolean s_vibrationOn = false;


public static final int MS_CHAR_NUM_LINE = 7;



public static int s_enterNameX = MS_CHAR_OFFSET_X;
public static int s_enterNameY = INGAME_HIGHSCORE_Y + MS_CHAR_OFFSET_Y;

public static final int NAME_LEN = 8;
public static byte[] s_name = null;
public static int s_namePos = 0;




//for interface
public static final int INTERFACE_GLI_BUFFER_SIZE = 17500;
public static final int INTERFACE_W = 70;
public static final int INTERFACE_H = 125;
public static Image s_interfaceFromGLI = null;

//for level
public static final int TOTAL_LEVEL = 9;




//for about
public static int s_scrollY = 0;




public void DrawMenu()
{
       s_ctrMenu++;
	switch(s_menuStatus)
		{
			case MS_MAINMENU:

                           // DrawMapFast(s_jingtouX, s_jingtouY);
                           s_g.setClip(0, 0 , PINGMUDDD.sssCHUANNN_WIDTH , PINGMUDDD.sssCHUANNN_HEIGHT);
				s_g.drawImage(s_menuBg , 0 , 0 , 0);	
			

                           shenJIIIIIIIActionPhase();
				//Jiaose.DrawJiaosess(s_g, s_jingtouX, s_jingtouY);	

				Jiaose a = null;
				for (int i = 0; i < Jiaose.s_freeFangjianID; i++)
					{
						a  = Jiaose.s_ajiaoses[i];
					       a.Draw(s_g, s_jingtouX, s_jingtouY);
		
                                          a.GoNextZhennnnnn();
					}
	                     drawSelectListBg(s_g, PINGMUDDD.sssCHUANNN_WIDTH  >> 1, MENU_MAIN_CENTER_Y, 6, s_selectedIndex , DWorld.STR_ID_MAIN_MENU_0, 0);

             //drawbuttons
				DrawButtons(false ,false);
    				receiveCheatCode();
							
		//preferm key event

				if (IsKeyPressed(GK_DOWN) )
                            {
			                	
			                    if (s_selectedIndex == s_beginIndex + MAINMENU_LEN_SHOW - 1)
			                    {
			                        if (s_beginIndex == MAINMENU_LEN - MAINMENU_LEN_SHOW)
			                        {
			                            s_beginIndex = 0;
			                        }
			                        else
			                        {
			                            s_beginIndex++;
			                        }
			                    }
		
			                    s_selectedIndex = changeValueLoop( ++s_selectedIndex , MAINMENU_LEN );
			                
			                    s_updateMenu = true;

					      
		                         	 
			                  

			        }
			        else if (IsKeyPressed(GK_UP) )
			        {
			  

			                    if (s_selectedIndex == s_beginIndex)
			                    {
			                        if (s_beginIndex == 0)
			                        {
			                            s_beginIndex = MAINMENU_LEN - MAINMENU_LEN_SHOW;
			                        }
			                        else
			                        {
			                            s_beginIndex--;
			                        }
			                    }
		
		                    s_selectedIndex = changeValueLoop( --s_selectedIndex , MAINMENU_LEN );
		                   
		                    s_updateMenu = true;

					
		             

		                }
				 else if (IsKeyPressed(GK_A | GK_SOFT_RIGHT) )
		                {
		                    
		                    s_lastMainMenuSelect = s_selectedIndex;
					s_lastBeginIndex = s_beginIndex;		

		                     if( s_selectedIndex == 0 )
		                    {
		                            SaveOrLoad(false);
						if(Jiaose.s_levelSaved >= TOTAL_LEVEL)			
							Jiaose.s_level = TOTAL_LEVEL - 1;
						else	
							Jiaose.s_level = Jiaose.s_levelSaved;			
 									
					       SetGameStatus(DGameStatus.GS_LOAD_GAME_RES);
		                    }
						 
		                    else if( s_selectedIndex == 1 )
		                    {
		                     	
                                          
		                            //SaveOrLoad(false);
                                          
                                          SetMenuStatus(MS_CHOOSE_UNLOCK_LEVEL );
										  

						
		                    }

		                    else if( s_selectedIndex == 2 )
		                    {
		                      	SetMenuStatus(MS_OPTION);
 
		                    }
		                    else if( s_selectedIndex == 3)
		                    {
		                    		SaveOrLoad(false);
		                            SetMenuStatus(MS_HIGHSCORE);
		                    		
		                    }
		                    else if( s_selectedIndex == 4 )
		                    {
		                    		SetMenuStatus(MS_HELP );
		                        
		                    }
		                    else if( s_selectedIndex == 5 )
		                    {
		                    		SetMenuStatus(MS_ABOUT);
		                        
		                    }
		                    else if( s_selectedIndex == MAINMENU_LEN-1 )
		                    {
		                        SetMenuStatus(MS_CONFIRM);
		                      
		                    }
		                }
				break;

			case MS_CHOOSE_UNLOCK_LEVEL:
				DrawMenuBg(GetString(DWorld.STR_ID_SELECT));
				s_g.setColor(COLOR_BLUE_WALL);
				s_g.fillRoundRect( PINGMUDDD.sssCHUANNN_WIDTH - GER_MENU_W>> 1 , MS_OPTION_BG_Y + 5 + MS_BOX_OFFSET_Y  ,GER_MENU_W, MS_UNLOCK_H, 10, 10);
/*				
                            for(int i = s_beginIndex; i < s_beginIndex + SHOW_LEVEL ; i++)
				drawImageString(s_g, s_menuStrings[DWorld.STR_ID_LEVEL - DWorld.STR_ID_MAIN_MENU_0 ] + "  " + (i / 3 + 1) + " - " + (i % 3 + 1) ,
        	           		60, MS_OPTION_BG_Y + 10 + 30 + (i - s_beginIndex) * 16, FONT_MINI, IMG_FONT_LEFT,
        	          		 1);
 //*/       	          		 

                            for(int i = s_beginIndex; i < s_beginIndex + SHOW_LEVEL ; i++)
				drawImageString(s_g, GetString(DWorld.STR_ID_LEVEL) + " " +(i / 3 + 1) + " -" + (i % 3 + 1) ,
        	           		MS_UNLOCK_LEFT, MS_UNLOCK_TOP + (i - s_beginIndex) * UNLOCK_LEVEL_LINE_H, FONT_HUGE, IMG_FONT_LEFT,
        	          		  i  >  Jiaose.s_level?1: 0);
//*/
                            DrawArrow(MS_UNLOCK_ARROW_LEFT , MS_UNLOCK_TOP + (s_selectedIndex) * UNLOCK_LEVEL_LINE_H , ARROW_INDICATOR , true);
				
                            DrawButtons(true ,false);	

				if (IsKeyPressed(GK_DOWN) )
                            {

⌨️ 快捷键说明

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