Showing
13 changed files
with
198 additions
and
76 deletions
publicAndroidSDK/demo/.DS_Store
0 → 100644
No preview for this file type
publicAndroidSDK/demo/Demo_PoolSdk/.DS_Store
0 → 100644
No preview for this file type
| ... | @@ -30,10 +30,16 @@ | ... | @@ -30,10 +30,16 @@ |
| 30 | <arguments> | 30 | <arguments> |
| 31 | </arguments> | 31 | </arguments> |
| 32 | </buildCommand> | 32 | </buildCommand> |
| 33 | + <buildCommand> | ||
| 34 | + <name>org.eclipse.buildship.core.gradleprojectbuilder</name> | ||
| 35 | + <arguments> | ||
| 36 | + </arguments> | ||
| 37 | + </buildCommand> | ||
| 33 | </buildSpec> | 38 | </buildSpec> |
| 34 | <natures> | 39 | <natures> |
| 35 | <nature>com.android.ide.eclipse.adt.AndroidNature</nature> | 40 | <nature>com.android.ide.eclipse.adt.AndroidNature</nature> |
| 36 | <nature>org.eclipse.jdt.core.javanature</nature> | 41 | <nature>org.eclipse.jdt.core.javanature</nature> |
| 37 | <nature>org.python.pydev.pythonNature</nature> | 42 | <nature>org.python.pydev.pythonNature</nature> |
| 43 | + <nature>org.eclipse.buildship.core.gradleprojectnature</nature> | ||
| 38 | </natures> | 44 | </natures> |
| 39 | </projectDescription> | 45 | </projectDescription> | ... | ... |
No preview for this file type
| ... | @@ -2,22 +2,20 @@ | ... | @@ -2,22 +2,20 @@ |
| 2 | <config> | 2 | <config> |
| 3 | 3 | ||
| 4 | <sdkconfig | 4 | <sdkconfig |
| 5 | - appClientKey="9DtxPtUrzYU0uTBGGMJzKyhKAK5t2O9i" | 5 | + appClientKey="+2s5b+AYHAgpswQzq78LaFHhNfC5osmdGGprOxfV6xag8iTgfnmFQg==" |
| 6 | - appId="Dz8T95TrG9d/WVIWAPZviuaV7Tbko3oAlqDCYpNKkTU=" | 6 | + appId="YjVogF6bg703sSYHiSTmHyuOFyYyLQGWpYNcYn0THjk=" |
| 7 | - channelparameter1="4uc0/gEfNt4=" | 7 | + channelparameter1="R6MpKQGnMrc=" |
| 8 | channelparameter2="4uc0/gEfNt4=" | 8 | channelparameter2="4uc0/gEfNt4=" |
| 9 | custom="T7w9VvhA5tQ=" | 9 | custom="T7w9VvhA5tQ=" |
| 10 | - gamechannelid="4uc0/gEfNt4=" | 10 | + gamechannelid="HYx3ghKCS3o=" |
| 11 | gamesimplename="qcFlv/sgri8oQ6xDbE0odg==" | 11 | gamesimplename="qcFlv/sgri8oQ6xDbE0odg==" |
| 12 | - logincheckurl="Xwm2VZk4IZHw4pR8WSu0JRSPl5jMDzA8+5nKH+jNJckQW+5uHcG5Mxl+gMWO6s8PhqrR0VX7irk=" | 12 | + logincheckurl="YxGzUoG7sH+s84gWL94+TAxKOcYkwWM7Mu4OGmV/HQUbvv/kDvncWL6Cw7OrEqYl" |
| 13 | - paycheckurl="Xwm2VZk4IZHw4pR8WSu0JRSPl5jMDzA8+5nKH+jNJclRWohb/BPqZ4ChH88g5ubtvsBW3D32B8c=" | 13 | + paycheckurl="YxGzUoG7sH+s84gWL94+TIYRcE2x8/D/+Ve+dBt4q59PO/yBgb+QHuJdF58ha2tt" |
| 14 | - payorderurl="Xwm2VZk4IZHw4pR8WSu0JRSPl5jMDzA8+5nKH+jNJclRWohb/BPqZ4SO5qrmq1RBsIoFXavzUfg=" | 14 | + payorderurl="YxGzUoG7sH+s84gWL94+TIYRcE2x8/D/+Ve+dBt4q5/H1RraDwOsdQSOJY/iFroo" |
| 15 | sdksimplename="vWVsU5Ogkh8=" | 15 | sdksimplename="vWVsU5Ogkh8=" |
| 16 | sdkversioncode="BVPAQexcXDk=" | 16 | sdkversioncode="BVPAQexcXDk=" |
| 17 | styleName="yvfh/4zhaEQ=" | 17 | styleName="yvfh/4zhaEQ=" |
| 18 | usertype="gssaXIIEiL0=" | 18 | usertype="gssaXIIEiL0=" |
| 19 | - weixinId="x3d4hSeP9KFDTFusyU+iB/9NgyvRyoop" | 19 | + weixinId="tEsCXmDVJ63j/UyDe3wVrNojH2NJXj59" /> |
| 20 | - payCallbackUrl = "http://51wang" | ||
| 21 | - /> | ||
| 22 | 20 | ||
| 23 | </config> | 21 | </config> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | +/* AUTO-GENERATED FILE. DO NOT MODIFY. | ||
| 2 | + * | ||
| 3 | + * This class was automatically generated by the | ||
| 4 | + * aapt tool from the resource data it found. It | ||
| 5 | + * should not be modified by hand. | ||
| 6 | + */ | ||
| 7 | + | ||
| 8 | +package com.youai.foolsdk.demo; | ||
| 9 | + | ||
| 10 | +public final class R { | ||
| 11 | + public static final class attr { | ||
| 12 | + } | ||
| 13 | + public static final class drawable { | ||
| 14 | + public static final int public_sdk_self_demo_btn_login_n=0x7f020000; | ||
| 15 | + public static final int public_sdk_self_demo_btn_login_s=0x7f020001; | ||
| 16 | + public static final int public_sdk_self_demo_btn_main_n=0x7f020002; | ||
| 17 | + public static final int public_sdk_self_demo_btn_main_s=0x7f020003; | ||
| 18 | + public static final int public_sdk_self_demo_main=0x7f020004; | ||
| 19 | + public static final int public_sdk_self_ic_launcher=0x7f020005; | ||
| 20 | + public static final int public_sdk_self_sdk_login_bg=0x7f020006; | ||
| 21 | + public static final int public_sdk_self_ya_bt_selector=0x7f020007; | ||
| 22 | + public static final int public_sdk_self_ya_login_bt_selector=0x7f020008; | ||
| 23 | + } | ||
| 24 | + public static final class id { | ||
| 25 | + public static final int forum_bt=0x7f050005; | ||
| 26 | + public static final int logout_bt=0x7f050004; | ||
| 27 | + public static final int ya_channel_center=0x7f050000; | ||
| 28 | + public static final int ya_enter_game_bt=0x7f050007; | ||
| 29 | + public static final int ya_login_bt=0x7f050006; | ||
| 30 | + public static final int ya_pay_bt=0x7f050001; | ||
| 31 | + public static final int ya_submit_role_data_bt=0x7f050003; | ||
| 32 | + public static final int ya_switch_account_bt=0x7f050002; | ||
| 33 | + } | ||
| 34 | + public static final class layout { | ||
| 35 | + public static final int public_sdk_self_game=0x7f030000; | ||
| 36 | + public static final int public_sdk_self_game_login=0x7f030001; | ||
| 37 | + } | ||
| 38 | + public static final class string { | ||
| 39 | + public static final int app_name=0x7f040000; | ||
| 40 | + } | ||
| 41 | +} |
No preview for this file type
| ... | @@ -11,4 +11,4 @@ | ... | @@ -11,4 +11,4 @@ |
| 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt | 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt |
| 12 | 12 | ||
| 13 | # Project target. | 13 | # Project target. |
| 14 | -target=android-19 | 14 | +target=android-20 | ... | ... |
| ... | @@ -5,51 +5,64 @@ | ... | @@ -5,51 +5,64 @@ |
| 5 | android:background="@drawable/public_sdk_self_demo_main" > | 5 | android:background="@drawable/public_sdk_self_demo_main" > |
| 6 | 6 | ||
| 7 | <Button | 7 | <Button |
| 8 | - android:id="@+id/ya_pay_bt" | 8 | + android:id="@+id/ya_channel_center" |
| 9 | - android:layout_width="wrap_content" | 9 | + android:layout_width="180dp" |
| 10 | - android:layout_height="wrap_content" | 10 | + android:layout_height="60dp" |
| 11 | - android:layout_alignParentLeft="true" | 11 | + android:layout_alignParentRight="true" |
| 12 | - android:layout_alignParentTop="true" | 12 | + android:layout_alignTop="@+id/ya_pay_bt" |
| 13 | - android:layout_marginLeft="14dp" | ||
| 14 | - android:layout_marginTop="53dp" | ||
| 15 | android:background="@drawable/public_sdk_self_ya_bt_selector" | 13 | android:background="@drawable/public_sdk_self_ya_bt_selector" |
| 16 | android:onClick="yaOnClick"/> | 14 | android:onClick="yaOnClick"/> |
| 17 | 15 | ||
| 18 | <Button | 16 | <Button |
| 17 | + android:id="@+id/ya_switch_account_bt" | ||
| 18 | + android:layout_width="180dp" | ||
| 19 | + android:layout_height="60dp" | ||
| 20 | + android:layout_alignParentRight="true" | ||
| 21 | + android:layout_alignTop="@+id/ya_submit_role_data_bt" | ||
| 22 | + android:background="@drawable/public_sdk_self_ya_bt_selector" | ||
| 23 | + android:onClick="yaOnClick" /> | ||
| 24 | + | ||
| 25 | + <Button | ||
| 19 | android:id="@+id/ya_submit_role_data_bt" | 26 | android:id="@+id/ya_submit_role_data_bt" |
| 20 | - android:layout_width="wrap_content" | 27 | + android:layout_width="180dp" |
| 21 | - android:layout_height="wrap_content" | 28 | + android:layout_height="60dp" |
| 22 | - android:layout_alignLeft="@+id/ya_pay_bt" | ||
| 23 | android:layout_alignParentBottom="true" | 29 | android:layout_alignParentBottom="true" |
| 24 | - android:layout_marginBottom="75dp" | 30 | + android:layout_alignParentLeft="true" |
| 25 | android:background="@drawable/public_sdk_self_ya_bt_selector" | 31 | android:background="@drawable/public_sdk_self_ya_bt_selector" |
| 26 | - android:onClick="yaOnClick"/> | 32 | + android:onClick="yaOnClick" /> |
| 27 | 33 | ||
| 28 | <Button | 34 | <Button |
| 29 | - android:id="@+id/ya_channel_center" | 35 | + android:id="@+id/ya_pay_bt" |
| 30 | - android:layout_width="wrap_content" | 36 | + android:layout_width="180dp" |
| 31 | - android:layout_height="wrap_content" | 37 | + android:layout_height="60dp" |
| 32 | - android:layout_alignParentRight="true" | 38 | + android:layout_alignParentLeft="true" |
| 33 | - android:layout_alignTop="@+id/ya_pay_bt" | 39 | + android:layout_alignParentTop="true" |
| 34 | android:background="@drawable/public_sdk_self_ya_bt_selector" | 40 | android:background="@drawable/public_sdk_self_ya_bt_selector" |
| 35 | - android:onClick="yaOnClick"/> | 41 | + android:onClick="yaOnClick" /> |
| 42 | + | ||
| 36 | 43 | ||
| 37 | <Button | 44 | <Button |
| 38 | - android:id="@+id/ya_switch_account_bt" | 45 | + android:id="@+id/logout_bt" |
| 39 | - android:layout_width="wrap_content" | 46 | + android:layout_width="180dp" |
| 40 | - android:layout_height="wrap_content" | 47 | + android:layout_height="60dp" |
| 41 | - android:layout_alignParentRight="true" | 48 | + android:layout_alignParentLeft="true" |
| 42 | - android:layout_alignTop="@+id/ya_submit_role_data_bt" | 49 | + android:layout_centerVertical="true" |
| 43 | android:background="@drawable/public_sdk_self_ya_bt_selector" | 50 | android:background="@drawable/public_sdk_self_ya_bt_selector" |
| 44 | - android:onClick="yaOnClick" /> | 51 | + android:onClick="yaOnClick" |
| 52 | + android:text="注销" | ||
| 53 | + android:textColor="@android:color/black" | ||
| 54 | + /> | ||
| 45 | 55 | ||
| 46 | <Button | 56 | <Button |
| 47 | android:id="@+id/forum_bt" | 57 | android:id="@+id/forum_bt" |
| 48 | - android:layout_width="wrap_content" | 58 | + android:layout_width="180dp" |
| 49 | - android:layout_height="wrap_content" | 59 | + android:layout_height="60dp" |
| 50 | - android:layout_centerHorizontal="true" | 60 | + android:layout_alignParentRight="true" |
| 51 | android:layout_centerVertical="true" | 61 | android:layout_centerVertical="true" |
| 52 | android:background="@drawable/public_sdk_self_ya_bt_selector" | 62 | android:background="@drawable/public_sdk_self_ya_bt_selector" |
| 53 | - android:onClick="yaOnClick" /> | 63 | + android:onClick="yaOnClick" |
| 64 | + android:text="论坛" | ||
| 65 | + android:textColor="@android:color/black" | ||
| 66 | + /> | ||
| 54 | 67 | ||
| 55 | </RelativeLayout> | 68 | </RelativeLayout> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -8,8 +8,8 @@ import android.content.res.Configuration; | ... | @@ -8,8 +8,8 @@ import android.content.res.Configuration; |
| 8 | import android.os.Bundle; | 8 | import android.os.Bundle; |
| 9 | import android.view.KeyEvent; | 9 | import android.view.KeyEvent; |
| 10 | import android.view.View; | 10 | import android.view.View; |
| 11 | +import android.view.WindowManager.LayoutParams; | ||
| 11 | import android.widget.Button; | 12 | import android.widget.Button; |
| 12 | -import android.widget.Toast; | ||
| 13 | 13 | ||
| 14 | import com.gzyouai.fengniao.sdk.framework.PoolExitDialogListener; | 14 | import com.gzyouai.fengniao.sdk.framework.PoolExitDialogListener; |
| 15 | import com.gzyouai.fengniao.sdk.framework.PoolExitListener; | 15 | import com.gzyouai.fengniao.sdk.framework.PoolExitListener; |
| ... | @@ -35,7 +35,8 @@ public class AppActivity extends Activity { | ... | @@ -35,7 +35,8 @@ public class AppActivity extends Activity { |
| 35 | private Button yaSubmitRoleDataBt; | 35 | private Button yaSubmitRoleDataBt; |
| 36 | private Button yaChannelCenter; | 36 | private Button yaChannelCenter; |
| 37 | private Button yaSwitchAccountBt; | 37 | private Button yaSwitchAccountBt; |
| 38 | - private Button forumBt; | 38 | + private Button yaLogoutBt; |
| 39 | + private Button yaForumBt; | ||
| 39 | 40 | ||
| 40 | @Override | 41 | @Override |
| 41 | protected void onCreate(Bundle savedInstanceState) { | 42 | protected void onCreate(Bundle savedInstanceState) { |
| ... | @@ -44,14 +45,15 @@ public class AppActivity extends Activity { | ... | @@ -44,14 +45,15 @@ public class AppActivity extends Activity { |
| 44 | "public_sdk_self_game_login", "layout", getPackageName()); | 45 | "public_sdk_self_game_login", "layout", getPackageName()); |
| 45 | setContentView(layoutId); | 46 | setContentView(layoutId); |
| 46 | initLoginView(); | 47 | initLoginView(); |
| 47 | - PoolSdkLog.setIsShowLog(true);//显示PoolSDK log | 48 | + //PoolSdkHelper.isDebug = true; |
| 48 | - | 49 | + PoolSdkLog.setIsShowLog(true); |
| 49 | PoolSdkHelper.init(this, new PoolSDKCallBackListener() { | 50 | PoolSdkHelper.init(this, new PoolSDKCallBackListener() { |
| 50 | @Override | 51 | @Override |
| 51 | public void poolSdkCallBack(int code, String msg) { | 52 | public void poolSdkCallBack(int code, String msg) { |
| 52 | // TODO Auto-generated method stub | 53 | // TODO Auto-generated method stub |
| 54 | + PoolSdkLog.logInfo("callback: code:" + code + "msg:" + msg); | ||
| 53 | switch (code) { | 55 | switch (code) { |
| 54 | - case PoolSDKCode.POOLSDK_INIT_SUCCESS://初始化成功 | 56 | + case PoolSDKCode.POOLSDK_INIT_SUCCESS:// 初始化成功 |
| 55 | PoolSdkLog.logInfo("游戏中POOLSDK_INIT_SUCCESS"); | 57 | PoolSdkLog.logInfo("游戏中POOLSDK_INIT_SUCCESS"); |
| 56 | login(); | 58 | login(); |
| 57 | break; | 59 | break; |
| ... | @@ -61,9 +63,8 @@ public class AppActivity extends Activity { | ... | @@ -61,9 +63,8 @@ public class AppActivity extends Activity { |
| 61 | break; | 63 | break; |
| 62 | } | 64 | } |
| 63 | } | 65 | } |
| 64 | - }); | 66 | + });// init(this);// this为游戏的activity对象 |
| 65 | 67 | ||
| 66 | - //注销账号监听(在SDK账号注销时回调通知,游戏可在此处理切换账号逻辑) | ||
| 67 | PoolSdkHelper.setLogoutCallback(new PoolLogoutListener() { | 68 | PoolSdkHelper.setLogoutCallback(new PoolLogoutListener() { |
| 68 | @Override | 69 | @Override |
| 69 | public void onLogoutSuccess() { | 70 | public void onLogoutSuccess() { |
| ... | @@ -80,40 +81,49 @@ public class AppActivity extends Activity { | ... | @@ -80,40 +81,49 @@ public class AppActivity extends Activity { |
| 80 | super.onStart(); | 81 | super.onStart(); |
| 81 | PoolSdkHelper.onStart(); | 82 | PoolSdkHelper.onStart(); |
| 82 | } | 83 | } |
| 84 | + | ||
| 83 | @Override | 85 | @Override |
| 84 | public void onStop() { | 86 | public void onStop() { |
| 85 | super.onStop(); | 87 | super.onStop(); |
| 86 | PoolSdkHelper.onStop(); | 88 | PoolSdkHelper.onStop(); |
| 87 | } | 89 | } |
| 90 | + | ||
| 91 | + @Override | ||
| 92 | + public void onDestroy() { | ||
| 93 | + super.onDestroy(); | ||
| 94 | + PoolSdkHelper.onDestroy(); | ||
| 95 | + } | ||
| 96 | + | ||
| 88 | @Override | 97 | @Override |
| 89 | public void onResume() { | 98 | public void onResume() { |
| 90 | super.onResume(); | 99 | super.onResume(); |
| 91 | PoolSdkHelper.onResume(); | 100 | PoolSdkHelper.onResume(); |
| 92 | } | 101 | } |
| 102 | + | ||
| 93 | @Override | 103 | @Override |
| 94 | public void onPause() { | 104 | public void onPause() { |
| 95 | super.onPause(); | 105 | super.onPause(); |
| 96 | PoolSdkHelper.onPause(); | 106 | PoolSdkHelper.onPause(); |
| 107 | + | ||
| 97 | } | 108 | } |
| 109 | + | ||
| 98 | @Override | 110 | @Override |
| 99 | public void onRestart() { | 111 | public void onRestart() { |
| 100 | super.onRestart(); | 112 | super.onRestart(); |
| 101 | PoolSdkHelper.onRestart(); | 113 | PoolSdkHelper.onRestart(); |
| 102 | } | 114 | } |
| 103 | - @Override | 115 | + |
| 104 | - public void onDestroy() { | ||
| 105 | - super.onDestroy(); | ||
| 106 | - PoolSdkHelper.onDestroy(); | ||
| 107 | - } | ||
| 108 | @Override | 116 | @Override |
| 109 | public void onNewIntent(Intent intent) { | 117 | public void onNewIntent(Intent intent) { |
| 110 | super.onNewIntent(intent); | 118 | super.onNewIntent(intent); |
| 111 | PoolSdkHelper.onNewIntent(intent); | 119 | PoolSdkHelper.onNewIntent(intent); |
| 112 | } | 120 | } |
| 121 | + | ||
| 113 | @Override | 122 | @Override |
| 114 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 123 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
| 115 | PoolSdkHelper.onActivityResult(requestCode, resultCode, data); | 124 | PoolSdkHelper.onActivityResult(requestCode, resultCode, data); |
| 116 | } | 125 | } |
| 126 | + | ||
| 117 | @Override | 127 | @Override |
| 118 | public void onConfigurationChanged(Configuration newConfig) { | 128 | public void onConfigurationChanged(Configuration newConfig) { |
| 119 | // TODO Auto-generated method stub | 129 | // TODO Auto-generated method stub |
| ... | @@ -122,10 +132,38 @@ public class AppActivity extends Activity { | ... | @@ -122,10 +132,38 @@ public class AppActivity extends Activity { |
| 122 | } | 132 | } |
| 123 | 133 | ||
| 124 | @Override | 134 | @Override |
| 135 | + protected void onSaveInstanceState(Bundle outState) { | ||
| 136 | + // TODO Auto-generated method stub | ||
| 137 | + super.onSaveInstanceState(outState); | ||
| 138 | + PoolSdkHelper.onSaveInstanceState(outState); | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + @Override | ||
| 142 | + protected void onRestoreInstanceState(Bundle savedInstanceState) { | ||
| 143 | + // TODO Auto-generated method stub | ||
| 144 | + super.onRestoreInstanceState(savedInstanceState); | ||
| 145 | + PoolSdkHelper.onRestoreInstanceState(savedInstanceState); | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + @Override | ||
| 149 | + public void onWindowFocusChanged(boolean hasFocus) { | ||
| 150 | + // TODO Auto-generated method stub | ||
| 151 | + super.onWindowFocusChanged(hasFocus); | ||
| 152 | + PoolSdkHelper.onWindowFocusChanged(hasFocus); | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + @Override | ||
| 156 | + public void onWindowAttributesChanged(LayoutParams params) { | ||
| 157 | + // TODO Auto-generated method stub | ||
| 158 | + super.onWindowAttributesChanged(params); | ||
| 159 | + PoolSdkHelper.onWindowAttributesChanged(params); | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + @Override | ||
| 125 | public boolean dispatchKeyEvent(KeyEvent pKeyEvent) { | 163 | public boolean dispatchKeyEvent(KeyEvent pKeyEvent) { |
| 126 | if (pKeyEvent.getKeyCode() == KeyEvent.KEYCODE_BACK | 164 | if (pKeyEvent.getKeyCode() == KeyEvent.KEYCODE_BACK |
| 127 | && pKeyEvent.getAction() == KeyEvent.ACTION_DOWN) { | 165 | && pKeyEvent.getAction() == KeyEvent.ACTION_DOWN) { |
| 128 | - if (PoolSdkHelper.hasExitDialog()) {//判断SDK是否含有退出框 | 166 | + if (PoolSdkHelper.hasExitDialog()) { |
| 129 | PoolSdkHelper.showExitDialog(new PoolExitDialogListener() { | 167 | PoolSdkHelper.showExitDialog(new PoolExitDialogListener() { |
| 130 | @Override | 168 | @Override |
| 131 | public void onDialogResult(int code, String msg) { | 169 | public void onDialogResult(int code, String msg) { |
| ... | @@ -134,7 +172,7 @@ public class AppActivity extends Activity { | ... | @@ -134,7 +172,7 @@ public class AppActivity extends Activity { |
| 134 | case PoolSDKCode.EXIT_SUCCESS:// 退出成功游戏处理自己退出逻辑 | 172 | case PoolSDKCode.EXIT_SUCCESS:// 退出成功游戏处理自己退出逻辑 |
| 135 | finish(); | 173 | finish(); |
| 136 | break; | 174 | break; |
| 137 | - case PoolSDKCode.EXIT_CANCEL://取消退出 | 175 | + case PoolSDKCode.EXIT_CANCEL:// 取消退出 |
| 138 | break; | 176 | break; |
| 139 | default: | 177 | default: |
| 140 | break; | 178 | break; |
| ... | @@ -203,10 +241,11 @@ public class AppActivity extends Activity { | ... | @@ -203,10 +241,11 @@ public class AppActivity extends Activity { |
| 203 | yaSwitchAccountBt = (Button) findViewById(getRedIdByName( | 241 | yaSwitchAccountBt = (Button) findViewById(getRedIdByName( |
| 204 | "ya_switch_account_bt", "id")); | 242 | "ya_switch_account_bt", "id")); |
| 205 | yaSwitchAccountBt.setText("切换账号"); | 243 | yaSwitchAccountBt.setText("切换账号"); |
| 206 | - | ||
| 207 | - forumBt = (Button)findViewById(getRedIdByName("forum_bt", "id")); | ||
| 208 | - forumBt.setText("打开论坛"); | ||
| 209 | PoolSdkLog.logError("" + yaPayBt + "yachannel:" + yaChannelCenter); | 244 | PoolSdkLog.logError("" + yaPayBt + "yachannel:" + yaChannelCenter); |
| 245 | + | ||
| 246 | + yaLogoutBt = (Button) findViewById(getRedIdByName("logout_bt", "id")); | ||
| 247 | + | ||
| 248 | + yaForumBt = (Button) findViewById(getRedIdByName("forum_bt", "id")); | ||
| 210 | } | 249 | } |
| 211 | 250 | ||
| 212 | public void yaOnClick(View view) { | 251 | public void yaOnClick(View view) { |
| ... | @@ -215,7 +254,7 @@ public class AppActivity extends Activity { | ... | @@ -215,7 +254,7 @@ public class AppActivity extends Activity { |
| 215 | } else if (view == yaEnterGameBt) { | 254 | } else if (view == yaEnterGameBt) { |
| 216 | setContentView(getRedIdByName("public_sdk_self_game", "layout"));// (R.layout.game); | 255 | setContentView(getRedIdByName("public_sdk_self_game", "layout"));// (R.layout.game); |
| 217 | initGameView(); | 256 | initGameView(); |
| 218 | - PoolReport.reportEnterGame("chufan", 11, "201"); | 257 | + PoolReport.reportEnterGame("chufan","角色名", 12, "201","服务器名"); |
| 219 | } else if (view == yaPayBt) { | 258 | } else if (view == yaPayBt) { |
| 220 | pay(); | 259 | pay(); |
| 221 | } else if (view == yaSubmitRoleDataBt) { | 260 | } else if (view == yaSubmitRoleDataBt) { |
| ... | @@ -224,18 +263,24 @@ public class AppActivity extends Activity { | ... | @@ -224,18 +263,24 @@ public class AppActivity extends Activity { |
| 224 | channelCenter(); | 263 | channelCenter(); |
| 225 | } else if (view == yaSwitchAccountBt) { | 264 | } else if (view == yaSwitchAccountBt) { |
| 226 | switchAccount(); | 265 | switchAccount(); |
| 227 | - }else if(view == forumBt){ | 266 | + } else if (view == yaLogoutBt){ |
| 267 | + logout(); | ||
| 268 | + } else if (view == yaForumBt){ | ||
| 228 | openForum(); | 269 | openForum(); |
| 229 | } | 270 | } |
| 230 | } | 271 | } |
| 231 | 272 | ||
| 232 | private void openForum(){ | 273 | private void openForum(){ |
| 233 | - Toast.makeText(this, "打开论坛", Toast.LENGTH_SHORT).show(); | ||
| 234 | PoolSdkHelper.openForum(); | 274 | PoolSdkHelper.openForum(); |
| 235 | } | 275 | } |
| 236 | 276 | ||
| 237 | - private void login() { | 277 | + private void logout(){ |
| 278 | + PoolSdkHelper.logout(this);//结果回调通知到PoolLogoutListener | ||
| 279 | + if(PoolSdkHelper.hasLogout()){ | ||
| 280 | + } | ||
| 281 | + } | ||
| 238 | 282 | ||
| 283 | + private void login() { | ||
| 239 | PoolSdkHelper.login("登录自定义字段", new PoolLoginListener() { | 284 | PoolSdkHelper.login("登录自定义字段", new PoolLoginListener() { |
| 240 | @Override | 285 | @Override |
| 241 | public void onLoginSuccess(PoolLoginInfo poolLoginInfo) { | 286 | public void onLoginSuccess(PoolLoginInfo poolLoginInfo) { |
| ... | @@ -244,6 +289,7 @@ public class AppActivity extends Activity { | ... | @@ -244,6 +289,7 @@ public class AppActivity extends Activity { |
| 244 | String serverSign = poolLoginInfo.getServerSign(); | 289 | String serverSign = poolLoginInfo.getServerSign(); |
| 245 | String openId = poolLoginInfo.getOpenID(); | 290 | String openId = poolLoginInfo.getOpenID(); |
| 246 | // TODO: 把以上信息发送给游戏服务端做登录校验,需要其他信息请从poolLoginInfo对象中获取 | 291 | // TODO: 把以上信息发送给游戏服务端做登录校验,需要其他信息请从poolLoginInfo对象中获取 |
| 292 | + | ||
| 247 | System.out.println("登录成功 userType = " + userType | 293 | System.out.println("登录成功 userType = " + userType |
| 248 | + "; timestamp = " + timestamp + "; serverSign = " | 294 | + "; timestamp = " + timestamp + "; serverSign = " |
| 249 | + serverSign + "; openId = " + openId); | 295 | + serverSign + "; openId = " + openId); |
| ... | @@ -255,11 +301,9 @@ public class AppActivity extends Activity { | ... | @@ -255,11 +301,9 @@ public class AppActivity extends Activity { |
| 255 | } | 301 | } |
| 256 | }); | 302 | }); |
| 257 | } | 303 | } |
| 258 | - /** | 304 | + |
| 259 | - * 充值接口 | ||
| 260 | - */ | ||
| 261 | private void pay() { | 305 | private void pay() { |
| 262 | - PoolPayInfo poolPayInfo = new PoolPayInfo(); | 306 | + final PoolPayInfo poolPayInfo = new PoolPayInfo(); |
| 263 | 307 | ||
| 264 | /******************************************** | 308 | /******************************************** |
| 265 | * 以下所有字段都是必填项 | 309 | * 以下所有字段都是必填项 |
| ... | @@ -287,6 +331,7 @@ public class AppActivity extends Activity { | ... | @@ -287,6 +331,7 @@ public class AppActivity extends Activity { |
| 287 | // 自定义参数 | 331 | // 自定义参数 |
| 288 | poolPayInfo.setCustom("我是自定义参数"); | 332 | poolPayInfo.setCustom("我是自定义参数"); |
| 289 | 333 | ||
| 334 | + // TODO Auto-generated method stub | ||
| 290 | PoolSdkHelper.pay(poolPayInfo, new PoolPayListener() { | 335 | PoolSdkHelper.pay(poolPayInfo, new PoolPayListener() { |
| 291 | 336 | ||
| 292 | @Override | 337 | @Override |
| ... | @@ -300,6 +345,7 @@ public class AppActivity extends Activity { | ... | @@ -300,6 +345,7 @@ public class AppActivity extends Activity { |
| 300 | + errorMsg); | 345 | + errorMsg); |
| 301 | } | 346 | } |
| 302 | }); | 347 | }); |
| 348 | + | ||
| 303 | } | 349 | } |
| 304 | 350 | ||
| 305 | /** | 351 | /** |
| ... | @@ -318,8 +364,16 @@ public class AppActivity extends Activity { | ... | @@ -318,8 +364,16 @@ public class AppActivity extends Activity { |
| 318 | poolRoleInfo.setRoleName("我是角色名"); | 364 | poolRoleInfo.setRoleName("我是角色名"); |
| 319 | poolRoleInfo.setServerID("1"); | 365 | poolRoleInfo.setServerID("1"); |
| 320 | poolRoleInfo.setServerName("我是服务器名"); | 366 | poolRoleInfo.setServerName("我是服务器名"); |
| 321 | - poolRoleInfo.setCustom(System.currentTimeMillis()/1000+"");//游戏创建角色时间 以秒为单位 | 367 | + poolRoleInfo.setCustom("角色创建时间"); |
| 322 | - poolRoleInfo.setCallType(PoolRoleInfo.Type_EnterGame);//1、登录游戏主场景 2、创建角色 3、角色升级 | 368 | + poolRoleInfo.setRoleCTime(System.currentTimeMillis()/1000);//角色创建时间(秒) |
| 369 | + poolRoleInfo.setPartyName("公会名称"); | ||
| 370 | + poolRoleInfo.setRoleType("狂战");//角色类型 | ||
| 371 | + poolRoleInfo.setRoleChangeTime(System.currentTimeMillis()/1000);//角色更新时间 | ||
| 372 | + poolRoleInfo.setVipLevel("10");//vip等级 | ||
| 373 | + poolRoleInfo.setDiamond("1000");//余额 | ||
| 374 | + poolRoleInfo.setMoneyType("金币");//商品单位 | ||
| 375 | + | ||
| 376 | + poolRoleInfo.setCallType(PoolRoleInfo.Type_EnterGame); | ||
| 323 | // poolRoleInfo.setCallType(PoolRoleInfo.Type_CreateRole); | 377 | // poolRoleInfo.setCallType(PoolRoleInfo.Type_CreateRole); |
| 324 | // poolRoleInfo.setCallType(PoolRoleInfo.Type_RoleUpgrade); | 378 | // poolRoleInfo.setCallType(PoolRoleInfo.Type_RoleUpgrade); |
| 325 | 379 | ||
| ... | @@ -334,8 +388,8 @@ public class AppActivity extends Activity { | ... | @@ -334,8 +388,8 @@ public class AppActivity extends Activity { |
| 334 | /** | 388 | /** |
| 335 | * 用户中心 | 389 | * 用户中心 |
| 336 | * | 390 | * |
| 337 | - * 游戏方先调用PoolSDKHelper.hasChannelCenter()获取是否有用户中心, | 391 | + * 游戏方先调用YASDKHelper.hasChannelCenter()获取是否有用户中心, |
| 338 | - * 如果有的话,游戏中需要添加按钮,点击按钮调用PoolSDKHelper.openChannelCenter(); | 392 | + * 如果有的话,游戏中需要添加按钮,点击按钮调用YASDKHelper.openChannelCenter(); |
| 339 | * 如果没有,则不需要显示按钮,也不用调用下面的接口 | 393 | * 如果没有,则不需要显示按钮,也不用调用下面的接口 |
| 340 | */ | 394 | */ |
| 341 | private void channelCenter() { | 395 | private void channelCenter() { |
| ... | @@ -343,16 +397,11 @@ public class AppActivity extends Activity { | ... | @@ -343,16 +397,11 @@ public class AppActivity extends Activity { |
| 343 | } | 397 | } |
| 344 | 398 | ||
| 345 | /** | 399 | /** |
| 346 | - * 切换帐号(使用用户中心中的切换账号) | 400 | + * 切换帐号 |
| 347 | */ | 401 | */ |
| 348 | private void switchAccount() { | 402 | private void switchAccount() { |
| 349 | - boolean hasChannelCenter = PoolSdkHelper.hasChannelCenter(); | 403 | + if(PoolSdkHelper.hasSwitchAccount()){ |
| 350 | - if(hasChannelCenter){ | 404 | + PoolSdkHelper.switchAccount(this); |
| 351 | - PoolSdkHelper.openChannelCenter();//打开用户中心 | ||
| 352 | - }else{//如果没有用户中心 游戏自己处理切换账号逻辑 | ||
| 353 | - setContentView(getRedIdByName("public_sdk_self_game_login", | ||
| 354 | - "layout"));// (R.layout.game_login); | ||
| 355 | - initLoginView(); | ||
| 356 | } | 405 | } |
| 357 | } | 406 | } |
| 358 | 407 | ||
| ... | @@ -361,6 +410,7 @@ public class AppActivity extends Activity { | ... | @@ -361,6 +410,7 @@ public class AppActivity extends Activity { |
| 361 | */ | 410 | */ |
| 362 | private void expansionInterface() { | 411 | private void expansionInterface() { |
| 363 | PoolSdkHelper.expansionInterface("自定义参数", new PoolExpansionListener() { | 412 | PoolSdkHelper.expansionInterface("自定义参数", new PoolExpansionListener() { |
| 413 | + | ||
| 364 | @Override | 414 | @Override |
| 365 | public void onSuccess(String paramCustom) { | 415 | public void onSuccess(String paramCustom) { |
| 366 | 416 | ... | ... |
No preview for this file type
-
Please register or login to post a comment