예제 #1
0
        private void OnPushGiftRsp(object s)
        {
            if (s is SCGetPushResponse)
            {
                var rsp = s as SCGetPushResponse;

                List <Push_Info> infos = new List <Push_Info>();

                if (null == rsp.Infos || 0 == rsp.Infos.Count)
                {
                    m_login_push_infos = null;
                    return;
                }

                infos.AddRange(rsp.Infos);

                PushGiftManager.Instance.RefreshLoginPush(infos);
            }
            else if (s is SCBuyPushResponse)
            {
                var rsp = s as SCBuyPushResponse;

                if (!MsgStatusCodeUtil.OnError(rsp.ReponseStatus))
                {
#if UNITY_IOS && PLATFORM_ID
                    GameEvents.IAPEvents.Sys_BuyProductIOSEvent.SafeInvoke(ConfCharge.Get(ConfPush.Get(rsp.PushId).chargeid).chargeSouceId);
#else
                    GameEvents.IAPEvents.Sys_BuyProductEvent.SafeInvoke(ConfCharge.Get(ConfPush.Get(rsp.PushId).chargeid).id);
#endif
                }
            }
        }
예제 #2
0
        public static bool GetConfig(string fieldName, object fieldValue, out ConfCharge config)
        {
            DataTable sqReader = SQLiteHelper.Instance().GetSelectWhereCondition("conf_Charge", fieldName, fieldValue);

            if (sqReader != null)
            {
                try
                {
                    sqReader.Read();
                    if (sqReader.HasRows)
                    {
                        config = GetConfByDic(sqReader);
                    }
                    else
                    {
                        config = null;
                        return(false);
                    }
                    return(true);
                }
                catch (Exception ex)
                {
                    SqliteDriver.SQLiteHelper.OnError(string.Format("Charge 表找不到列={0} 值={1}的数据\n{2}", fieldName, fieldValue, ex));
                }
                config = null;
                return(false);
            }
            config = null;
            return(false);
        }
예제 #3
0
        public void Refresh(ConfCharge itemdata, int index_)
        {
            m_itemdata = itemdata;

            m_icon_img.Sprite = itemdata.icon;

            if (!string.IsNullOrEmpty(itemdata.discountIcon) && !string.IsNullOrWhiteSpace(itemdata.discountIcon))
            {
                m_praise_icon.Sprite = itemdata.discountIcon;
            }
            else
            {
                m_praise_icon.Visible = false;
            }

            m_count_lab.Text = string.Format("x{0}", itemdata.cashCount + itemdata.addCount);

            string price = string.Format("{0:N2}", (float)itemdata.dollar / 100.0f);

#if  UNITY_IOS && PLATFORM_ID
            //price = GameEvents.IAPEvents.Sys_GetPriceIOSEvent.SafeInvoke(itemdata.chargeSouceId);
#else
            //price = GameEvents.IAPEvents.Sys_GetPriceEvent.SafeInvoke(itemdata.id);
#endif
            m_cost_lab.Text = string.IsNullOrEmpty(price) ? "" : price;


            if (null != m_icon_effect)
            {
                m_icon_effect.EffectPrefabName = string.Format("UI_chaopiao_0{0}.prefab", index_ + 1);
            }
        }
예제 #4
0
        private static ConfCharge GetConfByDic(DataTable reader)
        {
            long   id            = reader.GetInt64(0);
            int    type          = reader.GetInt32(1);
            string discountIcon  = reader.GetString(2);
            int    source        = reader.GetInt32(3);
            string chargeSouceId = reader.GetString(4);
            int    plusPercent   = reader.GetInt32(5);
            int    addCount      = reader.GetInt32(6);
            int    dollar        = reader.GetInt32(7);
            int    cashCount     = reader.GetInt32(8);
            string icon          = reader.GetString(9);
            string desc          = reader.GetString(10);

            ConfCharge new_obj_ConfCharge = new ConfCharge(id,
                                                           type,
                                                           discountIcon,
                                                           source,
                                                           chargeSouceId,
                                                           plusPercent,
                                                           addCount,
                                                           dollar,
                                                           cashCount,
                                                           icon,
                                                           desc
                                                           );

            return(new_obj_ConfCharge);
        }
예제 #5
0
        private List <IAPProduct> DoGetProductsIOS()
        {
            List <IAPProduct> ret = new List <IAPProduct>();


            foreach (var item in ConfCharge.array)
            {
#if UNITY_ANDROID
                if ((int)IAP_PLATFROM_TYPE.E_GOOGLE_PLAY != item.source)
                {
                    continue;
                }
#elif UNITY_IOS
                if ((int)IAP_PLATFROM_TYPE.E_APPLE_STORE != item.source)
                {
                    continue;
                }
#endif


                IAPProduct product = new IAPProduct()
                {
                    m_charge_id          = item.id,
                    m_unique_platform_id = ConfCharge.Get(item.id).chargeSouceId,
                    m_type = ConvertProductType(1),
                };

                ret.Add(product);
            }

            return(ret);
        }
예제 #6
0
        public void RspVerifyTransaction(long charge_id_)
        {
#if UNITY_IOS && PLATFORM_ID
            ConfCharge charge = ConfCharge.Get(charge_id_);

            DoConfirmPendingPurchaseByIDIOS(charge.chargeSouceId);
#else
            DoConfirmPendingPurchaseByID(charge_id_);
#endif
        }
예제 #7
0
        private float GetUSDPrice(long charge_id)
        {
            ConfCharge charge = this.GetGoodsByChargeID(charge_id);

            if (null != charge)
            {
                return(float.Parse(charge.cashCount.ToString()));
            }

            return(0.0f);
        }
예제 #8
0
        private void DoTransactionDoneIOS(string platform_unique_id_, string currency_, string price_)
        {
            ConfCharge good       = IAPTools.GetGoodsByPlatformID(platform_unique_id_);
            long       charge_id_ = good.id;

            System.Collections.Generic.Dictionary <UBSParamKeyName, object> _params = new System.Collections.Generic.Dictionary <UBSParamKeyName, object>()
            {
                { UBSParamKeyName.ContentID, charge_id_ },
                //{ UBSParamKeyName.ContentType, good.type},
                { UBSParamKeyName.ContentType, 1 },
                { UBSParamKeyName.NumItems, 1 },
                { UBSParamKeyName.Currency, currency_ },
                { UBSParamKeyName.Description, LocalizeModule.Instance.GetString(good.desc) }
            };
            UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.Purchased, float.Parse(price_), _params);
        }
예제 #9
0
 private static void GetArrrayList()
 {
     if (cacheArray.Count <= 0)
     {
         DataTable sqReader = SQLiteHelper.Instance().GetReadFullTable("conf_Charge");
         if (sqReader != null)
         {
             while (sqReader.Read())
             {
                 ConfCharge _conf = GetConfByDic(sqReader);
                 cacheArray.Add(_conf);
                 dic[_conf.id] = _conf;
             }
             resLoaded = true;
         }
     }
 }
예제 #10
0
        private void DoTransactionDone(long charge_id_, string currency_, string price_)
        {
            //Confinapppurchase good = this.GetGoodsByProductID(game_product_id_);

            ConfCharge good = this.GetGoodsByChargeID(charge_id_);

            System.Collections.Generic.Dictionary <UBSParamKeyName, object> _params = new System.Collections.Generic.Dictionary <UBSParamKeyName, object>()
            {
                { UBSParamKeyName.ContentID, charge_id_ },
                //{ UBSParamKeyName.ContentType, good.type},
                { UBSParamKeyName.ContentType, 1 },
                { UBSParamKeyName.NumItems, 1 },
                { UBSParamKeyName.Currency, currency_ },
                { UBSParamKeyName.Description, LocalizeModule.Instance.GetString(good.desc) }
            };
            UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.Purchased, float.Parse(price_), _params);
        }
예제 #11
0
        public static long GetGiftID(long charge_id_)
        {
            ConfCharge charge = ConfCharge.Get(charge_id_);

            if (null == charge)
            {
                return(-1L);
            }

            ConfPush push_gift = ConfPush.array.Find((item) => item.chargeid == charge.id);

            if (null == push_gift)
            {
                return(-1L);
            }

            return(push_gift.giftid);
        }
예제 #12
0
        public static bool GetConfig(long id, out ConfCharge config)
        {
            if (dic.TryGetValue(id, out config))
            {
                return(config != null);
            }
            if (cacheLoaded)
            {
                config = null;
                return(false);
            }
            DataTable sqReader = SQLiteHelper.Instance().GetSelectWhere("conf_Charge", id);

            if (sqReader != null)
            {
                try
                {
                    sqReader.Read();
                    if (sqReader.HasRows)
                    {
                        config = GetConfByDic(sqReader);
                    }
                    else
                    {
                        dic[id] = null;
                        config  = null;
                        return(false);
                    }
                    dic[id] = config;
                    return(true);
                }
                catch (Exception ex)
                {
                    SqliteDriver.SQLiteHelper.OnError(string.Format("Charge 表找不到SN={0} 的数据\n{1}", id, ex));
                }
                config = null;
                return(false);
            }
            else
            {
                config = null;
                return(false);
            }
        }
예제 #13
0
 public override void OnHide()
 {
     base.OnHide();
     m_buy_btn.RemoveClickCallBack(btnBuy);
     m_itemdata = null;
 }
예제 #14
0
 public static void Register()
 {
     ConfAchievement.Init();
     ConfActiveDrop.Init();
     ConfActivityBase.Init();
     ConfAssetManifest.Init();
     Confbranchtask.Init();
     ConfBuilding.Init();
     ConfCartoonScene.Init();
     ConfChapter.Init();
     ConfCharge.Init();
     ConfChat.Init();
     ConfChatItem.Init();
     ConfCheckIn.Init();
     ConfCombineFormula.Init();
     ConfDemoScene.Init();
     ConfDropOut.Init();
     ConfPropGiftItem0.Init();
     ConfPropGiftItem1.Init();
     ConfPropGiftItem2.Init();
     ConfDropOut2.Init();
     Confetl.Init();
     ConfEvent.Init();
     ConfEventAttribute.Init();
     ConfEventPhase.Init();
     Confexhibit.Init();
     ConfExpToLevel.Init();
     Conffailtips.Init();
     ConfFeedback.Init();
     ConfFind.Init();
     ConfFindClue.Init();
     ConfFindTypeIcon.Init();
     ConfGMCMD.Init();
     ConfGuid.Init();
     ConfGuidArt.Init();
     ConfGuidNew.Init();
     ConfGuidNewFunction.Init();
     Confinapppurchase.Init();
     ConfJigsawScene.Init();
     ConfKeyWords.Init();
     ConfLanguage.Init();
     ConfMsgCode.Init();
     ConfNode.Init();
     ConfNpc.Init();
     ConfOfficer.Init();
     ConfPath.Init();
     ConfPoliceRankIcon.Init();
     ConfProp.Init();
     ConfPropGift.Init();
     ConfPropGiftItem0.Init();
     ConfPropGiftItem1.Init();
     ConfPropGiftItem2.Init();
     ConfPush.Init();
     ConfReasoning.Init();
     ConfScene.Init();
     ConfSceneDifficulty.Init();
     ConfSceneSpecial.Init();
     ConfServiceConfig.Init();
     ConfSkill.Init();
     ConfSkyEye.Init();
     ConfSound.Init();
     ConfTask.Init();
     ConfTitle.Init();
 }
예제 #15
0
        private void DoRspVerifyTransaction(object msg_)
        {
            if (msg_ is SCGooglePayChargeResponse)
            {
                var rsp = msg_ as SCGooglePayChargeResponse;

                if (!MsgStatusCodeUtil.OnError(rsp.ResponseStatus))
                {
                    Debugger.Log("UNITY IAP purchase rsp product id = " + rsp.ProductId);

                    EngineCoreEvents.AudioEvents.PlayAudio.SafeInvoke(Audio.AudioType.UISound, GameCustomAudioKey.buy_cash_success.ToString());

                    ConfCharge good = (!string.IsNullOrEmpty(rsp.ProductId) && !string.IsNullOrWhiteSpace(rsp.ProductId)) ? IAPTools.GetGoodsByPlatformID(rsp.ProductId) : null;

                    long charge_id = null != good ? good.id : 0L;

                    if (0 == charge_id)
                    {
                        TransactionTips(LocalizeModule.Instance.GetString("submit_ok"), false);
                        return;
                    }

                    Debugger.Log("UNITY IAP purchase rsp charge id = " + charge_id);
                    IAPTools.instance.RspVerifyTransaction(charge_id);

                    string good_desc = LocalizeModule.Instance.GetString(good.desc);

                    Debugger.Log("UNITY IAP in transction done charge_id = " + charge_id);

                    GameEvents.NetWorkEvents.SendAsyncMsg.SafeInvoke(new CSPlayerInfoRequest());

                    TransactionTips(good_desc, true);

                    GameEvents.IAPEvents.OnTransactionDone.SafeInvoke(charge_id);

                    long giftID = CommonHelper.GetGiftID(charge_id);
                    if (giftID > 0)
                    {
                        //CommonHelper.OpenGift(giftID, 1);
                    }
                }
                else
                {
                    Debugger.LogError("UNITY IAP error transction done product id = " + rsp.ProductId);

                    ConfCharge good = (!string.IsNullOrEmpty(rsp.ProductId) && !string.IsNullOrWhiteSpace(rsp.ProductId)) ? IAPTools.GetGoodsByPlatformID(rsp.ProductId) : null;

                    if (null != good)
                    {
                        string good_desc = LocalizeModule.Instance.GetString(good.desc);

                        TransactionTips(good_desc, false);

                        IAPTools.instance.RspVerifyTransaction(good.id);
                    }
                    else
                    {
                        var pair_req = EngineCoreEvents.SystemEvents.GetRspPairReq.SafeInvoke();

                        if (pair_req is CSGooglePayChargeRequest)
                        {
                            CSGooglePayChargeRequest req_wrapper = pair_req as CSGooglePayChargeRequest;
                            string charge_id = req_wrapper.ProductId;

                            good = ConfCharge.Get(long.Parse(charge_id));

                            if (null != good)
                            {
                                string good_desc = LocalizeModule.Instance.GetString(good.desc);

                                TransactionTips(good_desc, false);

                                IAPTools.instance.RspVerifyTransaction(good.id);
                            }
                        }
                    }
                }
            }
            else if (msg_ is SCIOSPayChargeResponse)
            {
                var rsp = msg_ as SCIOSPayChargeResponse;

                Debugger.Log("UNITY IAP purchase rsp platform id = " + rsp.ProductId);


                if (!MsgStatusCodeUtil.OnError(rsp.ResponseStatus))
                {
                    EngineCoreEvents.AudioEvents.PlayAudio.SafeInvoke(Audio.AudioType.UISound, GameCustomAudioKey.buy_cash_success.ToString());

                    ConfCharge good = (!string.IsNullOrEmpty(rsp.ProductId) && !string.IsNullOrWhiteSpace(rsp.ProductId)) ? IAPTools.GetGoodsByPlatformID(rsp.ProductId) : null;

                    long charge_id = null != good ? good.id : 0L;

                    if (0 == charge_id)
                    {
                        TransactionTips(LocalizeModule.Instance.GetString("submit_ok"), false);
                        return;
                    }

                    Debugger.Log("UNITY IAP purchase rsp charge id = " + charge_id);
                    IAPTools.instance.RspVerifyTransaction(charge_id);

                    string good_desc = LocalizeModule.Instance.GetString(good.desc);


                    Debugger.Log("in transction done charge_id = " + charge_id);

                    GameEvents.NetWorkEvents.SendAsyncMsg.SafeInvoke(new CSPlayerInfoRequest());

                    TransactionTips(good_desc, true);

                    GameEvents.IAPEvents.OnTransactionDone.SafeInvoke(charge_id);

                    //long giftID = CommonHelper.GetGiftID(charge_id);
                    //if (giftID > 0)
                    //{
                    //    var gifts = PushGiftManager.Instance.GetPushInfosByTurnOnType(ENUM_PUSH_GIFT_BLOCK_TYPE.E_LOGIN);

                    //    if( null != gifts && gifts.Count > 0)
                    //    {
                    //        foreach( var gift in gifts)
                    //        {
                    //            if( giftID ==  gift.PushId )
                    //            {
                    //                gift.Buyed = true;
                    //            }

                    //        }
                    //    }
                    //    //CommonHelper.OpenGift(giftID, 1);
                    //}
                }
                else
                {
                    Debugger.LogError("UNITY IAP error transction done product id = " + rsp.ProductId);


                    ConfCharge good = (!string.IsNullOrEmpty(rsp.ProductId) && !string.IsNullOrWhiteSpace(rsp.ProductId)) ? IAPTools.GetGoodsByPlatformID(rsp.ProductId) : null;

                    if (null != good)
                    {
                        string good_desc = LocalizeModule.Instance.GetString(good.desc);

                        TransactionTips(good_desc, false);

                        IAPTools.instance.RspVerifyTransaction(good.id);
                    }
                    else
                    {
                        var pair_req = EngineCoreEvents.SystemEvents.GetRspPairReq.SafeInvoke();

                        if (pair_req is CSIOSPayChargeRequest)
                        {
                            CSIOSPayChargeRequest req_wrapper = pair_req as CSIOSPayChargeRequest;
#if UNITY_IOS && PLATFROM_ID
                            string platform_unique_id = req_wrapper.ProductId;
                            Debug.Log("失败交易商品 platform unique id " + platform_unique_id);
                            good = IAPTools.GetGoodsByPlatformID(platform_unique_id);
#else
                            string charge_id = req_wrapper.ProductId;
                            Debug.Log("失败交易商品 charge id " + charge_id);
                            good = ConfCharge.Get(long.Parse(charge_id));
#endif
                            if (null != good)
                            {
                                string good_desc = LocalizeModule.Instance.GetString(good.desc);

                                Debug.Log("失败交易商品 " + good_desc);

                                TransactionTips(good_desc, false);

                                IAPTools.instance.RspVerifyTransaction(good.id);
                            }
                        }
                    }
                }
            }
        }