Exemple #1
0
    public static void UpdateCommodityData(CommodityType comType, CommodityData data)
    {
        List <CommodityData> list = null;

        if (!sVipCommodityDicts.TryGetValue(comType, out list))
        {
            list = new List <CommodityData>();
        }

        bool tFind = false;

        for (int i = 0; i < list.Count; i++)
        {
            if (list[i].IsEquals(data))
            {
                list[i] = data;
                tFind   = true;
                break;
            }
        }

        if (!tFind)
        {
            list.Add(data);
        }

        sVipCommodityDicts[comType] = list;
    }
Exemple #2
0
    public static void PayForCommodity(CommodityData data)
    {
        string orderId        = data.orderId;
        string productId      = data.ItemID.ToString();
        string productName    = data.BasicData.Name;
        string payDescription = data.BasicData.Description;

        float exchangeRatio = RmbYuan2NdBean;

        if (data.currency == CurrencyType.RmbYuan)
        {
            exchangeRatio = RmbYuan2NdBean;
        }
        else if (data.currency == CurrencyType.RmbJiao)
        {
            exchangeRatio = 0.1f * RmbYuan2NdBean;
        }
        else if (data.currency == CurrencyType.RmbFen)
        {
            exchangeRatio = 0.01f * RmbYuan2NdBean;
        }
        float productPrice         = exchangeRatio * data.currPrice;
        float productOriginalPrice = exchangeRatio * data.originalPrice;

        int productCnt = data.BasicData.Count;

        productPrice         *= productCnt;
        productOriginalPrice *= productCnt;


        HelpUtil.AndroidNativeCallStatic(JavaClassUnity2NdSDK, "ndUniPayAysn", orderId, productId, productName, productPrice, productOriginalPrice, productCnt, payDescription);
    }
Exemple #3
0
    public static void PayForCommodity(CommodityData data)
    {
        string roleName = Globals.Instance.MGameDataManager.MActorData.BasicData.Name;
        int    level    = Globals.Instance.MGameDataManager.MActorData.BasicData.Level;

        float exchangeRatio = RmbYuan2Mibi;

        if (data.currency == CurrencyType.RmbYuan)
        {
            exchangeRatio = RmbYuan2Mibi;
        }
        else if (data.currency == CurrencyType.RmbJiao)
        {
            exchangeRatio = 0.1f * RmbYuan2Mibi;
        }
        else if (data.currency == CurrencyType.RmbFen)
        {
            exchangeRatio = 0.01f * RmbYuan2Mibi;
        }
        float productPrice         = exchangeRatio * data.currPrice;
        float productOriginalPrice = exchangeRatio * data.originalPrice;
        int   productCnt           = data.BasicData.Count;

        productPrice         *= productCnt;
        productOriginalPrice *= productCnt;

        int mibi = (int)Mathf.CeilToInt(productPrice);

        HelpUtil.AndroidNativeCallStatic(JavaClassUnity2MiSDK, "miUniPayOnline", data.orderId, mibi);
    }
Exemple #4
0
    public static void PayForCommodity(CommodityData data)
    {
        string roleName = Globals.Instance.MGameDataManager.MActorData.BasicData.Name;
        int    level    = Globals.Instance.MGameDataManager.MActorData.BasicData.Level;

        float exchangeRatio = RmbYuan2Mibi;

        if (data.currency == CurrencyType.RmbYuan)
        {
            exchangeRatio = RmbYuan2Mibi;
        }
        else if (data.currency == CurrencyType.RmbJiao)
        {
            exchangeRatio = 0.1f * RmbYuan2Mibi;
        }
        else if (data.currency == CurrencyType.RmbFen)
        {
            exchangeRatio = 0.01f * RmbYuan2Mibi;
        }
        float productPrice         = exchangeRatio * data.currPrice;
        float productOriginalPrice = exchangeRatio * data.originalPrice;
        int   productCnt           = data.BasicData.Count;

        productPrice         *= productCnt;
        productOriginalPrice *= productCnt;

        int mibi = (int)Mathf.CeilToInt(productPrice);
    }
Exemple #5
0
 public CreateOrder(TestStartInfo teststartinfo, DataManager datamanager)
 {
     _CreateOrderPage  = new CreateOrderPage(teststartinfo);
     _CreateOrderData  = new CreateOrderData(datamanager);
     _ShippingUintData = new ShippingUnitData(datamanager);
     _CommodityData    = new CommodityData(datamanager);
     _datamanager      = datamanager;
 }
    private void OnClickDiamondBtn(GameObject obj)
    {
        UIToggle btn = obj.transform.GetComponent <UIToggle>();

        moneyToDiamondCommodityData = (CommodityData)btn.Data;

//		NGUITools.SetActive(BuyBtn , true);
//		NGUITools.SetActive(ExchangeBtn , false);

        OnClickBuyBtn();
    }
Exemple #7
0
    public bool IsEquals(CommodityData other)
    {
        if ((comType == CommodityType.Recharge && ItemID == other.ItemID) ||
            (comType == CommodityType.GameInner && BasicData.LogicID == other.BasicData.LogicID)
            )
        {
            return(true);
        }

        return(false);
    }
Exemple #8
0
 void SetItemCount(CommodityData data)
 {
     if (data.BasicData.Count > 1)
     {
         Count.transform.localScale = Vector3.one;
         Count.Text = data.BasicData.Count.ToString();
     }
     else
     {
         Count.transform.localScale = Vector3.zero;
     }
 }
Exemple #9
0
    public static void PayForCommodity(CommodityData data)
    {
#if OPEN_PPSDK
        string orderId = data.orderId;

        string productId   = data.ItemID.ToString();
        string productName = data.BasicData.Name;

        // Convert to 91Bean unit
        float exchangeRatio = RmbYuan2NdBeanExchangeRatio;
        if (data.currency == CurrencyType.RmbYuan)
        {
            exchangeRatio = RmbYuan2NdBeanExchangeRatio;
        }
        else if (data.currency == CurrencyType.RmbJiao)
        {
            exchangeRatio = 0.1f * RmbYuan2NdBeanExchangeRatio;
        }
        else if (data.currency == CurrencyType.RmbFen)
        {
            exchangeRatio = 0.01f * RmbYuan2NdBeanExchangeRatio;
        }

        float productPrice         = exchangeRatio * data.currPrice;
        float productOriginalPrice = exchangeRatio * data.originalPrice;

        int    productCnt     = data.BasicData.Count;
        string payDescription = data.BasicData.Description;

        productPrice         *= productCnt;
        productOriginalPrice *= productCnt;

        Debug.Log("[GUIVipStore]: PayForCommodity PPPlatform " + productPrice.ToString() + " and count " + productCnt);

        float blanceMoney = pp_SYPPMoneyRequest();
        if (blanceMoney >= productPrice)
        {
            string prompt = string.Format(Globals.Instance.MDataTableManager.GetWordText(24700036), blanceMoney.ToString("F2"), productPrice.ToString("F2"));

            GUIDialog.PopupYesNoDlg(prompt, delegate() {
                pp_uniPayAsyn(orderId, productId, productName, productPrice, productCnt, payDescription);
            }, null);
        }
        else
        {
            pp_uniPayAsyn(orderId, productId, productName, productPrice, productCnt, payDescription);
        }
#endif
    }
Exemple #10
0
    public static void PayForCommodity(CommodityData data)
    {
#if UNITY_ANDROID
        string orderId = data.orderId;

        string productId   = data.ItemID.ToString();
        string productName = data.BasicData.Name;

        // Convert to GfanQuan unit
        float exchangeRatio = RmbYuan2GfanQExchangeRatio;
        if (data.currency == CurrencyType.RmbYuan)
        {
            exchangeRatio = RmbYuan2GfanQExchangeRatio;
        }
        else if (data.currency == CurrencyType.RmbJiao)
        {
            exchangeRatio = 0.1f * RmbYuan2GfanQExchangeRatio;
        }
        else if (data.currency == CurrencyType.RmbFen)
        {
            exchangeRatio = 0.01f * RmbYuan2GfanQExchangeRatio;
        }

        float productPrice         = exchangeRatio * data.currPrice;
        float productOriginalPrice = exchangeRatio * data.originalPrice;

        int    productCnt     = data.BasicData.Count;
        string payDescription = data.BasicData.Description;
        string userName       = GetUserUniqId();

        productPrice         *= productCnt;
        productOriginalPrice *= productCnt;

        // Gfan pay's mininum is 1 * multiple
        int gfanPayVal = (int)Mathf.CeilToInt(productPrice);

        Debug.Log("[GUIVipStore]: PayForCommodity GfanPlatform " + gfanPayVal.ToString() + " and count " + productCnt);
        using (AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
        {
            using (AndroidJavaObject jo = jc.GetStatic <AndroidJavaObject>("currentActivity"))
            {
                // jo.Call("startGfanPay", orderId, productName, payDescription, productPrice, userName);
                jo.Call("startGfanPay", orderId, productName, payDescription, gfanPayVal);
            }
        }
#endif
    }
Exemple #11
0
    public void SetItemData(CommodityData data)
    {
        ItemBGBtn.Data = data;

        if (null == data)
        {
            Plus.transform.localScale  = Vector3.zero;
            Count.transform.localScale = Vector3.zero;
        }
        else
        {
            Plus.transform.localScale = Vector3.zero;

            Icon.PlayAnim(data.BasicData.Icon);
            SetItemCount(data);
        }
    }
Exemple #12
0
    public static void RemoveCommodityData(CommodityData data)
    {
        List <CommodityData> list = null;

        if (!sVipCommodityDicts.TryGetValue(data.comType, out list))
        {
            return;
        }

        for (int i = 0; i < list.Count; ++i)
        {
            if (list[i].IsEquals(data))
            {
                list.Remove(data);
                break;
            }
        }

        sVipCommodityDicts[data.comType] = list;
    }
Exemple #13
0
    public static void PayForCommodity(CommodityData data)
    {
#if OPEN_ND91
        string orderId = data.orderId;

        string productId   = data.ItemID.ToString();
        string productName = data.BasicData.Name;

        // Convert to 91Bean unit
        float exchangeRatio = RmbYuan2NdBeanExchangeRatio;
        if (data.currency == CurrencyType.RmbYuan)
        {
            exchangeRatio = RmbYuan2NdBeanExchangeRatio;
        }
        else if (data.currency == CurrencyType.RmbJiao)
        {
            exchangeRatio = 0.1f * RmbYuan2NdBeanExchangeRatio;
        }
        else if (data.currency == CurrencyType.RmbFen)
        {
            exchangeRatio = 0.01f * RmbYuan2NdBeanExchangeRatio;
        }

        double productPrice         = exchangeRatio * data.currPrice;
        double productOriginalPrice = exchangeRatio * data.originalPrice;

        int    productCnt     = data.BasicData.Count;
        string payDescription = data.BasicData.Description;

        productPrice         *= productCnt;
        productOriginalPrice *= productCnt;

        Debug.Log("[GUIVipStore]: PayForCommodity NdPlatform " + productPrice.ToString() + " and count " + productCnt);
        int nError = U3dNdUniPayAsyn(orderId, productId, productName, productPrice, productOriginalPrice, productCnt, payDescription);
        if (-1 == nError)
        {
            Debug.Log("[U3dNdSender]: ");
        }
#endif
    }
Exemple #14
0
    public static void PayForCommodityInApp(CommodityData data)
    {
#if OPEN_GFAN_SDK
        string orderId = data.orderId;

        string productId   = data.ItemID.ToString();
        string productName = data.BasicData.Name;

        // Convert to GfanQuan unit
        float exchangeRatio = RmbYuan2GfanQExchangeRatio;
        if (data.currency == CurrencyType.RmbYuan)
        {
            exchangeRatio = RmbYuan2GfanQExchangeRatio;
        }
        else if (data.currency == CurrencyType.RmbJiao)
        {
            exchangeRatio = 0.1f * RmbYuan2GfanQExchangeRatio;
        }
        else if (data.currency == CurrencyType.RmbFen)
        {
            exchangeRatio = 0.01f * RmbYuan2GfanQExchangeRatio;
        }

        float productPrice         = exchangeRatio * data.currPrice;
        float productOriginalPrice = exchangeRatio * data.originalPrice;

        int    productCnt     = data.BasicData.Count;
        string payDescription = data.BasicData.Description;
        string userName       = ThirdPartyPlatform.UserUniqId;

        productPrice         *= productCnt;
        productOriginalPrice *= productCnt;

        // Gfan pay's mininum is 1 * multiple
        int gfanPayVal = (int)Mathf.CeilToInt(productPrice);

        U3dGfanInAppPayOrder(OurAppId.ToString(), orderId, productName, productName, payDescription, gfanPayVal);
#endif
    }
Exemple #15
0
 public static void PayForCommodity(CommodityData data)
 {
     Statistics.INSTANCE.CustomEventCall(Statistics.CustomEventType.WantToPay, "ItemID", data.BasicData.LogicID, "Amount", data.BasicData.Count, "Price", data.currPrice);
     if (GameDefines.OutputVerDefs == OutputVersionDefs.Windows)
     {
         GUIRadarScan.Hide();
     }
     else if (GameDefines.OutputVerDefs == OutputVersionDefs.AppStore)
     {
         U3dIOSSendToSdk.BuyProductClick(data.CommodityStr, data.orderId);
         Debug.Log("CommodityStr is " + data.CommodityStr);
     }
     else if (GameDefines.OutputVerDefs == OutputVersionDefs.WPay)
     {
         GooglePayment.Instance.BuyProductID(data.CommodityStr);
         Debug.Log("orderId is " + data.orderId);
         Debug.Log("CommodityStr is " + data.CommodityStr);
     }
     else
     {
         Globals.Instance.MGUIManager.ShowSimpleCenterTips(20000019, true);
     }
 }
    public static void PayForCommodity(CommodityData data)
    {
        long   roleId   = Globals.Instance.MGameDataManager.MActorData.PlayerID;
        string roleName = Globals.Instance.MGameDataManager.MActorData.BasicData.Name;
        int    level    = Globals.Instance.MGameDataManager.MActorData.BasicData.Level;

        float exchangeRatio = RmbYuan2UCbi;

        if (data.currency == CurrencyType.RmbYuan)
        {
            exchangeRatio = RmbYuan2UCbi;
        }
        else if (data.currency == CurrencyType.RmbJiao)
        {
            exchangeRatio = 0.1f * RmbYuan2UCbi;
        }
        else if (data.currency == CurrencyType.RmbFen)
        {
            exchangeRatio = 0.01f * RmbYuan2UCbi;
        }
        float productPrice         = exchangeRatio * data.currPrice;
        float productOriginalPrice = exchangeRatio * data.originalPrice;
        int   productCnt           = data.BasicData.Count;

        productPrice         *= productCnt;
        productOriginalPrice *= productCnt;
        int ucbi = (int)Mathf.CeilToInt(productPrice);

        // Send to our pay server
        string customInfo = cpid + "," + data.orderId;

#if UNITY_ANDROID
        //调用支付接口
        UCGameSdk.pay(true, ucbi, serverid, roleId.ToString(), roleName, level.ToString(), customInfo);
#elif UNITY_IPHONE
#endif
    }
Exemple #17
0
        private static List <InteractionObjectPair> GetUnfilteredSocials(SocialComponent ths, Sim actor, Sim target, Relationship r)
        {
            bool isAutonomous = false;
            List <InteractionObjectPair> results = new List <InteractionObjectPair>();

            if (actor != target)
            {
                int numSocials = STCData.GetNumSocials(ths.Conversation);
                SocialInteractionCandidateCollection candidates = new SocialInteractionCandidateCollection(actor, target, r, ths.Conversation, isAutonomous);
                foreach (CommodityTypes types in CommodityData.AllPlayableCommodities)
                {
                    sMsg += Common.NewLine + "CommodityType: " + types;
                    switch (types)
                    {
                    case CommodityTypes.Amorous:
                    {
                        if (actor.CanGetRomantic(target, false))
                        {
                            break;
                        }
                        results.Add(new InteractionObjectPair(Sim.BetrayedSimsFutileRomance.Singleton, target));

                        sMsg += Common.NewLine + "Amorous Denied";
                        continue;
                    }

                    case CommodityTypes.Steamed:
                    {
                        if (!r.STC.IsPositive)
                        {
                            break;
                        }

                        sMsg += Common.NewLine + "Steamed Denied";
                        continue;
                    }

                    case CommodityTypes.Insulting:
                        if (isAutonomous && actor.BuffManager.HasElement(BuffNames.Admonished))
                        {
                            sMsg += Common.NewLine + "Insulting Denied";
                            continue;
                        }
                        break;
                    }
                    int maxNumSocials = numSocials;
                    if (CommodityData.AppearsAsSubMenu(types))
                    {
                        GetSocialsForSTC(types, actor, target, r, ths.Conversation, isAutonomous);

                        List <SocialInteractionCandidate> socialsFor = candidates.GetSocialsFor(types);
                        if (socialsFor != null)
                        {
                            string changeToneText = CommodityData.Get(types).GetChangeToneText();
                            AddSocials("1", ths, types, actor, target, socialsFor, isAutonomous, maxNumSocials, results, new string[] { changeToneText }, TraitNames.Unknown);
                            if (types == CommodityTypes.Friendly)
                            {
                                List <SocialInteractionCandidate> socials = candidates.GetSocialsFor(CommodityTypes.Neutral);
                                if (socials != null)
                                {
                                    AddSocials("2", ths, CommodityTypes.Neutral, actor, target, socials, isAutonomous, maxNumSocials, results, new string[] { changeToneText }, TraitNames.Unknown);
                                }
                            }
                        }
                    }
                }

                string str3 = Common.LocalizeEAString("Gameplay/Socializing:Special");
                foreach (Trait trait in actor.TraitManager.List)
                {
                    List <SocialInteractionCandidate> list4 = candidates.GetSocialsFor(trait.Guid);
                    if ((list4 != null) && (list4.Count > 0x0))
                    {
                        string   str5             = trait.TraitName(actor.IsFemale);
                        string[] inlineParentMenu = new string[] { str3, str5 + Localization.Ellipsis };
                        AddSocials("3", ths, CommodityTypes.Undefined, actor, target, list4, isAutonomous, numSocials, results, inlineParentMenu, trait.Guid);
                    }
                }
                if (((ths.Conversation != null) && (actor.Household != target.Household)) && ((!actor.IsAtHome || target.IsAtHome) && (actor.IsAtHome || !target.IsAtHome)))
                {
                    SocialInteractionCandidate candidate = new SocialInteractionCandidate(ths.GetGoodbyeSocial(actor, target), new string[0], null);
                    AddSocials("4", ths, CommodityTypes.Undefined, actor, target, new List <SocialInteractionCandidate>(new SocialInteractionCandidate[] { candidate }), isAutonomous, numSocials, results, new string[0x0], TraitNames.Unknown);
                }
            }
            return(results);
        }
    public void ShowPurshaseMoneyInfor()
    {
        mCurrentShowView = 1;
        NGUITools.SetActive(BuyBtn, true);
//		NGUITools.SetActive(ExchangeBtn , false);
        NGUITools.SetActive(WatchVideo, true);
        BuyDiamondLabel.transform.localScale = Vector3.zero;
        BuyMoneyLabel.transform.localScale   = Vector3.one;
        List <CommodityData> list = new List <CommodityData>();

        if (commodityDataList != null)
        {
            foreach (CommodityData data in commodityDataList)
            {
                if (data != null && data.currency == CurrencyType.RmbYuan)
                {
                    list.Add(data);
                }
            }
        }

        if (list.Count <= 0)
        {
            return;
        }
        DiamondToGoldConfig config = Globals.Instance.MDataTableManager.GetConfig <DiamondToGoldConfig>();
        Dictionary <int, DiamondToGoldConfig.DiamondToGoldElement> moneytoDiamond = config.GetDiamondToGoldElementList();

        HelpUtil.DelListInfo(PurshaseUIGrid.transform);
        for (int i = 0; i < (list.Count + moneytoDiamond.Count); i++)
        {
            if (i % 2 == 0)
            {
                GameObject purchaseItem = GameObject.Instantiate(PurchaseDiamondItem) as GameObject;
                purchaseItem.transform.parent     = PurshaseUIGrid.transform;
                purchaseItem.transform.localScale = Vector3.one;

                purchaseItem.transform.localPosition = new Vector3(-260f, 334f - (i / 2) * 360f, 0);
                CommodityData commodityItem = list[i / 2];

                UISprite iconSprite   = purchaseItem.transform.Find("IconSprite").GetComponent <UISprite>();
                UILabel  diamondLabel = purchaseItem.transform.Find("DiamondLabel").GetComponent <UILabel>();
                UILabel  rmbLabel     = purchaseItem.transform.Find("RmbLabel").GetComponent <UILabel>();

                UILabel rechargeLabel = iconSprite.transform.Find("RechargeLabel").GetComponent <UILabel>();

                if (commodityItem.BasicData.IsFirstDouble)
                {
                    NGUITools.SetActive(rechargeLabel.gameObject, true);
                }
                else
                {
                    NGUITools.SetActive(rechargeLabel.gameObject, false);
                }
                UISprite diamondIcon = diamondLabel.transform.Find("Sprite").GetComponent <UISprite>();
                diamondIcon.spriteName = "IconJinqian";

                iconSprite.spriteName = commodityItem.BasicData.Icon;

                diamondLabel.text = commodityItem.recvIgnotCnt.ToString();

                String currencyText = commodityItem.originalPrice.ToString("N2");
                Debug.Log("commodityItem.CommodityStr:" + commodityItem.CommodityStr);
                if (ShopDataManager.CommodityToCurrencyDicts.ContainsKey(commodityItem.CommodityStr))
                {
                    ShopDataManager.CommodityToCurrencyDicts.TryGetValue(commodityItem.CommodityStr, out currencyText);
                }

                rmbLabel.text = currencyText;

                UIToggle btn = purchaseItem.transform.GetComponent <UIToggle>();
                btn.Data = commodityItem;

                UIEventListener.Get(btn.gameObject).onClick += OnClickDiamondBtn;
            }
            else
            {
                GameObject purchaseItem = GameObject.Instantiate(PurchaseMoneyItem) as GameObject;
                purchaseItem.transform.parent     = PurshaseUIGrid.transform;
                purchaseItem.transform.localScale = Vector3.one;

                purchaseItem.transform.localPosition = new Vector3(260f, 334f - (i / 2) * 360f, 0);

                DiamondToGoldConfig.DiamondToGoldElement element = moneytoDiamond[/*i-((i+1)/2)*/ i];

                UISprite iconSprite   = purchaseItem.transform.Find("IconSprite").GetComponent <UISprite>();
                UILabel  moneyLabel   = purchaseItem.transform.Find("MoneyLabel").GetComponent <UILabel>();
                UILabel  diamondLabel = purchaseItem.transform.Find("DiamondLabel").GetComponent <UILabel>();
                iconSprite.spriteName = element.Icon;
                moneyLabel.text       = element.Get_Gold.ToString();
                diamondLabel.text     = element.Need_Diamond.ToString();
                UIToggle btn = purchaseItem.transform.GetComponent <UIToggle>();
                btn.Data = element;
                UIEventListener.Get(btn.gameObject).onClick += OnClickMoneyBtn;
            }
        }
    }
Exemple #19
0
        // From SocialComponent
        private static List <InteractionObjectPair> GetUnfilteredSocials(SocialComponent ths, Sim actor, Sim target, Relationship r)
        {
            string msg = actor.FullName;

            msg += Common.NewLine + target.FullName;

            bool isAutonomous = false;
            List <InteractionObjectPair> results = new List <InteractionObjectPair>();

            if (actor != target)
            {
                bool flag2;
                int  numSocials = STCData.GetNumSocials(ths.Conversation);

                SocialInteractionCandidateCollection candidates = new SocialInteractionCandidateCollectionEx(actor, target, r, ths.Conversation, isAutonomous, ref msg);

                Conversation.GetCurrentSTC(actor, target, r, ths.Conversation, out flag2);
                foreach (CommodityTypes str in CommodityData.AllPlayableCommodities)
                {
                    using (Common.TestSpan span = new Common.TestSpan(TimeSpanLogger.Bin, "Commodity: " + str, Common.DebugLevel.Stats))
                    {
                        msg += Common.NewLine + "1 " + str;

                        switch (str)
                        {
                        case CommodityTypes.Amorous:
                        {
                            if ((actor.CanGetRomantic(target, false) || !actor.SimDescription.IsHuman) || !target.SimDescription.IsHuman)
                            {
                                break;
                            }
                            results.Add(new InteractionObjectPair(Sim.BetrayedSimsFutileRomance.Singleton, target));
                            continue;
                        }

                        case CommodityTypes.Steamed:
                        {
                            if (!r.STC.IsPositive)
                            {
                                break;
                            }
                            continue;
                        }

                        case CommodityTypes.Insulting:
                            if (isAutonomous && actor.BuffManager.HasElement(BuffNames.Admonished))
                            {
                                continue;
                            }
                            break;
                        }

                        msg += Common.NewLine + "2 " + str;

                        int num2 = numSocials;
                        if (CommodityData.AppearsAsSubMenu(str))
                        {
                            msg += Common.NewLine + "AppearsAsSubMenu " + str;

                            List <SocialInteractionCandidate> socialsFor = candidates.GetSocialsFor(str);
                            if (socialsFor != null)
                            {
                                msg += Common.NewLine + "socialsFor " + str + " " + socialsFor.Count;

                                string changeToneText = CommodityData.Get(str).GetChangeToneText();
                                AddSocials(ths, actor, target, socialsFor, isAutonomous, num2, results, new string[] { changeToneText }, TraitNames.Unknown, ref msg);
                                if (str == CommodityTypes.Friendly)
                                {
                                    List <SocialInteractionCandidate> socials = candidates.GetSocialsFor(CommodityTypes.Neutral);
                                    if (socials != null)
                                    {
                                        AddSocials(ths, actor, target, socials, isAutonomous, num2, results, new string[] { changeToneText }, TraitNames.Unknown, ref msg);
                                    }
                                }
                            }
                        }
                    }
                }

                string str3 = Localization.LocalizeString("Gameplay/Socializing:Special", new object[0x0]);
                foreach (Trait trait in actor.TraitManager.List)
                {
                    List <SocialInteractionCandidate> list4 = candidates.GetSocialsFor(trait.Guid);
                    if ((list4 != null) && (list4.Count > 0x0))
                    {
                        string   str5             = trait.TraitName(actor.IsFemale);
                        string[] inlineParentMenu = new string[] { str3, str5 + Localization.Ellipsis };
                        AddSocials(ths, actor, target, list4, isAutonomous, numSocials, results, inlineParentMenu, trait.Guid, ref msg);
                    }
                }

                if (((ths.Conversation != null) && (actor.Household != target.Household)) && ((!actor.IsAtHome || target.IsAtHome) && (actor.IsAtHome || !target.IsAtHome)))
                {
                    SocialInteractionCandidate candidate = new SocialInteractionCandidate(ths.GetGoodbyeSocial(actor, target), new string[0], null);
                    ths.AddSocials(actor, target, new List <SocialInteractionCandidate>(new SocialInteractionCandidate[] { candidate }), isAutonomous, numSocials, results, new string[0x0], TraitNames.Unknown);
                }
            }

            Common.WriteLog(msg);

            return(results);
        }
Exemple #20
0
    public void UpdateGUI(CommodityData data)
    {
        ItemData            = data;
        itemCheckedBtn.Data = data;

        pckageItemIcon.SetItemData(data);

        nameText.Text = data.BasicData.Name;
        descText.Text = data.BasicData.Description;

        float showOrigPrice = (float)data.originalPrice;
        float showCurrPrice = (float)data.currPrice;

        if (data.currency == CurrencyType.RmbYuan)
        {
            showOrigPrice = (float)data.originalPrice;
            showCurrPrice = (float)data.currPrice;
        }
        else if (data.currency == CurrencyType.RmbJiao)
        {
            showOrigPrice = (float)data.originalPrice * 0.1f;
            showCurrPrice = (float)data.currPrice * 0.1f;
        }
        else if (data.currency == CurrencyType.RmbFen)
        {
            showOrigPrice = (float)data.originalPrice * 0.01f;
            showCurrPrice = (float)data.currPrice * 0.01f;
        }

        // Show the RMB-Yuan
        origPriceText.Text = showOrigPrice.ToString("F0");

        if (data.comType == CommodityType.GameInner)
        {
            currPriceText.Text = showCurrPrice.ToString("F0");
        }
        else
        {
            currPriceText.Text = showCurrPrice.ToString("F2");
        }

        currencyText.Text = "¥";

        if (data.comType == CommodityType.GameInner)
        {
            currencyText.transform.localScale = Vector3.zero;
            //currencyIcon.transform.localScale = Vector3.one;

            pinzhiText.transform.localScale  = Vector3.one;
            pingfenText.transform.localScale = Vector3.one;

            pinzhiText.Text  = data.GetDisplayQualityName();
            pingfenText.Text = "--";
        }
        else
        {
            currencyText.transform.localScale = Vector3.zero;
            //currencyIcon.transform.localScale = Vector3.zero;

            pinzhiText.transform.localScale  = Vector3.zero;
            pingfenText.transform.localScale = Vector3.zero;
        }

        // if (null == data.bargainEvent)
        // {
        //  bargainEventText.transform.localScale = Vector3.zero;
        //
        //  // Give as freeGoods, so show the text
        //  if (null != data.handselEvent)
        //  {
        //      bargainEventText.transform.localScale = Vector3.one;
        //      bargainEventText.Text = "赠送截止于:" + data.handselEvent.endTime;
        //  }
        // }
        // else
        // {
        //  bargainEventText.transform.localScale = Vector3.one;
        //  bargainEventText.Text = "特价截止于:" + data.bargainEvent.endTime;
        // }

        if (data.IsDiscounted)
        {
            bargainPriceLine.transform.localScale = Vector3.one;

            int   defTextNum = 8;
            float lineScale  = (float)(origPriceText.Text.Length + 2) / defTextNum;
            bargainPriceLine.transform.localScale = new Vector3(lineScale, 1, 1);

            currPriceText.transform.localScale = Vector3.one;
        }
        else
        {
            bargainPriceLine.transform.localScale = Vector3.zero;
            currPriceText.transform.localScale    = Vector3.zero;
        }

        // if (null == data.freeGoodsList || 0 == data.freeGoodsList.Count)
        // {
        //  freeGoodsIcon.transform.localScale = Vector3.zero;
        // }
        // else
        // {
        //  freeGoodsIcon.transform.localScale = Vector3.one;
        // }

        origPriceText.transform.localScale = Vector3.zero;
        currencyIcon.transform.localScale  = Vector3.zero;
    }
    public void ShowPurshaseDiamondInfor()
    {
        mCurrentShowView = 2;
        NGUITools.SetActive(BuyBtn, true);
//		NGUITools.SetActive(ExchangeBtn , false);
        NGUITools.SetActive(WatchVideo, false);
        BuyDiamondLabel.transform.localScale = Vector3.one;
        BuyMoneyLabel.transform.localScale   = Vector3.zero;
        HelpUtil.DelListInfo(PurshaseUIGrid.transform);

        List <CommodityData> list = new List <CommodityData>();

        if (commodityDataList != null)
        {
            foreach (CommodityData data in commodityDataList)
            {
                if (data != null && data.currency == CurrencyType.RmbJiao)
                {
                    list.Add(data);
                }
            }
        }

        if (list.Count <= 0)
        {
            return;
        }

        for (int i = 0; i < list.Count; i++)
        {
            CommodityData commodityItem = list[i];
            GameObject    purchaseItem  = GameObject.Instantiate(PurchaseDiamondItem) as GameObject;
            purchaseItem.transform.parent     = PurshaseUIGrid.transform;
            purchaseItem.transform.localScale = Vector3.one;
            if (i % 2 == 0)
            {
                purchaseItem.transform.localPosition = new Vector3(-260f, 334f - (i / 2) * 360f, 0);
            }
            else
            {
                purchaseItem.transform.localPosition = new Vector3(260f, 334f - (i / 2) * 360f, 0);
            }

            UISprite iconSprite    = purchaseItem.transform.Find("IconSprite").GetComponent <UISprite>();
            UILabel  diamondLabel  = purchaseItem.transform.Find("DiamondLabel").GetComponent <UILabel>();
            UILabel  rmbLabel      = purchaseItem.transform.Find("RmbLabel").GetComponent <UILabel>();
            UILabel  rechargeLabel = iconSprite.transform.Find("RechargeLabel").GetComponent <UILabel>();
            if (commodityItem.BasicData.IsFirstDouble)
            {
                NGUITools.SetActive(rechargeLabel.gameObject, true);
            }
            else
            {
                NGUITools.SetActive(rechargeLabel.gameObject, false);
            }
            iconSprite.spriteName = commodityItem.BasicData.Icon;

            diamondLabel.text = commodityItem.recvIgnotCnt.ToString();

            String currencyText = commodityItem.originalPrice.ToString("N2");
            if (ShopDataManager.CommodityToCurrencyDicts.ContainsKey(commodityItem.CommodityStr))
            {
                ShopDataManager.CommodityToCurrencyDicts.TryGetValue(commodityItem.CommodityStr, out currencyText);
            }

            rmbLabel.text = currencyText;

            UIToggle btn = purchaseItem.transform.GetComponent <UIToggle>();
            btn.Data = commodityItem;

            UIEventListener.Get(btn.gameObject).onClick += OnClickDiamondBtn;
        }
    }
Exemple #22
0
        public void OnPreLoad()
        {
            CommodityData amorous = CommodityData.Get(CommodityTypes.Amorous);

            CommodityData.Add(new CommodityData(
                                  sAmorous2,
                                  amorous.ChangeToneText,
                                  amorous.mIsPositive,
                                  false /*amorous.mIsSymmetric*/,
                                  amorous.mAppearsAsSubMenu,
                                  amorous.EndStanceX,
                                  amorous.EndStanceY,
                                  amorous.NumSocialsDecremented,
                                  amorous.NextCommodity1,
                                  amorous.NextCommodity2,
                                  amorous.X1,
                                  amorous.X2,
                                  amorous.Y1,
                                  amorous.Y2,
                                  amorous.Y3
                                  ));

            CommodityTable.sMap[sAmorous2] = new Dictionary <CommodityTypes, float>();

            CommodityTable.Add(sAmorous2, sAmorous2, 1);

            foreach (CommodityTypes type in Enum.GetValues(typeof(CommodityTypes)))
            {
                if (type == CommodityTypes.Undefined)
                {
                    continue;
                }

                CommodityTable.Add(sAmorous2, type, CommodityTable.Get(CommodityTypes.Amorous, type));

                CommodityTable.Add(type, sAmorous2, CommodityTable.Get(type, CommodityTypes.Amorous));
            }

            foreach (SocialRuleLHS oldRule in new List <SocialRuleLHS>(SocialRuleLHS.Get("GR")))
            {
                if (oldRule.GeneralCommodity != CommodityTypes.Amorous)
                {
                    continue;
                }

                SocialRuleLHS newRule = new SocialRuleLHS(
                    "GR",
                    sAmorous2,
                    oldRule.mSpeechAct,
                    oldRule.ThirdParty,
                    oldRule.STCommodityPositive,
                    new Pair <CommodityTypes, bool>(oldRule.STCommodity.First, oldRule.STCommodity.Second),
                    new Pair <ShortTermContextTypes, bool>(oldRule.STContext.First, oldRule.STContext.Second),
                    oldRule.TargetMood,
                    new Pair <LongTermRelationshipTypes, bool>(oldRule.LTRelationship.First, oldRule.LTRelationship.Second),
                    oldRule.LTRMin,
                    oldRule.LTRMax,
                    "",
                    "",
                    "",
                    oldRule.mSkillLevel,
                    oldRule.mSkillThresholdAbove,
                    "",
                    "",
                    "",
                    "",
                    "",
                    oldRule.Partner,
                    oldRule.WrongGenderPreference,
                    oldRule.Repetition,
                    oldRule.ActorAgeRestrictions,
                    oldRule.TargetAgeRestrictions,
                    oldRule.TargetBetrayed,
                    oldRule.SpecificityOverride,
                    oldRule.STEffectCommodity,
                    oldRule.LTROverride
                    );

                newRule.mActorTraits  = oldRule.mActorTraits;
                newRule.mTargetTraits = oldRule.mTargetTraits;
                newRule.mSkill        = oldRule.mSkill;
                newRule.mActorIncreasedEffectiveness  = oldRule.mActorIncreasedEffectiveness;
                newRule.mActorReducedEffectiveness    = oldRule.mActorReducedEffectiveness;
                newRule.mTargetIncreasedEffectiveness = oldRule.mTargetIncreasedEffectiveness;
                newRule.mTargetReducedEffectiveness   = oldRule.mTargetReducedEffectiveness;
                newRule.ProceduralPrecondition        = oldRule.ProceduralPrecondition;
            }

            SocialRuleLHS.Get("GR").Sort(new Comparison <SocialRuleLHS>(SocialRuleLHS.SortSocialRules));

            CloneSTCData(sFlirty2, sAmorous2, ShortTermContextTypes.Flirty);
            CloneSTCData(sSeductive2, sAmorous2, ShortTermContextTypes.Seductive);
            CloneSTCData(sHot2, sAmorous2, ShortTermContextTypes.Hot);

            STCData.SetNextSTC(sFlirty2, sSeductive2);
            STCData.SetNextSTC(sSeductive2, sHot2);
        }