Example #1
0
    public void ChangeNewFashion(PShopItem item, Creature creature)
    {
        PItem        newItem = moduleEquip.GetNewPItem(item.itemTypeId, item.itemTypeId);
        PropItemInfo info    = ConfigManager.Get <PropItemInfo>(newItem.itemTypeId);

        PItem containItem = m_changeFashion.Find((p) =>
        {
            var _info = p.GetPropItem();
            if (!_info)
            {
                return(false);
            }
            return(_info.itemType == PropType.FashionCloth && info.subType == _info.subType);
        });

        if (containItem != null)
        {
            m_changeFashion.Remove(containItem);
            m_changeFashion.Add(newItem);
        }
        else
        {
            m_changeFashion.Add(newItem);
        }

        CharacterEquip.ChangeCloth(creature, m_changeFashion);
        changedCloth = true;
    }
Example #2
0
    public List <DialogReviewData> GetDialogReviewDatas(int storyId, DatingFoodOrder order = null, DivinationData divination = null)
    {
        var info = ConfigManager.Get <StoryInfo>(storyId);

        if (info == null)
        {
            Logger.LogError("story data is null, and storyId={0} in storyinfo", storyId);
        }
        if (!info || info.storyItems == null || info.storyItems.Length == 0)
        {
            return(null);
        }

        var isCurrentDialog = currentStory && storyId == currentStory.ID;

        var list = new List <DialogReviewData>();

        for (int i = 0; i < info.storyItems.Length; i++)
        {
            var item = info.storyItems[i];
            //必须检测回顾的是否是当前对话,由策划保证一个约会事件下的所有对化ID不重复
            if (string.IsNullOrEmpty(item.content) || (isCurrentDialog && i > currentStoryIndex))
            {
                continue;
            }

            var data = DialogReviewData.Create();
            data.RefreshDialogReviewData(item, order, divination);
            list.Add(data);
        }
        return(list);
    }
Example #3
0
    private void OnClickSuiteItem(RectTransform node, PShopItem data)
    {
        var shopItem = node.GetComponent <ShopItem>();

        if (shopItem == null)
        {
            return;
        }

        if (moduleShop.curClickItem != null && moduleShop.curClickItem == data)
        {
            return;
        }

        moduleShop.lastClickItem = moduleShop.curClickItem;
        moduleShop.curClickItem  = data;

        OnSetNpcSuiteItem(node, data);
        //刷之前选中框
        if (itemList != null && moduleShop.lastClickItem != null)
        {
            var lastIndex = itemList.FindIndex((p) => p.itemTypeId == moduleShop.lastClickItem.itemTypeId && p.num == moduleShop.lastClickItem.num);
            suiteData.SetItem(moduleShop.lastClickItem, lastIndex);
        }

        var prop = ConfigManager.Get <PropItemInfo>(data.itemTypeId);

        if (prop)
        {
            var mode = prop.mesh != null && prop.mesh.Length > 0 ? prop.mesh[0] : "";
            ChangeNpcMode(mode);
        }

        RefreshNpcPanel(shopItem.isEquip ? 0 : shopItem.isHaved ? 2 : 1);
    }
Example #4
0
 public void RefreshDialogReviewData(StoryInfo.StoryItem item, DatingFoodOrder order, DivinationData divination)
 {
     storyItem      = item;
     orderData      = order;
     divinationData = divination;
     RefreshDialogReviewData();
 }
Example #5
0
    private bool ReturnCanBuy(PShopItem clickItem)
    {
        if (clickItem == null)
        {
            return(false);
        }

        var prop = ConfigManager.Get <PropItemInfo>(clickItem.currencyType);

        if (!prop)
        {
            return(false);
        }

        uint currencyNow = 0;

        if (prop.itemType == PropType.Currency)
        {
            currencyNow = modulePlayer.GetMoneyCount((CurrencySubType)prop.subType);
        }
        else
        {
            currencyNow = (uint)moduleEquip.GetPropCount(clickItem.currencyType);
        }

        return(currencyNow >= clickItem.currencyNum);
    }
Example #6
0
 private void AddFashionData(FashionType type, PShopItem item)
 {
     if (!m_FashionShop.ContainsKey(type))
     {
         m_FashionShop.Add(type, new List <PShopItem>());
     }
     m_FashionShop[type].Add(item);
 }
Example #7
0
    private void SetItemData(Transform node, PShopItem data)
    {
        if (data == null)
        {
            return;
        }

        PropItemInfo psi = ConfigManager.Get <PropItemInfo>(data.itemTypeId);

        if (psi == null)
        {
            return;
        }

        Image  icon       = node.Find("icon").GetComponent <Image>();
        Text   orderName  = node.Find("title").GetComponent <Text>();
        Image  priceIcon  = node.Find("consume/number/icon").GetComponent <Image>();
        Text   price      = node.Find("consume/number").GetComponent <Text>();
        Image  newMark    = node.Find("newInfo").GetComponent <Image>();
        Button btnBuy     = node.Find("bug_Btn").GetComponent <Button>();
        Text   textBtnBuy = node.Find("bug_Btn/buy_Txt").GetComponent <Text>();
        Text   textdesc   = node.Find("des").GetComponent <Text>();

        Util.SetText(textBtnBuy, ConfigText.GetDefalutString(TextForMatType.NpcDatingRest, 1));

        Util.SetText(textdesc, psi.desc);   //菜品描述
        Util.SetText(orderName, psi.itemNameId);
        AtlasHelper.SetItemIcon(icon, psi); //菜品图标

        PropItemInfo itemInfo = ConfigManager.Get <PropItemInfo>(data.currencyType);

        AtlasHelper.SetItemIcon(priceIcon, itemInfo);//设置货币的icon
        string strPrice = "×" + data.currencyNum;

        //如果是免费的,则显示免费字样
        priceIcon.SafeSetActive(data.currencyNum > 0);
        if (data.currencyNum > 0)
        {
            Util.SetText(price, strPrice);
        }
        else
        {
            Util.SetText(price, ConfigText.GetDefalutString(TextForMatType.NpcDatingRest, 2)); //免费字样看文本
        }
        bool enoughMoney = CheckMoney(data.currencyType, data.currencyNum);

        price.color = ColorGroup.GetColor(ColorManagerType.NpcDatingRestOrder, enoughMoney);

        newMark.SafeSetActive(data.isNew == 0);

        var btnIndex = btnBuy.transform.parent.GetSiblingIndex();

        if (m_itemDataDic.ContainsKey(btnIndex))
        {
            m_itemDataDic.Remove(btnIndex);
        }
        m_itemDataDic.Add(btnIndex, data);
    }
Example #8
0
    public static ReviewSourceData Create(int storyId, DatingFoodOrder order, DivinationData divination)
    {
        var review = Create();

        review.storyId   = storyId;
        review.orderData = order;
        review.diviData  = divination;
        return(review);
    }
Example #9
0
 public static void Show(string rTitle, PShopItem item)
 {
     if (item == null)
     {
         return;
     }
     title = rTitle;
     datas = new List <PItem2>();
     datas.Add(GetPItem2(item.itemTypeId, item.num));
     ShowAsync <Window_ItemTip>();
 }
Example #10
0
    public static string GetReplaceContent(StoryInfo.StoryItem item, DatingFoodOrder order, DivinationData divination)
    {
        if (item == null)
        {
            return(string.Empty);
        }

        string str = item.content.Replace(StoryConst.PLAYER_NAME_PARAM, modulePlayer.name_);

        str = str.Replace(StoryConst.PLAYER_GENDER_PARAM, genderDialogContent);

        if (divination != null)
        {
            var type = (EnumDivinationType)divination.type;
            str = str.Replace(StoryConst.DEVINE_TYPE_PARAM, GetDivinationName(type));

            if (type == EnumDivinationType.CrystalDevine)
            {
                str = str.Replace(StoryConst.CRYSTAL_DEVINE_RESULT_PARAM, Util.GetString(divination.contentId));
            }
            else if (type == EnumDivinationType.LotDevine)
            {
                str = str.Replace(StoryConst.LOT_DEVINE_RESULT_PARAM, Util.GetString(divination.contentId));
            }
            else
            {
                str = str.Replace(StoryConst.CRYSTAL_DEVINE_RESULT_PARAM, string.Empty);
                str = str.Replace(StoryConst.LOT_DEVINE_RESULT_PARAM, string.Empty);
            }

            str = str.Replace(StoryConst.DEVINE_INT_PARAM, divination.addMood.ToString());
            str = str.Replace(StoryConst.DEVINE_PERCENT_PARAM, divination.addMood.ToString("P"));
        }
        else
        {
            str = str.Replace(StoryConst.DEVINE_TYPE_PARAM, string.Empty);
            str = str.Replace(StoryConst.CRYSTAL_DEVINE_RESULT_PARAM, string.Empty);
            str = str.Replace(StoryConst.LOT_DEVINE_RESULT_PARAM, string.Empty);
            str = str.Replace(StoryConst.DEVINE_INT_PARAM, "0");
            str = str.Replace(StoryConst.DEVINE_PERCENT_PARAM, "0%");
        }

        var p = order == null ? string.Empty : order.itemName;

        str = str.Replace(StoryConst.SHOPITEM_NAME_PARAM, p);
        p   = order == null ? string.Empty : order.currencyNum.ToString();
        str = str.Replace(StoryConst.SHOPITEM_PRICE_PARAM, p);

        return(str);
    }
Example #11
0
    private void OnSetNpcSuiteItem(RectTransform node, PShopItem data)
    {
        var shopItem = node.GetComponentDefault <ShopItem>();

        if (moduleShop.curShopMsg != null)
        {
            shopItem.RefreshUiData(moduleShop.curShopMsg, data);
        }

        if (shopItem.isEquip && moduleShop.lastClickItem == null)
        {
            RefreshNpcPanel();
        }
    }
Example #12
0
    private void OnClickPayBtn(PShopItem item)
    {
        if (item == null)
        {
            moduleGlobal.ShowMessage(ConfigText.GetDefalutString(TextForMatType.PublicUIText, 14));
            return;
        }

        ushort id = moduleShop.curShopMsg.shopId;

        moduleShop.SendBuyInfo(id, item.itemTypeId, item.num);

        payBtn.interactable = false;
    }
Example #13
0
    private void OnClickItem(RectTransform node, PShopItem data)
    {
        var shopItem = node.GetComponent <ShopItem>();

        if (shopItem == null)
        {
            return;
        }
        if (shopItem.isHaved)
        {
            moduleGlobal.ShowMessage(ConfigText.GetDefalutString(TextForMatType.PublicUIText, 12));
            return;
        }
        if (shopItem.isSelled)
        {
            moduleGlobal.ShowMessage(ConfigText.GetDefalutString(TextForMatType.PublicUIText, 11));
            return;
        }

        //选中
        if (moduleShop.curClickItem == null || data != moduleShop.curClickItem)
        {
            moduleShop.lastClickItem = moduleShop.curClickItem;
            moduleShop.curClickItem  = data;

            //刷之前选中框
            if (moduleShop.curItmes != null && moduleShop.lastClickItem != null)
            {
                var lastIndex = moduleShop.curItmes.FindIndex((p) => p.itemTypeId == moduleShop.lastClickItem.itemTypeId && p.num == moduleShop.lastClickItem.num);
                dataSource.SetItem(moduleShop.lastClickItem, lastIndex);
            }

            m_buyBtn.interactable = ReturnCanBuy(data);
            m_buyInfoTip.SetActive(true);

            PropItemInfo info = ConfigManager.Get <PropItemInfo>(data.itemTypeId);
            if (info)
            {
                Util.SetText(m_buyInfoText, (int)TextForMatType.ExChangeShopUIText, 1, info.itemName);
            }
        }
        //取消选中
        else if (moduleShop.curClickItem == data)
        {
            InitExchangePanel();
        }

        OnSetShopItemInfo(node, data);
    }
Example #14
0
    private void OnClickItem(RectTransform node, PShopItem data)
    {
        var shopItem = node.GetComponent <ShopItem>();

        if (shopItem == null)
        {
            return;
        }
        if (shopItem.isHaved)
        {
            moduleGlobal.ShowMessage(ConfigText.GetDefalutString(TextForMatType.PublicUIText, 12));
            return;
        }
        if (shopItem.isSelled)
        {
            moduleGlobal.ShowMessage(ConfigText.GetDefalutString(TextForMatType.PublicUIText, 11));
            return;
        }
        if (moduleShop.curClickItem != null && moduleShop.curClickItem == data)
        {
            return;
        }

        moduleShop.lastClickItem = moduleShop.curClickItem;
        moduleShop.curClickItem  = data;
        moduleShop.ChangeNewFashion(data, creatureInFashion);

        OnSetItemInfo(node, data);
        //刷之前选中框
        if (itemlist != null && moduleShop.lastClickItem != null)
        {
            var lastIndex = itemlist.FindIndex((p) => p.itemTypeId == moduleShop.lastClickItem.itemTypeId && p.num == moduleShop.lastClickItem.num);
            dataSource.SetItem(moduleShop.lastClickItem, lastIndex);
        }

        m_pay.interactable = true;
        pay_tip.gameObject.SetActive(true);
        var info = ConfigManager.Get <PropItemInfo>(data.itemTypeId);

        if (info)
        {
            Util.SetText(pay_tip, (int)TextForMatType.PublicUIText, 20, info.itemName);
        }
    }
Example #15
0
    public void RefreshUiData(ShopMessage msg, PShopItem data)
    {
        IniteCompent();

        var info = ConfigManager.Get <PropItemInfo>(data.itemTypeId);

        if (info == null)
        {
            return;
        }
        Util.SetItemInfoSimple(wupin, info);
        if (msg.pos == ShopPos.Npc)
        {
            AtlasHelper.SetIcons(wupin?.Find("icon"), info.mesh != null && info.mesh.Length > 1 ? info.mesh[1] : info.icon);
        }
        _name.text = info.itemName;
        count.text = "×" + data.num.ToString();
        Util.SetText(alreadyHave, (int)TextForMatType.TravalShopUIText, 9);
        Util.SetText(alreadySelled, (int)TextForMatType.TravalShopUIText, 10);
        Util.SetText(discountImage, (int)TextForMatType.TravalShopUIText, 12);
        cost_panel.SafeSetActive(true);
        grayPanel.SafeSetActive(false);
        //正常
        var currencyType = ConfigManager.Get <PropItemInfo>(data.currencyType);

        if (currencyType && payType)
        {
            payType.SafeSetActive(true);
            AtlasHelper.SetItemIcon(payType, currencyType);
        }
        cost.text = "×" + data.currencyNum.ToString();

        tip_btn.onClick.RemoveAllListeners();
        tip_btn.onClick.AddListener(() => { Module_Global.instance.UpdateGlobalTip(data.itemTypeId, true); });
        //促销
        int hash = Module_Shop.instance.GetPromoHash(msg.shopId, data.itemTypeId, data.num);

        PShopPromotion promotion = Module_Shop.instance.allPromo.Get(hash);

        if (promotion != null)
        {
            discountCostPanel.SafeSetActive(true);
            originalCost.text = "×" + data.currencyNum.ToString();
            if (promotion != null)
            {
                nowCost.text = "×" + promotion.price.ToString();
            }
            discountImage.transform.parent.SafeSetActive(true);
            cost.SafeSetActive(false);
        }
        else
        {
            discountCostPanel.SafeSetActive(false);
            cost.SafeSetActive(true);
            discountImage.transform.parent.SafeSetActive(false);
        }
        isHaved  = false;
        isSelled = false;

        //随机商店显示已售罄
        if (msg.isRandom)
        {
            isSelled = data.buy == 1;

            cost_panel.SafeSetActive(!isSelled);
            grayPanel.SafeSetActive(isSelled);
            alreadyHave.SafeSetActive(false);
            alreadySelled.SafeSetActive(isSelled);
        }

        //如果是时装显示已拥有&&不能是子类型为8的时装,为8的要显示已售罄
        var have = (info.itemType == PropType.FashionCloth && (FashionSubType)info.subType != FashionSubType.FourPieceSuit) || (info.itemType == PropType.HeadAvatar && info.subType == 1);

        if (have)
        {
            isHaved = Module_Equip.instance.HasProp(data.itemTypeId);

            cost_panel.SafeSetActive(!isHaved);
            grayPanel.SafeSetActive(isHaved);
            alreadyHave.SafeSetActive(isHaved);
            alreadySelled.SafeSetActive(false);
        }

        if (msg.pos == ShopPos.Npc && Module_Npc.instance.curNpc != null && Module_Npc.instance.curNpc.npcInfo != null)
        {
            isEquip = Module_Npc.instance.curNpc._mode == data.itemTypeId;
            isHaved = Module_Equip.instance.HasProp(data.itemTypeId) || isEquip || Module_Npc.instance.curNpc.npcInfo.cloth == data.itemTypeId;

            cost_panel.SafeSetActive(!isHaved);
            grayPanel.SafeSetActive(isHaved);
            grayPanel.enabled = !isHaved;
            alreadyHave.SafeSetActive(isHaved);
            alreadySelled.SafeSetActive(false);
            offImage.SafeSetActive(!isHaved);
            alreadyEquip.SafeSetActive(isEquip);
            //选中框
            if (isEquip && Module_Shop.instance.lastClickItem == null)
            {
                Module_Shop.instance.curClickItem = data;
            }
        }

        selectBox.SafeSetActive(Module_Shop.instance.curClickItem != null && Module_Shop.instance.curClickItem == data);
    }
Example #16
0
 public static ReviewSourceData Create(int storyId, DatingFoodOrder order)
 {
     return(Create(storyId, order, null));
 }
Example #17
0
    private void OnSetShopItemInfo(RectTransform node, PShopItem data)
    {
        ShopItem item = node.GetComponentDefault <ShopItem>();

        item.RefreshUiData(moduleShop.curShopMsg, data);
    }