Commit 409f1ffaa4e0e5bf0123e0b7f0aa10e55fd42fce
1 parent
101a7a1718
Exists in
master
clean
Showing 9 changed files with 6 additions and 66 deletions Inline Diff
README
| 1 | GumpTech SDK 分为以下几个部分 | 1 | GumpTech SDK 分为以下几个部分 |
| 2 | ------------------------------------ | 2 | ------------------------------------ |
| 3 | 3 | ||
| 4 | GameSDKRelease SDK的Library工程,接入需要引用此工程 | ||
| 5 | GameSDKSample SDK的Sample工程,可以参考此工程接入 | ||
| 6 | ios ios的sdk | ||
| 7 | doc 文档部分 |
android/GameSDKSample/src/com/gumptech/loginsdk/sample/MainActivity.java
| 1 | package com.gumptech.loginsdk.sample; | 1 | package com.gumptech.loginsdk.sample; |
| 2 | 2 | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 5 | import android.util.Log; | 5 | import android.util.Log; |
| 6 | import android.view.View; | 6 | import android.view.View; |
| 7 | import android.widget.Button; | 7 | import android.widget.Button; |
| 8 | import android.widget.TextView; | 8 | import android.widget.TextView; |
| 9 | import android.widget.Toast; | 9 | import android.widget.Toast; |
| 10 | 10 | ||
| 11 | import com.gumptech.sdk.GumpSDK; | 11 | import com.gumptech.sdk.GumpSDK; |
| 12 | import com.gumptech.sdk.bean.GumpUser; | 12 | import com.gumptech.sdk.bean.GumpUser; |
| 13 | import com.gumptech.sdk.bean.PurchaseResult; | 13 | import com.gumptech.sdk.bean.PurchaseResult; |
| 14 | import com.gumptech.sdk.callback.InitializeCallback; | 14 | import com.gumptech.sdk.callback.InitializeCallback; |
| 15 | import com.gumptech.sdk.callback.LoginStateListener; | 15 | import com.gumptech.sdk.callback.LoginStateListener; |
| 16 | import com.gumptech.sdk.callback.PurchaseCallback; | 16 | import com.gumptech.sdk.callback.PurchaseCallback; |
| 17 | import com.gumpsdk.wuruid.R; | 17 | import com.gumpsdk.wuruid.R; |
| 18 | 18 | ||
| 19 | public class MainActivity extends Activity implements PurchaseCallback{ | 19 | public class MainActivity extends Activity implements PurchaseCallback{ |
| 20 | 20 | ||
| 21 | private static final String TAG = "MainActivity"; | 21 | private static final String TAG = "MainActivity"; |
| 22 | 22 | ||
| 23 | private TextView tvVersion; | 23 | private TextView tvVersion; |
| 24 | private TextView userInfo; | 24 | private TextView userInfo; |
| 25 | 25 | ||
| 26 | private Button btnLoginOrLogout; | 26 | private Button btnLoginOrLogout; |
| 27 | 27 | ||
| 28 | private String appId = "10022"; | 28 | private String appId = "10022"; |
| 29 | private String appKey = "93a27b0bd99bac3e68a440b48aa421ab"; | 29 | private String appKey = "93a27b0bd99bac3e68a440b48aa421ab"; |
| 30 | 30 | ||
| 31 | @Override | 31 | @Override |
| 32 | protected void onCreate(Bundle savedInstanceState) { | 32 | protected void onCreate(Bundle savedInstanceState) { |
| 33 | super.onCreate(savedInstanceState); | 33 | super.onCreate(savedInstanceState); |
| 34 | setContentView(R.layout.activity_main); | 34 | setContentView(R.layout.activity_main); |
| 35 | tvVersion = (TextView) findViewById(R.id.version); | 35 | tvVersion = (TextView) findViewById(R.id.version); |
| 36 | userInfo = (TextView) findViewById(R.id.user_info); | 36 | userInfo = (TextView) findViewById(R.id.user_info); |
| 37 | btnLoginOrLogout = (Button) findViewById(R.id.login_or_logout); | 37 | btnLoginOrLogout = (Button) findViewById(R.id.login_or_logout); |
| 38 | btnLoginOrLogout.setOnClickListener(new View.OnClickListener() { | 38 | btnLoginOrLogout.setOnClickListener(new View.OnClickListener() { |
| 39 | 39 | ||
| 40 | @Override | 40 | @Override |
| 41 | public void onClick(View v) { | 41 | public void onClick(View v) { |
| 42 | if (btnLoginOrLogout.getTag() == null || (Integer) btnLoginOrLogout.getTag() == 0) | 42 | if (btnLoginOrLogout.getTag() == null || (Integer) btnLoginOrLogout.getTag() == 0) |
| 43 | GumpSDK.start(MainActivity.this); | 43 | GumpSDK.start(MainActivity.this); |
| 44 | else | 44 | else |
| 45 | GumpSDK.logout(MainActivity.this); | 45 | GumpSDK.logout(MainActivity.this); |
| 46 | } | 46 | } |
| 47 | }); | 47 | }); |
| 48 | findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() { | 48 | findViewById(R.id.pay).setOnClickListener(new View.OnClickListener() { |
| 49 | 49 | ||
| 50 | @Override | 50 | @Override |
| 51 | public void onClick(View v) { | 51 | public void onClick(View v) { |
| 52 | Bundle payInfo = new Bundle(); | 52 | Bundle payInfo = new Bundle(); |
| 53 | payInfo.putString("nick", "thi"); | 53 | payInfo.putString("nick", "thi"); |
| 54 | payInfo.putString("product", "元宝"); | 54 | payInfo.putString("product", "元宝"); |
| 55 | payInfo.putFloat("amount", 0.0f); | 55 | payInfo.putFloat("amount", 0.0f); |
| 56 | payInfo.putString("extraInfo", "This is demo!"); | 56 | payInfo.putString("extraInfo", "This is demo!"); |
| 57 | payInfo.putString("serverId", "103"); | 57 | payInfo.putString("serverId", "103"); |
| 58 | GumpSDK.pay(MainActivity.this, payInfo, "6151046", MainActivity.this); | 58 | GumpSDK.pay(MainActivity.this, payInfo, "6151046", MainActivity.this); |
| 59 | } | 59 | } |
| 60 | }); | 60 | }); |
| 61 | /** | 61 | /** |
| 62 | * 设置否是开启debug模式 | 62 | * 设置否是开启debug模式 |
| 63 | */ | 63 | */ |
| 64 | GumpSDK.setDebugState(true); | 64 | GumpSDK.setDebugState(false); |
| 65 | /** | 65 | /** |
| 66 | * 设置是否启用facebook登录 | 66 | * 设置是否启用facebook登录 |
| 67 | */ | 67 | */ |
| 68 | GumpSDK.setFBEnable(true); | 68 | GumpSDK.setFBEnable(true); |
| 69 | /** | 69 | /** |
| 70 | * 设置是否启用Vk登录 | 70 | * 设置是否启用Vk登录 |
| 71 | */ | 71 | */ |
| 72 | GumpSDK.setVKEnable(true); | 72 | GumpSDK.setVKEnable(false); |
| 73 | /** | 73 | /** |
| 74 | * 设置屏幕方向 | 74 | * 设置屏幕方向 |
| 75 | */ | 75 | */ |
| 76 | GumpSDK.setScreenLandscape(false); | 76 | GumpSDK.setScreenLandscape(false); |
| 77 | /** | 77 | /** |
| 78 | * 设置用户登录状态监听器 | 78 | * 设置用户登录状态监听器 |
| 79 | */ | 79 | */ |
| 80 | GumpSDK.setUserStateListener(new LoginStateListener() { | 80 | GumpSDK.setUserStateListener(new LoginStateListener() { |
| 81 | @Override | 81 | @Override |
| 82 | public void onLoginSuccess(GumpUser user) { | 82 | public void onLoginSuccess(GumpUser user) { |
| 83 | userInfo.setText("Userid:" + user.getUid() + "\n accountType:" + user.getAccountType() + "\n sessionKey:" + user.getSessionKey()); | 83 | userInfo.setText("Userid:" + user.getUid() + "\n accountType:" + user.getAccountType() + "\n sessionKey:" + user.getSessionKey()); |
| 84 | btnLoginOrLogout.setText("Logout"); | 84 | btnLoginOrLogout.setText("Logout"); |
| 85 | btnLoginOrLogout.setTag(1); | 85 | btnLoginOrLogout.setTag(1); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | @Override | 88 | @Override |
| 89 | public void onLoginFailed(int code, String msg) { | 89 | public void onLoginFailed(int code, String msg) { |
| 90 | userInfo.setText(msg); | 90 | userInfo.setText(msg); |
| 91 | Toast.makeText(MainActivity.this, "Login failed:code="+code+",message="+msg, Toast.LENGTH_SHORT).show(); | 91 | Toast.makeText(MainActivity.this, "Login failed:code="+code+",message="+msg, Toast.LENGTH_SHORT).show(); |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | @Override | 94 | @Override |
| 95 | public void onLoginCanceled() { | 95 | public void onLoginCanceled() { |
| 96 | Toast.makeText(MainActivity.this, "operate be canceled", Toast.LENGTH_SHORT).show(); | 96 | Toast.makeText(MainActivity.this, "operate be canceled", Toast.LENGTH_SHORT).show(); |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | @Override | 99 | @Override |
| 100 | public void onLogout() { | 100 | public void onLogout() { |
| 101 | btnLoginOrLogout.setText("Login"); | 101 | btnLoginOrLogout.setText("Login"); |
| 102 | btnLoginOrLogout.setTag(0); | 102 | btnLoginOrLogout.setTag(0); |
| 103 | userInfo.setText("User is logout"); | 103 | userInfo.setText("User is logout"); |
| 104 | } | 104 | } |
| 105 | }); | 105 | }); |
| 106 | /** | 106 | /** |
| 107 | * 初始化sdk | 107 | * 初始化sdk |
| 108 | */ | 108 | */ |
| 109 | GumpSDK.init(getApplicationContext(), appId, appKey, "1000", new InitializeCallback() { | 109 | GumpSDK.init(getApplicationContext(), appId, appKey, "1000", new InitializeCallback() { |
| 110 | @Override | 110 | @Override |
| 111 | public void initComplete(int result) { | 111 | public void initComplete(int result) { |
| 112 | if (result == GumpSDK.CODE.OK) { | 112 | if (result == GumpSDK.CODE.OK) { |
| 113 | btnLoginOrLogout.setEnabled(true); | 113 | btnLoginOrLogout.setEnabled(true); |
| 114 | } | 114 | } |
| 115 | } | 115 | } |
| 116 | }); | 116 | }); |
| 117 | 117 | ||
| 118 | 118 | ||
| 119 | tvVersion.setText("SDK Version:" + GumpSDK.getVersion()); | 119 | tvVersion.setText("SDK Version:" + GumpSDK.getVersion()); |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | @Override | 122 | @Override |
| 123 | public void onPurchaseCompleted(PurchaseResult result) { | 123 | public void onPurchaseCompleted(PurchaseResult result) { |
| 124 | Log.i(TAG,"purchase completed"); | 124 | Log.i(TAG,"purchase completed"); |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | @Override | 127 | @Override |
| 128 | public void onPurchaseError(int code, String msg) { | 128 | public void onPurchaseError(int code, String msg) { |
| 129 | Log.i(TAG,"purchase error"); | 129 | Log.i(TAG,"purchase error"); |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | @Override | 132 | @Override |
| 133 | public void onPurchaseCanceled() { | 133 | public void onPurchaseCanceled() { |
| 134 | Log.i(TAG,"purchase canceled"); | 134 | Log.i(TAG,"purchase canceled"); |
| 135 | } | 135 | } |
| 136 | } | 136 | } |
| 137 | 137 |
doc/sdkGm.md
| 1 | 支付SDK管理后台使用说明 | File was deleted | |
| 2 | = | ||
| 3 | |||
| 4 | |||
| 5 | 1. 创建应用 | ||
| 6 | - | ||
| 7 | [回调地址]--用于通知应用方支付数据,如不填写,支付后不会通知应用方 | ||
| 8 | [facebookKey]--facebook登录所需 | ||
| 9 | [facebookId]--facebook登录所需 | ||
| 10 | 可以在后台直接查看我们已经创建的应用的相关信息; | ||
| 11 |  | ||
| 12 | |||
| 13 | |||
| 14 | 2. 添加APP渠道 | ||
| 15 | - | ||
| 16 | 在APP 渠道目录下,添加新的app 和新的渠道ID,这样我们可以控制产品支付的情况 | ||
| 17 | 在创建应用的时候默认会生成一个1000的渠道 | ||
| 18 | |||
| 19 | [googleplay Key]--如果接入gp支付,需要填写 | ||
| 20 | 在配置中,如果是GP支付,一定在在gpkey 中添加,GP支付KEY,这个key可以在Google Play 后台获得 | ||
| 21 | 如果一个产品GP 版本和mol 版本都使用我们的SDK ,并且分两个包进行提交的话,我们在一个产品下需要创建2个渠道ID,这样方便后台进行控制 | ||
| 22 |  | ||
| 23 | |||
| 24 | 3. 添加应用支付方式 | ||
| 25 | - | ||
| 26 | 根据渠道配置所需的支付方式,mol/paypal/gp | ||
| 27 | |||
| 28 | [maxMoney]--paypal/gp充值超过此金额才可以手动填写充值金额 | ||
| 29 | [比例]--充值和游戏币对应比例 | ||
| 30 | |||
| 31 | 在这里需要注意的是渠道id,mol和paypal的渠道ID可以是同一个,因为这两种支付都属于第三方支付,Google Play支付一定要与第三方渠道支付的渠道id进行区分; | ||
| 32 | |||
| 33 | PS:特殊情况可以三种支付方式都使用一个渠道id,当这个app支持3种支付方式时,可以选择同样的渠道id。 | ||
| 34 |  | ||
| 35 | |||
| 36 | 4. 添加应用充值金额对照 | ||
| 37 | - | ||
| 38 | 支付sdk界面显示的充值说明 xx RMB = xx 游戏币 | ||
| 39 | |||
| 40 | 下方标注的红色条框,在完成设定后一定要仔细检查,防止出现错误,一旦出现错误就会导致我们收入收到影响 | ||
| 41 |  | ||
| 42 | |||
| 43 | 5.MOL商品定价 | ||
| 44 | - | ||
| 45 | 在mol支付中包含4种支付方式,每种支付方式的面值都不一样,所以我们在添加商品的时候一定要注意定价, | ||
| 46 | 支付方式:mol 渠道ID 要核对是否是你要配置的ID, mol选项,选择充值卡类型,金额 和游戏币要校对 | ||
| 47 | 以下是各类卡片的面值表格。 | ||
| 48 |  | ||
| 49 |  | ||
| 50 | 6.PAYPAL支付 | ||
| 51 | - | ||
| 52 | Paypal支付设置相对要简单一些,只要填写固定的金额和游戏货币,选择好支付方式即可。 | ||
| 53 |  | ||
| 54 | |||
| 55 | 7.GOOGLE PLAY支付 | ||
| 56 | - | ||
| 57 | googleplay 支付 需要注意的是 GP商品ID,也就是我们经常说的in-app ID,这个ID需要在gp后台进行设置,创建好以后, | ||
| 58 | 确定可以正常激活后,在我们的SDK后台,进行填写。支付方式上一定要选择好google play 支付。 | ||
| 59 |  | ||
| 60 | |||
| 61 | 1 | 支付SDK管理后台使用说明 |
ios/ios_20140917.tar
No preview for this file type
ios/ios_20150215.zip
No preview for this file type
ios/ios_sdk_20150423.zip
No preview for this file type
ios/ios_sdk_20150603.zip
No preview for this file type
ios/ios_sdk_20150630.zip
No preview for this file type
ios/ios_sdk_20150810.zip
No preview for this file type