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

📄 xiyou.java

📁 HappyTreeFriends手机游戏的源代码
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
//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 = 75;
//general menu
public static final int GER_MENU_W = 74;
public static final int GER_MENU_Y = 100;
public static final int GER_MENU_H = 67;
//for option 

   //bg

public static final int MS_OPTION_BG_Y = 30 + 25 ;
public static final int MS_OPTION_BG_W = 80;
public static final int MS_OPTION_BG_X = PINGMUDDD.sssCHUANNN_WIDTH - MS_OPTION_BG_W >> 1;
public static final int MS_OPTION_BG_H = 95;


public static final int MS_OPTION_BG_ARC_W = 10;
public static final int MS_OPTION_TITLE_W = 70;
public static final int MS_OPTION_TITLE_H = 13;
public static final int MS_TITLE_BG_OFFSET_Y = 3;
public static final int MS_TITLE_OFFSET_Y = 2;

//option rects

public static final int MS_BOX_OFFSET_Y = 16;
public static final int MS_OPTION_RECT_H = 35;
public static final int MS_OPTION_IMG_OFFSET_X = 45;
public static final int MS_OPTION_IMG_H = 26;
public static final int MS_OPTION_TWO_RECT_SPACE = 12;


//option words
public static final int MS_OPTION_SOUND_OFFSET_X = 10;
public static final int MS_OPTION_SOUND_OFFSET_Y = 20;
public static final int MS_OPTION_SOUND_ON_OFFSET_X = 22;
public static final int MS_OPTION_SOUND_ON_OFFSET_Y = 36;
public static final int MS_OPTION_VIB_OFFSET_X = 10;
public static final int MS_OPTION_VIB_OFFSET_Y = 18 + 16 + 29;
public static final int MS_OPTION_VIB_ON_OFFSET_X = 22;
public static final int MS_OPTION_VIB_ON_OFFSET_Y = 18 + 59;



//for enter name

public static final int MS_CHAR_OFFSET_X = 35;
public static final int MS_CHAR_OFFSET_Y = 30;


//for high score
public static final int RESET_X = PINGMUDDD.sssCHUANNN_WIDTH -50;
public static final int RESET_Y = PINGMUDDD.sssCHUANNN_HEIGHT - 16;
public static final int RESET_W = 32;
public static final int RESET_H = 14;
public static final int HIGH_SCORE_NAME_LEFT = PINGMUDDD.sssCHUANNN_WIDTH  - GER_MENU_W + 4 >> 1;
public static final int HIGH_SCORE_SCORE_LEFT = PINGMUDDD.sssCHUANNN_WIDTH  +  GER_MENU_W >> 1;
public static final int HIGH_SCORE_H = 60;

//only mini and small
public static final int NAME_SHOW = 4;

public static final int HIGH_SCORE_STEP_LINE = 14;

public static final int SHOW_LEVEL = 4;

public static final int MS_ABOUT_CLIP_TOP = MS_OPTION_BG_Y + 5 + 16; 
public static final int MS_ABOUT_CLIP_H = 60;


//for confirm
public static final int MS_CONFIRM_YN_W = GER_MENU_W - 4 >> 1;
public static final int MS_CONFIRM_YN_H = 16;
public static final int MS_CONFIRM_Y = MS_OPTION_BG_Y + 5 + 40;
public static final int MS_STRING_OFFSET_Y = 3;
public static final int MS_STRING_OFFSET_X = GER_MENU_W + 5  >> 1;


public static final int MS_CHAR_STEP = 10;

public static final int MS_UNLOCK_LEFT = 41;
public static final int MS_UNLOCK_ARROW_LEFT = 29;  
public static final int MS_UNLOCK_TOP = MS_OPTION_BG_Y + 10 + 16; 
public static final int MS_UNLOCK_H = 70;;   

public static final int UNLOCK_LEVEL_LINE_H = 16;
//for pause
public static final int GS_PAUSE_YELLOW_BG_W = 86;
public static final int GS_PAUSE_YELLOW_BG_H = 50;  
public static final int GS_PAUSE_BLUE_BG_W = 80;  
public static final int GS_PAUSE_BLUE_BG_H = 44; 
public static final int GS_PAUSE_WORD_OFFSET_Y = 4;
public static final int GS_PAUSE_GAP = 11;

//for gs enter name
public static final int GS_ENTERNAME_GET_W = 100;
public static final int GS_ENTERNAME_GET_H = 20;
public static final int GS_ENTERNAME_TITLE_W = 70;  
public static final int GS_ENTERNAME_TITLE_H = 15;  

  //FOR HIGHSCORE IN GAME
   public static final int GS_HIGHSCORE_W = 70;

   public static final int GS_HIGHSCORE_H = 56;   

   public static final int GS_HIGHSCORE_TITLE_H = 12;
   public static final int GS_HIGHSCORE_TEXT_W = 70;  



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) )
                            {
			                    
					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

⌨️ 快捷键说明

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