// 获取服务器列表地址 public static string GetServerListUrl() { #if UNITY_WP8 && !UNITY_EDITOR string strServerListPath = WPSDKHelperScript.Instance().WPGetServerlistUrl(); #elif UNITY_ANDROID && !UNITY_EDITOR string strServerListPath = AndroidHelper.platformHelper("getServerlistUrl"); #elif UNITY_IPHONE && !UNITY_EDITOR string strServerListPath = IOSHelper.Common_GetServerListUrl(); #else string strServerListPath = "0"; #endif if (string.Equals(strServerListPath, "0") || string.IsNullOrEmpty(strServerListPath)) { //如果从平台URL获取错误,使用包体内的IPList #if UNITY_ANDROID && !UNITY_EDITOR strServerListPath = Application.streamingAssetsPath + "/IPList.txt"; #else // IOS PC Editor strServerListPath = "file://" + Application.streamingAssetsPath + "/IPList.txt"; #endif } else { strServerListPath = DownloadHelper.AddTimestampToUrl(strServerListPath); } return(strServerListPath); }
// 发送客户端自定义事件 MBI统计 public static void SendUserAction(string strEvent) { #if UNITY_WP8 && !UNITY_EDITOR WPSDKHelperScript.Instance().WPSendUserAction(strEvent); #elif UNITY_ANDROID && !UNITY_EDITOR AndroidHelper.platformHelper("sendUserAction", strEvent); #elif UNITY_IPHONE && !UNITY_EDITOR IOSHelper.SDK_SendUserAction(strEvent); #else #endif }
// 显示充值记录 public static void ShowRechargeRecord() { #if UNITY_WP8 && !UNITY_EDITOR WPSDKHelperScript.Instance().WPShowChargeRecord(); #elif UNITY_ANDROID && !UNITY_EDITOR AndroidHelper.doSdk("showRechargeRecord", ""); #elif UNITY_IPHONE && !UNITY_EDITOR IOSHelper.showRechargeRecord(); #else #endif }
//获取应用的Detail介绍Url public static string GetAppDetailUrl() { #if UNITY_WP8 && !UNITY_EDITOR return(WPSDKHelperScript.Instance().WPgetAppDetailUrl()); #elif UNITY_ANDROID && !UNITY_EDITOR return(AndroidHelper.platformHelper("getValue", "APP_DETAIL_URL")); #elif UNITY_IPHONE && !UNITY_EDITOR return(IOSHelper.Common_GetAppDetailUrl()); #else return("https://itunes.apple.com/cn/app/tian-long-ba-bu3d/id824104400?l=zh&ls=1&mt=8"); #endif }
// 获取包体更新地址 public static string GetUpdateAppUrl() { #if UNITY_WP8 && !UNITY_EDITOR return(WPSDKHelperScript.Instance().WPgetUpdateAppUrl()); #elif UNITY_ANDROID && !UNITY_EDITOR return(AndroidHelper.platformHelper("getUpdateAppUrl")); #elif UNITY_IPHONE && !UNITY_EDITOR return(IOSHelper.Common_GetUpdateAppUrl()); #else return("http://127.0.0.1:8080/tlbb/res"); #endif }
// 更新公告_备用公告地址 public static string GetCommonGengxinInfoURL() { #if UNITY_WP8 && !UNITY_EDITOR return(WPSDKHelperScript.Instance().WPGetCommonGengxinInfoURL()); #elif UNITY_ANDROID && !UNITY_EDITOR return(AndroidHelper.platformHelper("getValue", "GONGGAO_COMMON")); #elif UNITY_IPHONE && !UNITY_EDITOR return(IOSHelper.Common_GetCommonGengXinUrl()); #else return(@"http://ydcabal.changyou.com/cabal3D/conf/notice/login/Notice_AppStore.txt"); #endif }
//备用CDN2 public static string GetCDNReplaceUrl2() { #if UNITY_WP8 && !UNITY_EDITOR return(WPSDKHelperScript.Instance().WPGetCDNReplaceUrl2()); #elif UNITY_ANDROID && !UNITY_EDITOR return(AndroidHelper.platformHelper("getValue", "CDN_REPLACE_URL2")); #elif UNITY_IPHONE && !UNITY_EDITOR return(IOSHelper.Common_GetCDNReplaceUrl2()); #else return(""); #endif }
// 获取渠道标识 public static string GetChannelID() { #if UNITY_WP8 && !UNITY_EDITOR return(WPSDKHelperScript.Instance().channelid()); #elif UNITY_ANDROID && !UNITY_EDITOR //return ""; return(AndroidHelper.platformHelper("getChannelID")); #elif UNITY_IPHONE && !UNITY_EDITOR return(IOSHelper.SDK_GetChannelID()); #else return(""); #endif }
// 程序版本 public static int GetProgramVersion() { #if UNITY_WP8 && !UNITY_EDITOR return(WPSDKHelperScript.Instance().WPGetProgramVersion()); #elif UNITY_ANDROID && !UNITY_EDITOR //return (int)VERSION.ProgramVersion; string ret = AndroidHelper.platformHelper("getProgramVersion"); return(int.Parse(ret)); #elif UNITY_IPHONE && !UNITY_EDITOR return(IOSHelper.Common_GetProGramVersion()); #else return((int)VERSION.ProgramVersion); #endif }
// 获取设备唯一ID public static string GetDeviceUDID() { #if UNITY_WP8 && !UNITY_EDITOR return(WPSDKHelperScript.Instance().WPGetDeviceID()); #elif UNITY_ANDROID && !UNITY_EDITOR //return "Device." + LoginData.accountData.m_account; return(AndroidHelper.platformHelper("getDeviceUDID")); #elif UNITY_IPHONE && !UNITY_EDITOR return(IOSHelper.System_GetDeviceID()); #else // 编辑器和windows下返回Device.account return("Device." + LoginData.accountData.m_account); #endif }
// 是否开启调试模式:左上角调试框,FPS public static bool IsEnableDebugMode() { #if UNITY_WP8 && !UNITY_EDITOR return(WPSDKHelperScript.Instance().WPIsEnableDebugMode()); #elif UNITY_ANDROID && !UNITY_EDITOR return(true); //return AndroidHelper.isDebug; #elif UNITY_IPHONE && !UNITY_EDITOR return(IOSHelper.Common_IsEnableDebugMode()); #else return(true); #endif }
// 用户登出,注销 public static void UserLogout() { #if UNITY_WP8 && !UNITY_EDITOR if (null != WPSDKHelperScript.Instance()) { WPSDKHelperScript.Instance().WPLogOut(); } #elif UNITY_ANDROID && !UNITY_EDITOR AndroidHelper.doSdk("doLogout", ""); #elif UNITY_IPHONE && !UNITY_EDITOR IOSHelper.doLogout(); #else #endif }
//获取渠道强更配置版本号,默认为0,当不改变服务器版本号和程序版本号时,通过这个值实现单独渠道强更 lihao_yd 2015-12-08 public static int GetUpdateChannelAppConfig() { #if UNITY_WP8 && !UNITY_EDITOR return(WPSDKHelperScript.Instance().WPGetUpdateChannelAppConfig()); #elif UNITY_ANDROID && !UNITY_EDITOR string ret = AndroidHelper.platformHelper("getValue", "UPDATE_CHANNEL_APP_CONFIG_VERSION"); return(int.Parse(ret)); //return 0; #elif UNITY_IPHONE && !UNITY_EDITOR return(IOSHelper.Common_GetUpdateChannelAppConfig()); #else return(0); #endif }
// 请求商品列表 public static void ReqPaymentGoodInfoList() { #if UNITY_WP8 && !UNITY_EDITOR WPSDKHelperScript.Instance().WPreqPaymentGoodInfoList(); #elif UNITY_ANDROID && !UNITY_EDITOR AndroidHelper.doSdk("reqPaymentGoodInfoList", ""); #elif UNITY_IPHONE && !UNITY_EDITOR IOSHelper.requestGoodsList(); #else RechargeData.Text(); if (null != RechargeController.Instance()) { RechargeController.Instance().UpdateRechargeList(); } #endif }
// 资源更新地址 public static string GetResDonwloadUrl() { #if UNITY_WP8 && !UNITY_EDITOR if (null != WPSDKHelperScript.Instance()) { return(WPSDKHelperScript.Instance().WPgetResDonwloadUrl()); } else { return(""); } #elif UNITY_ANDROID && !UNITY_EDITOR return(AndroidHelper.platformHelper("getResDonwloadUrl")); #elif UNITY_IPHONE && !UNITY_EDITOR return(IOSHelper.Common_GetResDownloadUrl()); #else return("http://127.0.0.1:8080/tlbb/res"); #endif }
// 是否开启资源更新 public static bool IsEnableUpdate() { #if UNITY_WP8 && !UNITY_EDITOR return(WPSDKHelperScript.Instance().WPIsEnableUpdate()); #elif UNITY_ANDROID && !UNITY_EDITOR string ret = AndroidHelper.platformHelper("isEnableUpdate"); if ("1".Equals(ret)) { return(true); } else { return(false); } #elif UNITY_IPHONE && !UNITY_EDITOR return(IOSHelper.Common_IsEnableUpdate()); #else return(false); #endif }
// 打开客服界面 public static void ShowCallCenter() { #if UNITY_WP8 && !UNITY_EDITOR WPSDKHelperScript.Instance().WPReqShowCallCenter(); #elif UNITY_ANDROID && !UNITY_EDITOR LoginData.ServerListData lastServerData = LoginData.GetServerListDataByID(PlayerPreferenceData.LastServer); LoginData.PlayerRoleData lastRoleData = LoginData.GetPlayerRoleData(PlayerPreferenceData.LastRoleGUID); Obj_MainPlayer mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer; if (null != lastServerData && null != lastRoleData && null != mainPlayer) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); JsonWriter writer = new JsonWriter(sb); writer.WriteObjectStart(); writer.WritePropertyName("serverName"); writer.Write(lastServerData.m_name); writer.WritePropertyName("serverId"); writer.Write(lastServerData.m_id.ToString()); writer.WritePropertyName("roleName"); writer.Write(lastRoleData.name); writer.WritePropertyName("roleId"); writer.Write(string.Format("{0:X16}", lastRoleData.guid)); writer.WritePropertyName("roleGrade"); writer.Write(mainPlayer.BaseAttr.Level.ToString()); writer.WritePropertyName("vipGrade"); writer.Write(VipData.GetVipLv().ToString()); writer.WritePropertyName("version"); writer.Write(GCGame.Utils.GetVersionString()); writer.WriteObjectEnd(); AndroidHelper.doSdk("showCallCenter", sb.ToString()); } #elif UNITY_IPHONE && !UNITY_EDITOR IOSHelper.SDK_ShowCallCenter(); #else #endif }
// 使用GOODINFO方式支付 public static bool MakePayWithGoodInfo(RechargeData.GoodInfo curGoodInfo) { if (null == curGoodInfo) { LogModule.ErrorLog("goodinfo null"); return(false); } LoginData.PlayerRoleData curRole = LoginData.GetPlayerRoleData(PlayerPreferenceData.LastRoleGUID); if (null == curRole) { LogModule.ErrorLog("get role data fail"); return(false); } #if UNITY_WP8 && !UNITY_EDITOR WPSDKHelperScript.Instance().WPmakePayWithGoodInfo(string.Format("{0:X16}", curRole.guid), PlayerPreferenceData.LastServer.ToString(), curRole.name, curGoodInfo.goods_id, curGoodInfo.goods_name, curGoodInfo.goods_number, curGoodInfo.goods_price, curGoodInfo.goods_register_id); #elif UNITY_ANDROID && !UNITY_EDITOR System.Text.StringBuilder sb = new System.Text.StringBuilder(); JsonWriter writer = new JsonWriter(sb); writer.WriteObjectStart(); writer.WritePropertyName("roleID"); writer.Write(string.Format("{0:X16}", curRole.guid)); writer.WritePropertyName("serverId"); writer.Write(PlayerPreferenceData.LastServer.ToString()); writer.WritePropertyName("roleName"); writer.Write(curRole.name); writer.WritePropertyName("goodsId"); writer.Write(curGoodInfo.goods_id); writer.WritePropertyName("goodsName"); writer.Write(curGoodInfo.goods_name); writer.WritePropertyName("goodsNum"); writer.Write(curGoodInfo.goods_number); writer.WritePropertyName("goodsPrice"); writer.Write(curGoodInfo.goods_price); writer.WritePropertyName("goodsDesc"); writer.Write(curGoodInfo.goods_describe); writer.WritePropertyName("goodsRegisterId"); writer.Write(curGoodInfo.goods_register_id); writer.WritePropertyName("oid"); writer.Write(LoginData.accountData.m_oid); writer.WritePropertyName("token"); writer.Write(LoginData.accountData.m_accessToken); writer.WritePropertyName("vip"); writer.Write("0"); writer.WritePropertyName("balance"); writer.Write("0"); writer.WritePropertyName("roleLevel"); writer.Write("1"); writer.WritePropertyName("partyName"); writer.Write("partyName"); writer.WritePropertyName("pushInfo"); writer.Write("pushInfo"); writer.WriteObjectEnd(); AndroidHelper.doSdk("makePayWithGoodInfo", sb.ToString()); #elif UNITY_IPHONE && !UNITY_EDITOR IOSHelper.makePayWithGoodInfo(string.Format("{0:X16}", curRole.guid), PlayerPreferenceData.LastServer.ToString(), curRole.name, curGoodInfo.goods_id, curGoodInfo.goods_name, curGoodInfo.goods_number, curGoodInfo.goods_price, curGoodInfo.goods_register_id); #else #endif return(true); }