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

📄 xiyou.java

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

			case 17:
						
		            break;		

					

			case 19:
			    LoadStrings(DWorld.STR_BLOCK_ID_MENU);
			    s_menuArrow = Image.createImage("/interface.png");	




			   break;

		        case 21:
                         s_imgFont[2] = Image.createImage("/font_11.png");
			    break;

			case 23:
                         s_imgFont[1] = Image.createImage("/font_14_01.png");
		          break;

			case 25:
                         
                         s_imgFont[3] = Image.createImage("/font_10.png");						 
		          break;
				  

			

		        case 27:
			     SheJintou(0 , 0 , 0, true);;		
		            SetGameStatus(DGameStatus.GS_MAIN_MENU);
			     SetMenuStatus(MS_DEFAULT);	



			 s_splash=null;


  			    if(s_isFirstRun)
  			    	{
 			   		
					 s_isFirstRun = false;
  			    	}



				 
		            break;

		        default:
		            System.gc();
		            Thread.sleep(SLEEP_TIME);
		            break;
	    	    }

		    if ((s_ctrGameStatus & 1) != 0)
		        Debug.Mem("end: " + s_ctrGameStatus);
		}
		catch (Exception e)
		{
	            e.printStackTrace();
		}
    	}

	//for free menu resource 
	public static void FreeMenuRes()
		{
			  s_menuBg = null;
			s_menuBg2 = null;
			s_menuArrow = null;
			//s_imgFont[0] = null;
			s_imgFont[1] = null;
			s_imgFont[2] = null;
			s_imgFont[3] = null;

			 s_interfaceFromGLI = null;
			//FreeSounds();
		}

       public static final int END_GAME_SCENE_INDEX = 11;

	public static void InitEnd()
		{
			 try
			{
			    if ((s_ctrGameStatus & 1) != 0)
				Debug.Mem("begin: " + s_ctrGameStatus);
					
			    switch (s_ctrGameStatus)
			    {
			        
		        
		                case 1:
				      FreeMenuRes();	
				      FreeBgHuanchong(); 		  	  
      					s_splash = Image.createImage("/chengsmall.png");


					Donghua.FreeAnimation();		
				   break;

	                     case 3:
		                   LoadMap(END_GAME_SCENE_INDEX);
				     Jiaose.s_level = 9;
				     SaveOrLoad(true); 

		                   InitializeCamera();
						   
				    break;
				case 5:
	                          //InitializeBgHuanchong();
	                          LoadStrings(DWorld.STR_BLOCK_ID_MENU);
					break;
				case 7:	
		                    Jiaose.LoadScene(END_GAME_SCENE_INDEX);
				    break;

				case 9:
		        	    Donghua.LoadAnimations(Jiaose.s_sceneAnimationMask);
		        	    Jiaose.SetAnims();
		
		                    for (int i = 0; i < Donghua.s_anims.length; i++)
		                    {
	  
		                        if (Donghua.s_anims[i] != null && Donghua.s_anims[i].m_imageFormat == Donghua.IMAGE_FORMAT_GLI)
		                        {
		                            Donghua.s_anims[i].CreateScenePals();
		                        }
		                    }

							
			            break;		

			        case 11:
				     SheJintou(0 , 0 , 0, true);;	
				     InitCameralStart();		 
			            SetGameStatus(DGameStatus.GS_END_GAME);	
			            break;

			        default:
			            System.gc();
			            Thread.sleep(SLEEP_TIME);
			            break;
		    	    }

			    if ((s_ctrGameStatus & 1) != 0)
			        Debug.Mem("end: " + s_ctrGameStatus);
			}
			catch (Exception e)
			{
		            e.printStackTrace();
			}
		}


	public static void InitSmallMap()
		{
			try
				{

					img_smallMap = Image.createImage("/chengsmall.png");


			 		
					s_gBgHuanchong.setClip(0, 0 , PINGMUDDD.sssCHUANNN_WIDTH , PINGMUDDD.sssCHUANNN_HEIGHT); 
					s_gBgHuanchong.drawImage(img_smallMap , 0 , 0 , 0);
					

					img_smallMap = null;
			}
			catch(Exception e)
				{
				}

		}

	
	
  
    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 



//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 = 2;
	

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 = 37;


//general menu
public static final int GER_MENU_W = 82;
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 = 3;
public static final int MS_OPTION_BG_W = 88;
public static final int MS_OPTION_BG_X = PINGMUDDD.sssCHUANNN_WIDTH - MS_OPTION_BG_W >> 1;
public static final int MS_OPTION_BG_H = 60;
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;

public static final int MS_BOX_OFFSET_Y = 14;

//option rects
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 offset
public static final int MS_OPTION_ITEM_OFFSET_Y = 5;


//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 = MS_OPTION_SOUND_OFFSET_X + 50;

public static final int MS_OPTION_VIB_OFFSET_X = 10;
public static final int MS_OPTION_VIB_OFFSET_Y = 36;
public static final int MS_OPTION_VIB_ON_OFFSET_X = MS_OPTION_VIB_OFFSET_X + 50;

//for enter name
public static final int MS_CHAR_OFFSET_X = 35 - 17;
public static final int MS_CHAR_OFFSET_Y = 30 - 22;


//for high score
public static final int RESET_X = PINGMUDDD.sssCHUANNN_WIDTH -35;
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 = 30;
public static final int HIGH_SCORE_STEP_LINE = 14;

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


public static final int SHOW_LEVEL = 2;

public static final int MS_ABOUT_CLIP_TOP = MS_OPTION_BG_Y + 5 + 14; 
public static final int MS_ABOUT_CLIP_H = 30;


//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 + 25;
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 = 24;
public static final int MS_UNLOCK_ARROW_LEFT = 11;  
public static final int MS_UNLOCK_TOP = MS_OPTION_BG_Y + 10 + 14; 
public static final int MS_UNLOCK_H = 38;;   
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 = 88;
public static final int GS_ENTERNAME_GET_H = 40;
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 = 35;   
   public static final int GS_HIGHSCORE_TITLE_H = 12;
   public static final int GS_HIGHSCORE_TEXT_W = 70;  

//nokia s30

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:
				if(s_ctrMenu == 1)
                                {
                                     PlaySound(DWorld.SOUND_ID_TITLE);

⌨️ 快捷键说明

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