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

📄 mycanvas.java

📁 一个商业的赌博老虎机游戏
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
          i++;
       }while( slip != 0 && i < 21 );
		
		slip = 0;
        offs = 0;
        if( AcPrize < 3 )	   offs = 2;
        if( AcNotice != 10 )	offs = 2;

        bkreel = reelOffs[ button ];			
        for( i=0; i<3 + offs; i++ )
		{
              if( checkPosition( AcPrize, sstep-1 ) )
			 {
                    slip = i;
                    break;
              }
             if( --reelOffs[ button ] < 0 )
			reelOffs[ button ] += 21;
        }
            reelOffs[ button ] = bkreel;
            reelSlip( button, slip );				

            df[0]=true;
            df[2]=true;

      if( sstep == 4 )
	 {

         if( AcNotice == 33 )
		{
                ////
				DrawFlg = true;				
                repaint();
				serviceRepaints();
				/////
              try{	Thread.sleep(300); }catch(Exception x ){}
              //PlaySound( 8,	1 );
             try{	Thread.sleep(300); }catch(Exception x ){}
             for( i=0; i<10; i++ )
			{
                  DrawFlg = true;
                  thisTm = System.currentTimeMillis();
                  if( thisTm < nextTm ){	i--;	continue; }
                  nextTm = thisTm + 1000/20;
                   for( int j=0; j<3; j++ )
					{
                          if( moveY[j] < 12 )		moveY[j] += 4;
                          else 					moveY[j] = 12;
                     }
					 ///////////
                  repaint();
				  serviceRepaints();
				  /////////
            }
            DrawFlg = true;
            charID[0] =charID[1] = charID[2] = 18;
               //PlaySound( 3,	1 );
			   //////////
			repaint();
			serviceRepaints();
			///////////
			reelSlip( 0, (reelOffs[0]+1) );
            //PlaySound( 4, 1 );
            reelSlip( 1, (reelOffs[1]+1) );
            //PlaySound( 4, 1 );
            reelSlip( 2, (reelOffs[2]+1) );
            //PlaySound( 4, 1 );
			/////////////
            DrawFlg = true;
           repaint();
		   serviceRepaints();
		   //////////////
            DrawFlg = true;
       }

     int prize = getPrize();
	 if( AcPrize != 7 && AcNotice != 10 )
	 {
            offs = 18;
            lcBG = getColorOfRGB(119,187,255);
     }else
	{
             offs = 20;
             lcBG = getColorOfRGB(0,2,74);
     }

     for( i=0; i<3; i++ )
	{
        if( charID[i] == 19 )	charID[i] = offs;
    }

    if( prize < 2 )
	{
       if( AcPrize != prize )
	   {
              reachCnt = 3;
              reach = 1;
              //PlaySound( 1, 1 );
              LKeyTm	= System.currentTimeMillis()+500;
        }
    }

        money += share[ prize ];
       switch( prize )
	   {
           case 0:
           case 1:
            if( sumBig < 9999999 )		sumBig++;
           case 2:
           if( prize == 2 )
		   {
                 if( sumReg < 9999999 )	sumReg++;
           }
           ngame = 0;
           reach = 0;
           //PlaySound( 0, 1 );
           LKeyTm	= System.currentTimeMillis()+2500;
           
		   RMSaccess(1);

                               
           ExInt  = 10;
           BnsWnd = 2;
		  for( i=0; i<20; i++ )
		  {
              DrawFlg = true;
              thisTm = System.currentTimeMillis();
              if( thisTm < nextTm ){	i--;	continue; }
              nextTm = thisTm + 1000/20;
              BnsWnd += 2;
			  //////////
              repaint();
			  serviceRepaints();
			  ////////////
            }

           ExInt  = 11;
           BnsWnd = 40;
			for( i=0; i<21; i++ )
		  {
                 DrawFlg = true;
                 thisTm = System.currentTimeMillis();
                 if( thisTm < nextTm ){	i--;	continue; }
                 nextTm = thisTm + 1000/20;
                 frameCnt++;
                 frameCnt &= 127;
                 BnsWnd -= 2;
                 if( BnsWnd < 0 )	BnsWnd = 0;
                 ///////
				 repaint();
				 serviceRepaints();
				 /////////
           }
           break;
			case 3:
		     case 4:
		    case 5:
            //PlaySound( 6, 1 );
                  LKeyTm	= System.currentTimeMillis()+900;
                  
				  RMSaccess(1);
                break;

           case 6:
              //PlaySound( 5, 1 );
               LKeyTm	= System.currentTimeMillis()+800;
              
			  RMSaccess(1);
          break;
          case 8:
                 //PlaySound( 6, 1 );
                 LKeyTm	= System.currentTimeMillis()+900;
               
				RMSaccess(1);
           break;

           default:
                   LKeyTm	= System.currentTimeMillis()+500;
                   break;
     }

     if( AcNotice == 3 && reach != 0 )
	{
           reachCnt = 0;
           //PlaySound( 1, 1 );
           LKeyTm	= System.currentTimeMillis()+1500;
    }

   //////////////
	repaint();
	serviceRepaints();
	////////////
	sstep = 5;
   
	}
    }



	public void reelSlip( int button, int slip )
	{
                int			i, j;
                boolean		btmp;

                btmp = reelStop[button];
                reelStop[button] = false;		
                for( i=0; i<slip; i++ )
				{
                        df[1]=true;
                        ///////////////
						repaint();
						serviceRepaints();
						//////////////

                        for( j=0; j<3; j++ )
						{
                                if( !reelStop[j] )
								{
                                        if( --reelOffs[j] < 0 )		reelOffs[j] += 21;
                                }
                        }
                        try{	Thread.sleep( 1000/20 ); } catch(Exception x){}
                }
                reelStop[button] = btmp;
                df[1]=true;
     }




  
  public int denialSlip( int button )
  {               
                if( sstep == 4 )
				{
                        int		prize = getPrize();
                        if( prize != 7 && AcPrize != prize )
						{
                                
                                if( prize != 8 )		return	1;
                        }
                       
                        if( checkPosition( 0, 3 ) )
						{
                               
                                return 1;
                        }
                }

                
                if( button == 0 )
				{
                        
                        if( AcPrize != 5 )
						{
                                if(      reel[ 0 ][ (reelOffs[0]+0)%21 ] == 5 )	return 3;
                                else if( reel[ 0 ][ (reelOffs[0]+1)%21 ] == 5 )	return 2;
                                else if( reel[ 0 ][ (reelOffs[0]+2)%21 ] == 5 )	return 1;
                        }

                        
                        if( reach == 0 )
						{                                
                                if( reelOffs[0] == 8 )
								{                                      
                                        return	1;
                                }                                
                                if( reelOffs[0] == 15 )
								{                                       
                                        return	1;
                                }
                        }                       
                        else
						{                                
                                if( 8 < reelOffs[0] && reelOffs[0] < 12 )
								{                                        
                                        return	(reelOffs[0] - 8 );
								}                                
                                if( 15 < reelOffs[0] && reelOffs[0] < 17 )
								{                                       
                                        return	(reelOffs[0] - 15 );
                                }
                        }
                }               
                else if( button == 1 )
				{
                        
                        if( reach == 0 )
						{                                
                                if( reelOffs[1] == 4 )
								{                                       
                                        return 1;
                                }                                
                                if( reelOffs[1] == 8 )
								{                                        
                                        return	1;
                                }
                        }                        
                        else 
						{                                
                                if( 4 < reelOffs[1] && reelOffs[1] < 7 )
								{
                                        return	(reelOffs[1] - 4 );
                                }                                
                                if( 8 < reelOffs[1] && reelOffs[1] < 10 )
								{                                       
                                        return	(reelOffs[1] - 8 );
                                }
                        }
                }
                return 0;
     }


	 private boolean checkPosition( int mark, int much )
	 {
                int			i, j;
                int			count;
                boolean		flg = false;	

                if( mark == 0 || mark == 1 ){			flg = true; }

                
                if( !flg )
				{
                        if( reel[0][reelOffs[0]  ] == 5 ||
                                reel[0][reelOffs[0]+1] == 5 ||
                                reel[0][reelOffs[0]+2] == 5 )
                                        return false;
                }


                for( i=0; i<3; i++ ){
                        count = 0;
                        for( j=0; j<3; j++ ){
                                if( reelStop[j] ){
                                        if( reel[j][ (reelOffs[j]+i)%21 ] == mark )				count++;
                                        else if( flg ){
                                                if( reel[j][ (reelOffs[j]+i)%21 ] == (1-mark) )		count++;
                                        }
                                }
                        }
                        if( count == much )		return true;
                }

                
                count = 0;
                for( i=0; i<3; i++ ){
                        if( reelStop[i] ){
                                if( reel[i][ (reelOffs[i]+i)%21 ] == mark )				count++;
                                else if( flg ){
                                        if( reel[i][ (reelOffs[i]+i)%21 ] == (1-mark) )		count++;
                                }
                        }
                }
                if( count == much )		return true;

               
                count = 0;
                for( i=0; i<3; i++ ){
                        if( reelStop[i] ){
                                if( reel[i][ (reelOffs[i]+(2-i)+21 )%21 ] == mark )		count++;
                                else if( flg ){
                                        if( reel[i][ (reelOffs[i]+i)%21 ] == (1-mark) )		count++;
                                }
                        }
                }
                if( count == much )		return true;

                return false;
    }


	 private int getPrize()
	 {
                int		i;
                Ltype = 99;

                
                for( i=0; i<3; i++ ){
                        if( reel[ 0 ][((reelOffs[0] + i)%21)] == reel[ 1 ][((reelOffs[1] + i)%21)] &&
                                reel[ 0 ][((reelOffs[0] + i)%21)] == reel[ 2 ][((reelOffs[2] + i)%21)] ){
                                                Ltype = (byte)i;
                                                return	reel[ 0 ][((reelOffs[0] + i)%21)];
                        }
                }

                
                if( reel[ 0 ][  reelOffs[0]       ] ==	reel[ 1 ][((reelOffs[1]+1)%21)] &&
                        reel[ 0 ][  reelOffs[0]       ] ==	reel[ 2 ][((reelOffs[2]+2)%21)] ){
                                        Ltype = 3;
                                        return	reel[ 0 ][reelOffs[0]];
                }

                
                else if( reel[ 2 ][  reelOffs[2]       ] == reel[ 1 ][((reelOffs[1]+1)%21)] &&
                                 reel[ 2 ][  reelOffs[2]       ] == reel[ 0 ][((reelOffs[0]+2)%21)] ){
                                        Ltype = 4;
                                        return	reel[ 2 ][reelOffs[2]];
                }

               
                if( reel[ 0 ][  reelOffs[0] ] == 5 ){
                                Ltype = 5;
                                return 8;
                }
                else if( reel[ 0 ][ (reelOffs[0]+2)%21 ] == 5 ){
                                Ltype = 6;
                                return	8;
                }
                else if( reel[ 0 ][ (reelOffs[0]+1)%21 ] == 5 ){
                                Ltype = 7;
                                return 5;
                }
                return	7;
     }
	public void showNotify()
	{
		
		if(pause)			
		{
			gameMode = modeTemp;
			pause = false;
		}

	}
	public void hideNotify()
	{
		pause = true;		//pause state
		modeTemp = gameMode;		//save the current game mode
		gameMode = 8;		//pause state
		
	}

	//-----------------------------------------------------------------------------
	//    tool methods
	//-----------------------------------------------------------------------------

	public void drawStr(Graphics g_2,String str,int x,int y,int color1,int color2)
	{
		g_2.setColor(color2);
		g_2.drawString(str,x+1,y+1,0);
		g_2.setColor(color1);
		g_2.drawString(str,x,y,0);
	}
	public void drawStr2(Graphics g_3,String str, int x, int y)
    {
           g_3.setColor(0);
           g_3.drawString(str, x+1, y+1,0);
           g_3.setColor(0xffffff);
           g_3.drawString(str, x, y,0);
     }
	 public void drawImage(Graphics g_4,Image img,int x,int y)
	{
		 g_4.drawImage(img,x,y,0);
	}

	public int getColorOfRGB(int r, int g, int b)
    {
          return (r << 16) + (g << 8) + b;
    }
	

}

⌨️ 快捷键说明

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