Esempio n. 1
0
    private void RefreshInfo()
    {
        awakeButton?.transform.SetGray(state != 0);
        awakeButton.SetInteractable(state == 0);
        Util.SetText(buttonText,
                     ConfigText.GetDefalutString(TextForMatType.AwakePoint, state == 0 ? 11 : state == -1 ? 10 : 12));

        if (info != null)
        {
            Util.SetText(skillName, info.NameString);
            Util.SetText(skillDesc, info.DescString);
            AtlasHelper.SetShared(skillIcon, info.icon, null, true);
            if (info.cost != null)
            {
                var prop = ConfigManager.Get <PropItemInfo>(info.cost.itemId);
                AtlasHelper.SetIcons(costIcon, prop.icon);
                Util.SetText(costNum, info.cost.count.ToString());
                uint own = 0;
                if (prop.itemType == PropType.Currency)
                {
                    own = modulePlayer.GetMoneyCount((CurrencySubType)prop.subType);
                }
                else
                {
                    own = moduleAwake.GetBeadCount(prop.subType);
                }
                Util.SetText(ownNum, Util.Format(ConfigText.GetDefalutString((int)TextForMatType.AwakePoint, 9), own));
                costNum.color = ColorGroup.GetColor(ColorManagerType.IsMatrialEnough, info.cost.count <= own);
            }
        }
    }
Esempio n. 2
0
    private void ShowSuitMatrial(SuitInfo rSuitInfo)
    {
        if (null == rSuitInfo)
        {
            return;
        }
        isMatrialEnough = true;

        Util.SetText(consumeCount, "0");

        BindItemInfo(drawingItem, drawingId, 1);

        Util.ClearChildren(matrialRoot);
        for (var i = 0; i < rSuitInfo.costs.Length; i++)
        {
            var itemId = rSuitInfo.costs[i].itemId;

            var prop = ConfigManager.Get <PropItemInfo>(itemId);
            if (itemId == 1)
            {
                AtlasHelper.SetIcons(consumeIcon, prop.icon);
                var a = rSuitInfo.costs[i].count;
                var b = modulePlayer.coinCount;
                Util.SetText(consumeCount, a.ToString());
                isMatrialEnough    = isMatrialEnough && a <= b;
                consumeCount.color = ColorGroup.GetColor(ColorManagerType.IsMoneyEnough, a <= b);
                continue;
            }

            var t = matrialRoot.AddNewChild(matrialTemp);
            t.SafeSetActive(true);
            BindItemInfo(t, itemId, rSuitInfo.costs[i].count);
        }
    }
Esempio n. 3
0
    protected override void OnBecameVisible(bool oldState, bool forward)
    {
        if (modulePlayer.isLevelUp)
        {
            var _params = GetWindowParam <Window_Settlement>();
            if (_params != null)
            {
                oldLv         = (byte)_params.param1;
                oldPoint      = (ushort)_params.param2;
                oldFatigue    = (ushort)_params.param3;
                oldMaxFatigue = (ushort)_params.param4;
            }
        }

        bgBtn.interactable = false;
        RefreshSettlementPanel();

        addPointValue?.transform.parent.SafeSetActive(modulePVE.addFriendPoint > 0 || modulePVE.addNpcPoint > 0);
        if (modulePVE.addFriendPoint > 0)
        {
            Util.SetText(addPointValue, $"+{modulePVE.addFriendPoint}");
            Util.SetText(addPointName, PropItemInfo.FriendPointProp.itemName);
            AtlasHelper.SetIcons(addPointIcon, PropItemInfo.FriendPointProp.icon);
        }
        else if (modulePVE.addNpcPoint > 0)
        {
            Util.SetText(addPointValue, $"+{modulePVE.addNpcPoint}");
            Util.SetText(addPointName, ConfigText.GetDefalutString(228, 1));
            AtlasHelper.SetIcons(addPointIcon, "s_npcrelationship");
        }
    }
Esempio n. 4
0
    private void BtnRemainText()
    {
        int id   = moduleShop.curShopMsg.refreshCurrency;
        var prop = ConfigManager.Get <PropItemInfo>(id);

        if (!prop)
        {
            return;
        }

        uint currency = 0;

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

        uint cost = moduleShop.curShopMsg.refreshNum;

        if (currency < cost)
        {
            moduleGlobal.ShowMessage(Util.Format(ConfigText.GetDefalutString(TextForMatType.PublicUIText, 31), prop.itemName));
            return;
        }

        AtlasHelper.SetIcons(refreshImage, prop.icon);
        var str = Util.Format(ConfigText.GetDefalutString(TextForMatType.TravalShopUIText, 11), cost, currency);

        Util.SetText(remainText, str);
    }
Esempio n. 5
0
    public void BindData(PFactionPlayerInfo rData)
    {
        AssertInit();
        data = rData;
        if (rData.battleInfo.rank <= m_specialRank.Length)
        {
            for (var i = 0; i < m_specialRank.Length; i++)
            {
                m_specialRank[i].SafeSetActive(rData.battleInfo.rank == i + 1);
            }
            m_rank.SafeSetActive(false);
        }
        else
        {
            for (var i = 0; i < m_specialRank.Length; i++)
            {
                m_specialRank[i].SafeSetActive(false);
            }
            m_rank.SafeSetActive(true);
            Util.SetText(m_rank, Module_FactionBattle.GetRankLabel(rData.battleInfo.rank));
        }
        Util.SetText(m_name, data.info.name);
        m_bg.color = ColorGroup.GetColor(Module_FactionBattle.instance.SelfFaction == Module_FactionBattle.Faction.Red ? ColorManagerType.FactionBgLeft : ColorManagerType.FactionBgRight, rData.info.roleId == Module_Player.instance.id_);
        Util.SetText(m_maxComboKill, Module_FactionBattle.GetKillString(data.battleInfo.maxCombokill));
        Util.SetText(m_comboKill, Module_FactionBattle.GetKillString(data.battleInfo.comboKill));
        Util.SetText(m_score, data.battleInfo.score.ToString());

        m_maxComboKill?.transform.parent.SafeSetActive(!string.IsNullOrEmpty(m_maxComboKill?.text));
        var info = ConfigManager.Get <FactionKillRewardInfo>(data.battleInfo.maxCombokill);

        if (!string.IsNullOrEmpty(info?.applique))
        {
            AtlasHelper.SetIcons(m_applique, info.applique);
        }
    }
Esempio n. 6
0
    private void RefreshMatrial()
    {
        var info = ConfigManager.Get <NpcPerfusionInfo>(_npc.starLv);
        int cost = 0, own = 0;

        if (info?.costs.Length > 0)
        {
            cost = info.costs[0].count;
            own  = moduleEquip.GetPropCount(info.costs[0].itemId) - info.costs[0].count * _excuteTimes;
            var prop = ConfigManager.Get <PropItemInfo>(info.costs[0].itemId);
            AtlasHelper.SetIcons(costIcon, prop?.icon);
            AtlasHelper.SetIcons(_costIcon2, prop?.icon);
            Util.SetText(costTitle, Util.Format(ConfigText.GetDefalutString(TextForMatType.NpcAwakeUI, 4), prop?.itemName));

            if (prop != null)
            {
                ushort itemId = (ushort)prop.ID;
                _costIcon2?.GetComponentDefault <Button>().onClick.AddListener(() =>
                {
                    moduleGlobal.UpdateGlobalTip(itemId, true);
                });
            }
        }

        Util.SetText(costLabel, cost.ToString());
        Util.SetText(ownLabel, Util.Format(ConfigText.GetDefalutString(TextForMatType.NpcAwakeUI, 5), own));
        if (costLabel)
        {
            costLabel.color = ColorGroup.GetColor(ColorManagerType.IsMatrialEnough, cost <= own);
        }
    }
Esempio n. 7
0
    private void RefreshClearCost(ushort suitId)
    {
        var suitInfo = ConfigManager.Get <SuitInfo>(suitId);

        if (null == suitInfo)
        {
            return;
        }

        Util.SetText(consumeCount, "0");
        Util.SetText(consumeRemain, "0");

        Util.ClearChildren(costRoot);
        for (var i = 0; i < suitInfo.clearCosts.Length; i++)
        {
            var prop = ConfigManager.Get <PropItemInfo>(suitInfo.clearCosts[i].itemId);
            if (suitInfo.clearCosts[i].itemId == 1 || suitInfo.clearCosts[i].itemId == 2)
            {
                AtlasHelper.SetIcons(consumeIcon, prop.icon);
                var a = suitInfo.clearCosts[i].count;
                var b = suitInfo.clearCosts[i].itemId == 1 ? modulePlayer.coinCount : modulePlayer.gemCount;
                Util.SetText(consumeCount, a.ToString());
                Util.SetText(consumeRemain, Util.Format(ConfigText.GetDefalutString(249, 19), b));
                isMatrialEnough    = isMatrialEnough && a <= b;
                consumeCount.color = ColorGroup.GetColor(ColorManagerType.IsMoneyEnough, a <= b);
                continue;
            }

            var t = costRoot.AddNewChild(costTemplete);
            t.SafeSetActive(true);
            Util.SetItemInfo(t, prop);
            BindItemInfo(t, prop.ID, suitInfo.clearCosts[i].count);
        }
    }
    public void SetMaxComboKillBg(int rMaxComboKill)
    {
        var info = ConfigManager.Get <FactionKillRewardInfo>(rMaxComboKill);

        if (!string.IsNullOrEmpty(info?.applique))
        {
            AtlasHelper.SetIcons(applique, info.applique);
        }
    }
    public override bool Initialize(params object[] p)
    {
        if (!base.Initialize(p))
        {
            return(false);
        }

        confirmButton?.onClick.AddListener(OnConfirm);
        cancelButton?.onClick.AddListener(() => UnInitialize());
        closeButton?.onClick.AddListener(() => UnInitialize());

        if (moduleAwakeMatch.CurrentTask != null)
        {
            var      remainTime = moduleAwakeMatch.maxbuyTimes - moduleAwakeMatch.buyTimes;
            var      time       = moduleAwakeMatch.buyTimes;
            var      costNum    = 0;
            ItemPair costItem   = null;
            bool     isMyself   = moduleAwakeMatch.CurrentTask.taskType == TaskType.Nightmare || (moduleAwakeMatch.CurrentTask.taskType == TaskType.Awake && moduleAwakeMatch.CurrentTaskIsActive);
            if (isMyself)
            {
                remainTime = moduleAwakeMatch.CurrentTask.taskConfigInfo.dayRemainCount -
                             moduleAwakeMatch.CurrentTask.taskData.resetTimes;
                time = moduleAwakeMatch.CurrentTask.taskData.resetTimes;
                var arr = moduleAwakeMatch.CurrentTask.taskConfigInfo.costItem;
                if (arr != null)
                {
                    var index = Mathd.Clamp(time, 0, arr.Length - 1);
                    costItem = arr[index];
                }
            }
            else
            {
                var arr = moduleAwakeMatch.costItem;
                if (arr != null)
                {
                    var index = Mathd.Clamp(time, 0, arr.Length - 1);
                    costItem = arr[index];
                }
            }
            if (costItem != null)
            {
                costNum = costItem.count;
                var prop = ConfigManager.Get <PropItemInfo>(costItem.itemId);
                if (prop)
                {
                    AtlasHelper.SetIcons(costIcon, prop.icon);
                }
            }
            Util.SetText(remainText, Util.Format(ConfigText.GetDefalutString((int)TextForMatType.AwakeStage, 43), remainTime));
            Util.SetText(costText, Util.Format(ConfigText.GetDefalutString((int)TextForMatType.AwakeStage, 44), costNum, modulePlayer.gemCount));
            if (costText)
            {
                costText.color = ColorGroup.GetColor(ColorManagerType.IsMatrialEnough, costNum <= modulePlayer.gemCount);
            }
        }
        return(true);
    }
Esempio n. 10
0
        public void BindData(PMatchInfo rMatchInfo, PBattleInfo rBattleInfo)
        {
            Util.SetText(name, rMatchInfo.roleName);
            Util.SetText(level, $"lv:{rMatchInfo.level}");
            Util.SetText(kill, Module_FactionBattle.GetKillString(rBattleInfo.maxCombokill));
            Util.SetText(score, rBattleInfo.score.ToString());
            killIcon.SafeSetActive(!string.IsNullOrEmpty(kill.text));
            var info = ConfigManager.Get <FactionKillRewardInfo>(rBattleInfo.maxCombokill);

            if (!string.IsNullOrEmpty(info?.applique))
            {
                AtlasHelper.SetIcons(killIcon, info.applique);
            }
        }
Esempio n. 11
0
    public void Init(Buff rBuff, Creature rCreature)
    {
        Initelize();
        buff          = rBuff;
        buffID        = rBuff.ID;
        OverlapNumber = 1;
        creature      = rCreature;

        if (!string.IsNullOrEmpty(buff.info.icon))
        {
            AtlasHelper.SetIcons(icon, buff.info.icon);
        }
        Util.SetText(desc, buff.info.BuffDesc(buff.BuffLevel));
    }
Esempio n. 12
0
    private void RefreshSelfInfo()
    {
        Util.SetText(m_selfFaction, moduleFactionBattle.SelfFactionName);
        Util.SetText(m_selfRank, Module_FactionBattle.GetRankLabel(moduleFactionBattle.SelfRank));
        Util.SetText(m_selfScore, moduleFactionBattle.SelfScore.ToString());
        Util.SetText(m_selfComboKill, Module_FactionBattle.GetKillString(moduleFactionBattle.ComboKill));
        Util.SetText(m_selfMaxComboKill, Module_FactionBattle.GetKillString(moduleFactionBattle.MaxComboKill));
        m_selfMaxComboKill?.transform.parent.SafeSetActive(!string.IsNullOrEmpty(m_selfMaxComboKill?.text));
        var info = ConfigManager.Get <FactionKillRewardInfo>(moduleFactionBattle.MaxComboKill);

        if (!string.IsNullOrEmpty(info?.applique))
        {
            AtlasHelper.SetIcons(m_selfApplique, info.applique);
        }
    }
Esempio n. 13
0
    private void CreateToggles(List <ShopMessage> msgs)
    {
        travalToggles.Clear();
        toggles.Clear();
        for (int i = 0; i < msgs.Count; i++)
        {
            var tran = toggleParent.childCount > i?toggleParent.GetChild(i) : null;

            if (tran == null)
            {
                tran = toggleParent.AddNewChild(togglePrefab);
            }
            if (!tran)
            {
                continue;
            }

            tran.SafeSetActive(true);
            tran.name = msgs[i].shopId.ToString();
            AtlasHelper.SetIcons(tran.Find("icon"), msgs[i].icon);
            Util.SetText(tran.Find("Text")?.gameObject, msgs[i].name);
            Util.SetText(tran.Find("xz/_text")?.gameObject, msgs[i].name);

            var toggle = tran.GetComponentDefault <Toggle>();
            toggles.Add(toggle);
            if (!travalToggles.ContainsKey(toggle))
            {
                travalToggles.Add(toggle, msgs[i].shopId);
            }

            toggle.onValueChanged.RemoveAllListeners();
            toggle.onValueChanged.AddListener(OnValueChangeCheck);
        }

        for (int i = 0; i < toggles.Count; i++)
        {
            toggles[i].SafeSetActive(false);
            toggles[i].isOn = false;
            toggles[i].SafeSetActive(true);
        }
    }
Esempio n. 14
0
    private void RefreshNpcShop()
    {
        var curShop = moduleShop.curShopMsg;

        if (toggles.Count > 1)
        {
            if (moduleNPCDating.curDatingNpcMsg == null && moduleShop.npcShop == null)
            {
                toggles[1].SafeSetActive(false);
            }
            //else //Npc时装先不做
            //    toggles[1].SafeSetActive(moduleShop.npcShop.ContainsKey(moduleNPCDating.curDatingNpcMsg.npcId) && moduleShop.npcShop[moduleNPCDating.curDatingNpcMsg.npcId].Count > 0);
        }
        if (curShop == null)
        {
            return;
        }

        Util.SetText(check_shoptext, curShop.name);
        Util.SetText(check_xzshoptext, curShop.name);
        AtlasHelper.SetIcons(check_shopimage, curShop.icon);
    }
Esempio n. 15
0
    private void SetOtherTxt(string content)
    {
        string[] split = new string[1] {
            "[sprit="
        };
        string[] txt = content.Split(split, StringSplitOptions.RemoveEmptyEntries);
        if (txt.Length > 1)
        {
            Contxt_one.text = txt[0];
            Contxt_one.Set();

            string[] txt1 = txt[1].Split(']');
            if (txt1.Length > 1)
            {
                Contxt_two.text = txt1[1];
                Contxt_two.Set();
            }

            string Imgname = txt1[0];
            if (Imgname == "0")
            {
                ConImg.gameObject.SetActive(false);
            }
            else
            {
                string[] NameId = Imgname.Split(':');
                ConImg.gameObject.SetActive(true);
                AtlasHelper.SetIcons(ConImg, NameId[0]);
                if (NameId.Length > 1)
                {
                    Button Click = ConImg.gameObject.GetComponentDefault <Button>();
                    Click.onClick.AddListener(delegate
                    {
                        moduleGlobal.UpdateGlobalTip(ushort.Parse(NameId[1]), true);
                    });
                }
            }
        }
    }
Esempio n. 16
0
    private void RefreshDiscardCost(PSoulAttr prevSoulAttr)
    {
        var soulInfo = ConfigManager.Get <SoulInfo>(prevSoulAttr.soulId);

        if (null == soulInfo?.discardCosts)
        {
            return;
        }
        for (var i = 0; i < soulInfo.discardCosts.Length; i++)
        {
            var prop = ConfigManager.Get <PropItemInfo>(soulInfo.discardCosts[i].itemId);
            if (prop)
            {
                AtlasHelper.SetIcons(discardCostIcon, prop.icon);
            }

            if (soulInfo.discardCosts[i].itemId == 2)
            {
                Util.SetText(discardCost, soulInfo.discardCosts[i].count.ToString());
                discardCost.color = ColorGroup.GetColor(ColorManagerType.IsMoneyEnough,
                                                        soulInfo.discardCosts[i].count <= modulePlayer.gemCount);
                return;
            }
            else if (soulInfo.discardCosts[i].itemId == 1)
            {
                Util.SetText(discardCost, soulInfo.discardCosts[i].count.ToString());
                discardCost.color = ColorGroup.GetColor(ColorManagerType.IsMoneyEnough,
                                                        soulInfo.discardCosts[i].count <= modulePlayer.coinCount);
                return;
            }
            else
            {
                Util.SetText(discardCost, soulInfo.discardCosts[i].count.ToString());
                discardCost.color = ColorGroup.GetColor(ColorManagerType.IsMatrialEnough,
                                                        soulInfo.discardCosts[i].count <= moduleEquip.GetPropCount(soulInfo.discardCosts[i].count));
            }
        }
    }
Esempio n. 17
0
    private void RefreshCost()
    {
        var prop     = moduleFurnace.currentSoulItem?.GetPropItem();
        var soulCost = ConfigManager.Get <SoulCost>(prop?.quality ?? 0);

        if (soulCost != null)
        {
            for (var i = 0; i < soulCost.costs.Length; i++)
            {
                if (soulCost.costs[i].itemId == 1)
                {
                    Util.SetText(costCoin, soulCost.costs[i].count.ToString());
                    costCoin.color = ColorGroup.GetColor(ColorManagerType.IsMoneyEnough,
                                                         soulCost.costs[i].count <= modulePlayer.coinCount);
                }
                else
                {
                    var own = moduleEquip.GetPropCount(soulCost.costs[i].itemId);
                    Util.SetText(costItem, Util.Format(Util.GetString((int)TextForMatType.SoulUI, 17), soulCost.costs[i].count.ToString(), own));
                    costItem.color = ColorGroup.GetColor(ColorManagerType.IsMatrialEnough, soulCost.costs[i].count <= own);
                    var costProp = ConfigManager.Get <PropItemInfo>(soulCost.costs[i].itemId);
                    if (null != costProp)
                    {
                        Util.SetText(costItemName, costProp.itemName);
                        AtlasHelper.SetIcons(costItemIcon, costProp.icon);
                        costItemIcon.GetComponentDefault <Button>()?
                        .onClick.AddListener(() => moduleGlobal.UpdateGlobalTip((ushort)costProp.ID));
                    }
                }
            }
        }
        else
        {
            Util.SetText(costCoin, "0");
            Util.SetText(costItem, "0");
        }
    }
Esempio n. 18
0
    private void RefreshOtherCurrency()
    {
        var list = moduleShop.curShopMsg.items;

        if (list == null || list.Length < 1)
        {
            return;
        }

        costId.Clear();
        for (int i = 0; i < list.Length; i++)
        {
            if (costId.Contains(list[i].currencyType))
            {
                continue;
            }
            costId.Add(list[i].currencyType);
        }

        for (int i = 0; i < otherCurrency.childCount; i++)
        {
            var tran = otherCurrency.GetChild(i);
            if (tran == null)
            {
                continue;
            }
            if (i < costId.Count)
            {
                int id   = costId[i];
                var prop = ConfigManager.Get <PropItemInfo>(id);

                if (!prop)
                {
                    tran.SafeSetActive(false);
                    continue;
                }

                bool isCurrency = prop.itemType == PropType.Currency && ((CurrencySubType)prop.subType == CurrencySubType.Gold || (CurrencySubType)prop.subType == CurrencySubType.Diamond);
                if (isCurrency)
                {
                    tran.SafeSetActive(false);
                    continue;
                }

                uint count = 0;
                isCurrency = prop.itemType == PropType.Currency && (CurrencySubType)prop.subType > CurrencySubType.None && (CurrencySubType)prop.subType < CurrencySubType.Count;
                if (isCurrency)
                {
                    count = modulePlayer.GetMoneyCount((CurrencySubType)prop.subType);
                }
                else
                {
                    count = (uint)moduleEquip.GetPropCount(id);
                }

                tran.SafeSetActive(true);
                AtlasHelper.SetIcons(tran.Find("icon"), prop.icon);
                Util.SetText(tran.Find("num")?.gameObject, "×" + count);
                var btn = tran.GetComponentDefault <Button>();
                if (btn)
                {
                    btn.onClick.RemoveAllListeners();
                    btn.onClick.AddListener(() => moduleGlobal.UpdateGlobalTip((ushort)id, true));
                }
            }
            else
            {
                tran.SafeSetActive(false);
            }
        }
    }
Esempio n. 19
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);
    }
Esempio n. 20
0
        public bool OpenRevivePanel()
        {
            if (modulePVE.isStandalonePVE &&
                (modulePVE.rebornItemDic == null || !modulePVE.canRevive || modulePVE.rebornItemDic.Count <= 0))
            {
                return(false);
            }

            PItem2 reviveItem = null;
            int    reviveCoin = m_reviveCoinItem != null?moduleEquip.GetPropCount(m_reviveCoinItem.itemTypeId) : 0;

            if (reviveCoin > 0)
            {
                reviveItem = m_reviveCoinItem;
            }
            if (reviveItem == null)
            {
                reviveItem = modulePVE.rebornItemDic.Get(modulePVE.currentReviveTimes);
            }

            if (reviveItem == null)
            {
                return(false);
            }

            currentReviveCostCount = (int)reviveItem.num;
            SetPanelVisible(true);

            //替换公共图片
            var info = ConfigManager.Get <PropItemInfo>(reviveItem.itemTypeId);

            if (info.itemType == PropType.Currency)
            {
                AtlasHelper.SetCurrencyIcon(m_costIcon, (CurrencySubType)info.subType);
            }
            else
            {
                AtlasHelper.SetIcons(m_costIcon, info.icon);
            }

            Util.SetText(m_contentText, (int)TextForMatType.CombatUIText, 3, info.itemName);

            int hasReviveCostCount = 0;

            if (info.itemType == PropType.Currency)
            {
                hasReviveCostCount = info.subType == (byte)CurrencySubType.Diamond
                    ? (int)modulePlayer.roleInfo.diamond
                    : (int)modulePlayer.roleInfo.coin;
            }
            else if (info.itemType == PropType.Sundries && info.subType == (int)SundriesSubType.Revive)
            {
                hasReviveCostCount = reviveCoin;
            }
            else
            {
                hasReviveCostCount = moduleEquip.GetPropCount(info.ID);
            }

            m_restReviveText.text = string.Format(restReviveTip,
                                                  (modulePVE.maxReviveTimes - modulePVE.currentReviveTimes));
            m_costCountText.text = string.Format(restCountTip, currentReviveCostCount, hasReviveCostCount);

            bool isReviveBtnEnable = hasReviveCostCount >= currentReviveCostCount && modulePVE.canRevive;

            m_reviveBtn.SetInteractable(isReviveBtnEnable);

            //组队模式不暂停AI
            if (!modulePVE.isTeamMode)
            {
                moduleAI.SetAllAIPauseState(true);
            }
            return(true);
        }