久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

Unity3d與iOS交互開發(fā)

 3dC 2014-11-13
//  MyIOSSdk.m
#import "MyIOSSdk.h"
//這里引用SDK的頭文件
#import "SDKPlatform.h"
#if defined(__cplusplus)
extern "C"{
#endif
    extern void UnitySendMessage(const char *, const char *, const char *);
    extern NSString* _CreateNSString (const char* string);
#if defined(__cplusplus)
}
#endif
//*****************************************************************************
@implementation MyIOSSdk
//**********************
//message tools
+ (void)sendU3dMessage:(NSString *)messageName param:(NSDictionary *)dict
{
    NSString *param = @"";
    if ( nil != dict ) {
        for (NSString *key in dict)
        {
            if ([param length] == 0)
            {
                param = [param stringByAppendingFormat:@"%@=%@", key, [dict valueForKey:key]];
            }
            else
            {
                param = [param stringByAppendingFormat:@"&%@=%@", key, [dict valueForKey:key]];
            }
        }
    }
    UnitySendMessage("SDK_Object", [messageName UTF8String], [param UTF8String]);
}
//**********************
//SDK fun
//初始化SDK
-(void)SDKInit
{
    SDKcfg *cfg = [[[SDKcfg alloc] init] autorelease];
    cfg.appid =123456;
    cfg.appKey =@"aoaoaoaoaoaoaoaoaoaoaoaoaaoaoaoaoaoaoao";
    cfg.orientation = UIDeviceOrientationLandscapeLeft;
    //調(diào)用SDK的初始化函數(shù)
    [[SDKPlatform defaultPlatform] SDKInit:cfg];
    //添加回調(diào)監(jiān)聽
    [[SDKPlatform defaultPlatform] addObserver:self selector:@selector(SNSInitResult:) name:(NSString *)kInitNotification object:nil];
}
//獲取用戶ID
-(NSString*)SDKGetUserID
{
    [[SDKPlatform defaultPlatform] SDKGetUserID];
}
//**********************
//call back fun
//初始化更新回調(diào)
- (void)SNSInitResult:(NSNotification *)notify
{
    [MyIOSSdk sendU3dMessage:@"SDKMsgInit" param:nil];
}
@end
//*****************************************************************************
#if defined(__cplusplus)
extern "C"{
#endif
     
    //字符串轉(zhuǎn)化的工具函數(shù)
     
    NSString* _CreateNSString (const char* string)
    {
        if (string)
            return [NSString stringWithUTF8String: string];
        else
            return [NSString stringWithUTF8String: ""];
    }
     
    char* _MakeStringCopy( const char* string)
    {
        if (NULL == string) {
            return NULL;
        }
        char* res = (char*)malloc(strlen(string)+1);
        strcpy(res, string);
        return res;
    }
     
    static MyIOSSdk *mySDK;
    //供u3d調(diào)用的c函數(shù)
   
    void _PlatformInit()
    {
        if(mySDK==NULL)
        {
            mySDK = [[MyIOSSdk alloc]init];
        }
        [lsSDK SDKInit];
    }
     
    //注意這個函數(shù)是返回字符串
    const char* _PlatformGetUin()
    {
        if(lsSDK==NULL)
        {
            lsSDK = [[MyIOSSdk alloc]init];
        }
        return _MakeStringCopy([[lsSDK SDKGetUserID] UTF8String]);
    }
     
#if defined(__cplusplus)
}
#endif

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式,、誘導(dǎo)購買等信息,,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請點(diǎn)擊一鍵舉報,。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多