123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675 |
- //
- // FitfunHead_C.h
- // FitfunSDKDesign
- //
- // Created by 许晨琛 on 2018/3/24.
- // Copyright © 2018年 Fitfun. All rights reserved.
- // iOS与Unity交互的桥接类,unity部分采用C#方法,iOS部分采用C++和O-C混编,.m后缀改为.mm
- #import <Foundation/Foundation.h>
- #import <FitfunCore/FitfunCore.h>
- #import <FitfunSDK/FitfunSDK.h>
- #import <AdSupport/AdSupport.h>
- #ifdef DEBUG
- #define NSLog(FORMAT, ...) fprintf(stderr,"%s:%d\t%s\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
- #else
- #define NSLog(FORMAT, ...) nil
- #endif
- #if defined(__cplusplus)
- extern "C"{
- #endif
- //C 拷贝
- char* FitfunMakeStringCopy ( const char* string )
- {
- if ( 0 == string )
- return 0;
-
- unsigned long nLengh = strlen(string);
- char* res = (char*)malloc( nLengh + 1);
- strcpy(res, string);
- res[nLengh] = '\0';
- return res;
- }
-
- //////////////////////////////////////////////////////////////
-
- #pragma mark - 获取设备当前任务占用内存
- double FitfunUsedMemory()
- {
- // NSLog(@"FitfunHead_C==FitfunUsedMemory==%f", [FitfunYDManager ff_usedMemory]);
- return [FitfunYDManager ff_usedMemory];
- }
-
- #pragma mark - Unity获取ServerKey ***
- /*
- key 如下:
- resServerIOS
- urlProxy
- webServerPost
- webServerGet
- webLoginBroadCast
- appVersionRequest
- webLoginBroadCastRealUrl
- appVersionUpdate
- serverListURL
- disEnableLoginManager
- logicServerDNS
- logicServerSDK
- GetQuestionSignsURL
- enableStartBroadcast
- enableShowGoogleIcon
- enableVoiceChatMsg
- enableRecharge
- resServerVersionCfg
- appVersionRequest
- enablePlatformManager
- enableChangeAccoutInGame
- enableShowPromotionIcon
- IsShowTrueNameRegisterBtn
- IsShowContact
- enableVoiceChatMsg
-
- */
- char* FitfunGetServerKey( char* key )
- {
-
- NSString *keyString = [NSString stringWithUTF8String:key];
- NSString *valueString = [FitfunYDManager ff_objectForKeywithCfgDictionary:keyString];
-
- if (![keyString isEqualToString:@"resServerIOS"]) {
- NSLog (@"FitfunHead_C==FitfunGetServerKey==key:%@, value:%@", keyString, valueString);
-
- }
-
- if (valueString.length != 0) {
- NSLog (@"FitfunHead_C==FitfunGetServerKey==key:%@, value:%s", keyString, FitfunMakeStringCopy([valueString UTF8String]));
- return FitfunMakeStringCopy([valueString UTF8String]);
- }
- else {
- const char* empty = "";
- NSLog (@"FitfunHead_C==FitfunGetServerKey==key:%@, value:%s", keyString, FitfunMakeStringCopy( empty ));
- return FitfunMakeStringCopy( empty );
- }
-
- }
-
- #pragma mark - 设置UserID
- void FitfunSetUserID( int64_t usrID )
- {
- /*
- 角色的role id,上传照片要用到
- */
- // NSLog(@"FitfunHead_C==FitfunSetUserID: %lld", usrID);
-
- [FitfunYDManager ff_sharedInstance].userID = usrID;
- }
-
- #pragma mark - 设置用户昵称
- void FitfunSetUserName( const char* userName )
- {
- NSLog(@"FitfunHead_C==FitfunSetUserName: %s", userName);
- [FitfunYDManager ff_sharedInstance].userName = [NSString stringWithUTF8String:userName];
- }
-
- #pragma mark - 获取App版本号
- char* FitfunGetVersionName()
- {
- // NSLog(@"FitfunHead_C==FitfunGetVersionName: %@", [FitfunYDManager ff_appVersion]);
- return FitfunMakeStringCopy([[FitfunYDManager ff_appVersion] UTF8String]);
- }
-
- #pragma mark - 获取设备识别码——IDFV
- char* FitfunGetDeviceID()
- {
- // NSLog(@"FitfunHead_C==FitfunGetDeviceID: %@", [FitfunYDManager ff_IDFV]);
-
- return FitfunMakeStringCopy([[FitfunYDManager ff_IDFV] UTF8String]);
- }
-
- #pragma mark - 获取设备识别码——IDFA
- char* FitfunGetMacAddress()
- {
- // NSString* adId = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
- // return FitfunMakeStringCopy( [adId UTF8String] );
-
- return FitfunMakeStringCopy([[FitfunYDManager ff_IDFA] UTF8String]);
- }
- #pragma mark - 获取包名
- char* FitfunGetAppName()
- {
- return FitfunMakeStringCopy([[FitfunYDManager ff_appBundleID] UTF8String]);
- }
- #pragma mark - 获取操作系统版本号
- char* FitfunGetOSVersion()
- {
- return FitfunMakeStringCopy([[FitfunYDManager ff_systemVersion] UTF8String]);
- }
- #pragma mark - 获取手机型号
- char* FitfunGetPhoneModel()
- {
- return FitfunMakeStringCopy([[FitfunYDManager ff_devicemodel] UTF8String]);
- }
-
- #pragma mark - 获取渠道ID
- char* FitfunGetChannelID()
- {
- // NSLog(@"FitfunHead_C==FitfunGetChannelID:%@", [FitfunYDManager ff_sharedInstance].channelID);
-
- return FitfunMakeStringCopy( [[FitfunYDManager ff_sharedInstance].channelID UTF8String] );
- }
-
- #pragma mark - 获取AppKey
- char* FitfunGetAppKey()
- {
- // NSLog(@"FitfunHead_C==FitfunGetAppKey:%@", [FitfunYDManager ff_sharedInstance].appKey);
-
- return FitfunMakeStringCopy( [[FitfunYDManager ff_sharedInstance].appKey UTF8String] );
- }
-
- #pragma mark - 获取AppSecret
- char* FitfunGetSecret()
- {
- // NSLog(@"FitfunHead_C==FitfunGetSecret:%@", [FitfunYDManager ff_sharedInstance].appSecret);
-
- return FitfunMakeStringCopy( [[FitfunYDManager ff_sharedInstance].appSecret UTF8String] );
- }
-
- #pragma mark - 检查更新
- void FitfunCheckUpdate( const char* target, const char* msg )
- {
- NSString* targetStr = [[NSString alloc] initWithCString:target encoding:NSUTF8StringEncoding];
- NSString* msgStr = [[NSString alloc] initWithCString:msg encoding:NSUTF8StringEncoding];
- NSLog(@"FitfunHead_C==FitfunCheckUpdate:%@, %@", targetStr, msgStr);
-
- [FitfunYDManager ff_checkUpdateWithTarget:targetStr message:msgStr];
- }
-
- #pragma mark - 设置游戏区服ID
- void FitfunSetGameID( const char* val )
- {
- NSString* gameID = [NSString stringWithUTF8String:val];
- NSLog(@"FitfunHead_C==FitfunSetGameID:%@", gameID);
-
- [FitfunYDManager ff_sharedInstance].gameID = gameID;
- }
-
-
- #pragma mark - 定位
- #pragma mark 定位初始化
- void FitfunLocationInit()
- {
- NSLog(@"FitfunHead_C==FitfunLocationInit");
-
- [FitfunYDManager ff_initLocation];
- }
-
- #pragma mark 停止定位
- void FitfunLocationStop()
- {
- NSLog(@"FitfunHead_C==FitfunLocationStop");
-
- [FitfunYDManager ff_stopLocation];
- }
-
- #pragma mark 获取当前定位状态
- int FitfunLocationGetStatus()
- {
- //登录前调用太频繁。。。
- // NSLog(@"FitfunHead_C==FitfunLocationGetStatus: %d", [FitfunYDManager ff_locationStatus]);
-
- return [FitfunYDManager ff_locationStatus];
- }
-
- #pragma mark 纬度
- double FitfunLocationGetLatitude()
- {
- NSLog(@"FitfunHead_C==FitfunLocationGetLatitude: %f",[FitfunYDManager ff_latitude] );
-
- return [FitfunYDManager ff_latitude];
- }
-
- #pragma mark 经度
- double FitfunLocationGetLongitude()
- {
- NSLog(@"FitfunHead_C==FitfunLocationGetLongitude: %f",[FitfunYDManager ff_longitude]);
-
- return [FitfunYDManager ff_longitude];
- }
-
- #pragma mark - 视频处理
- void FitfunPlayMovie( const char* path, const char* type, const char* u3dPath )
- {
-
- NSString *pathStr = [NSString stringWithUTF8String:path];
- NSString *typeStr = [NSString stringWithUTF8String:type];
- NSString *u3dPathStr = [NSString stringWithUTF8String:u3dPath];
- //NSLog(@"FitfunHead_C==FitfunPlayMovie path: %@, type:%@, u3dPath:%@",pathStr, typeStr, u3dPathStr );
-
- [[FitfunYDManager ff_sharedInstance] ff_play:pathStr TypeName:typeStr u3dPath:u3dPathStr];
- }
-
-
- /// SnapShot Interface
- #pragma mark - 照片处理
- #pragma mark 调用相机
- void FitfunSnapShotCamera()
- {
- NSLog(@"FitfunHead_C==FitfunSnapShotCamera");
-
- [[FitfunYDManager ff_sharedInstance] ff_takePhotoFromCamera];
- }
-
- #pragma mark 调用相册
- void FitfunSnapShotLibrary()
- {
- NSLog(@"FitfunHead_C==FitfunSnapShotLibrary");
-
- [[FitfunYDManager ff_sharedInstance] ff_takePhotoFromLibrary];
- }
-
- #pragma mark 裁剪图片
- int FitfunClipShot( const char* path, float x, float y, float width, float height )
- {
- NSString *pathStr = [NSString stringWithUTF8String:path];
- NSLog(@"FitfunHead_C==FitfunClipShot:path:%@, x:%.f, y:%.f, width:%.f, height:%.f", pathStr, x, y, width, height);
-
- return [FitfunYDManager ff_clipPhotoFromPath:pathStr X:x Y:y Width:width Height:height];
- }
- #pragma mark 上传图片
- int FitfunPostImage( const char* path )
- {
- NSString *pathStr = [NSString stringWithUTF8String:path];
- NSLog(@"FitfunHead_C==FitfunPostImage path:%@", pathStr);
-
- return [FitfunYDManager ff_uploadPhotoToWebServerWithPath:pathStr];
- }
-
- #pragma mark - 云娃语音--->废弃
- /// YvIm Interface
- //isTest 1 测试环境 0 真机环境
- #pragma mark 云娃初始化
- void FitFuninitYvIm(const char* appid, const char* isTest)
- {
- // NSString *appidStr = [NSString stringWithUTF8String:appid];
- // NSString *isTestStr = [NSString stringWithUTF8String:isTest];
- NSLog(@"FitfunHead_C==FitFuninitYvIm appid:%@, isTest:%@", appidStr, isTestStr);
-
- [FitfunYDManager ff_initYvimSDK];
- }
-
- #pragma mark 云娃第三方登录
- void FitFunThirdLoginWithTT( const char* userid,const char* nickname)
- {
- NSString *userIDStr = [NSString stringWithUTF8String:userid];
- NSString *nickNameStr = [NSString stringWithUTF8String:nickname];
- NSLog(@"FitfunHead_C==FitFunThirdLoginWithTT userid:%@, nickname:%@", userIDStr, nickNameStr);
-
- NSString * tt = [NSString stringWithFormat:@"{\"uid\": \"%@\", \"nickname\": \"%@\"}",userIDStr,nickNameStr];
-
- [FitfunYDManager ff_thirdLoginWithTT:tt];
- }
-
- #pragma mark 云娃登录频道
- void FitFunLoginChannel( const char* wildCard, const char* channelId)
- {
- NSString *wildCardString = [[NSString alloc] initWithCString:wildCard encoding:NSUTF8StringEncoding];
- NSString *channelCardString = [[NSString alloc] initWithCString:channelId encoding:NSUTF8StringEncoding];
- NSLog(@"FitfunHead_C==FitFunLoginChannel wild:%@, channelID:%@", wildCardString, channelCardString);
-
- [FitfunYDManager ff_loginChannel:wildCardString channelId:channelCardString];
- }
-
-
- #pragma mark 云娃发送文字消息
- BOOL FitFunChannelTextMsg( const char* textMsg, const char* wildCard, const char* expand)
- {
- NSString *wildCardString = [[NSString alloc] initWithCString:wildCard encoding:NSUTF8StringEncoding];
- NSString *textMessage = [[NSString alloc] initWithCString:textMsg encoding:NSUTF8StringEncoding];
- NSString *expandString = [[NSString alloc] initWithCString:expand encoding:NSUTF8StringEncoding];
- NSLog(@"FitfunHead_C==FitFunChannelTextMsg textMsg:%@, wildCard:%@, expand:%@", textMessage, wildCardString, expandString);
-
- return [FitfunYDManager ff_channelTextMsg:textMessage wildCard:wildCardString expand:expandString];
- }
- #pragma mark 云娃开始录音
- void FitFunStartRecord(const char* strfilepath, const char* ext)
- {
- NSString *strFile = [[NSString alloc] initWithCString:strfilepath encoding:NSUTF8StringEncoding];
- NSString *extString = [[NSString alloc] initWithCString:ext encoding:NSUTF8StringEncoding];
- NSLog(@"FitfunHead_C==FitFunStartRecord strFile:%@, extString:%@", strFile, extString);
-
- [FitfunYDManager ff_startRecord:strFile ext:extString];
- }
-
- #pragma mark 云娃停止录音
- void FitFunStopRecord()
- {
- NSLog(@"FitfunHead_C==FitFunStopRecord");
-
- [FitfunYDManager ff_stopRecord];
- }
-
- #pragma mark 播放音频
- void FitFunPlayAudioWithUrl(const char* strUrl, const char* ext)
- {
- ext = ""; //不加这句,iOS 11 播放音频会闪退
-
- NSString *strUrlString = [[NSString alloc] initWithCString:strUrl encoding:NSUTF8StringEncoding];
- NSString *extString = [[NSString alloc] initWithCString:ext encoding:NSUTF8StringEncoding];
- NSLog(@"FitfunHead_C==FitFunPlayAudioWithUrl strUrl:%@, ext:%@", strUrlString, extString);
-
- [FitfunYDManager ff_playAudioWithUrl:strUrlString filepath:nil ext:extString];
- }
- #pragma mark 停止播放音频
- void FitFunStopPlayAudio()
- {
- // NSLog(@"FitfunHead_C==FitFunStopPlayAudio");
-
- [FitfunYDManager ff_stopPlayAudio];
- }
- #pragma mark 上传音频
- void FitFunUploadFileReq(const char* filename, const char* fileId)
- {
- NSString *fileNameString = [[NSString alloc] initWithCString:filename encoding:NSUTF8StringEncoding];
- NSString *fileIdString = [[NSString alloc] initWithCString:fileId encoding:NSUTF8StringEncoding];
- NSLog(@"FitfunHead_C==FitFunUploadFileReq fileNameString:%@, fileIdString:%@", fileNameString, fileIdString);
-
- if ( NSNotFound == [fileNameString rangeOfString:@"/"].location )
- {
- fileNameString = [NSString stringWithFormat:@"%@/%@", [FitfunYDManager ff_cachePath], fileNameString];
- }
-
- [FitfunYDManager ff_uploadFileReq:fileNameString fileId:fileIdString];
- }
-
- #pragma mark 音频下载
- void FitFunDownloadFileReq(const char* url, const char* filename, const char* fileId)
- {
- NSString *urlString = [[NSString alloc] initWithCString:url encoding:NSUTF8StringEncoding];
- NSString *fileNameString = [[NSString alloc] initWithCString:filename encoding:NSUTF8StringEncoding];
- NSString *fileIdSting = [[NSString alloc] initWithCString:fileId encoding:NSUTF8StringEncoding];
- NSLog(@"FitfunHead_C==FitFunDownloadFileReq urlString:%@, fileNameString:%@, fileIdString:%@", urlString,fileNameString, fileIdSting);
-
- [FitfunYDManager ff_downloadFileReq:urlString filename:fileNameString fileId:fileIdSting];
- }
-
- #pragma mark - 同步POST请求
- const char* FitfunPostData(const char* webUrl,const char* m_Params)
- {
- NSString *webUrlString = [[NSString alloc] initWithCString:webUrl encoding:NSUTF8StringEncoding];
- NSString *m_ParamsString = [[NSString alloc] initWithCString:m_Params encoding:NSUTF8StringEncoding];
- NSLog(@"FitfunHead_C==FitfunPostData webUrlString:%@, m_ParamsString:%@", webUrlString, m_ParamsString);
-
- return FitfunMakeStringCopy([[FitfunYDManager PostToWeb:webUrlString params:m_ParamsString] UTF8String]);
- }
-
-
-
- #pragma mark - 文件下载
- //断点续传
- #pragma mark 断点下载
- void FitfunBreakPtDownload( const char* url,const char * filePath ){
- NSString *urlString = [[NSString alloc] initWithCString:url encoding:NSUTF8StringEncoding];
- NSString *filePathString = [[NSString alloc] initWithCString:filePath encoding:NSUTF8StringEncoding];
- NSDate* dat = [NSDate dateWithTimeIntervalSinceNow:0];
- NSTimeInterval a=[dat timeIntervalSince1970] * 1000;
- NSString*timeString = [NSString stringWithFormat:@"%0.f", a];//转为字符型
- NSString *dataUrlstring = urlString;
- if ([urlString containsString:@"?t="] == NO) {
- dataUrlstring = [NSString stringWithFormat:@"%@?t=%@",urlString,timeString];;
- }
-
-
- NSLog(@"FitfunHead_C==FitfunBreakPtDownload urlString:%@, filePathString:%@", dataUrlstring, filePathString);
-
- [FitfunYDManager ff_startBreakDownloadWithURLStr:dataUrlstring savePath:filePathString];
-
- }
-
- #pragma mark 文件下载是否成功
- int FitfunBreakPtIsSuccess() {
-
- return [FitfunYDManager ff_breakDownloadIsSuccess];
- }
-
- #pragma mark 获取文件下载进度
- int FitfunBreakPtGetProgress() {
-
- return [FitfunYDManager ff_breakDownloadProgress];
- }
-
- #pragma mark 文件总字节数
- int FitfunBreakPtGetTotalBytes() {
- NSLog(@"FitfunHead_C==FitfunBreakPtGetTotalBytes: %d", [FitfunYDManager ff_breakDownloadTotalBytes]);
-
- return [FitfunYDManager ff_breakDownloadTotalBytes];
- }
-
- #pragma mark 立即获取文件大小 字节
- long FitfunGetRemoteFileBytes( const char* url) {
- NSString *urlStr = [[NSString alloc] initWithCString:url encoding:NSUTF8StringEncoding];
-
- long dataLength = [FitfunYDManager URLHEAD:urlStr];
- NSLog(@"FitfunHead_C==FitfunGetRemoteFileBytes ==url:%@, 文件大小:%zd字节==", urlStr, dataLength);
-
- return dataLength;
- }
-
- #pragma mark - 网络连接
- #pragma mark 建立连接
- void FitfunNetLink( const char* value, int port )
- {
- NSString *hostName = [[NSString alloc] initWithCString:value encoding:NSUTF8StringEncoding];
- // NSLog(@"FitfunHead_C==FitfunNetLink:hostName:%@, port:%d", hostName, port);
-
- [FitfunYDManager ff_connectServer:hostName port:port];
- }
-
- #pragma mark 向服务器发消息
- void FitfunNetSend( const char* value )
- {
- NSString *message = [[NSString alloc] initWithCString:value encoding:NSUTF8StringEncoding];
- // NSLog(@"FitfunHead_C==FitfunNetSend: message:%@", message);
-
- [FitfunYDManager ff_sendSeverMessage:message];
- }
-
- #pragma mark 关闭网络连接
- void FitfunNetClose()
- {
- [FitfunYDManager ff_closeSocket];
- }
-
- #pragma mark - 打开网页
- void FitFunOpenWebUrl(const char* webUrl)
- {
- NSString *webUrlString = [[NSString alloc] initWithCString:webUrl encoding:NSUTF8StringEncoding];
- NSLog(@"FitfunHead_C==FitFunOpenWebUrl webUrlString:%@", webUrlString);
-
- [[FitfunYDManager ff_sharedInstance] ff_openWebWithURL:webUrlString];
- }
-
-
- #pragma mark - 登录 *****************接渠道需要变更接入SDK*****************************************
- #pragma mark -
-
- void FitfunLogin( char* key )
- {
- NSString *keyStr = [NSString stringWithUTF8String:key];
- NSLog(@"FitfunHead_C==FitfunLogin: key:%@", keyStr);
-
-
- [[FitfunSDKManager ff_sharedInstance] ff_showLoginViewIsAutoLogin:YES currentController:[FitfunYDManager ff_sharedInstance].rootViewController];
- }
-
- #pragma mark 切换账号/退出 *****************接渠道需要变更接入SDK************************************
- void FitfunSwitchAccount( char* value )
- {
- NSLog(@"FitfunHead_C==FitfunSwitchAccount");
-
- [[FitfunSDKManager ff_sharedInstance] ff_switchAccount];
-
-
- /*
- 如果渠道没有切换账号/退出功能,就直接调用下面的方法
-
- //向u3d发送消息,注销登录
- [FitfunYDManager ff_sendMessageToU3DWithTarget:@"ledouApi" message:@"OnLogoutGame" param:@""];
- */
- }
-
- #pragma mark - 支付 *****************接渠道需要变更接入SDK********************************************
- #pragma mark -
- void FitfunPay( char* c_amount, char* c_productID, char* c_extraInfo, char* c_desc )
- {
- NSString *strAmount = [[NSString alloc] initWithCString:c_amount encoding:NSUTF8StringEncoding];
- NSString *strProductID = [[NSString alloc] initWithCString:c_productID encoding:NSUTF8StringEncoding];
- NSString *strExtraInfo = [[NSString alloc] initWithCString:c_extraInfo encoding:NSUTF8StringEncoding];
- NSString *descStr = [NSString stringWithUTF8String:c_desc];
- /*strExtraInfo:productId=10002&userId=85291267&environment=QA*/
- NSLog(@"FitfunHead_C==FitfunPay strAmount:%@, strProductID:%@, strExtraInfo:%@, descStr:%@", strAmount, strProductID, strExtraInfo, descStr);
-
- [[FitfunSDKManager ff_sharedInstance] ff_payWithProductID:strProductID amount:strAmount];
- }
-
-
- #pragma mark - 个人中心
- void FitFunShowSDKSetting()
- {
- NSLog(@"FitfunHead_C==FitFunShowSDKSetting");
-
- [[FitfunSDKManager ff_sharedInstance] ff_showMeCenter];
- }
-
- #pragma mark - 分享
- void FitFunShareWithImageAndText(const char* imagePath, const char* text)
- {
- NSString *imagePathString = [[NSString alloc] initWithCString:imagePath encoding:NSUTF8StringEncoding];
- NSString *textString = [[NSString alloc] initWithCString:text encoding:NSUTF8StringEncoding];
-
- NSLog(@"FitfunHead_C==FitFunShareWithImageAndText imagePathString:%@, textString:%@", imagePathString, textString);
-
- [[FitfunSDKManager ff_sharedInstance] ff_shareWithImage:imagePathString text:textString];
- }
-
-
-
-
-
- #pragma mark - 通用接口函数 Set
- /*
- 函数名 参数 对照表
- funcName:OnGameInit params:
-
- funcName:FitFunUpdateUserInfo params:{"USER_INFO_ID":"ODUyOTEyNjc=","USER_INFO_NAME":"6Z2e5Yeh55qE5ZyfMDE=","USER_INFO_LEVEL":"Mw==","USER_INFO_VIP_LEVEL":"MA==","USER_INFO_BALANCE":"MA==","USER_INFO_GUILD_NAME":"MA==","USER_INFO_SERVER_ID":"Mg==","USER_INFO_SERVER_NAME":"5YWo5rCR5LmQ6Iie6YCB5a6h5pyN","USER_INFO_LEVEL_CHANGE_TIME_CHUO_AND_LEVEL":""}
-
- funcName:role_login params:
-
- funcName:role_level_change params:
-
- funcName: params:
- funcName: params:
- funcName: params:
-
- */
- void FitFunSetFuncAny(const char* funcName, const char* params )
- {
- NSString *funcNameStr = [[NSString alloc] initWithCString:funcName encoding:NSUTF8StringEncoding];
- NSString *paramsStr = [[NSString alloc] initWithCString:params encoding:NSUTF8StringEncoding];
- NSLog(@"FitfunHead_C==FitFunSetFuncAny funcNameStr:%@, paramsStr:%@", funcNameStr, paramsStr);
-
- [[FitfunSDKManager ff_sharedInstance] ff_setFuncAnyWithFuncName:funcNameStr params:paramsStr];
- }
-
- #pragma mark - 通用接口函数 Get
- const char* FitFunGetFuncAny( const char* funcName, const char* params)
- {
- NSString *funcNameStr = [[NSString alloc] initWithCString:funcName encoding:NSUTF8StringEncoding];
- NSString *paramsStr = [[NSString alloc] initWithCString:params encoding:NSUTF8StringEncoding];
- //NSLog(@"FitfunHead_C==FitFunGetFuncAny funcNameStr:%@, paramsStr:%@", funcNameStr, paramsStr);
-
- if ( [funcNameStr isEqualToString:@"GetProviderName"] )
- {
- NSString* providerValue = @"";
- return FitfunMakeStringCopy([providerValue UTF8String]);
- }
-
- NSString *returnValue = [[FitfunSDKManager ff_sharedInstance] ff_getFuncAnyWithFuncName:funcNameStr params:paramsStr];
- if (returnValue == nil || returnValue.length == 0) {
- NSLog(@"FitfunHead_C==FitFunGetFuncAny funcNameStr:%@, paramsStr:%@", funcNameStr, paramsStr);
- }
- return FitfunMakeStringCopy([returnValue UTF8String]);
- }
-
- void FitFunExitGame(){
- UIWindow *window = [UIApplication sharedApplication].keyWindow;
- // 动画 1
- [UIView animateWithDuration:0.6f animations:^{
- window.alpha = 0;
- window.frame = CGRectMake(0, window.bounds.size.width, 0, 0);
- } completion:^(BOOL finished) {
- exit(0);
- }];
- }
-
-
- #pragma mark -
- #pragma mark - 已废弃函数
- void FitfunSetRoleName( const char* rolename ){
- NSLog(@"FitfunHead_C==FitfunSetRoleName");
- }
-
- //游戏中心
- void FitFunReportScoreAndScoreInt(const char* scoreId,const char *scoreInt)
- {
- NSLog(@"FitfunHead_C==FitFunReportScoreAndScoreInt");
- }
-
- void FitFunAchievementsWithId (const char *achievementsId)
- {
- NSLog(@"FitfunHead_C==FitFunAchievementsWithId");
- }
-
- void FitFunShowGameCentre ()
- {
- NSLog(@"FitfunHead_C==FitFunShowGameCentre");
- }
-
-
-
- //设置服务器host === 存在延迟,不合理 (程序一启动就应该调用此方法的,初始化需要用到根地址)
- void FitfunSetSDKUrl( const char* val )
- {
- // NSString* SDKURL = [NSString stringWithUTF8String:val];
- // NSLog(@"FitfunHead_C==FitfunSetSDKUrl:%@", SDKURL);
- }
-
- // 云娃登出频道
- void FitFunLogoutChannel()
- {
- // NSLog(@"FitfunHead_C==FitFunLogoutChannel");
- }
-
- //设置照片上传地址 -- 正式环境下没用
- void FitfunSetPhotoPostUrl( const char* val )
- {
- //只有QA环境下才会执行这个方法
- NSString *photoPostURL = [NSString stringWithUTF8String:val];
- NSLog(@"FitfunHead_C==FitfunSetPhotoPostUrl:%@", photoPostURL);
-
- [FitfunYDManager ff_sharedInstance].photoPostKURL = photoPostURL;
- }
-
-
- #if defined(__cplusplus)
- }
- #endif
|