PlayPhone SDK V2.0 Beta (Android)

Monkey Programming Forums/User Modules/PlayPhone SDK V2.0 Beta (Android)

Origaming(Posted 2013) [#1]
hi all,
just want to share PlayPhone SDK V2.0

Download

PlayPhone :
format_codebox('
Import mojo

#IF TARGET="android"
Import "native/playphoneMonkey.${TARGET}.${LANG}"
Import "native/ExampleBilling.java"
Public

Extern

Function ppStart:Void(key:String) = "PlayPhoneMonkey.Start"
Function ppOnPause:Void() = "PlayPhoneMonkey.onPause"
Function ppOnResume:Void() = "PlayPhoneMonkey.onResume"

Function ppShowDBMain:Void() = "PlayPhoneMonkey.dMain"
Function ppShowDBFriend:Void() = "PlayPhoneMonkey.dFriend"
Function ppShowDBProfile:Void() = "PlayPhoneMonkey.dProfile"
Function ppShowDBGames:Void() = "PlayPhoneMonkey.dGames"
Function ppShowDBNotifications:Void() = "PlayPhoneMonkey.dNotifications"
Function ppShowDBLeaderboards:Void() = "PlayPhoneMonkey.dLeaderboards"

Function ppSubmitScore:Void(id:Int, score:Int) = "PlayPhoneMonkey.dSubmitScore"
Function ppSubmitAchievement:Void(id:Int) = "PlayPhoneMonkey.dAchievement"

Function ppLogin:Void() = "PlayPhoneMonkey.dLogin"
Function ppFbLogin:Void() = "PlayPhoneMonkey.dFBLogin"
Function ppFbConnect:Bool() = "PlayPhoneMonkey.dFbConnect"
Function ppFBInvite:Void() = "PlayPhoneMonkey.dInviteFB"
Function ppFbPost:Void(linkS:String, nameS:String, descS:String, linkPicS:String, captionS:String) = "PlayPhoneMonkey.dPostFB"

Function ppItemBuy:Void(ITEM_ID:Int) = "PlayPhoneMonkey.dBuyItem"
Function ppItemWaitStatus:bool() = "PlayPhoneMonkey.dWaitBuy"
Function ppItemBuyStatus:bool() = "PlayPhoneMonkey.dBuyStatus"
Function ppItemID:int() = "PlayPhoneMonkey.dItemID"
Function ppItemQty:int() = "PlayPhoneMonkey.dQtyID"
#Else
Function ppStart:Void(key:String)
End
Function ppOnPause:Void()
End
Function ppOnResume:Void()
End
Function ppShowDBMain:Void()
End
Function ppShowDBFriend:Void()
End
Function ppShowDBProfile:Void()
End
Function ppShowDBGames:Void()
End
Function ppShowDBNotifications:Void()
End
Function ppShowDBLeaderboards:Void()
End
Function ppSubmitScore:Void(id:Int, score:Int)
End
Function ppSubmitAchievement:Void(id:Int)
End
Function ppLogin:Void()
End
Function ppFbLogin:Void()
End
Function ppFbConnect:Bool()
Return False
End
Function ppFBInvite:Void()
End
Function ppFbPost:Void(linkS:String, nameS:String, descS:String, linkPicS:String, captionS:String)
End
Function ppItemBuy:Void(ITEM_ID:Int)
End
Function ppItemWaitStatus:bool()
Return False
End
Function ppItemBuyStatus:bool()
Return False
End
Function ppItemID:int()
Return 0
End
Function ppItemQty:int()
Return 0
End
#End
')

Sample :
format_codebox('
Strict

Import playphone
Import diddy

Function Main:Int()
ppStart("7edb38ab2dc88ed95812780ceef8e43a54ea2b81")
game = New MyGame()
Return 0
End Function

Global titleScreen:TitleScreen

Class MyGame Extends DiddyAppC
Method OnCreate:Int()
game.FPS = 30
Super.OnCreate()

#If TARGET<>"ios" Or TARGET<>"android"
game.inputCache.MonitorTouch(True)
#End

SetScreenSize(1024, 600, True)

titleScreen = New TitleScreen
titleScreen.PreStart()
game.inputCache.MonitorAllKeys()
Return 0
End
End

Class TitleScreen Extends Screen
Field udaStart:Bool
Field onBuy:Bool

Method New()
name = "TitleScreen"
End

Method Start:Void()
End

Method Render:Void()
Cls
SetColor 0, 250, 250
DrawRect(900, 0, 124, 100)
SetColor 250, 0, 250
DrawRect(900, 100, 124, 100)
SetColor 250, 250, 250
DrawRect(900, 200, 124, 100)

If onBuy Then
If ppItemWaitStatus() Then
SetColor 250, 250, 250
DrawRect(20, 200, 124, 100)
Else
'buy success or fail
If ppItemBuyStatus() Then
SetColor 0, 250, 0
DrawRect(30, 200, 124, 100)
Else
SetColor 250, 0, 0
DrawRect(40, 200, 124, 100)
EndIf
EndIf
EndIf

End

Method OnTouchHit:Void(x:Int, y:Int, pointer:Int)
If game.mouseX > 900 And game.mouseX < 1024 And game.mouseY > 0 And game.mouseY < 100 Then
ppShowDBFriend()
EndIf
If game.mouseX > 900 And game.mouseX < 1024 And game.mouseY > 100 And game.mouseY < 200 Then
ppFBInvite()
EndIf

If game.mouseX > 900 And game.mouseX < 1024 And game.mouseY > 200 And game.mouseY < 300 Then
ppItemBuy(524)
onBuy = True
EndIf
End
Method Update:Void()

End
End

Class DiddyAppC Extends DiddyApp
Method OnSuspend:Int()
Super.OnSuspend()
ppOnPause()
Return 0
End

Method OnResume:Int()
Super.OnResume()
ppOnResume()
Return 0
End
End
')

note :
1. on build folder looked "android" folder in "build/src/com" and make it read only
2. we need to add function ppOnPause and ppOnResume


ps: @c.k sorry for the delay...


[edit]
you need fb developer to use fb function, and fb app will be created by PlayPhone
[/edit]


c.k.(Posted 2013) [#2]
Awesome! Thanks, Origaming!

What's it going to take to get iPhone and HTML5 included in the module? I thought I saw those SDKs available at PlayPhone's web site. You guys don't like iPhone/HTML5? :-)

EDIT: Took a closer look at PP's web site. Looks like v2.0 is only available for Android right now. heh.


c.k.(Posted 2013) [#3]
Origaming, are you part of the private beta testing for iOS?


Origaming(Posted 2013) [#4]
sorry for delay, we still not develop for ios,,


MikeHart(Posted 2013) [#5]
Is the module compatible with V67c and up?


Origaming(Posted 2013) [#6]
I'll test it asap, I'm still fixing IAPP.