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

📄 xiyou.java

📁 HappyTreeFriends手机游戏的源代码
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
public static final int MS_OPTION_BG_ARC_W = 20;
public static final int MS_OPTION_TITLE_W = 90;
public static final int MS_OPTION_TITLE_H = 23;
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 = 26;

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

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

public static final int MS_CHAR_OFFSET_X = 40;
public static final int MS_CHAR_OFFSET_Y = 37;

//for high score

public static final int RESET_X = PINGMUDDD.sssCHUANNN_WIDTH -80;
public static final int RESET_Y = PINGMUDDD.sssCHUANNN_HEIGHT - 22;
public static final int RESET_W = 46;
public static final int RESET_H = 20;
public static final int HIGH_SCORE_SCORE_LEFT = PINGMUDDD.sssCHUANNN_WIDTH + 100 >> 1;
public static final int HIGH_SCORE_NAME_LEFT = PINGMUDDD.sssCHUANNN_WIDTH - 100 >> 1;
public static final int HIGH_SCORE_H = 80;
public static final int HIGH_SCORE_STEP_LINE = 14;


//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 + 26; 
public static final int MS_ABOUT_CLIP_H = 95;

//for confirm
public static final int MS_CONFIRM_YN_W = 50;
public static final int MS_CONFIRM_YN_H = 26;
public static final int MS_CONFIRM_Y = MS_OPTION_BG_Y + 5 + 60;
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 = 60;
public static final int MS_UNLOCK_ARROW_LEFT = 40;

public static final int UNLOCK_LEVEL_LINE_H = 16;
public static final int MS_UNLOCK_TOP = MS_OPTION_BG_Y + 10 + 30;   
public static final int MS_UNLOCK_H = 100;; 

public static final int MS_CHAR_STEP = 14;

//for gs pause
public static final int GS_PAUSE_YELLOW_BG_W = 106;
public static final int GS_PAUSE_YELLOW_BG_H = 70;  
public static final int GS_PAUSE_BLUE_BG_W = 100;  
public static final int GS_PAUSE_BLUE_BG_H = 64; 
public static final int GS_PAUSE_WORD_OFFSET_Y = 7;
public static final int GS_PAUSE_GAP = 15;


public static final int GS_ENTERNAME_GET_W = 140;
public static final int GS_ENTERNAME_GET_H = 30;
public static final int GS_ENTERNAME_TITLE_W = 100;  
public static final int GS_ENTERNAME_TITLE_H = 20;  

   public static final int GS_HIGHSCORE_W = 90;
   public static final int GS_HIGHSCORE_H = 86;     
   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);
							
		//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) )
                            {
			                    
					if(s_selectedIndex < SHOW_LEVEL - 1) 
                                            {
                                     	  	s_selectedIndex++;
                                            }
                                            else
                                            {
                                                	 if (s_beginIndex < TOTAL_LEVEL - SHOW_LEVEL)
                                                 {

                                                      s_beginIndex++;
                                                	}

                                            }
			                    
			                
			                    s_updateMenu = true;

			        }
			        else if (IsKeyPressed(GK_UP) )
			        {
			  
		                    if (s_selectedIndex > 0)
		                    {
		                        s_selectedIndex--;
		                    }
		                    else 
		                    {
		                        if(s_beginIndex > 0)
		                        {
		                            s_beginIndex--;
		                        }
		                    }

		                    s_updateMenu = true;            

		                }
				if (IsKeyPressed(GK_SOFT_LEFT) )
					{
						SetMenuStatus(MS_MAINMENU);
						Jiaose.s_level  = 0;
					}
				else if (IsKeyPressed(GK_A | GK_SOFT_RIGHT) )
					{
					       if(s_selectedIndex + s_beginIndex <= Jiaose.s_levelSaved )
					       	{
					       		Jiaose.s_level  = s_selectedIndex + s_beginIndex;
								SetGameStatus(DGameStatus.GS_LOAD_GAME_RES);
					       	}
						
					}
							
				break;

				
			case MS_OPTION:
				DrawMenuBg(GetString(DWorld.STR_ID_MAIN_MENU_2));
				
				
                            s_g.setColor(COLOR_BLUE_WALL);
//blue bg
				s_g.fillRoundRect( PINGMUDDD.sssCHUANNN_WIDTH - GER_MENU_W>> 1 , MS_OPTION_BG_Y + 5 + MS_BOX_OFFSET_Y  , GER_MENU_W, MS_OPTION_RECT_H, 10, 10);


				s_g.fillRoundRect( PINGMUDDD.sssCHUANNN_WIDTH - GER_MENU_W >> 1 , MS_OPTION_BG_Y + 5 + MS_BOX_OFFSET_Y + MS_OPTION_IMG_H + MS_OPTION_TWO_RECT_SPACE , GER_MENU_W, MS_OPTION_RECT_H, 10, 10);	

//pic bg  

				s_g.setColor(0xFFFFFF);

				s_g.fillRoundRect( MS_OPTION_BG_X + MS_OPTION_IMG_OFFSET_X , MS_OPTION_BG_Y + 10 + MS_BOX_OFFSET_Y  ,MS_OPTION_IMG_H ,MS_OPTION_IMG_H, 10, 10);


				s_g.fillRoundRect( MS_OPTION_BG_X + MS_OPTION_IMG_OFFSET_X  , MS_OPTION_BG_Y + 10 + MS_BOX_OFFSET_Y + MS_OPTION_IMG_H + MS_OPTION_TWO_RECT_SPACE  ,MS_OPTION_IMG_H, MS_OPTION_IMG_H, 10, 10);	

				s_g.setColor(0x00FF00);
				s_g.drawRoundRect( MS_OPTION_BG_X + MS_OPTION_IMG_OFFSET_X  , MS_OPTION_BG_Y + 10 + MS_BOX_OFFSET_Y + (MS_OPTION_IMG_H + MS_OPTION_TWO_RECT_SPACE) * s_selectedIndex  ,MS_OPTION_IMG_H, MS_OPTION_IMG_H, 10, 10);	
				s_g.drawRoundRect( MS_OPTION_BG_X + MS_OPTION_IMG_OFFSET_X + 1  , MS_OPTION_BG_Y + 10 + MS_BOX_OFFSET_Y + (MS_OPTION_IMG_H + MS_OPTION_TWO_RECT_SPACE) * s_selectedIndex + 1  ,MS_OPTION_IMG_H - 2, MS_OPTION_IMG_H - 2, 10, 10);	
//sound
				drawImageString(s_g, GetString(DWorld.STR_ID_SOUND),
        	           MS_OPTION_BG_X + MS_OPTION_SOUND_OFFSET_X, MS_OPTION_BG_Y + 5+ MS_OPTION_SOUND_OFFSET_Y, FONT_MINI, IMG_FONT_LEFT,
        	           1);

				drawImageString(s_g, GetString(DWorld.STR_ID_ON + (s_soundOn ? 0 : 1)),
        	           MS_OPTION_BG_X + MS_OPTION_SOUND_ON_OFFSET_X, MS_OPTION_BG_Y + 5 + MS_OPTION_SOUND_ON_OFFSET_Y, FONT_MINI, IMG_FONT_CENTER,
        	             1);
//option
				drawImageString(s_g, GetString(DWorld.STR_ID_VIBRATION),
        	           MS_OPTION_BG_X + MS_OPTION_VIB_OFFSET_X, MS_OPTION_BG_Y + 5 +  MS_OPTION_VIB_OFFSET_Y, FONT_MINI, IMG_FONT_LEFT,
        	            1);

				drawImageString(s_g, GetString(DWorld.STR_ID_ON + (s_vibrationOn ? 0 : 1) ),
        	           MS_OPTION_BG_X + MS_OPTION_VIB_ON_OFFSET_X, MS_OPTION_BG_Y + 5 + MS_OPTION_VIB_ON_OFFSET_Y, FONT_MINI, IMG_FONT_CENTER,
        	            1);

//draw image

                            s_g.setClip(MS_OPTION_BG_X + 70 + 3 , MS_OPTION_BG_Y + 10 + 28 , 32, 35);
                           s_g.drawImage(s_menuArrow , MS_OPTION_BG_X + 70 + 3, MS_OPTION_BG_Y + 10 + 28 - 35  , 0);

		   
			      s_g.setClip(MS_OPTION_BG_X + 70 + 3 , MS_OPTION_BG_Y + 10 + 28 + 52 , 32 , 35);
                           s_g.drawImage(s_menuArrow , MS_OPTION_BG_X + 70 + 3, MS_OPTION_BG_Y + 10 + 28 + 52 , 0);

 
				DrawButtons(true ,false);		   
			      changeSelect(2);
				  
				if (IsKeyPressed(GK_SOFT_LEFT) )
					{
						SetMenuStatus(MS_MAINMENU);
					}
				else if (IsKeyPressed(GK_A | GK_SOFT_RIGHT) )
					{
						if(s_selectedIndex == 0)
					  	{
					  		s_soundOn =! s_soundOn;
							
					  	}
					       else if(s_selectedIndex == 1)
					  	{
					  		s_vibrationOn = !s_vibrationOn;
							Librate(false , 1000);
					  	}
					}
				break;	

				
			case MS_ABOUT:
				DrawMenuBg(GetString(DWorld.STR_ID_MAIN_MENU_5));
				s_g.setColor(COLOR_BLUE_WALL);
//blue bg
				s_g.fillRoundRect( PINGMUDDD.sssCHUANNN_WIDTH - GER_MENU_W>> 1 , MS_ABOUT_CLIP_TOP  ,GER_MENU_W, MS_ABOUT_CLIP_H + 8, 10, 10);

				int lenABOUT = drawStringLines(GetString(DWorld.STR_ID_ABOUT) , PINGMUDDD.sssCHUANNN_WIDTH >> 1  , s_scrollY , CHAR_H[FONT_MINI] + 3 , IMAGE_STR , IMG_FONT_CENTER);

				s_scrollY -=2;
				if(s_scrollY + lenABOUT * (CHAR_H[FONT_MINI] + 3)< MS_ABOUT_CLIP_TOP) 

⌨️ 快捷键说明

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