| | |
| | | Free = 1,// 默认 |
| | | Quick = 10, //quick |
| | | Hy = 15, //欢游 |
| | | Gaore = 20, // 20-高热 - 硬核渠道 |
| | | } |
| | | |
| | | //权限申请回调 |
| | |
| | | { |
| | | ChannelPlatform = E_ChannelPlatform.Quick; |
| | | } |
| | | else if (_channelPlatform.Equals("gaore")) |
| | | { |
| | | ChannelPlatform = E_ChannelPlatform.Gaore; |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | Application.Quit(); |
| | | } |
| | | break; |
| | | case CodeA2U.GetAdAward: |
| | | if (AdsManager.Instance.waitAdID > 0) |
| | | { |
| | | AdsManager.Instance.GetAdsAward(AdsManager.Instance.waitAdID); |
| | | AdsManager.Instance.waitAdID = 0; |
| | | } |
| | | break; |
| | | case CodeA2U.AdLoadFail: |
| | | AdsManager.Instance.lastLoadErrorTime = Time.time; |
| | | break; |
| | | } |
| | | onSdkMsg?.Invoke(_code, _json); |
| | | } |
| | |
| | | public const int PingfenCallBack = 113; //评分回调 和 GotoShopOK 不一样 具体看使用区分 |
| | | public const int GotoShopOK = 115; //前往商店成功 |
| | | public const int GotoFBOK = 116; |
| | | public const int GetAdAward = 117; //广告播放成功发放奖励 |
| | | public const int AdLoadFail = 118; //广告加载失败 |
| | | #endregion |
| | | } |
| | | |
| | |
| | | public const int FansHouse = 120; //粉丝屋 论坛等 |
| | | public const int GotoShop = 121; //前往商店 |
| | | public const int TrackEvent = 122; //自定义事件 |
| | | /** |
| | | * 极光推送 |
| | | * */ |
| | | public const int JPushAddLocalMessage = 200; |
| | | public const int JPushRemoveLocalMessage = 201; |
| | | public const int PlayAds = 123; //播放广告 |
| | | /** |
| | | * IOS特殊需求 |
| | | */ |
| | |
| | | public int totalMemory; |
| | | } |
| | | |
| | | #region 自由sdk相关 |
| | | #region sdk相关 |
| | | |
| | | public UnityAction onFreePlatformInitOk; |
| | | public UnityAction onFreePlatformInitFail; |
| | |
| | | #endif |
| | | } |
| | | |
| | | public void FreePlatformBindPhone() |
| | | { |
| | | #if UNITY_ANDROID |
| | | AndroidJavaClass _jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); |
| | | AndroidJavaObject _jo = _jc.GetStatic<AndroidJavaObject>("currentActivity"); |
| | | _jo.Call("BindPhone"); |
| | | #endif |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 自由SDK登陆 |
| | | /// SDK登陆 |
| | | /// </summary> |
| | | public void FreePlatformLogin() |
| | | { |
| | |
| | | SendMessageToSDK(m_Json); |
| | | } |
| | | |
| | | public void TencentLogin(string param) |
| | | { |
| | | #if !UNITY_EDITOR |
| | | m_Json.Clear(); |
| | | m_Json["code"] = CodeU2A.TencentLogin; |
| | | if (!string.IsNullOrEmpty(param)) |
| | | { |
| | | m_Json["param"] = param; |
| | | } |
| | | SendMessageToSDK(m_Json); |
| | | #endif |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 自由SDK登出 |
| | |
| | | // FreePlatformLogin(); |
| | | #endif |
| | | } |
| | | public void ShowAccountView() |
| | | { |
| | | #if !UNITY_EDITOR |
| | | m_Json.Clear(); |
| | | m_Json["code"] = CodeU2A.ShowAccountView; |
| | | SendMessageToSDK(m_Json); |
| | | |
| | | // FreePlatformLogin(); |
| | | |
| | | #endif |
| | | } |
| | | public void FreePlatformSwitchAccount() |
| | | { |
| | | #if UNITY_ANDROID |
| | | AndroidJavaClass _jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); |
| | | AndroidJavaObject _jo = _jc.GetStatic<AndroidJavaObject>("currentActivity"); |
| | | _jo.Call("SwitchAccount"); |
| | | #endif |
| | | } |
| | | |
| | | private Dictionary<string, string> m_PaymentTable = new Dictionary<string, string>(); |
| | | private string m_EncodeKey = "03sujm7gerywdvyd5vkkk772rs4by230"; |
| | | |
| | | |
| | | |
| | |
| | | m_Json["createTime"] = TimeUtility.CreateSeconds.ToString(); |
| | | m_Json["familyID"] = PlayerDatas.Instance.baseData.FamilyId.ToString(); |
| | | m_Json["fightPower"] = PlayerDatas.Instance.baseData.FightPower.ToString(); |
| | | m_Json["num"] = 1; |
| | | |
| | | #if UNITY_IOS |
| | | m_Json["identifier"] = VersionConfig.Get().bundleIdentifier; |
| | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 分享到facebook |
| | | /// /// </summary> |
| | | public void ShareToFaceBook(int type) |
| | | { |
| | | // Debug.Log("越南分享"); |
| | | // m_Json.Clear(); |
| | | // m_Json["code"] = CodeU2A.ShareToFaceBook; |
| | | // m_Json["type"] = type; |
| | | // SendMessageToSDK(m_Json); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 去商店评论 |
| | | /// </summary> |
| | | public void GoToPingfen() |
| | | { |
| | | // Debug.Log("越南评分"); |
| | | // m_Json.Clear(); |
| | | // m_Json["code"] = CodeU2A.GoToPingfen; |
| | | // SendMessageToSDK(m_Json); |
| | | } |
| | | |
| | | //前往商店 |
| | | public void GoToShop() |
| | | { |
| | | // m_Json.Clear(); |
| | | // m_Json["code"] = CodeU2A.GotoShop; |
| | | // SendMessageToSDK(m_Json); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @param context |
| | | * @param event 事件名 |
| | | * @param value 事件值,如果没有可以传"" |
| | | * @param isRepeatReport 是否重复上报。根据运营需求是否排重上报,true可以重复上报,false仅上报一次 |
| | | */ |
| | | public void TraceEvent(string eventName, string value, bool isRepeatReport) |
| | | { |
| | | // Debug.Log("越南事件汇报 :" + eventName); |
| | | // m_Json.Clear(); |
| | | // m_Json["code"] = CodeU2A.TrackEvent; |
| | | // m_Json["eventName"] = eventName; |
| | | // m_Json["value"] = value; |
| | | // m_Json["isRepeatReport"] = isRepeatReport; |
| | | // SendMessageToSDK(m_Json); |
| | | } |
| | | |
| | | private void BuildFreePlatformInfo(JsonData json) |
| | | { |
| | |
| | | FreePlatformInfo.phone = 0; |
| | | } |
| | | |
| | | private void HandleFreePlatformRegisteOk(JsonData json) |
| | | { |
| | | // BuildFreePlatformInfo(json); |
| | | } |
| | | |
| | | private void HandleFreePlatformLoginOk(JsonData data) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // public void OnServerChargeOk(HA106_tagMCCoinToGoldReport pack) |
| | | // { |
| | | // string orderID = pack.OrderID; |
| | | // uint coin = pack.Coin; |
| | | // OperationLogCollect.Instance.RecordEvent(9, coin); |
| | | |
| | | // if (onFreePlatformPayOk != null) |
| | | // { |
| | | // onFreePlatformPayOk(); |
| | | // } |
| | | |
| | | // m_Json.Clear(); |
| | | // m_Json["code"] = CodeU2A.PayFinished; |
| | | // m_Json["orderID"] = orderID; |
| | | // m_Json["payType"] = "_default_"; |
| | | // m_Json["moneyType"] = "CNY"; |
| | | // m_Json["money"] = (float)coin / 100; |
| | | // SendMessageToSDK(m_Json); |
| | | // } |
| | | |
| | | public void SendRegistEvent(bool _ok, string _result) |
| | | { |
| | | if (_ok) |
| | | { |
| | | if (!_result.Equals("0")) |
| | | { |
| | | m_Json.Clear(); |
| | | m_Json["code"] = CodeU2A.SendRegistEvent; |
| | | SendMessageToSDK(m_Json); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void SendLoginEvent() |
| | | { |
| | | m_Json.Clear(); |
| | | m_Json["code"] = CodeU2A.SendLoginEvent; |
| | | SendMessageToSDK(m_Json); |
| | | } |
| | | |
| | | public void SendHideFloatWin() |
| | | { |
| | |
| | | |
| | | public void CreateRoleOk(string roleID, string roleName, string time) |
| | | { |
| | | if (VersionConfig.Get().appId == "ryzj") |
| | | { |
| | | SendGaoreEvent(2); |
| | | return; |
| | | } |
| | | |
| | | m_Json.Clear(); |
| | | m_Json["code"] = CodeU2A.CreateRole; |
| | | |
| | |
| | | |
| | | public void RoleLogin() |
| | | { |
| | | if (VersionConfig.Get().appId == "ryzj") |
| | | { |
| | | SendGaoreEvent(3); |
| | | return; |
| | | } |
| | | m_Json.Clear(); |
| | | m_Json["code"] = CodeU2A.RoleLogin; |
| | | |
| | |
| | | SendMessageToSDK(m_Json); |
| | | } |
| | | |
| | | |
| | | void SendGaoreEvent(int dataType, string pageType = "无", string pageName = "无", string pageItemId = "无", |
| | | int money = 0, string orderID = "") |
| | | { |
| | | m_Json.Clear(); |
| | | m_Json["code"] = CodeU2A.TrackEvent; |
| | | m_Json["dataType"] = dataType; |
| | | m_Json["sid"] = ServerListCenter.Instance.currentServer.region_flag; |
| | | m_Json["serverName"] = ServerListCenter.Instance.currentServer.name; |
| | | m_Json["roleName"] = PlayerDatas.Instance.baseData.PlayerName; |
| | | m_Json["level"] = PlayerDatas.Instance.baseData.LV; |
| | | m_Json["roleID"] = PlayerDatas.Instance.baseData.PlayerID; |
| | | m_Json["orderId"] = orderID; |
| | | m_Json["mount"] = money; //充值分 |
| | | m_Json["money"] = PlayerDatas.Instance.baseData.diamond; |
| | | m_Json["createTime"] = TimeUtility.CreateSeconds < 0 ? 0 : TimeUtility.CreateSeconds; |
| | | m_Json["familyID"] = PlayerDatas.Instance.baseData.FamilyId; |
| | | m_Json["familyName"] = PlayerDatas.Instance.baseData.FamilyName; |
| | | m_Json["familyLV"] = PlayerDatas.Instance.fairyData.fairy != null ? PlayerDatas.Instance.fairyData.fairy.FamilyLV.ToString() : "0"; |
| | | m_Json["familyLeaderName"] = PlayerDatas.Instance.fairyData.fairy != null ? PlayerDatas.Instance.fairyData.fairy.LeaderName : ""; |
| | | m_Json["fightPower"] = PlayerDatas.Instance.baseData.FightPower; |
| | | m_Json["job"] = 0; |
| | | m_Json["jobName"] = "无"; |
| | | m_Json["sex"] = "无"; |
| | | m_Json["jobID"] = 0; |
| | | m_Json["jobIDName"] = "无"; |
| | | m_Json["vipLevel"] = 0; |
| | | if (PlayerDatas.Instance.fairyData.mine != null && PlayerDatas.Instance.fairyData.mine.FmLV > 0) |
| | | { |
| | | if (PlayerDatas.Instance.fairyData.mine.FmLV == 3) |
| | | { |
| | | m_Json["faimilyRoleID"] = 1; |
| | | } |
| | | else if (PlayerDatas.Instance.fairyData.mine.FmLV == 2) |
| | | { |
| | | m_Json["faimilyRoleID"] = 2; |
| | | } |
| | | else |
| | | { |
| | | m_Json["faimilyRoleID"] = 3; |
| | | } |
| | | |
| | | m_Json["faimilyRoleName"] = RichTextMsgReplaceConfig.GetRichReplace("FAMILY", PlayerDatas.Instance.fairyData.mine.FmLV); |
| | | } |
| | | else |
| | | { |
| | | m_Json["faimilyRoleID"] = 0; |
| | | m_Json["faimilyRoleName"] = "无"; |
| | | } |
| | | m_Json["opentime"] = 0; |
| | | m_Json["pageType"] = pageType; |
| | | m_Json["pageName"] = pageName; |
| | | m_Json["pageItemId"] = pageItemId; |
| | | |
| | | SendMessageToSDK(m_Json); |
| | | |
| | | } |
| | | |
| | | //事件记录 |
| | | public void SendTraceEvent(int dataType, string pageType = "无", string pageName = "无", string pageItemId = "无", |
| | | int money = 0, string orderID = "") |
| | | { |
| | | if (VersionConfig.Get().appId == "ryzj") |
| | | { |
| | | SendGaoreEvent(dataType, pageType, pageName, pageItemId, money, orderID); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | public void RoleLevelUp() |
| | | { |
| | | if (VersionConfig.Get().appId == "ryzj") |
| | | { |
| | | SendGaoreEvent(4); |
| | | return; |
| | | } |
| | | |
| | | |
| | | m_Json.Clear(); |
| | | m_Json["code"] = CodeU2A.RoleLevelUp; |
| | | |
| | |
| | | { |
| | | if (PlayerDatas.Instance.PlayerId == 0) |
| | | return; |
| | | |
| | | if (!DTC0403_tagPlayerLoginLoadOK.finishedLogin) |
| | | |
| | | if (!DTC0403_tagPlayerLoginLoadOK.finishedLogin) |
| | | return; |
| | | if (VersionConfig.Get().appId == "ryzj") |
| | | { |
| | | SendGaoreEvent(5); |
| | | return; |
| | | } |
| | | |
| | | |
| | | m_Json.Clear(); |
| | | m_Json["code"] = CodeU2A.RoleLoginOut; |
| | |
| | | SendMessageToSDK(m_Json); |
| | | } |
| | | |
| | | public void GotoFansHouse() |
| | | { |
| | | Debug.Log("越南点赞"); |
| | | m_Json.Clear(); |
| | | m_Json["code"] = CodeU2A.FansHouse; |
| | | |
| | | SendMessageToSDK(m_Json); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 插件相关 |
| | | |
| | | #endregion |
| | | |
| | | #region 极光推送相关 |
| | | public void GeTui_SendLocalMessage(JsonData jsonData) |
| | | #region 广告 |
| | | //type为0立即播放视频,1为预加载 |
| | | public void PlayAds(string adid) |
| | | { |
| | | return; |
| | | Debug.Log("GeTui_SendLocalMessage:" + jsonData["id"]); |
| | | // ------ 举例 ------ |
| | | // JsonData _params = new JsonData (); |
| | | // _params ["code"] = 2005; |
| | | // _params ["id"] = 5;// id 重要, 标示每个通知的更新或者移除 |
| | | // _params ["title"] = "the title";// 推送标题 |
| | | // _params ["subtitle"] = "the subtitle";// 副标题 |
| | | // _params ["content"] = "the content";// 具体内容 |
| | | // _params ["badge"] = -1;// 角标 |
| | | // |
| | | // // 以下为决定应该多久后弹出此通知 |
| | | // System.TimeSpan ts = System.DateTime.UtcNow - new System.DateTime (1970, 1, 1, 0, 0, 0, 0); |
| | | // long ret = System.Convert.ToInt64 (ts.TotalSeconds) + 3;// 表示3秒后 |
| | | // _params ["fireTime"] = ret; |
| | | #if !UNITY_EDITOR |
| | | jsonData["code"] = CodeU2A.JPushAddLocalMessage; |
| | | #if UNITY_ANDROID |
| | | jsonData["fireTime"] = (long)jsonData["fireTime"] * 1000; |
| | | #endif |
| | | SendMessageToSDK(jsonData); |
| | | #endif |
| | | } |
| | | |
| | | public void GeTui_RemoveLocalMessage(string id) |
| | | { |
| | | return; |
| | | Debug.Log("GeTui_RemoveLocalMessage:" + id); |
| | | #if !UNITY_EDITOR |
| | | m_Json.Clear(); |
| | | m_Json["code"] = CodeU2A.JPushRemoveLocalMessage; |
| | | m_Json["id"] = id;// id 重要, 标示每个通知的更新或者移除 |
| | | |
| | | m_Json["code"] = CodeU2A.PlayAds; |
| | | m_Json["adid"] = adid; |
| | | m_Json["type"] = 0; |
| | | SendMessageToSDK(m_Json); |
| | | #endif |
| | | } |
| | | |
| | | //打开带广告的界面 提前加载 |
| | | public void LoadAds(string adid) |
| | | { |
| | | m_Json.Clear(); |
| | | m_Json["code"] = CodeU2A.PlayAds; |
| | | m_Json["adid"] = adid; |
| | | m_Json["type"] = 1; |
| | | SendMessageToSDK(m_Json); |
| | | } |
| | | #endregion |
| | | |
| | | } |