-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample2.monkey
More file actions
167 lines (133 loc) · 3.66 KB
/
example2.monkey
File metadata and controls
167 lines (133 loc) · 3.66 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
Strict
Import mojo
Import wrapper
'these are demo identities
#If TARGET = "ios"
Const APP_ID:= "4f21c409cd1cb2fb7000001b"
Const APP_SIGNATURE:= "92e2de2fd7070327bdeb54c15a5295309c6fcd2d"
#Elseif TARGET = "android"
Const APP_ID:= "4f7b433509b6025804000002"
Const APP_SIGNATURE:= "dd2d41b69ac01b80f443f5b6cf06096d457f82bd"
#else
Const APP_ID:= "FAKE_APP_ID"
Const APP_SIGNATURE:= "FAKE_APP_SIGNATURE"
#end
'main program init
Function Main:Int()
'we should start the chartboost session in main ALWAYS!
'it is also fine to place this in your apps New constructor
'(see below)
New MyApp
Return 0
End
'demo app
Class MyApp Extends App Implements ChartboostDelegate
Field wrapper:= New ChartboostWrapper
'constructor/destructor
Method New()
'setup chartboost through the wrapper
wrapper.SetDelegate(Self)
wrapper.StartSession(APP_ID, APP_SIGNATURE)
End
'app events
Method OnCreate:Int()
' --- setup app ---
SetUpdateRate(60)
wrapper.CacheAdvert()
'return nothing
Return 0
End
Method OnUpdate:Int()
' --- update app ---
'update chartboost (will be ignored on ios or android)
'we look for return FALSE which means teh wrapper isnt active and our program can operate normall
If wrapper.Update() = False
'process normal app operation here
'check for hitting various bits
If TouchHit()
If TouchY() < DeviceHeight() * 0.5
wrapper.ShowAdvert()
Else If TouchY() > DeviceHeight() * 0.5
wrapper.ShowMoreApps()
End
EndIf
EndIf
'return nothing
Return 0
End
Method OnRender:Int()
' --- render app ---
Cls()
'render app
SetColor(100, 200, 75)
DrawRect(0, DeviceHeight() * 0.5 - 5, DeviceWidth(), 10)
SetColor(255, 0, 0)
DrawText("Touch TopPart of Screen to activate Fullscreen Ad", 120, DeviceHeight() * 0.25)
DrawText("Touch BottomPart of Screen to activate More Screen", 120, DeviceHeight() * 0.75)
'render chartboost (will be ignored on ios or android)
wrapper.Render()
'return nothing
Return 0
End
'chartboost delegate events
Method shouldRequestInterstitial:Bool(location:String)
Print "shouldRequestInterstitial:"+location
Return true
End
Method shouldDisplayInterstitial:Bool(location:String)
Print "shouldDisplayInterstitial:"+location
Return true
End
Method didCacheInterstitial:Void(location:String)
Print "didCacheInterstitial:"+location
End
Method didFailToLoadInterstitial:Void(location:String)
Print "didFailToLoadInterstitial:"+location
End
Method didDismissInterstitial:Void(location:String)
Print "didDismissInterstitial:"+location
End
Method didCloseInterstitial:Void(location:String)
Print "didCloseInterstitial:"+location
End
Method didClickInterstitial:Void(location:String)
Print "didClickInterstitial:"+location
End
Method didShowInterstitial:Void(location:String)
Print "didShowInterstitial:"+location
End
Method shouldDisplayLoadingViewForMoreApps:Bool()
Print "shouldDisplayLoadingViewForMoreApps"
Return true
End
Method shouldRequestMoreApps:Bool()
Print "shouldRequestMoreApps"
Return True
End
Method shouldDisplayMoreApps:Bool()
Print "shouldDisplayMoreApps"
Return True
End
Method didCacheMoreApps:Void()
Print "didCacheMoreApps"
End
Method didFailToLoadMoreApps:Void()
Print "didFailToLoadMoreApps"
End
Method didDismissMoreApps:Void()
Print "didDismissMoreApps"
End
Method didCloseMoreApps:Void()
Print "didCloseMoreApps"
End
Method didClickMoreApps:Void()
Print "didClickMoreApps"
End
Method didShowMoreApps:Void()
Print "didShowMoreApps"
End
Method shouldRequestInterstitialsInFirstSession:Bool()
Print "shouldRequestInterstitialsInFirstSession"
Return true
End
End