-
Notifications
You must be signed in to change notification settings - Fork 0
/
Modules.vb
129 lines (110 loc) · 4.97 KB
/
Modules.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
Imports System.IO
Imports System.Web.UI.Design.WebControls
Module Modules
Dim folders() = {"C:/snaipdefix",
"C:/snaipdefix/LuckySpin",
"C:/snaipdefix/LuckySpin/settings",
"C:/snaipdefix/LuckySpin/profiles"}
Public Sub check_folders()
If Not Directory.Exists("C:/snaipdefix/LuckySpin") Then
create_folders()
End If
End Sub
Private startx As Integer
Private starty As Integer
Private endx As Integer
Private endy As Integer
Private indexx As Integer
Private picbox As New Guna.UI2.WinForms.Guna2PictureBox
Private timer1 As New Timer
Private incr As Integer
Public Sub animate_to(parentform As Form, startpos As Point, endpos As Point, picture As Image, size As Size, tick As Integer, increment As Integer)
picbox.Visible = True
picbox.Image = Nothing
picbox.Image = picture
picbox.SizeMode = PictureBoxSizeMode.Zoom
picbox.Parent = parentform
picbox.Location = startpos
picbox.UseTransparentBackground = True
picbox.BringToFront()
picbox.Size = size
incr = increment
startx = startpos.X
starty = startpos.Y
endx = endpos.X
endy = endpos.Y
indexx = 0
AddHandler timer1.Tick, AddressOf t1tick
timer1.Interval = tick
timer1.Start()
End Sub
Private Function approximate10(value As Integer)
Return Math.Ceiling(value / 10) * 10
End Function
Private Sub t1tick()
If picbox.Location.X > endx Then
picbox.Location = New Point(picbox.Location.X - incr, picbox.Location.Y)
ElseIf picbox.Location.x < endx Then
picbox.Location = New Point(picbox.Location.X + incr, picbox.Location.Y)
End If
If picbox.Location.Y > endy Then
picbox.Location = New Point(picbox.Location.X, picbox.Location.Y - incr)
ElseIf picbox.Location.Y < endy Then
picbox.Location = New Point(picbox.Location.X, picbox.Location.Y + incr)
End If
If approximate10(picbox.Location.Y) = approximate10(endy) And approximate10(picbox.Location.X) = approximate10(endx) Then
timer1.Stop()
picbox.Image = Nothing
picbox.Visible = False
End If
End Sub
Private Sub create_folders()
For Each folder In folders
If Not Directory.Exists(folder) Then
My.Computer.FileSystem.CreateDirectory(folder)
End If
Next
End Sub
Public Sub load_user_items(username As String)
Dim pth = "C:/snaipdefix/LuckySpin/profiles/" + username + "/saves/"
My.Settings.coins = My.Computer.FileSystem.ReadAllText(pth + "coins.snp")
My.Settings.diamonds = My.Computer.FileSystem.ReadAllText(pth + "diamonds.snp")
My.Settings.piggies = My.Computer.FileSystem.ReadAllText(pth + "piggies.snp")
My.Settings.spins = My.Computer.FileSystem.ReadAllText(pth + "spins.snp")
My.Settings.citylevel = My.Computer.FileSystem.ReadAllText(pth + "citylevel.snp")
End Sub
Public Sub save_user_items(username As String)
Dim pth = "C:/snaipdefix/LuckySpin/profiles/" + username + "/saves/"
My.Computer.FileSystem.WriteAllText(pth + "coins.snp", My.Settings.coins.ToString, False)
My.Computer.FileSystem.WriteAllText(pth + "diamonds.snp", My.Settings.diamonds.ToString, False)
My.Computer.FileSystem.WriteAllText(pth + "piggies.snp", My.Settings.piggies.ToString, False)
My.Computer.FileSystem.WriteAllText(pth + "spins.snp", My.Settings.spins.ToString, False)
My.Computer.FileSystem.WriteAllText(pth + "citylevel.snp", My.Settings.citylevel.ToString, False)
End Sub
Public Sub generate_new_user(username As String)
My.Computer.FileSystem.CreateDirectory("C:/snaipdefix/LuckySpin/profiles/" + username)
My.Computer.FileSystem.CreateDirectory("C:/snaipdefix/LuckySpin/profiles/" + username + "/saves")
Dim pth = "C:/snaipdefix/LuckySpin/profiles/" + username + "/saves/"
My.Computer.FileSystem.WriteAllText(pth + "coins.snp", "1000", False)
My.Computer.FileSystem.WriteAllText(pth + "diamonds.snp", "10", False)
My.Computer.FileSystem.WriteAllText(pth + "piggies.snp", "5", False)
My.Computer.FileSystem.WriteAllText(pth + "spins.snp", "50", False)
My.Computer.FileSystem.WriteAllText(pth + "citylevel.snp", "0", False)
My.Settings.coins = 1000
My.Settings.diamonds = 10
My.Settings.piggies = 5
My.Settings.spins = 50
My.Settings.citylevel = 0
End Sub
Public Sub newmessage(text As String)
MessageUtility.messagevalue = text
MessageUtility.ShowDialog()
End Sub
Public Sub prepare_form(form As Form, panel As Control)
form.TopLevel = False
form.Location = panel.Location
form.WindowState = FormWindowState.Normal
form.Visible = True
panel.Controls.Add(form)
End Sub
End Module