Type=Activity
Version=4.3
ModulesStructureVersion=1
B4A=true
@EndOfDesignText@
#Region  Activity Attributes 
	#FullScreen: False
	#IncludeTitle: False
#End Region

Sub Process_Globals
	'These global variables will be declared once when the application starts.
	'These variables can be accessed from all modules.
Dim sGame As Int
Dim tmr1 As Timer
End Sub

Sub Globals
	'These global variables will be redeclared each time the activity is created.
	'These variables can only be accessed from this module.

	Dim imgstar1 As ImageView
	Dim imgstar2 As ImageView
	Dim imgstar3 As ImageView
	Dim btnnext As Button
	Dim btnagain As Button
	Dim imgbackground As ImageView
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("game1_final")
common.changeTheme(imgbackground)
tmr1.Initialize("tmr1",500)
tmr1.Enabled = True
loadMenu
End Sub
Sub loadMenu
Activity.AddMenuItem2("تنظیمات","btnsetting",LoadBitmap(File.DirAssets,"setting.png"))
Activity.AddMenuItem2("درباره ما","btnabout",LoadBitmap(File.DirAssets,"about.png"))
Activity.AddMenuItem2("خروج","exit1",LoadBitmap(File.DirAssets,"exit.png"))
End Sub
Sub btnsetting_Click
Activity.Finish
StartActivity(setting)
End Sub
Sub btnabout_Click
Activity.Finish
StartActivity(frmabout)
End Sub
Sub exit1_Click
Dim i As Int
i = Msgbox2("آیا مایل به خروج هستید؟","خروج","آری","خیر","",Null)
If i = DialogResponse.POSITIVE Then
 ExitApplication
End If
End Sub

Sub tmr1_Tick
 If imgstar1.Visible = False Then
  common.playAudio("star.mp3")
  imgstar1.Visible = True
 Else If imgstar2.Visible = False Then
  common.playAudio("star.mp3")
  imgstar2.Visible = True
 Else If imgstar3.Visible = False Then
  common.playAudio("star.mp3")
  imgstar3.Visible = True
  tmr1.Enabled = False
  common.playAudio("win.mp3")
End If
End Sub
Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
  If KeyCode = KeyCodes.KEYCODE_BACK Then
   Activity.Finish
   StartActivity(Main)
  End If
  If KeyCode = KeyCodes.KEYCODE_MENU Then
   Activity.OpenMenu
  End If
End Sub
Sub btnagain_Click
File.Delete(File.DirInternal,"settingGame" & sGame & ".app")
Activity.Finish
Select Case sGame
  Case "1"
   StartActivity(frmGame1)
  Case "3"
   StartActivity(frmGame3)
  Case "4"
   StartActivity(frmGame4)
  Case "5"
   StartActivity(frmGame5)
  Case "8"
   StartActivity(frmGame8)
 End Select
End Sub
Sub btnnext_Click
   settings.saveData("settingGame1.app","timeout","15")
   settings.saveData("settingGame1.app","stage","1")
   settings.saveData("settingGame2.app","timeout","15")
   settings.saveData("settingGame2.app","stage","1")
   settings.saveData("settingGame3.app","timeout","15")
   settings.saveData("settingGame3.app","stage","1")
   settings.saveData("settingGame4.app","timeout","15")
   settings.saveData("settingGame4.app","stage","1")
   settings.saveData("settingGame5.app","timeout","15")
   settings.saveData("settingGame5.app","stage","1")
   settings.saveData("settingGame6.app","timeout","15")
   settings.saveData("settingGame6.app","stage","1")
   settings.saveData("settingGame7.app","timeout","15")
   settings.saveData("settingGame7.app","stage","1")
   settings.saveData("settingGame8.app","timeout","15")
   settings.saveData("settingGame8.app","stage","1")   
   Activity.Finish
   StartActivity(Main)  	
End Sub