Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim IntLivelloBatter As Int
Dim IntLivelloMarvin As Int
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.
Private ImVBart As ImageView
Dim Bart As Bitmap
Private BTInizia As Button
Private BTContinua As Button
Dim Sigillo As Bitmap
Dim s As SQL
Dim c As Cursor
Private ImageViewBatter As ImageView
Private ImageViewMarvin As ImageView
'''' Livelli''''
Dim BatterLv As Bitmap
Dim MarvinLv As Bitmap
Dim BatterInt As Int =0
Dim MarvinInt As Int =0
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Livelli")
Load_DB
Bart.Initialize(File.DirAssets,"VaiBart.png")
Sigillo.Initialize(File.DirAssets,"Sigillo.png")
ImVBart.SetBackgroundImage(Bart)
BatterLv.Initialize(File.DirAssets,"Batter.png")
MarvinLv.Initialize(File.DirAssets,"Marvin.png")
Avanzamento1
Avanzamento2
LivelloBatterSuperato
End Sub
Sub LivelloBatterSuperato
If IntLivelloBatter=1 Then
IntLivelloBatter=0
MarvinInt=1
Dim unit As Int
unit=1
s.ExecNonQuery("INSERT INTO Mostri (BatterLv) VALUES('"& unit &"')")
Msgbox("Unit livello next","")
End If
End Sub
Sub Load_DB
Dim My As String
If File.ExternalWritable Then
My = File.DirInternal
Else
My = File.DirInternal
End If
If File.Exists(File.DirInternal,"DBGiocoSBS.db")= False Then
File.Copy(File.DirAssets,"DBGiocoSBS.db",File.DirInternal,"DBGiocoSBS.db")
End If
s.Initialize(My,"DBGiocoSBS.db",True)
Log("db Inizializzato")
End Sub
Sub Avanzamento1
c=s.ExecQuery("SELECT BatterLv FROM Mostri")
If c.RowCount>0 Then
For i = 0 To c.RowCount-1
c.Position=i
Next
BatterInt=c.GetInt("BatterLv")
End If
If BatterInt=1 Then
ImageViewBatter.Bitmap=BatterLv
ImVBart.Left=13%x
Else
ImageViewBatter.Bitmap=Sigillo
ImageViewMarvin.Bitmap=Sigillo
ImVBart.Left=0%x
For i=ImVBart.Left To 13%x Step 1dip
ImVBart.Left=i
Sleep(5)
Next
BTInizia.Visible=True
Sleep(1000)
End If
End Sub
Sub Avanzamento2
If BatterInt=1 Then
ImageViewMarvin.Bitmap=Sigillo
ImVBart.Left=13%x
For i=ImVBart.Left To 33%x Step 1dip
ImVBart.Left=i
Sleep(5)
Next
BTContinua.Visible=True
Sleep(1000)
Else
ImageViewMarvin.Bitmap=Sigillo
End If
End Sub
Sub Avanzamento3
c=s.ExecQuery("SELECT MarvinLv FROM Mostri")
If c.RowCount>0 Then
For i = 0 To c.RowCount-1
c.Position=i
Next
MarvinInt=c.GetInt("MarvinLv")
If MarvinInt=1 Then
ImageViewMarvin.Bitmap=MarvinLv
End If
End If
End Sub
Sub Activity_Resume
Avanzamento1
Avanzamento2
LivelloBatterSuperato
End Sub
Sub BTInizia_Click
StartActivity("Batter")
Activity.Finish
End Sub
Sub BTContinua_Click
StartActivity("Marvin")
Activity.Finish
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub