hch
2025-03-12 cc0ac1c80caf6d64ce152218d279f2b18847d452
0312 越南同步欧美的sdk:google和ios
14个文件已添加
680 ■■■■■ 已修改文件
Channel/Android/hyenglish_vn/AndroidManifest.xml 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Channel/Android/hyenglish_vn/baseProjectTemplate.gradle 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Channel/Android/hyenglish_vn/debug/libs/library-debug-hyyngame.aar 补丁 | 查看 | 原始文档 | blame | 历史
Channel/Android/hyenglish_vn/deps.gradle 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Channel/Android/hyenglish_vn/google-services.json 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Channel/Android/hyenglish_vn/gradleTemplate.properties 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Channel/Android/hyenglish_vn/launcherTemplate.gradle 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Channel/Android/hyenglish_vn/mainTemplate.gradle 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Channel/Android/hyenglish_vn/release/libs/ald_v.aar 补丁 | 查看 | 原始文档 | blame | 历史
Channel/Android/hyenglish_vn/release/libs/library-release-hyyngame.aar 补丁 | 查看 | 原始文档 | blame | 历史
Channel/Android/hyenglish_vn/settingsTemplate.gradle 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Channel/IOS/hyenglish_vn/Plugins/ynmbxxj/YnmbxxjRES.bundle/anniu.png 补丁 | 查看 | 原始文档 | blame | 历史
Channel/IOS/hyenglish_vn/Plugins/ynmbxxj/YnmbxxjSDK.h 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Channel/IOS/hyenglish_vn/Plugins/ynmbxxj/YnmbxxjSDK.mm 378 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Channel/Android/hyenglish_vn/AndroidManifest.xml
New file
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.unity3d.player"
    xmlns:tools="http://schemas.android.com/tools">
    <application
    android:allowNativeHeapPointerTagging="false">
        <activity android:name="com.secondworld.sdk.GameActivity"
                  android:theme="@style/UnityThemeSelector">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
        </activity>
    </application>
</manifest>
Channel/Android/hyenglish_vn/baseProjectTemplate.gradle
New file
@@ -0,0 +1,16 @@
plugins {
    // If you are changing the Android Gradle Plugin version, make sure it is compatible with the Gradle version preinstalled with Unity
    // See which Gradle version is preinstalled with Unity here https://docs.unity3d.com/Manual/android-gradle-overview.html
    // See official Gradle and Android Gradle Plugin compatibility table here https://developer.android.com/studio/releases/gradle-plugin#updating-gradle
    // To specify a custom Gradle version in Unity, go do "Preferences > External Tools", uncheck "Gradle Installed with Unity (recommended)" and specify a path to a custom Gradle version
    id 'com.android.application' version '7.1.2' apply false
    id 'com.android.library' version '7.1.2' apply false
    //id 'com.android.tools.build' version "7.3.0" apply false
    id "com.google.gms.google-services" version "4.3.10" apply false
    id 'com.google.firebase.crashlytics' version '2.8.1' apply false
    **BUILD_SCRIPT_DEPS**
}
task clean(type: Delete) {
    delete rootProject.buildDir
}
Channel/Android/hyenglish_vn/debug/libs/library-debug-hyyngame.aar
Binary files differ
Channel/Android/hyenglish_vn/deps.gradle
New file
@@ -0,0 +1,3 @@
dependencies {
}
Channel/Android/hyenglish_vn/google-services.json
New file
@@ -0,0 +1,3 @@
{
}
Channel/Android/hyenglish_vn/gradleTemplate.properties
New file
@@ -0,0 +1,7 @@
org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M
org.gradle.parallel=true
android.useAndroidX=true
## Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
unityStreamingAssets=.unity3d
**ADDITIONAL_PROPERTIES**
Channel/Android/hyenglish_vn/launcherTemplate.gradle
New file
@@ -0,0 +1,67 @@
apply plugin: 'com.android.application'
dependencies {
    implementation project(':unityLibrary')
    }
android {
    ndkPath "**NDKPATH**"
    compileSdkVersion 34
    buildToolsVersion '34.0.0'
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    packagingOptions {exclude 'META-INF/rxjava.properties'}
    defaultConfig {
        minSdkVersion 24
        targetSdkVersion 34
        applicationId '**APPLICATIONID**'
        ndk {
            abiFilters **ABIFILTERS**
        }
        versionCode **VERSIONCODE**
        versionName '**VERSIONNAME**'
    }
    aaptOptions {
        noCompress = ['.unity3d', '.ress', '.resource', '.obb'] + unityStreamingAssets.tokenize(', ')
        ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
    }**SIGN**
    lintOptions {
        abortOnError false
        checkReleaseBuilds false
    }
    buildTypes {
        debug {
            minifyEnabled **MINIFY_DEBUG**
            proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG**
            jniDebuggable true
        }
        release {
            minifyEnabled **MINIFY_RELEASE**
            proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG**
        }
    }**PACKAGING_OPTIONS****PLAY_ASSET_PACKS****SPLITS**
**BUILT_APK_LOCATION**
    bundle {
        language {
            enableSplit = false
        }
        density {
            enableSplit = false
        }
        abi {
            enableSplit = true
        }
    }
}**SPLITS_VERSION_CODE****LAUNCHER_SOURCE_BUILD_SETUP**
task copyJsonFile {
}
Channel/Android/hyenglish_vn/mainTemplate.gradle
New file
@@ -0,0 +1,70 @@
apply plugin: 'com.android.library'
**APPLY_PLUGINS**
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation(name: 'ald_v', ext: 'aar')
    //SDK基础能力
    implementation 'com.appsflyer:af-android-sdk:6.9.0'
    implementation 'com.android.installreferrer:installreferrer:2.2'
    api 'androidx.annotation:annotation:1.5.0'
    api 'androidx.core:core:1.6.0'
    api 'androidx.percentlayout:percentlayout:1.0.0'
    //google ID
    implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
    //firebase
    implementation 'com.google.firebase:firebase-analytics'
    implementation platform('com.google.firebase:firebase-bom:31.2.2') {
        exclude group: 'com.android.support', module: 'support-compat'
    }
    //base  theme
    api 'androidx.appcompat:appcompat:1.2.0'
    //ald ui用
    api 'androidx.cardview:cardview:1.0.0'
    //rustore
    implementation 'org.jetbrains:annotations:15.0'
    implementation("ru.rustore.sdk:billingclient:6.0.0")
    //paypal
    implementation('androidx.browser:browser:1.5.0')
**DEPS**}
android {
    ndkPath "**NDKPATH**"
    compileSdkVersion 34
    buildToolsVersion '34.0.0'
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    packagingOptions {exclude 'META-INF/rxjava.properties'}
    defaultConfig {
        minSdkVersion 24
        targetSdkVersion 34
        ndk {
            abiFilters **ABIFILTERS**
        }
        versionCode **VERSIONCODE**
        versionName '**VERSIONNAME**'
        consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD**
    }
    lintOptions {
        abortOnError false
        checkReleaseBuilds false
    }
    aaptOptions {
        noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ')
        ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
    }**PACKAGING_OPTIONS**
}
**IL_CPP_BUILD_SETUP**
**SOURCE_BUILD_SETUP**
**EXTERNAL_SOURCES**
Channel/Android/hyenglish_vn/release/libs/ald_v.aar
Binary files differ
Channel/Android/hyenglish_vn/release/libs/library-release-hyyngame.aar
Binary files differ
Channel/Android/hyenglish_vn/settingsTemplate.gradle
New file
@@ -0,0 +1,37 @@
pluginManagement {
    repositories {
        **ARTIFACTORYREPOSITORY**
        maven { url "https://jitpack.io" }
        // 俄罗斯rustore
        maven {url 'https://artifactory-external.vkpartner.ru/artifactory/maven'}
        // paypal
        maven {
            url  "https://cardinalcommerceprod.jfrog.io/artifactory/android"
        }
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
include ':launcher', ':unityLibrary'
**INCLUDES**
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
    repositories {
        **ARTIFACTORYREPOSITORY**
        maven { url "https://jitpack.io" }
        // 俄罗斯rustore
        maven {url 'https://artifactory-external.vkpartner.ru/artifactory/maven'}
        // paypal
        maven {
            url  "https://cardinalcommerceprod.jfrog.io/artifactory/android"
        }
        google()
        mavenCentral()
        flatDir {
            dirs "${project(':unityLibrary').projectDir}/libs"
        }
    }
}
Channel/IOS/hyenglish_vn/Plugins/ynmbxxj/YnmbxxjRES.bundle/anniu.png
Channel/IOS/hyenglish_vn/Plugins/ynmbxxj/YnmbxxjSDK.h
New file
@@ -0,0 +1,82 @@
#ifndef __YNMBXXJSDK_H_
#define __YNMBXXJSDK_H_
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <WebKit/WebKit.h>
#import <TUYEFramework/TUYESDK.h>
#define FUNC_NAME_GAME "ynmbxxjUtil"
#define FUNCTION_NAME "HandleMsgWithSDK"
#define STOUni_BatteryLevel                1
#define STOUni_BatteryCharging             2
#define STOUni_SdkInitComplete             3
#define STOUni_DeviceInfo                  4
#define STOUni_PushClientID                5
#define STOUni_YNmbxxjInitOk          100
#define STOUni_YNmbxxjInitFail        101
#define STOUni_YNmbxxjLoginOk         102
#define STOUni_YNmbxxjLoginFail       103
#define STOUni_YNmbxxjLoginCancel     104
#define STOUni_YNmbxxjLogoutOk        105
#define STOUni_YNmbxxjLogoutFail      106
#define STOUni_YNmbxxjSwitchAccountOk 107
#define STOUni_YNmbxxjPayOk           108
#define STOUni_YNmbxxjPayFail         109
#define STOUni_YNmbxxjPayCancel       110
#define STOUni_YNmbxxjRegisterOk      111
#define STOUni_FBShareResult               112  //fb分享结果
#define UTOSDK_BatteryListenStart          1
#define UTOSDK_BatteryListenStop           2
#define UTOSDK_CopyContent                 7
#define UTOSDK_OpenWebView                 8
#define UTOSDK_Init                        9
#define UTOSDK_YNmbxxjInit            100
#define UTOSDK_YNmbxxjLogin           101
#define UTOSDK_YNmbxxjLogout          102
#define UTOSDK_YNmbxxjSwitchAccount   103
#define UTOSDK_YNmbxxjPay             104
#define UTOSDK_PayFinished                 105
#define UTOSDK_CreateRole                  106
#define UTOSDK_RoleLogin                   107
#define UTOSDK_RoleLevelUp                 108
#define UTOSDK_ShareToFaceBook             112 //FB分享
#define UTOSDK_GotoPingfen                  113 //前往评分
#define UTOSDK_FansHouse                   120 //粉丝屋
#define UTOSDK_GotoShop                    121 //打开商店
#define UTOSDK_TrackEvent                  122 //自定义事件
#define UTOSDK_MakeKeyAndVisible           300
#define UTOSDK_SendRegistEvent             500
#define UTOSDK_SendLoginEvent              600
#define KIsiPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
@interface YnmbxxjSDK : NSObject<WKUIDelegate, WKNavigationDelegate> {
    WKWebView* m_wkWebView;
    WKWebView* m_jiaWKWebView;
    UIButton* c_loseBtn;
}
-(void) HandleGameMessage:(NSString*) json;
-(void) Init;
-(id) APNativeJSONObject:(NSData*) data;
-(void) YngameSDKInit:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;
@end
@interface YnmbxxjSDK ()<DelegateTUYESDK>
//@property (weak, nonatomic) IBOutlet UILabel *demoTitleLabel;
//@property(nonatomic)UIInterfaceOrientationMask korientationMask;
//@property (weak, nonatomic) IBOutlet UILabel *resultLabel;
//@property (nonatomic, strong)TUYESDK *sdkManager;
//@property (weak, nonatomic) IBOutlet UIImageView *backImageView;
@end
#endif
Channel/IOS/hyenglish_vn/Plugins/ynmbxxj/YnmbxxjSDK.mm
New file
@@ -0,0 +1,378 @@
#import "YnmbxxjSDK.h"
#ifdef NSFoundationVersionNumber_iOS_9_x_Max
#import <UserNotifications/UserNotifications.h>
#endif
#import "SystemConfiguration/CaptiveNetwork.h"
@implementation YnmbxxjSDK
static int cClassBattery = -1;
static int cZhuangtaiBattery = -1;
static NSString* cYingyongID;
static NSString* cYouxiID;
static NSString* sYonghuMing;
static NSThread* _xianchengThd;
-(id)init
{
     self = [super init];
     m_jiaWKWebView = [[WKWebView alloc] initWithFrame:CGRectZero];
     NSURL *dizhi = [NSURL URLWithString:@"www.google.com"];
     NSURLRequest *request = [NSURLRequest requestWithURL:dizhi
                                           cachePolicy:NSURLRequestUseProtocolCachePolicy
                                           timeoutInterval:8.f];
     [m_jiaWKWebView loadRequest:request];
     return self;
}
-(void) Init
{
    UIDevice *_device = [UIDevice currentDevice];
    _device.batteryMonitoringEnabled = true;
    NSString* _uniqueID = @"ddgg";
    //获取IDFA
    NSString* _idfa = @"acd";
    // 取得UserAgent
    [m_jiaWKWebView evaluateJavaScript:@"navigator.userAgent" completionHandler:^(id _Nullable userAgent, NSError * _Nullable error) {
        NSLog(@"%@", userAgent);
        NSString* _userAgent = [NSString stringWithFormat:@"%@", userAgent];
        // 发送设备信息
        NSMutableDictionary *d_i_ct = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                      _uniqueID,@"unique_id",
                                      _idfa,@"android_id",
                                      [NSNumber numberWithInt:STOUni_DeviceInfo],@"code",
                                      _userAgent,@"userAgent",nil];
        [self SendMessageToUnity:d_i_ct];
        }];
    [TUYESDK sharedGameSDK] .sdkDelegate = (id<DelegateTUYESDK>)self;
    UIViewController *view = UnityGetGLViewController();
    [[TUYESDK sharedGameSDK] initSDKwithViewController:view gameId:1135 appId:53 channelId:332];
}
- (void)smpcQpLogoutResult:(NSNotification *)notify {
    NSLog(@"sdk请求退出");
    //注销成功
    NSDictionary *d_i_ct = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:STOUni_YNmbxxjLogoutOk], @"code", nil];
    [self SendMessageToUnity:d_i_ct];
}
-(void)SendMessageToUnity:(NSDictionary*)dict
{
    BOOL _result = [NSJSONSerialization isValidJSONObject:dict];
    if(_result)
    {
        NSData* _jsonData = [NSJSONSerialization dataWithJSONObject:dict options:0 error:NULL];
        UnitySendMessage(FUNC_NAME_GAME, FUNCTION_NAME,
                         [[[NSString alloc] initWithData:_jsonData encoding:NSUTF8StringEncoding] UTF8String]);
    }
}
-(void) BatteryThread {
    while (TRUE)
    {
        [NSThread sleepForTimeInterval:1];
        UIDevice *_device = [UIDevice currentDevice];
        int _state = [_device batteryState];
        if(_state != cZhuangtaiBattery){
            cZhuangtaiBattery = _state;
            NSDictionary *d_i_ct = [NSDictionary dictionaryWithObjectsAndKeys:
                                   [NSNumber numberWithInt:cZhuangtaiBattery], @"status",
                                   [NSNumber numberWithInt:STOUni_BatteryCharging], @"code", nil];
            [self SendMessageToUnity:d_i_ct];
        }
        int _level = (int)([_device batteryLevel] * 100);
        if(_level != cClassBattery){
            cClassBattery = _level;
            NSDictionary *d_i_ct = [NSDictionary dictionaryWithObjectsAndKeys:
                                   [NSNumber numberWithInt:cClassBattery], @"level",
                                   [NSNumber numberWithInt:STOUni_BatteryLevel], @"code", nil];
            [self SendMessageToUnity:d_i_ct];
        }
    }
}
-(void) OpenURL:(NSString*) url {
    if(m_jiaWKWebView != NULL) {
        [self btnClick:NULL];
        return;
    }
    CGRect b_ounds = UnityGetMainWindow().bounds;
    float s_cale = b_ounds.size.width / (1300 + 34);
    float w_idth = (900 + 82) * s_cale;
    float h_eight = (500 + 60) * s_cale;
    float _offsetX = (b_ounds.size.width - w_idth) * .5f;
    float _offsetY = (b_ounds.size.height - h_eight) * .5f;
    m_jiaWKWebView = [[WKWebView alloc] initWithFrame:CGRectMake(_offsetX, _offsetY, w_idth, h_eight)];
    m_jiaWKWebView.UIDelegate = self;
    m_jiaWKWebView.navigationDelegate = self ;
    m_jiaWKWebView.scrollView.scrollEnabled = YES;
    m_jiaWKWebView.scrollView.bounces = NO;
    NSURLRequest *request =[NSURLRequest requestWithURL:[NSURL URLWithString:url]];
    [m_jiaWKWebView loadRequest:request];
}
-(void) btnClick:(UIButton*)sender {
    [c_loseBtn removeFromSuperview];
    [c_loseBtn removeTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
    c_loseBtn = NULL;
    NSURLCache *_cache = [NSURLCache sharedURLCache];
    [_cache removeAllCachedResponses];
    [_cache setDiskCapacity:0];
    [_cache setMemoryCapacity:0];
    [m_jiaWKWebView removeFromSuperview];
    m_jiaWKWebView = NULL;
}
//-(void)webViewDidFinishLoad:(WKWebView *)webView{
- (void)webView:(WKWebView *)webView didFinishNavigation:(null_unspecified WKNavigation *)navigation{
    CGRect _bounds = UnityGetMainWindow().bounds;
    float _scale = _bounds.size.width / 1334;
    float _width = 982 * _scale;
    float _height = 560 * _scale;
    c_loseBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [c_loseBtn setFrame:CGRectMake(_width - 600 * _scale, _height - 86 * _scale, 360 * _scale, 72 * _scale)];
    [c_loseBtn setTitle:@"OK" forState:UIControlStateNormal];
    NSString *_bundlePath = [[NSBundle mainBundle] pathForResource:@"YnmbxxjRES.bundle" ofType:nil];
    NSBundle *_bundle = [NSBundle bundleWithPath:_bundlePath];
    NSString *pic1Path = [_bundle pathForResource:@"anniu.png" ofType:nil];
    [c_loseBtn setBackgroundImage:[UIImage imageWithContentsOfFile:pic1Path] forState:UIControlStateNormal];
    [c_loseBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [c_loseBtn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
    [m_jiaWKWebView addSubview:c_loseBtn];
    UIView *view = UnityGetGLViewController().view;
    [view addSubview:m_jiaWKWebView];
}
-(void)YngameSDKInit:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    NSLog(@"初始化成功");
    [[TUYESDK sharedGameSDK] application:application
                  didFinishLaunchingWithOptions:launchOptions];
}
#pragma mark - 回调结果
- (void)onInitSuccess
{
    NSLog(@"\n***************初始化成功****************");
    NSDictionary *d_i_ct = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:STOUni_YNmbxxjInitOk], @"code", nil];
    [self SendMessageToUnity:d_i_ct];
    NSMutableDictionary *d_i_ct1 = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                  [NSNumber numberWithInt:STOUni_SdkInitComplete], @"code",
                                  @"hyyn", @"channelPlatform", nil];
    [self SendMessageToUnity:d_i_ct1];
}
- (void)onInitFail:(NSError *)kerror
{
    NSDictionary *d_i_ct = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:STOUni_YNmbxxjInitFail], @"code", nil];
    [self SendMessageToUnity:d_i_ct];
}
- (void)onLoginSuccess:(id )user
{
    NSString *uid = user[@"user_id"];
    NSString *gameUID = [NSString stringWithFormat:@"%@@1", uid];
    NSLog(@" 登陆参数:「%@ %@ %@」", uid, user[@"timestamp"], user[@"sign"]);
    NSDictionary *d_i_ct = [NSDictionary dictionaryWithObjectsAndKeys:
                           [NSDictionary dictionaryWithObjectsAndKeys:user[@"sign"], @"token",
                            uid, @"userName",
                            user[@"timestamp"], @"token_expire",
                            gameUID, @"account", nil],@"info",
                           [NSNumber numberWithInt:STOUni_YNmbxxjLoginOk], @"code", nil];
    [self SendMessageToUnity:d_i_ct];
}
- (void)onLoginFail:(NSError *)kerror
{
    //self.resultLabel.text = [NSString stringWithFormat:@"登录失败\nerror:%@",kerror.localizedDescription];
    NSDictionary *d_i_ct = [NSDictionary dictionaryWithObjectsAndKeys:
                           [NSNumber numberWithInt:STOUni_YNmbxxjLoginFail], @"code", nil];
    [self SendMessageToUnity:d_i_ct];
}
- (void)onLogout
{
    NSLog(@"注销");
    //self.resultLabel.text = @"注销成功";
    NSDictionary *d_i_ct = [NSDictionary dictionaryWithObjectsAndKeys:
                           [NSNumber numberWithInt:STOUni_YNmbxxjLogoutOk], @"code", nil];
    [self SendMessageToUnity:d_i_ct];
}
- (void)onPaySuccess{
    NSLog(@"充值调用返回");
    NSDictionary *d_i_ct = [NSDictionary dictionaryWithObjectsAndKeys:
                           [NSNumber numberWithInt:STOUni_YNmbxxjPayOk], @"code", nil];
    [self SendMessageToUnity:d_i_ct];
}
-(id) APNativeJSONObject:(NSData *)data{
    if (!data) {
        return nil;
    }
    NSError *error = nil;
    id retId = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
    if (error) {
        NSLog(@"%s trans data to obj with error: %@", __func__, error);
        return nil;
    }
    return retId;
}
-(void)HandleGameMessage:(NSString *)json {
    NSLog(@"收到Unity发来的消息 => %@", json);
    NSData *_jsonData = [json dataUsingEncoding:NSUTF8StringEncoding];
    NSDictionary *d_i_ct = [self APNativeJSONObject:_jsonData];
    switch([[d_i_ct objectForKey:@"code"] intValue]){
        case UTOSDK_Init:
            cYingyongID = d_i_ct[@"appID"];
            cYouxiID = d_i_ct[@"gameID"];
            [self Init];
            break;
        case UTOSDK_CopyContent:
            [UIPasteboard generalPasteboard].string = d_i_ct[@"content"];
            break;
        case UTOSDK_YNmbxxjInit:
            break;
        case UTOSDK_MakeKeyAndVisible:
        {
            UIWindow * _window = [[UIApplication sharedApplication].delegate window];
            if (_window != nil && _window.rootViewController != nil) {
                [_window makeKeyAndVisible];
            }
        }
            break;
        case UTOSDK_OpenWebView:
            [self OpenURL:d_i_ct[@"url"]];
            break;
        case UTOSDK_YNmbxxjLogin:
        {
            [[TUYESDK sharedGameSDK] login];
        }
            break;
        case UTOSDK_YNmbxxjLogout:
        {
            [[TUYESDK sharedGameSDK] logout];
        }
            break;
        case UTOSDK_CreateRole:
        {
            [[TUYESDK sharedGameSDK] roleCreateWithRoleId:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"roleID"]] roleName:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"roleName"]] roleLevel:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"level"]] serverName:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"serverName"]] serverId:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"sid"]] userMoney:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"money"]] vipLevel:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"vipLevel"]]];
            break;
        }
        case UTOSDK_RoleLogin:
        {
            // 更新角色信息
            [[TUYESDK sharedGameSDK] roleLoginWithRoleId:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"roleID"]] roleName:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"roleName"]] roleLevel:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"level"]] serverName:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"serverName"]] serverId:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"sid"]] userMoney:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"money"]] vipLevel:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"vipLevel"]]];
            break;
        }
        case UTOSDK_RoleLevelUp:
        {
            // 更新角色信息
            [[TUYESDK sharedGameSDK] roleLevelUpWithRoleId:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"roleID"]] roleName:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"roleName"]] roleLevel:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"level"]] serverName:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"serverName"]] serverId:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"sid"]] userMoney:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"money"]] vipLevel:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"vipLevel"]]];
            break;
        }
        case UTOSDK_YNmbxxjPay:
        {
            NSString *extra = [NSString stringWithFormat:@"1_%@_%@_%@", [NSString stringWithFormat:@"%@", [d_i_ct objectForKey:@"orderId"]],
                               [NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"sid"]],
                               [NSString stringWithFormat:@"%@", [d_i_ct objectForKey:@"cpInfo"]]];
            [[TUYESDK sharedGameSDK] IAPWithProductId:[NSString stringWithFormat:@"%@", [d_i_ct objectForKey:@"storeOrderInfo"]] productDesc:[NSString stringWithFormat:@"%@", [d_i_ct objectForKey:@"title"]] amount:[NSString stringWithFormat:@"%@", [d_i_ct objectForKey:@"mount"]] cpOrderId:[NSString stringWithFormat:@"%@", [d_i_ct objectForKey:@"orderId"]] callBackUrl:[NSString stringWithFormat:@"%@", [d_i_ct objectForKey:@"callback"]] callBackInfo:extra roleId:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"roleID"]] roleName:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"roleName"]] roleLevel:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"level"]] serverId:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"sid"]] serverName:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"serverName"]]];
            break;
        }
        case UTOSDK_BatteryListenStart:
            if(_xianchengThd == NULL)
            {
                _xianchengThd = [[NSThread alloc] initWithTarget:self selector:@selector(BatteryThread) object:nil];
                [_xianchengThd setName:@"BatteryCheck"];
            }
            if(![_xianchengThd isExecuting])
            {
                [_xianchengThd start];
            }
            break;
        case UTOSDK_BatteryListenStop:
            break;
        case UTOSDK_ShareToFaceBook:
        {
            [[TUYESDK sharedGameSDK] shareUrlWithResult:^(BOOL isSuccess) {
                NSLog(@"%@%@",@"facebookShareURL ",isSuccess?@"YES":@"NO");
            }];
            NSDictionary *d_i_ct = [NSDictionary dictionaryWithObjectsAndKeys:
                                   [NSDictionary dictionaryWithObjectsAndKeys:@"1", @"state", nil],@"info",
                                   [NSNumber numberWithInt:STOUni_FBShareResult], @"code", nil];
            [self SendMessageToUnity:d_i_ct];
            break;
        }
        case UTOSDK_GotoPingfen:
            [[TUYESDK sharedGameSDK] appStoreStar];
            break;
        case UTOSDK_FansHouse:
            [[TUYESDK sharedGameSDK] facebookFansHome];
            break;
        case UTOSDK_GotoShop:
            [[TUYESDK sharedGameSDK] appStore];
            break;
        case UTOSDK_TrackEvent:
            //isRepeat:NO仅上报一次,YES允许重复上报(一般看运营要求)
            [[TUYESDK sharedGameSDK] reportTrackEvent:[NSString stringWithFormat:@"%@",[d_i_ct objectForKey:@"eventName"]] isRepeat:[[d_i_ct objectForKey:@"eventName"] boolValue]];
            break;
    }
}
@end