1556138063

add public android sdk

Showing 41 changed files with 843 additions and 0 deletions
No preview for this file type
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<config>
3 +
4 + <sdkconfig
5 + appClientKey="9DtxPtUrzYU0uTBGGMJzKyhKAK5t2O9i"
6 + appId="Dz8T95TrG9d/WVIWAPZviuaV7Tbko3oAlqDCYpNKkTU="
7 + channelparameter1="4uc0/gEfNt4="
8 + channelparameter2="4uc0/gEfNt4="
9 + custom="T7w9VvhA5tQ="
10 + gamechannelid="4uc0/gEfNt4="
11 + gamesimplename="qcFlv/sgri8oQ6xDbE0odg=="
12 + logincheckurl="Xwm2VZk4IZHw4pR8WSu0JRSPl5jMDzA8+5nKH+jNJckQW+5uHcG5Mxl+gMWO6s8PhqrR0VX7irk="
13 + paycheckurl="Xwm2VZk4IZHw4pR8WSu0JRSPl5jMDzA8+5nKH+jNJclRWohb/BPqZ4ChH88g5ubtvsBW3D32B8c="
14 + payorderurl="Xwm2VZk4IZHw4pR8WSu0JRSPl5jMDzA8+5nKH+jNJclRWohb/BPqZ4SO5qrmq1RBsIoFXavzUfg="
15 + sdksimplename="vWVsU5Ogkh8="
16 + sdkversioncode="BVPAQexcXDk="
17 + styleName="4N7gnKed6uk="
18 + usertype="gssaXIIEiL0="
19 + weixinId="x3d4hSeP9KFDTFusyU+iB/9NgyvRyoop"
20 + payCallbackUrl = "http://51wang"
21 + />
22 +
23 +</config>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<classpath>
3 + <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
4 + <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
5 + <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
6 + <classpathentry kind="src" path="src"/>
7 + <classpathentry kind="src" path="gen"/>
8 + <classpathentry kind="output" path="bin/classes"/>
9 +</classpath>
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<projectDescription>
3 + <name>Demo_PoolSdk</name>
4 + <comment></comment>
5 + <projects>
6 + </projects>
7 + <buildSpec>
8 + <buildCommand>
9 + <name>org.python.pydev.PyDevBuilder</name>
10 + <arguments>
11 + </arguments>
12 + </buildCommand>
13 + <buildCommand>
14 + <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
15 + <arguments>
16 + </arguments>
17 + </buildCommand>
18 + <buildCommand>
19 + <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
20 + <arguments>
21 + </arguments>
22 + </buildCommand>
23 + <buildCommand>
24 + <name>org.eclipse.jdt.core.javabuilder</name>
25 + <arguments>
26 + </arguments>
27 + </buildCommand>
28 + <buildCommand>
29 + <name>com.android.ide.eclipse.adt.ApkBuilder</name>
30 + <arguments>
31 + </arguments>
32 + </buildCommand>
33 + </buildSpec>
34 + <natures>
35 + <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
36 + <nature>org.eclipse.jdt.core.javanature</nature>
37 + <nature>org.python.pydev.pythonNature</nature>
38 + </natures>
39 +</projectDescription>
1 +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 +<?eclipse-pydev version="1.0"?><pydev_project>
3 +<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
4 +<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
5 +</pydev_project>
1 +eclipse.preferences.version=1
2 +encoding/<project>=UTF-8
1 +eclipse.preferences.version=1
2 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
3 +org.eclipse.jdt.core.compiler.compliance=1.6
4 +org.eclipse.jdt.core.compiler.source=1.6
1 +@echo off
2 +cd /d %~dp0
3 +"%ANT_ROOT%\bin\ant" clean release -f build.xml
4 +pause
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 + package="com.youai.foolsdk.demo"
4 + android:versionCode="1"
5 + android:versionName="1.0" >
6 +
7 + <uses-sdk
8 + android:minSdkVersion="8"
9 + android:targetSdkVersion="19" />
10 +
11 + <uses-permission android:name="android.permission.INTERNET" >
12 + </uses-permission>
13 + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
14 + <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
15 + <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
16 + <uses-permission android:name="android.permission.INTERNET" />
17 + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
18 + <uses-permission android:name="android.permission.READ_PHONE_STATE" />
19 + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
20 + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
21 + <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
22 + <uses-permission android:name="android.permission.READ_LOGS" />
23 + <uses-permission android:name="android.permission.GET_TASKS" />
24 +
25 + <application
26 + android:name="com.gzyouai.publicsdk.application.PoolSDKApplication"
27 + android:allowBackup="true"
28 + android:icon="@drawable/public_sdk_self_ic_launcher"
29 + android:label="@string/app_name" >
30 + <activity
31 + android:name="com.youai.foolsdk.demo.AppActivity"
32 + android:configChanges="keyboardHidden|orientation|screenSize"
33 + android:label="@string/app_name"
34 + android:screenOrientation="landscape"
35 + android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
36 + <intent-filter>
37 + <action android:name="android.intent.action.MAIN" />
38 +
39 + <category android:name="android.intent.category.LAUNCHER" />
40 + </intent-filter>
41 + </activity>
42 +
43 + <!-- start YouaiSDK -->
44 + <receiver
45 + android:name="com.gzyouai.fengniao.sdk.framework.AppInstallReceiver"
46 + android:label="@string/app_name" >
47 + <intent-filter>
48 + <action android:name="android.intent.action.PACKAGE_ADDED" />
49 + <action android:name="android.intent.action.PACKAGE_REPLACED" />
50 + <action android:name="android.intent.action.PACKAGE_REMOVED" />
51 +
52 + <data android:scheme="package" />
53 + </intent-filter>
54 + </receiver>
55 + <!-- start i9133 -->
56 + <activity
57 + android:name=".wxapi.WXPayEntryActivity"
58 + android:exported="true"
59 + android:launchMode="singleTop" />
60 + <activity
61 + android:name="com.youai.sdk.YouaiSDK"
62 + android:label="youai_sdk"
63 + android:theme="@android:style/Theme.Dialog" >
64 + </activity>
65 +
66 + <service
67 + android:name="com.youai.sdk.YouaiService"
68 + android:enabled="true" >
69 + <intent-filter>
70 + <action android:name="com.youai.sdk.YouaiService" />
71 + </intent-filter>
72 + </service>
73 + <service
74 + android:name="com.youai.sdk.FloatViewService"
75 + android:enabled="true"
76 + android:exported="true" >
77 + <intent-filter>
78 + <action android:name="com.youai.sdk.FloatViewService" />
79 + </intent-filter>
80 + </service>
81 +
82 + <receiver android:name="com.youai.sdk.Receiver" >
83 + <intent-filter>
84 + <action android:name="android.intent.action.BOOT_COMPLETED" >
85 + </action>
86 +
87 + <category android:name="android.intent.category.LAUNCHER" />
88 + </intent-filter>
89 + </receiver>
90 +
91 + <activity
92 + android:name="com.alipay.sdk.app.H5PayActivity"
93 + android:configChanges="orientation|keyboardHidden|navigation"
94 + android:exported="false"
95 + android:screenOrientation="behind" >
96 + </activity>
97 + <activity
98 + android:name="com.alipay.sdk.auth.AuthActivity"
99 + android:configChanges="orientation|keyboardHidden|navigation"
100 + android:exported="false"
101 + android:screenOrientation="behind" >
102 + </activity>
103 + <!-- end i9133 -->
104 +
105 + </application>
106 +
107 +</manifest>
...\ No newline at end of file ...\ No newline at end of file
1 +# This file is used to override default values used by the Ant build system.
2 +#
3 +# This file must be checked into Version Control Systems, as it is
4 +# integral to the build system of your project.
5 +
6 +# This file is only used by the Ant script.
7 +
8 +# You can use this to override default values such as
9 +# 'source.dir' for the location of your java source folder and
10 +# 'out.dir' for the location of your output folder.
11 +
12 +# You can also use it define how the release builds are signed by declaring
13 +# the following properties:
14 +# 'key.store' for the location of your keystore and
15 +# 'key.alias' for the name of the key to use.
16 +# The password will be asked during the build when you use the 'release' target.
17 +
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<config>
3 +
4 + <sdkconfig
5 + appClientKey="9DtxPtUrzYU0uTBGGMJzKyhKAK5t2O9i"
6 + appId="Dz8T95TrG9d/WVIWAPZviuaV7Tbko3oAlqDCYpNKkTU="
7 + channelparameter1="4uc0/gEfNt4="
8 + channelparameter2="4uc0/gEfNt4="
9 + custom="T7w9VvhA5tQ="
10 + gamechannelid="4uc0/gEfNt4="
11 + gamesimplename="qcFlv/sgri8oQ6xDbE0odg=="
12 + logincheckurl="Xwm2VZk4IZHw4pR8WSu0JRSPl5jMDzA8+5nKH+jNJckQW+5uHcG5Mxl+gMWO6s8PhqrR0VX7irk="
13 + paycheckurl="Xwm2VZk4IZHw4pR8WSu0JRSPl5jMDzA8+5nKH+jNJclRWohb/BPqZ4ChH88g5ubtvsBW3D32B8c="
14 + payorderurl="Xwm2VZk4IZHw4pR8WSu0JRSPl5jMDzA8+5nKH+jNJclRWohb/BPqZ4SO5qrmq1RBsIoFXavzUfg="
15 + sdksimplename="vWVsU5Ogkh8="
16 + sdkversioncode="BVPAQexcXDk="
17 + styleName="yvfh/4zhaEQ="
18 + usertype="gssaXIIEiL0="
19 + weixinId="x3d4hSeP9KFDTFusyU+iB/9NgyvRyoop"
20 + payCallbackUrl = "http://51wang"
21 + />
22 +
23 +</config>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<project name="PoolSdk" default="help">
3 +
4 + <!-- The local.properties file is created and updated by the 'android' tool.
5 + It contains the path to the SDK. It should *NOT* be checked into
6 + Version Control Systems. -->
7 + <property file="local.properties" />
8 +
9 + <!-- The ant.properties file can be created by you. It is only edited by the
10 + 'android' tool to add properties to it.
11 + This is the place to change some Ant specific build properties.
12 + Here are some properties you may want to change/update:
13 +
14 + source.dir
15 + The name of the source directory. Default is 'src'.
16 + out.dir
17 + The name of the output directory. Default is 'bin'.
18 +
19 + For other overridable properties, look at the beginning of the rules
20 + files in the SDK, at tools/ant/build.xml
21 +
22 + Properties related to the SDK location or the project target should
23 + be updated using the 'android' tool with the 'update' action.
24 +
25 + This file is an integral part of the build system for your
26 + application and should be checked into Version Control Systems.
27 +
28 + -->
29 + <property file="ant.properties" />
30 +
31 + <!-- if sdk.dir was not set from one of the property file, then
32 + get it from the ANDROID_HOME env var.
33 + This must be done before we load project.properties since
34 + the proguard config can use sdk.dir -->
35 + <property environment="env" />
36 + <condition property="sdk.dir" value="${env.ANDROID_HOME}">
37 + <isset property="env.ANDROID_HOME" />
38 + </condition>
39 +
40 + <!-- The project.properties file is created and updated by the 'android'
41 + tool, as well as ADT.
42 +
43 + This contains project specific properties such as project target, and library
44 + dependencies. Lower level build properties are stored in ant.properties
45 + (or in .classpath for Eclipse projects).
46 +
47 + This file is an integral part of the build system for your
48 + application and should be checked into Version Control Systems. -->
49 + <loadproperties srcFile="project.properties" />
50 +
51 + <!-- quick check on sdk.dir -->
52 + <fail
53 + message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
54 + unless="sdk.dir"
55 + />
56 +
57 + <!--
58 + Import per project custom build rules if present at the root of the project.
59 + This is the place to put custom intermediary targets such as:
60 + -pre-build
61 + -pre-compile
62 + -post-compile (This is typically used for code obfuscation.
63 + Compiled code location: ${out.classes.absolute.dir}
64 + If this is not done in place, override ${out.dex.input.absolute.dir})
65 + -post-package
66 + -post-build
67 + -pre-clean
68 + -->
69 + <import file="custom_rules.xml" optional="true" />
70 +
71 + <!-- Import the actual build file.
72 +
73 + To customize existing targets, there are two options:
74 + - Customize only one target:
75 + - copy/paste the target into this file, *before* the
76 + <import> task.
77 + - customize it to your needs.
78 + - Customize the whole content of build.xml
79 + - copy/paste the content of the rules files (minus the top node)
80 + into this file, replacing the <import> task.
81 + - customize to your needs.
82 +
83 + ***********************
84 + ****** IMPORTANT ******
85 + ***********************
86 + In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
87 + in order to avoid having your file be overridden by tools such as "android update project"
88 + -->
89 + <!-- version-tag: 1 -->
90 + <import file="${sdk.dir}/tools/ant/build.xml" />
91 +
92 +</project>
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<lint>
3 +</lint>
...\ No newline at end of file ...\ No newline at end of file
1 +# This file is automatically generated by Android Tools.
2 +# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 +#
4 +# This file must *NOT* be checked into Version Control Systems,
5 +# as it contains information specific to your local configuration.
6 +
7 +# location of the SDK. This is only used by Ant
8 +# For customization when using a Version Control System, please read the
9 +# header note.
10 +sdk.dir=D:\\android\\sdk
1 +# To enable ProGuard in your project, edit project.properties
2 +# to define the proguard.config property as described in that file.
3 +#
4 +# Add project specific ProGuard rules here.
5 +# By default, the flags in this file are appended to flags specified
6 +# in ${sdk.dir}/tools/proguard/proguard-android.txt
7 +# You can edit the include path and order by changing the ProGuard
8 +# include property in project.properties.
9 +#
10 +# For more details, see
11 +# http://developer.android.com/guide/developing/tools/proguard.html
12 +
13 +# Add any project specific keep options here:
14 +
15 +# If your project uses WebView with JS, uncomment the following
16 +# and specify the fully qualified class name to the JavaScript interface
17 +# class:
18 +#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 +# public *;
20 +#}
1 +# This file is automatically generated by Android Tools.
2 +# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 +#
4 +# This file must be checked in Version Control Systems.
5 +#
6 +# To customize properties used by the Ant build system edit
7 +# "ant.properties", and override values to adapt the script to your
8 +# project structure.
9 +#
10 +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 +
13 +# Project target.
14 +target=android-19
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<selector xmlns:android="http://schemas.android.com/apk/res/android" >
3 + <item android:drawable="@drawable/public_sdk_self_demo_btn_main_s" android:state_selected="true"/>
4 + <item android:drawable="@drawable/public_sdk_self_demo_btn_main_s" android:state_pressed="true"/>
5 + <item android:drawable="@drawable/public_sdk_self_demo_btn_main_n"/>
6 +</selector>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<selector xmlns:android="http://schemas.android.com/apk/res/android" >
3 + <item android:drawable="@drawable/public_sdk_self_demo_btn_login_s" android:state_selected="true"/>
4 + <item android:drawable="@drawable/public_sdk_self_demo_btn_login_s" android:state_pressed="true"/>
5 + <item android:drawable="@drawable/public_sdk_self_demo_btn_login_n"/>
6 +</selector>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:layout_width="match_parent"
4 + android:layout_height="match_parent"
5 + android:background="@drawable/public_sdk_self_demo_main" >
6 +
7 + <Button
8 + android:id="@+id/ya_pay_bt"
9 + android:layout_width="wrap_content"
10 + android:layout_height="wrap_content"
11 + android:layout_alignParentLeft="true"
12 + android:layout_alignParentTop="true"
13 + android:layout_marginLeft="14dp"
14 + android:layout_marginTop="53dp"
15 + android:background="@drawable/public_sdk_self_ya_bt_selector"
16 + android:onClick="yaOnClick"/>
17 +
18 + <Button
19 + android:id="@+id/ya_submit_role_data_bt"
20 + android:layout_width="wrap_content"
21 + android:layout_height="wrap_content"
22 + android:layout_alignLeft="@+id/ya_pay_bt"
23 + android:layout_alignParentBottom="true"
24 + android:layout_marginBottom="75dp"
25 + android:background="@drawable/public_sdk_self_ya_bt_selector"
26 + android:onClick="yaOnClick"/>
27 +
28 + <Button
29 + android:id="@+id/ya_channel_center"
30 + android:layout_width="wrap_content"
31 + android:layout_height="wrap_content"
32 + android:layout_alignParentRight="true"
33 + android:layout_alignTop="@+id/ya_pay_bt"
34 + android:background="@drawable/public_sdk_self_ya_bt_selector"
35 + android:onClick="yaOnClick"/>
36 +
37 + <Button
38 + android:id="@+id/ya_switch_account_bt"
39 + android:layout_width="wrap_content"
40 + android:layout_height="wrap_content"
41 + android:layout_alignParentRight="true"
42 + android:layout_alignTop="@+id/ya_submit_role_data_bt"
43 + android:background="@drawable/public_sdk_self_ya_bt_selector"
44 + android:onClick="yaOnClick" />
45 +
46 + <Button
47 + android:id="@+id/forum_bt"
48 + android:layout_width="wrap_content"
49 + android:layout_height="wrap_content"
50 + android:layout_centerHorizontal="true"
51 + android:layout_centerVertical="true"
52 + android:background="@drawable/public_sdk_self_ya_bt_selector"
53 + android:onClick="yaOnClick" />
54 +
55 +</RelativeLayout>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 + android:layout_width="match_parent"
4 + android:background="@drawable/public_sdk_self_sdk_login_bg"
5 + android:layout_height="match_parent" >
6 +
7 + <Button
8 + android:id="@+id/ya_login_bt"
9 + android:layout_width="wrap_content"
10 + android:layout_height="wrap_content"
11 + android:layout_alignParentRight="true"
12 + android:layout_alignParentTop="true"
13 + android:layout_marginRight="28dp"
14 + android:layout_marginTop="21dp"
15 + android:background="@drawable/public_sdk_self_ya_login_bt_selector"
16 + android:onClick="yaOnClick" />
17 +
18 + <Button
19 + android:id="@+id/ya_enter_game_bt"
20 + android:layout_width="wrap_content"
21 + android:layout_height="wrap_content"
22 + android:layout_alignLeft="@+id/ya_login_bt"
23 + android:layout_below="@+id/ya_login_bt"
24 + android:layout_marginTop="28dp"
25 + android:background="@drawable/public_sdk_self_ya_login_bt_selector"
26 + android:onClick="yaOnClick"/>
27 +
28 +</RelativeLayout>
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<resources>
3 +
4 + <string name="app_name">SDK_Demo</string>
5 +
6 +</resources>
1 +package com.youai.foolsdk.demo;
2 +
3 +import android.app.Activity;
4 +import android.app.AlertDialog;
5 +import android.content.DialogInterface;
6 +import android.content.Intent;
7 +import android.content.res.Configuration;
8 +import android.os.Bundle;
9 +import android.view.KeyEvent;
10 +import android.view.View;
11 +import android.widget.Button;
12 +import android.widget.Toast;
13 +
14 +import com.gzyouai.fengniao.sdk.framework.PoolExitDialogListener;
15 +import com.gzyouai.fengniao.sdk.framework.PoolExitListener;
16 +import com.gzyouai.fengniao.sdk.framework.PoolExpansionListener;
17 +import com.gzyouai.fengniao.sdk.framework.PoolLoginInfo;
18 +import com.gzyouai.fengniao.sdk.framework.PoolLoginListener;
19 +import com.gzyouai.fengniao.sdk.framework.PoolLogoutListener;
20 +import com.gzyouai.fengniao.sdk.framework.PoolPayInfo;
21 +import com.gzyouai.fengniao.sdk.framework.PoolPayListener;
22 +import com.gzyouai.fengniao.sdk.framework.PoolReport;
23 +import com.gzyouai.fengniao.sdk.framework.PoolRoleInfo;
24 +import com.gzyouai.fengniao.sdk.framework.PoolRoleListener;
25 +import com.gzyouai.fengniao.sdk.framework.PoolSDKCallBackListener;
26 +import com.gzyouai.fengniao.sdk.framework.PoolSDKCode;
27 +import com.gzyouai.fengniao.sdk.framework.PoolSdkHelper;
28 +import com.gzyouai.fengniao.sdk.framework.PoolSdkLog;
29 +
30 +public class AppActivity extends Activity {
31 +
32 + private Button yaLoginBt;
33 + private Button yaEnterGameBt;
34 + private Button yaPayBt;
35 + private Button yaSubmitRoleDataBt;
36 + private Button yaChannelCenter;
37 + private Button yaSwitchAccountBt;
38 + private Button forumBt;
39 +
40 + @Override
41 + protected void onCreate(Bundle savedInstanceState) {
42 + super.onCreate(savedInstanceState);
43 + int layoutId = getResources().getIdentifier(
44 + "public_sdk_self_game_login", "layout", getPackageName());
45 + setContentView(layoutId);
46 + initLoginView();
47 + PoolSdkLog.setIsShowLog(true);//显示PoolSDK log
48 +
49 + PoolSdkHelper.init(this, new PoolSDKCallBackListener() {
50 + @Override
51 + public void poolSdkCallBack(int code, String msg) {
52 + // TODO Auto-generated method stub
53 + switch (code) {
54 + case PoolSDKCode.POOLSDK_INIT_SUCCESS://初始化成功
55 + PoolSdkLog.logInfo("游戏中POOLSDK_INIT_SUCCESS");
56 + login();
57 + break;
58 + case PoolSDKCode.POOLSDK_INIT_FAIL:
59 + break;
60 + default:
61 + break;
62 + }
63 + }
64 + });
65 +
66 + //注销账号监听(在SDK账号注销时回调通知,游戏可在此处理切换账号逻辑)
67 + PoolSdkHelper.setLogoutCallback(new PoolLogoutListener() {
68 + @Override
69 + public void onLogoutSuccess() {
70 + // TODO: 此处处理SDK登出的逻辑
71 + login();
72 + PoolSdkLog.logInfo("游戏中logoutSuccess");
73 + }
74 + });
75 +
76 + }
77 +
78 + @Override
79 + public void onStart() {
80 + super.onStart();
81 + PoolSdkHelper.onStart();
82 + }
83 + @Override
84 + public void onStop() {
85 + super.onStop();
86 + PoolSdkHelper.onStop();
87 + }
88 + @Override
89 + public void onResume() {
90 + super.onResume();
91 + PoolSdkHelper.onResume();
92 + }
93 + @Override
94 + public void onPause() {
95 + super.onPause();
96 + PoolSdkHelper.onPause();
97 + }
98 + @Override
99 + public void onRestart() {
100 + super.onRestart();
101 + PoolSdkHelper.onRestart();
102 + }
103 + @Override
104 + public void onDestroy() {
105 + super.onDestroy();
106 + PoolSdkHelper.onDestroy();
107 + }
108 + @Override
109 + public void onNewIntent(Intent intent) {
110 + super.onNewIntent(intent);
111 + PoolSdkHelper.onNewIntent(intent);
112 + }
113 + @Override
114 + protected void onActivityResult(int requestCode, int resultCode, Intent data) {
115 + PoolSdkHelper.onActivityResult(requestCode, resultCode, data);
116 + }
117 + @Override
118 + public void onConfigurationChanged(Configuration newConfig) {
119 + // TODO Auto-generated method stub
120 + super.onConfigurationChanged(newConfig);
121 + PoolSdkHelper.onConfigurationChanged(newConfig);
122 + }
123 +
124 + @Override
125 + public boolean dispatchKeyEvent(KeyEvent pKeyEvent) {
126 + if (pKeyEvent.getKeyCode() == KeyEvent.KEYCODE_BACK
127 + && pKeyEvent.getAction() == KeyEvent.ACTION_DOWN) {
128 + if (PoolSdkHelper.hasExitDialog()) {//判断SDK是否含有退出框
129 + PoolSdkHelper.showExitDialog(new PoolExitDialogListener() {
130 + @Override
131 + public void onDialogResult(int code, String msg) {
132 + // TODO Auto-generated method stub
133 + switch (code) {
134 + case PoolSDKCode.EXIT_SUCCESS:// 退出成功游戏处理自己退出逻辑
135 + finish();
136 + break;
137 + case PoolSDKCode.EXIT_CANCEL://取消退出
138 + break;
139 + default:
140 + break;
141 + }
142 + }
143 + });
144 + } else {
145 + // TODO: 调用游戏的退出界面
146 + showGameExitTips();
147 + }
148 + return false;
149 + }
150 + return super.dispatchKeyEvent(pKeyEvent);
151 + }
152 +
153 + private void showGameExitTips() {
154 + AlertDialog.Builder dialog = new AlertDialog.Builder(this);
155 + int ic_dialog_alert_id = getRedIdByName("ic_dialog_alert", "drawable");
156 + dialog.setIcon(ic_dialog_alert_id);
157 + dialog.setTitle("提示");
158 + dialog.setMessage("是否退出游戏?");
159 + dialog.setPositiveButton("确定", new DialogInterface.OnClickListener() {
160 + @Override
161 + public void onClick(DialogInterface dialog, int which) {
162 + PoolSdkHelper.exitGame(new PoolExitListener() {
163 + @Override
164 + public void onExitGame() {
165 + finish();
166 + }
167 + });
168 + }
169 + });
170 + dialog.setNegativeButton("取消", new DialogInterface.OnClickListener() {
171 + @Override
172 + public void onClick(DialogInterface dialog, int which) {
173 + dialog.dismiss();
174 + }
175 + });
176 + dialog.show();
177 + }
178 +
179 + private int getRedIdByName(String resName, String resType) {
180 + return getResources().getIdentifier(resName, resType, getPackageName());
181 + }
182 +
183 + private void initLoginView() {
184 + int ya_login_bt = getRedIdByName("ya_login_bt", "id");// getResources().getIdentifier("ya_login_bt",
185 + // "id",
186 + // getPackageName());
187 + yaLoginBt = (Button) findViewById(ya_login_bt);
188 + yaLoginBt.setText("登录");
189 + yaEnterGameBt = (Button) findViewById(getRedIdByName(
190 + "ya_enter_game_bt", "id"));
191 + yaEnterGameBt.setText("进入游戏");
192 + }
193 +
194 + private void initGameView() {
195 + yaPayBt = (Button) findViewById(getRedIdByName("ya_pay_bt", "id"));
196 + yaPayBt.setText("支付");
197 + yaSubmitRoleDataBt = (Button) findViewById(getRedIdByName(
198 + "ya_submit_role_data_bt", "id"));
199 + yaSubmitRoleDataBt.setText("提交角色数据");
200 + yaChannelCenter = (Button) findViewById(getRedIdByName(
201 + "ya_channel_center", "id"));
202 + yaChannelCenter.setText("渠道中心");
203 + yaSwitchAccountBt = (Button) findViewById(getRedIdByName(
204 + "ya_switch_account_bt", "id"));
205 + yaSwitchAccountBt.setText("切换账号");
206 +
207 + forumBt = (Button)findViewById(getRedIdByName("forum_bt", "id"));
208 + forumBt.setText("打开论坛");
209 + PoolSdkLog.logError("" + yaPayBt + "yachannel:" + yaChannelCenter);
210 + }
211 +
212 + public void yaOnClick(View view) {
213 + if (view == yaLoginBt) {
214 + login();
215 + } else if (view == yaEnterGameBt) {
216 + setContentView(getRedIdByName("public_sdk_self_game", "layout"));// (R.layout.game);
217 + initGameView();
218 + PoolReport.reportEnterGame("chufan", 11, "201");
219 + } else if (view == yaPayBt) {
220 + pay();
221 + } else if (view == yaSubmitRoleDataBt) {
222 + submitRoleData();
223 + } else if (view == yaChannelCenter) {
224 + channelCenter();
225 + } else if (view == yaSwitchAccountBt) {
226 + switchAccount();
227 + }else if(view == forumBt){
228 + openForum();
229 + }
230 + }
231 +
232 + private void openForum(){
233 + Toast.makeText(this, "打开论坛", Toast.LENGTH_SHORT).show();
234 + PoolSdkHelper.openForum();
235 + }
236 +
237 + private void login() {
238 +
239 + PoolSdkHelper.login("登录自定义字段", new PoolLoginListener() {
240 + @Override
241 + public void onLoginSuccess(PoolLoginInfo poolLoginInfo) {
242 + String userType = poolLoginInfo.getUserType();
243 + String timestamp = poolLoginInfo.getTimestamp();
244 + String serverSign = poolLoginInfo.getServerSign();
245 + String openId = poolLoginInfo.getOpenID();
246 + // TODO: 把以上信息发送给游戏服务端做登录校验,需要其他信息请从poolLoginInfo对象中获取
247 + System.out.println("登录成功 userType = " + userType
248 + + "; timestamp = " + timestamp + "; serverSign = "
249 + + serverSign + "; openId = " + openId);
250 + }
251 +
252 + @Override
253 + public void onLoginFailed(String errorMsg) {
254 + System.out.println("登录失败 = " + errorMsg);
255 + }
256 + });
257 + }
258 + /**
259 + * 充值接口
260 + */
261 + private void pay() {
262 + PoolPayInfo poolPayInfo = new PoolPayInfo();
263 +
264 + /********************************************
265 + * 以下所有字段都是必填项
266 + */
267 + // 设置充值金额,单位“元”
268 + poolPayInfo.setAmount("1");
269 + // 服务器id
270 + poolPayInfo.setServerID("8");
271 + // 服务器名
272 + poolPayInfo.setServerName("我是服务器名");
273 + // 角色id
274 + poolPayInfo.setRoleID("123456");
275 + // 角色名
276 + poolPayInfo.setRoleName("我是角色名");
277 + // 角色等级
278 + poolPayInfo.setRoleLevel("10");
279 + // 商品ID
280 + poolPayInfo.setProductID("1");
281 + // 商品名称
282 + poolPayInfo.setProductName("金币");
283 + // 商品描述
284 + poolPayInfo.setProductDesc("购买金币");
285 + // 兑换比例
286 + poolPayInfo.setExchange("10");
287 + // 自定义参数
288 + poolPayInfo.setCustom("我是自定义参数");
289 +
290 + PoolSdkHelper.pay(poolPayInfo, new PoolPayListener() {
291 +
292 + @Override
293 + public void onPaySuccess(String paramCustom) {
294 + System.out.println("支付成功 = " + paramCustom);
295 + }
296 +
297 + @Override
298 + public void onPayFailed(String paramCustom, String errorMsg) {
299 + System.out.println("支付失败 = " + paramCustom + "; errorMsg = "
300 + + errorMsg);
301 + }
302 + });
303 + }
304 +
305 + /**
306 + * 提交角色数据 该接口需要在3个地方调用
307 + *
308 + * 1、登录游戏主场景 2、创建角色 3、角色升级
309 + */
310 + private void submitRoleData() {
311 + /********************************************
312 + * 以下所有字段都是必填项
313 + */
314 + PoolRoleInfo poolRoleInfo = new PoolRoleInfo();
315 + poolRoleInfo.setRoleID("123456");
316 + poolRoleInfo.setRoleLevel("10");
317 + poolRoleInfo.setRoleSex("0");
318 + poolRoleInfo.setRoleName("我是角色名");
319 + poolRoleInfo.setServerID("1");
320 + poolRoleInfo.setServerName("我是服务器名");
321 + poolRoleInfo.setCustom(System.currentTimeMillis()/1000+"");//游戏创建角色时间 以秒为单位
322 + poolRoleInfo.setCallType(PoolRoleInfo.Type_EnterGame);//1、登录游戏主场景 2、创建角色 3、角色升级
323 + // poolRoleInfo.setCallType(PoolRoleInfo.Type_CreateRole);
324 + // poolRoleInfo.setCallType(PoolRoleInfo.Type_RoleUpgrade);
325 +
326 + PoolSdkHelper.submitRoleData(poolRoleInfo, new PoolRoleListener() {
327 + @Override
328 + public void onRoleDataSuccess(String paramCustom) {
329 + System.out.println("提交角色数据成功 = " + paramCustom);
330 + }
331 + });
332 + }
333 +
334 + /**
335 + * 用户中心
336 + *
337 + * 游戏方先调用PoolSDKHelper.hasChannelCenter()获取是否有用户中心,
338 + * 如果有的话,游戏中需要添加按钮,点击按钮调用PoolSDKHelper.openChannelCenter();
339 + * 如果没有,则不需要显示按钮,也不用调用下面的接口
340 + */
341 + private void channelCenter() {
342 + PoolSdkHelper.openChannelCenter();
343 + }
344 +
345 + /**
346 + * 切换帐号(使用用户中心中的切换账号)
347 + */
348 + private void switchAccount() {
349 + boolean hasChannelCenter = PoolSdkHelper.hasChannelCenter();
350 + if(hasChannelCenter){
351 + PoolSdkHelper.openChannelCenter();//打开用户中心
352 + }else{//如果没有用户中心 游戏自己处理切换账号逻辑
353 + setContentView(getRedIdByName("public_sdk_self_game_login",
354 + "layout"));// (R.layout.game_login);
355 + initLoginView();
356 + }
357 + }
358 +
359 + /**
360 + * 扩展接口
361 + */
362 + private void expansionInterface() {
363 + PoolSdkHelper.expansionInterface("自定义参数", new PoolExpansionListener() {
364 + @Override
365 + public void onSuccess(String paramCustom) {
366 +
367 + }
368 + });
369 + }
370 +}
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type