/// <summary>
    /// 更新奖励列表
    /// </summary>
    /// <param name="mission">任务数据</param>
    /// <param name="rewardBox">奖励容器</param>
    private void UpdateRewardList(MissionVO mission, Transform rewardBox)
    {
        CfgEternityProxy configs = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;

        m_RewardIDs.Clear();
        m_RewardCounts.Clear();

        MissionMain cfg = mission.MissionMainConfig.Value;

        if (cfg.ItemId1 > 0)
        {
            m_RewardIDs.Add(cfg.ItemId1);
            m_RewardCounts.Add(cfg.ItemNum1);
        }
        if (cfg.ItemId2 > 0)
        {
            m_RewardIDs.Add(cfg.ItemId2);
            m_RewardCounts.Add(cfg.ItemNum2);
        }
        if (cfg.ItemId3 > 0)
        {
            m_RewardIDs.Add(cfg.ItemId3);
            m_RewardCounts.Add(cfg.ItemNum3);
        }
        if (cfg.ItemId4 > 0)
        {
            m_RewardIDs.Add(cfg.ItemId4);
            m_RewardCounts.Add(cfg.ItemNum4);
        }
        if (cfg.ItemId5 > 0)
        {
            m_RewardIDs.Add(cfg.ItemId5);
            m_RewardCounts.Add(cfg.ItemNum5);
        }

        int index = 0;

        for (; index < m_RewardIDs.Count; index++)
        {
            int  itemID    = m_RewardIDs[index];
            int  itemCount = m_RewardCounts[index];
            Item item      = configs.GetItemByKey((uint)m_RewardIDs[index]);

            Transform node    = index < rewardBox.childCount ? rewardBox.GetChild(index) : Object.Instantiate(rewardBox.GetChild(0), rewardBox);
            Image     icon    = FindComponent <Image>(node, "Icon/Icon");
            Image     quality = FindComponent <Image>(node, "Icon/Quality");
            TMP_Text  name    = FindComponent <TMP_Text>(node, "Label_Name");
            TMP_Text  count   = FindComponent <TMP_Text>(node, "Label_Num");

            node.gameObject.SetActive(true);
            UIUtil.SetIconImageSquare(icon, item.Icon);
            quality.color = ColorUtil.GetColorByItemQuality(item.Quality);
            name.text     = TableUtil.GetItemName(itemID);
            count.text    = itemCount.ToString();
        }
        for (; index < rewardBox.childCount; index++)
        {
            rewardBox.GetChild(index).gameObject.SetActive(false);
        }
    }
    /// <summary>
    /// 设置回购数据
    /// </summary>
    /// <param name="sellBackVO"></param>
    /// <param name="isList">是否列表模式</param>
    public void SetData(ShopSellBackVO sellBackVO, bool isList)
    {
        Init();
        m_SellBackVO    = sellBackVO;
        m_Quality.color = ColorUtil.GetColorByItemQuality(sellBackVO.ItemConfig.Quality);
        if (isList)
        {
            UIUtil.SetIconImage(m_Icon, TableUtil.GetItemIconBundle((uint)m_SellBackVO.Tid), TableUtil.GetItemIconImage((uint)m_SellBackVO.Tid));
            UIUtil.SetIconImage(m_Icon2, TableUtil.GetItemIconBundle((uint)m_SellBackVO.Tid), TableUtil.GetItemIconImage((uint)m_SellBackVO.Tid));
        }
        else
        {
            UIUtil.SetIconImage(m_Icon, TableUtil.GetItemIconBundle((uint)m_SellBackVO.Tid), TableUtil.GetItemSquareIconImage((uint)m_SellBackVO.Tid));
            UIUtil.SetIconImage(m_Icon2, TableUtil.GetItemIconBundle((uint)m_SellBackVO.Tid), TableUtil.GetItemSquareIconImage((uint)m_SellBackVO.Tid));
        }
        m_Num.text = sellBackVO.Num.ToString();
        UIUtil.SetIconImage(m_MoneyIcon, TableUtil.GetItemIconBundle((uint)sellBackVO.ItemConfig.SellCurrency), TableUtil.GetItemIconImage((uint)sellBackVO.ItemConfig.SellCurrency));
        m_Price.text = sellBackVO.ItemConfig.BuybackPrice.ToString();
        m_Name.text  = TableUtil.GetItemName((uint)m_SellBackVO.Tid);
        m_Level.text = TableUtil.ShowLevel(1);


        if (MoneyeEnough())
        {
            m_Price.color = new Color(30f / 255f, 170f / 255f, 33f / 255f, 1);
        }
        else
        {
            m_Price.color = Color.red;
        }
    }
 public void SetData(ItemBase item, bool isSelect, bool isList = false)
 {
     Init();
     m_Quality.color = ColorUtil.GetColorByItemQuality(item.ItemConfig.Quality);
     if (isList)
     {
         UIUtil.SetIconImage(m_Icon, TableUtil.GetItemIconBundle(item.TID), TableUtil.GetItemIconImage(item.TID));
         UIUtil.SetIconImage(m_Icon2, TableUtil.GetItemIconBundle(item.TID), TableUtil.GetItemIconImage(item.TID));
     }
     else
     {
         UIUtil.SetIconImage(m_Icon, TableUtil.GetItemIconBundle(item.TID), TableUtil.GetItemSquareIconImage(item.TID));
         UIUtil.SetIconImage(m_Icon2, TableUtil.GetItemIconBundle(item.TID), TableUtil.GetItemSquareIconImage(item.TID));
     }
     m_Count.text = item.Count.ToString();
     m_Used.gameObject.SetActive(item.Replicas != null && item.Replicas.Count > 0);
     m_Price.text = item.ItemConfig.MoneyPrice.ToString();
     if (isSelect)
     {
         m_Price.color = new Color(41f / 255f, 41f / 255f, 41f / 255f, 1);
     }
     else
     {
         m_Price.color = Color.white;
     }
     m_Name.text  = TableUtil.GetItemName(item.TID);
     m_Level.text = TableUtil.ShowLevel(1);
     UIUtil.SetIconImage(m_MoneyIcon, TableUtil.GetItemIconBundle((uint)item.ItemConfig.SellCurrency), TableUtil.GetItemIconImage((uint)item.ItemConfig.SellCurrency));
 }
    /// <summary>
    /// 根据类型初始化面板内容
    /// </summary>
    private void SetContent()
    {
        m_Prime.gameObject.SetActive(false);
        m_BlueprintNameLabel.text   = TableUtil.GetItemName(m_CurrentProduce.Id);
        m_BlueprintQuality.color    = ColorUtil.GetColorByItemQuality(TableUtil.GetItemQuality(m_CurrentItem.Id));
        m_BlueprintNumberLabel.text = m_CurrentProduce.ProductNum.ToString();
        string iconName = "";

        if (m_Style == UIViewListLayout.Row)
        {
            iconName = TableUtil.GetItemIconImage(m_CurrentItem.Id);
        }
        else
        {
            iconName = TableUtil.GetItemSquareIconImage(m_CurrentItem.Id);
        }

        UIUtil.SetIconImage(m_IconImage, TableUtil.GetItemIconBundle(m_CurrentItem.Id), iconName);
        m_OverlyingIcon.sprite = m_IconImage.sprite;
        switch (m_ProduceType)
        {
        case ProduceType.HeavyWeapon:
        case ProduceType.LightWeapon:
            WeaponL2 weaponL2 = 0;
            ItemTypeUtil.SetSubType(ref weaponL2, ItemTypeUtil.GetItemType(m_CurrentItem.Type));
            m_Prime.text = TableUtil.GetLanguageString(weaponL2);
            m_Prime.gameObject.SetActive(true);
            break;
        }
    }
    /// <summary>
    /// 初始化消息动画
    /// </summary>
    private void InitializeMessageAnimation()
    {
        switch (m_CurrentMessage.type)
        {
        case NotificationName.MSG_MISSION_ACCEPT:
        case NotificationName.MSG_MISSION_FAIL:
            break;

        case NotificationName.MSG_MISSION_COMMIT:
        {
            UIIconAndLabel label = m_CurrentAnimationEvent.GetComponent <UIIconAndLabel>();
            if (label && label.Label)
            {
                label.Label.text = TableUtil.GetLanguageString("mission_title_1005");
            }
        }
        break;

        case NotificationName.MSG_MISSION_STATE_CHANGE:
        {
            UIIconAndLabel label = m_CurrentAnimationEvent.GetComponent <UIIconAndLabel>();
            if (label && label.Label)
            {
                label.Label.text = TableUtil.GetLanguageString("mission_title_1015");
            }
        }
        break;

        case NotificationName.MSG_PLAYER_LEVEL_UP:
        {
            UIIconAndLabel label = m_CurrentAnimationEvent.GetComponent <UIIconAndLabel>();
            if (label && label.Label)
            {
                label.Label.text = m_CurrentMessage.argument != null ? "Lv." + m_CurrentMessage.argument.ToString() : string.Empty;
            }
        }
        break;

        case NotificationName.MSG_PLAYER_SHIP_LEVEL_UP:
        {
            MsgShipLevelUp msg       = (MsgShipLevelUp)m_CurrentMessage.argument;
            UIIconAndLabel shipLabel = m_CurrentAnimationEvent.GetComponent <UIIconAndLabel>();
            if (shipLabel && shipLabel.Label)
            {
                shipLabel.Label.text = m_CurrentMessage.argument != null ? "Lv." + msg.m_level : string.Empty;
            }
            if (shipLabel && shipLabel.Icon)
            {
                UIUtil.SetIconImage(shipLabel.Icon, TableUtil.GetItemIconTid(msg.m_Tid));
            }
            if (shipLabel && shipLabel.Info)
            {
                string name = TableUtil.GetItemName(msg.m_Tid);
                shipLabel.Info.text = string.Format(TableUtil.GetLanguageString("hud_text_id_1036"), name);
            }
        }
        break;
        }
    }
Beispiel #6
0
    /// <summary>
    /// 打开确认面板
    /// </summary>
    /// <param name="type">操作类型</param>
    public void OpenConfim(MsgProduceConfim confim)//消耗数据
    {
        ProduceOrder type = confim.OrderType;

        m_SelectProduceTid = confim.Tid;
        switch (type)
        {
        case ProduceOrder.Produce:      //生产
            m_ReturnTitle.text = string.Format(TableUtil.GetLanguageString("production_text_1025"),
                                               TableUtil.GetItemName(m_FoundryProxy.GetItemByProduceKey(m_SelectProduceTid).Id));
            m_HintLabel.text = "";
            break;

        case ProduceOrder.Canel:      //取消生产
            m_ReturnTitle.text = TableUtil.GetLanguageString("production_text_1026");
            m_HintLabel.text   = TableUtil.GetLanguageString("production_text_1041");
            m_IconList.Clear();
            Item[]           items   = m_FoundryProxy.GetEffectItem(m_SelectProduceTid);
            EffectElement?[] effects = m_FoundryProxy.GetEffectElementsByProduceTid(m_SelectProduceTid);
            for (int i = 0; i < items.Length; i++)
            {
                IconManager.Instance.LoadItemIcon <IconCommon>(IconConstName.ICON_COMMON, m_ReturnItemRoot,
                                                               (icon) =>
                {
                    m_IconList.Add(icon);
                    icon.SetData(TableUtil.GetItemIconTid(items[i].Id), items[i].Quality, (int)effects[i].Value.Value);
                });
            }

            break;

        case ProduceOrder.Recevie:      //领取 不要图标
            m_ReturnTitle.text = TableUtil.GetLanguageString("production_text_1028");
            m_HintLabel.text   = "";
            break;

        case ProduceOrder.SpeedUp:      //加速
            m_ReturnTitle.text = TableUtil.GetLanguageString("production_text_1027");
            m_HintLabel.text   = TableUtil.GetLanguageString("production_text_1040");
            m_IconList.Clear();
            IconManager.Instance.LoadItemIcon <IconCommon>(IconConstName.ICON_COMMON, m_ReturnItemRoot,
                                                           (icon) =>
            {
                m_IconList.Add(icon);
                icon.SetData(TableUtil.GetItemIconTid(GameConstant.CurrencyConst.RECHARGE_CURRENCY_ITEM_TID),
                             TableUtil.GetItemQuality(GameConstant.CurrencyConst.RECHARGE_CURRENCY_ITEM_TID), (int)confim.ExpendNum);
            });
            break;

        default:
            break;
        }
    }
    public void SetData(ItemWeaponVO Vo)
    {
        Initialize();
        m_Empty.gameObject.SetActive(Vo.TID == 0);
        m_Content.gameObject.SetActive(Vo.TID != 0);
        if (Vo.TID == 0)
        {
            return;
        }
        UIUtil.SetIconImage(m_IconImage, TableUtil.GetItemIconBundle(Vo.TID), TableUtil.GetItemIconImage(Vo.TID));
        m_OverlyingIcon.sprite = m_IconImage.sprite;
        m_NameLabel.text       = TableUtil.GetItemName((int)Vo.TID);
        m_Quality.color        = ColorUtil.GetColorByItemQuality(Vo.ItemConfig.Quality);
        m_Used.gameObject.SetActive(Vo.Replicas != null && Vo.Replicas.Count > 0);
        int index = 0;

        char[] charArray = Vo.Lv.ToString().PadLeft(3, '0').ToCharArray();
        for (int i = 0; i < charArray.Length; i++)
        {
            char cc = charArray[i];
            if (cc != '0')
            {
                index = i;
                break;
            }
        }
        string sstr = Vo.Lv.ToString().PadLeft(3, '0');

        if (index != 0)
        {
            sstr = sstr.Insert(index, "</color>");
            sstr = sstr.Insert(0, "<color=#808080>");
        }
        m_LvLabel.text   = sstr;
        m_TypeLabel.text = TableUtil.GetLanguageString(Vo.WeaponType2);
        int m_ModCount = 0;

        if (Vo.Items != null)
        {
            foreach (ItemContainer item in Vo.Items.Values)
            {
                if (item.Items != null)
                {
                    m_ModCount += item.Items.Count;
                }
            }
        }
        SetMod(m_ModCount);
    }
Beispiel #8
0
 public void SetData(ItemBase Vo)
 {
     Initialize();
     m_Empty.gameObject.SetActive(Vo.TID == 0);
     m_Content.gameObject.SetActive(Vo.TID != 0);
     if (Vo.TID == 0)
     {
         return;
     }
     UIUtil.SetIconImage(m_IconImage, TableUtil.GetItemIconBundle(Vo.TID), TableUtil.GetItemIconImage(Vo.TID));
     m_OverlyingIcon.sprite = m_IconImage.sprite;
     m_NameLabel.text       = TableUtil.GetItemName((int)Vo.TID);
     m_Quality.color        = ColorUtil.GetColorByItemQuality(Vo.ItemConfig.Quality);
     m_NumLabel.text        = Vo.Count.ToString();
     m_TypeLabel.text       = TableUtil.GetLanguageString(Vo.MainType);
 }
Beispiel #9
0
 /// <summary>
 /// 设置单个装备数据
 /// </summary>
 /// <param name="data"></param>
 /// <param name="cell"></param>
 private void SetEquipmentData(IEquipment data, Transform cell)
 {
     TransformUtil.FindUIObject <Transform>(cell, "Content").gameObject.SetActive(data != null);
     TransformUtil.FindUIObject <Transform>(cell, "Empty").gameObject.SetActive(data == null);
     if (data != null)
     {
         //icon
         UIUtil.SetIconImage(TransformUtil.FindUIObject <Image>(cell, "Content/Image_Icon"), TableUtil.GetItemIconBundle(data.GetTID()), TableUtil.GetItemIconImage(data.GetTID()));
         //name
         TransformUtil.FindUIObject <TMP_Text>(cell, "Content/Label_Name").text = TableUtil.GetItemName((int)data.GetTID());
         //quality
         TransformUtil.FindUIObject <Image>(cell, "Content/Image_Quality").color = ColorUtil.GetColorByItemQuality(data.GetBaseConfig().Quality);
         //lv
         TransformUtil.FindUIObject <TMP_Text>(cell, "Content/Label_Lv").text = "Lv." + PadLeft(data.GetLv().ToString());
     }
 }
Beispiel #10
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="view"></param>
    /// <param name="data"></param>
    private void LayoutMailTip(GameObject view, MailDataVO data)
    {
        int             index           = 0;
        Transform       m_TipsTransform = FindComponent <Transform>(view.transform, "TipsScrollView/ALL");
        TextMeshProUGUI m_Title         = FindComponent <TextMeshProUGUI>(view.transform, "TipsScrollView/ALL/Content/NameType/Label_Name");
        TextMeshProUGUI m_Sender        = FindComponent <TextMeshProUGUI>(view.transform, "TipsScrollView/ALL/Content/NameType/Type/Label_Type");
        TextMeshProUGUI m_Describe      = FindComponent <TextMeshProUGUI>(view.transform, "TipsScrollView/ALL/Content/Describe/Label_Describe");

        Transform itemRootTf = FindComponent <Transform>(view.transform, "TipsScrollView/ALL/Content/Materials");

        m_Title.text    = data.Title;
        m_Sender.text   = data.Sender;
        m_Describe.text = data.Content;
        m_Describe.text = m_Describe.text.Replace("\\n", "\n");
        if (data.Items == null)
        {
            return;
        }
        for (; index < data.Items.Count; index++)
        {
            RewardDateVO mailReward = data.Items[index];
            Transform    node       = index < itemRootTf.childCount ? itemRootTf.GetChild(index) : Object.Instantiate(itemRootTf.GetChild(0), itemRootTf);
            Image        icon       = FindComponent <Image>(node, "Content/Icon/Icon");
            Image        quality    = FindComponent <Image>(node, "Content/Icon/Quality");
            TMP_Text     name       = FindComponent <TMP_Text>(node, "Content/Label_Name");
            TMP_Text     num        = FindComponent <TMP_Text>(node, "Content/Label_Num");
            name.text     = TableUtil.GetItemName((int)mailReward.Id);
            num.text      = mailReward.Num.ToString();
            quality.color = ColorUtil.GetColorByItemQuality(mailReward.Quality);
            string iconName = TableUtil.GetItemSquareIconImage(mailReward.Id);
            UIUtil.SetIconImage(icon, TableUtil.GetItemIconBundle(mailReward.Id), iconName);
            if (data.Got == 1)
            {
                icon.color = Color.gray;
            }
            else
            {
                icon.color = Color.white;
            }
            node.gameObject.SetActive(true);
        }
        for (; index < itemRootTf.childCount; index++)
        {
            itemRootTf.GetChild(index).gameObject.SetActive(false);
        }
    }
Beispiel #11
0
    /// <summary>
    /// 添加条目
    /// </summary>
    /// <param name="itemGetting">条目数据</param>
    private void OnGettingItem(ItemChangeInfo itemGetting)
    {
        if (itemGetting.CountChangeDelta > 0 && itemGetting.TID > 0)
        {
            if (itemGetting.Category != 0 && itemGetting.Category != Category.Package)
            {
                ItemData data = new ItemData();
                data.Name       = TableUtil.GetItemName(itemGetting.TID);
                data.Quality    = TableUtil.GetItemQuality(itemGetting.TID);
                data.Count      = itemGetting.CountChangeDelta;
                data.IconBundle = TableUtil.GetItemIconBundle(itemGetting.TID);
                data.IconName   = TableUtil.GetItemSquareIconImage(itemGetting.TID);

                m_WaitingQueue.Add(data);
            }
        }
    }
    /// <summary>
    /// 获取其他玩家的信息
    /// </summary>
    /// <param name="id"></param>
    private void GetShipData(ulong id)
    {
        //Debug.LogError("收到玩家信息"+id);
        ShipItemsProxy shipItemsProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipItemsProxy) as ShipItemsProxy;
        // 飞船的
        IShip ship = shipItemsProxy.GetCurrentWarShip(id);

        if (ship != null)
        {
            IWeaponContainer weaponContainer = ship.GetWeaponContainer();
            if (weaponContainer != null)
            {
                IWeapon[] weapons = weaponContainer.GetWeapons();
                //Debug.LogError("weapons==="+weapons.Length);
                if (weapons != null)
                {
                    for (int i = 0; i < weapons.Length; i++)
                    {
                        IWeapon weapon = weapons[i];
                        m_Weapons[i].text = TableUtil.GetItemName((int)weapon.GetBaseConfig().Id);
                    }
                }
            }

            IEquipmentContainer equipmentContainer = ship.GetEquipmentContainer();
            if (equipmentContainer != null)
            {
                IEquipment[] equipments = ship.GetEquipmentContainer().GetEquipments();
                for (int i = 0; i < equipments.Length; i++)
                {
                    IEquipment equipment = equipments[i];
                    m_EquipMents[i].text = TableUtil.GetItemName((int)equipment.GetBaseConfig().Id);
                }
            }
            IReformer ireformer = ship.GetReformerContainer().GetReformer();
            if (ireformer != null)
            {
                m_Converter.text = TableUtil.GetItemName((int)ireformer.GetBaseConfig().Id);
            }
        }
        else
        {
            Debug.LogError("船的信息为空");
        }
    }
Beispiel #13
0
 /// <summary>
 /// 设置船内容显示
 /// </summary>
 /// <param name="ship"></param>
 public void SetData(IShip ship, bool isList)
 {
     Initialize();
     m_Ship = ship;
     if (isList)
     {
         UIUtil.SetIconImage(m_IconImage, TableUtil.GetItemIconBundle(ship.GetTID()), TableUtil.GetItemIconImage(ship.GetTID()));
     }
     else
     {
         UIUtil.SetIconImage(m_IconImage, TableUtil.GetItemIconBundle(ship.GetTID()), TableUtil.GetItemSquareIconImage(ship.GetTID()));
     }
     m_OverlyingIcon.sprite = m_IconImage.sprite;
     m_NameLabel.text       = TableUtil.GetItemName((int)ship.GetTID());
     m_LvLabel.text         = TableUtil.ShowLevel(ship.GetLv());
     m_Appoint.gameObject.SetActive(ship.GetUID() == m_ShipProxy.GetAppointWarShip().GetUID());
     m_New.gameObject.SetActive(!m_ShipProxy.MarkNew(ship));
 }
    public void OnItemRendererSkin(Vector2Int currentIndex, object data, Transform view, bool isSelected)
    {
        int    i      = (int)data;
        int    page   = currentIndex.x;
        int    index  = currentIndex.y;
        Toggle toggle = view.GetComponent <Toggle>();

        view.GetComponent <Toggle>().group = m_SkinToggleRoot.GetComponent <ToggleGroup>();
        view.localScale = Vector3.one;
        view.Find("Label").GetComponent <TMP_Text>().text = TableUtil.GetItemName("player_name_{0}", (int)m_CfgEternityProxy.GetMalePlayerByIndex(index).Id);
        UIUtil.SetIconImageSquare(view.Find("Image_Icon").GetComponent <Image>(),
                                  (uint)m_CfgEternityProxy.GetMalePlayerByIndex(index).Icon);
        toggle.onValueChanged.RemoveAllListeners();
        toggle.isOn = false;
        Animator animator = view.GetComponent <Animator>();

        toggle.onValueChanged.AddListener((select) => SelectSkinClick(toggle, index, select));
        //FocusTo(toggle);
    }
Beispiel #15
0
    /// <summary>
    /// 设置日志内容显示
    /// </summary>
    private void SetContent(LogDataVO dataVO)
    {
        UIUtil.SetIconImage(m_Icon, TableUtil.GetItemIconBundle(dataVO.Tid), TableUtil.GetItemIconImage(dataVO.Tid));
        UIUtil.SetIconImage(m_OverlyingIcon, TableUtil.GetItemIconBundle(dataVO.Tid), TableUtil.GetItemIconImage(dataVO.Tid));
        Color  m_QualityColor = ColorUtil.GetColorByItemQuality(TableUtil.GetItemQuality(dataVO.Tid));
        string m_Name         = TableUtil.GetItemName(dataVO.Tid);
        string m_ColorText    = ColorUtil.AddColor(m_Name, m_QualityColor);
        string m_ShowText     = "";

        if (dataVO.Num > 1)
        {
            m_ShowText = string.Format(TableUtil.GetLanguageString("log_text_1011"), m_ColorText, dataVO.Num);
        }
        else
        {
            m_ShowText = string.Format(TableUtil.GetLanguageString("log_text_1010"), m_ColorText);
        }
        m_Describe.text = string.Format(m_ShowText);
    }
Beispiel #16
0
    /// <summary>
    /// 设置船具体属性数据
    /// </summary>
    private void SetShipData()
    {
        InitShipPanel();

        m_ShipPanelEmptyRoot.SetActive(false);
        m_ShipPanelContentRoot.SetActive(true);

        UIUtil.SetIconImage(m_ShipPanelIcon, TableUtil.GetItemIconBundle(m_CurrentShip.GetTID()), TableUtil.GetItemIconImage(m_CurrentShip.GetTID()));
        m_ShipPanelNameText.text      = TableUtil.GetItemName((int)m_CurrentShip.GetTID());
        m_ShipPanelQualityImage.color = ColorUtil.ShipColor.GetColorByPrime(m_CurrentShip.GetConfig().IsPrime > 0);
        m_ShipPanelLvText.text        = "Lv." + PadLeft(m_CurrentShip.GetLv().ToString());

        uint modCount = m_CurrentShip.GetGeneralModContainer().GetCurrentSizeMax() + m_CurrentShip.GetExclusivelyModContainer().GetCurrentSizeMax();

        for (int i = 0; i < m_ShipMods.Length; i++)
        {
            m_ShipMods[i].gameObject.SetActive(i < modCount);
            m_ShipMods[i].transform.GetChild(0).GetComponent <Image>().enabled = false;
        }

        IMod[] mods = m_CurrentShip.GetGeneralModContainer().GetMods();
        if (mods != null && mods.Length > 0)
        {
            for (int i = 0; i < mods.Length; i++)
            {
                m_ShipMods[mods[i].GetPos()].transform.GetChild(0).GetComponent <Image>().enabled = true;
                m_ShipMods[mods[i].GetPos()].transform.GetChild(0).GetComponent <Image>().color   = ColorUtil.GetColorByItemQuality(mods[i].GetBaseConfig().Quality);
            }
        }
        mods = m_CurrentShip.GetExclusivelyModContainer().GetMods();
        uint GeneralModCount = m_CurrentShip.GetGeneralModContainer().GetCurrentSizeMax();

        if (mods != null && mods.Length > 0)
        {
            for (int i = 0; i < mods.Length; i++)
            {
                m_ShipMods[mods[i].GetPos() + GeneralModCount].transform.GetChild(0).GetComponent <Image>().enabled = true;
                m_ShipMods[mods[i].GetPos() + GeneralModCount].transform.GetChild(0).GetComponent <Image>().color   = ColorUtil.GetColorByItemQuality(mods[i].GetBaseConfig().Quality);
            }
        }
    }
 /// <summary>
 /// 按名字az排序
 /// </summary>
 /// <param name="list">list</param>
 public List <ProduceInfoVO> SortName(List <ProduceInfoVO> list)
 {
     return(list = list.OrderBy(o => TableUtil.GetItemName(o.MProduce.Id)).ThenBy(o => o.MProduce.Order).ThenBy(o => o.MProduce.Id).ToList());
 }
Beispiel #18
0
    /// <summary>
    /// 按指定方式排序
    /// </summary>
    /// <param name="kind">排序方式</param>
    /// <param name="a">数据项A</param>
    /// <param name="b">数据项B</param>
    /// <returns>排序结果</returns>
    protected virtual int Compare(UIViewSortKind kind, object a, object b)
    {
        int result = 0;

        if (a is ItemBase && b is ItemBase)
        {
            ItemBase left  = a as ItemBase;
            ItemBase right = b as ItemBase;

            switch (kind)
            {
            case UIViewSortKind.Quality:
                result = right.ItemConfig.Quality - left.ItemConfig.Quality;
                break;

            case UIViewSortKind.TLevel:
                result = left.ItemConfig.Grade - right.ItemConfig.Grade;
                break;

            case UIViewSortKind.StrengthenLevel:
                result = right.Lv - left.Lv;
                break;

            case UIViewSortKind.UseLevel:
                result = right.ItemConfig.PlayerLvLimit - left.ItemConfig.PlayerLvLimit;
                break;

            case UIViewSortKind.Name:
                result = string.Compare(TableUtil.GetItemName(left.TID), TableUtil.GetItemName(right.TID));
                break;

            case UIViewSortKind.GetTime:
                result = (int)(right.CreateTime - left.CreateTime);
                break;

            case UIViewSortKind.SellPrice:
                result = (int)(right.ItemConfig.MoneyPrice - left.ItemConfig.MoneyPrice);
                break;
            }

            if (result == 0)
            {
                result = right.ItemConfig.Order - left.ItemConfig.Order;
            }
            if (result == 0)
            {
                result = (int)(right.TID - left.TID);
            }
        }
        else if (a is Item && b is Item)
        {
            Item left  = (Item)a;
            Item right = (Item)b;
            switch (kind)
            {
            case UIViewSortKind.Quality:
                result = right.Quality - left.Quality;
                break;

            case UIViewSortKind.TLevel:
                result = left.Grade - right.Grade;
                break;

            case UIViewSortKind.UseLevel:
                result = right.PlayerLvLimit - left.PlayerLvLimit;
                break;

            case UIViewSortKind.Name:
                result = string.Compare(TableUtil.GetItemName(left.Id), TableUtil.GetItemName(right.Id));
                break;

            case UIViewSortKind.SellPrice:
                result = (int)(right.MoneyPrice - left.MoneyPrice);
                break;
            }

            if (result == 0)
            {
                result = right.Order - left.Order;
            }
            if (result == 0)
            {
                result = (int)(right.Id - left.Id);
            }
        }

        return(result);
    }
Beispiel #19
0
    public override void OnShow(object msg)
    {
        base.OnShow(msg);
        if (msg != null)
        {
            m_ShopParameter = (OpenShopParameter)msg;
        }
        m_ItemConfig = m_CfgEternityProxy.GetItemByKey(m_ShopParameter.Tid);
        m_Bounds     = m_ShopParameter.Bounds;
        if (m_ShopParameter.MoneyType == 1)
        {
            m_Money = (int)CurrencyUtil.GetGameCurrencyCount();
        }
        else
        {
            m_Money = (int)CurrencyUtil.GetRechargeCurrencyCount();
        }
        if (m_ShopParameter.OperateType == 1)
        {
            m_Max = m_ShopParameter.LimitCount;
        }
        else
        {
            GetGoodMax();
            if (m_Max == 0)
            {
                m_Min = 0;
            }
        }
        m_GoodName.text  = TableUtil.GetItemName(m_ShopParameter.Tid);
        m_GoodName.color = ColorUtil.GetColorByItemQuality(m_ItemConfig.Quality);
        UIUtil.SetIconImage(m_MoneyIcon, TableUtil.GetItemIconBundle((KNumMoneyType)m_ShopParameter.MoneyType), TableUtil.GetItemIconImage((KNumMoneyType)m_ShopParameter.MoneyType));
        m_InputBox.onValueChanged.RemoveAllListeners();
        m_CurrentNum      = m_Bounds;
        m_InputBox.text   = m_Bounds.ToString();
        m_TotalPrice.text = Mathf.CeilToInt(m_CurrentNum * (m_ShopParameter.Price / m_ShopParameter.Bounds)).ToString();

        m_InputBox.onValueChanged.AddListener((str) =>
        {
            if (str.Length > 0)
            {
                m_CurrentNum = int.Parse(str);
                if (m_CurrentNum < m_Min)
                {
                    m_CurrentNum = m_Min;
                }
                else if (m_CurrentNum > m_Max)
                {
                    m_CurrentNum = m_Max;
                }
                m_InputBox.text = m_CurrentNum.ToString();
                m_BtnLeft.GetComponent <Button>().interactable  = m_CurrentNum > m_Bounds;
                m_BtnRight.GetComponent <Button>().interactable = m_CurrentNum < m_Max;
                SetHotKeyEnabled("left", m_CurrentNum > m_Bounds);
                SetHotKeyEnabled("Right", m_CurrentNum < m_Max);
                int m_Price       = Mathf.CeilToInt(m_CurrentNum * (m_ShopParameter.Price / m_ShopParameter.Bounds));
                m_TotalPrice.text = m_Price.ToString();
                if (m_ShopParameter.OperateType != 1)
                {
                    SetHotKeyEnabled("confirm", m_Money >= m_Price && m_CurrentNum > 0);
                }
                else
                {
                    SetHotKeyEnabled("confirm", true);
                }
            }
            else
            {
                m_CurrentNum      = 0;
                int m_Price       = 0;
                m_TotalPrice.text = m_Price.ToString();
                SetHotKeyEnabled("confirm", false);
            }
        });
        UIEventListener.UIEventListener.AttachListener(m_BtnLeft).onDown  = OnLeftDonw;
        UIEventListener.UIEventListener.AttachListener(m_BtnLeft).onUp    = OnUp;
        UIEventListener.UIEventListener.AttachListener(m_BtnRight).onDown = OnRightDown;
        UIEventListener.UIEventListener.AttachListener(m_BtnRight).onUp   = OnUp;
    }
Beispiel #20
0
    /// <summary>
    /// 布局Tip
    /// </summary>
    /// <param name="view">视图</param>
    /// <param name="data">数据</param>
    protected void LayoutItemTip(GameObject view, ItemBase data, ItemBase compareData)
    {
        RectTransform root = FindComponent <RectTransform>(view.transform, "TipsScrollView/Viewport/Content/Content");
        //品质部分
        Transform qualityNode = FindComponent <Transform>(view.transform, "TipsScrollView/Viewport/Content/Quality");

        //名称部分
        TMP_Text nameField = FindComponent <TMP_Text>(root, "NameType/Label_Name");

        TMP_Text tnField = FindComponent <TMP_Text>(root, "NameType/Label_T");

        Transform typeNode  = FindComponent <Transform>(root, "NameType/Type");
        TMP_Text  typeField = FindComponent <TMP_Text>(typeNode, "Label_Type");
        Image     typeIcon  = FindComponent <Image>(typeNode, "Image_IconType");

        Transform levelNode  = FindComponent <Transform>(root, "NameType/Level");
        TMP_Text  levelField = FindComponent <TMP_Text>(levelNode, "Label_Score_Num");

        //限制部分
        Transform limitNode = FindComponent <Transform>(root, "Limit");
        TMP_Text  limitText = FindComponent <TMP_Text>(limitNode, "Label");

        //材料部分
        Transform materialNode = FindComponent <Transform>(root, "Materials");

        //描述部分
        Transform descriptionNode  = FindComponent <Transform>(root, "Describe");
        TMP_Text  descriptionField = FindComponent <TMP_Text>(descriptionNode, "Label_Describe");

        //属性部分
        Transform attributeNode = FindComponent <Transform>(root, "Attribute");
        //属性部分A
        Transform attributeANode = FindComponent <Transform>(root, "Attribute/Top");
        //属性部分B
        Transform attributeBNode = FindComponent <Transform>(root, "Attribute/Temp");
        //属性部分C
        Transform attributeCNode = FindComponent <Transform>(root, "Attribute/DFD");
        //属性部分D
        Transform attributeDNode = FindComponent <Transform>(root, "Attribute/Repair");

        //属性部分Nature 容器
        Transform attributeNature = FindComponent <Transform>(root, "Attribute/nature");
        //属性部分Extra容器
        Transform attributeExtra = FindComponent <Transform>(root, "Attribute/Extra");

        //属性部分Nature 单体
        Transform attributeNatureSingle = FindComponent <Transform>(root, "Attribute/nature/content1");
        //属性部分Extra 单体
        Transform attributeExtraSingle = FindComponent <Transform>(root, "Attribute/Extra/content1");


        //技能部分
        Transform skillNode = FindComponent <Transform>(root, "Attribute/Skill");

        //随机属性部分
        Transform randomNode = FindComponent <Transform>(root, "Random");

        //模组部分
        Transform modNode = FindComponent <Transform>(root, "MOD");

        //关掉所有
        tnField.text = string.Empty;
        typeNode.gameObject.SetActive(false);
        levelNode.gameObject.SetActive(false);
        limitNode.gameObject.SetActive(false);
        materialNode.gameObject.SetActive(false);
        attributeNode.gameObject.SetActive(false);
        attributeANode.gameObject.SetActive(false);
        attributeBNode.gameObject.SetActive(false);
        attributeCNode.gameObject.SetActive(false);
        attributeDNode.gameObject.SetActive(false);
        skillNode.gameObject.SetActive(false);
        randomNode.gameObject.SetActive(false);
        modNode.gameObject.SetActive(false);

        attributeNature.gameObject.SetActive(false);
        attributeExtra.gameObject.SetActive(false);
        //名称
        nameField.text = TableUtil.GetItemName(data.TID);
        //描述
        descriptionField.text = TableUtil.GetItemDescribe(data.TID);
        //品质
        int quality = data.ItemConfig.Quality;

        //data.ItemConfig
        for (int i = 0; i < qualityNode.childCount; i++)
        {
            qualityNode.GetChild(i).gameObject.SetActive((i + 1) == quality);
        }

        //蓝图
        if (data.MainType == Category.Blueprint)
        {
            ItemDrawingVO blueprint = data as ItemDrawingVO;

            //类型
            typeNode.gameObject.SetActive(true);
            typeField.text = TableUtil.GetLanguageString(blueprint.DrawingType);
            switch (blueprint.DrawingType)
            {
            case BlueprintL1.Warship: UIUtil.SetIconImage(typeIcon, 31005); break;

            case BlueprintL1.Weapon: UIUtil.SetIconImage(typeIcon, 31006); break;

            case BlueprintL1.Reformer: UIUtil.SetIconImage(typeIcon, 31007); break;

            case BlueprintL1.EquipmentMod: UIUtil.SetIconImage(typeIcon, 31008); break;

            case BlueprintL1.Equipment: UIUtil.SetIconImage(typeIcon, 31009); break;

            case BlueprintL1.Material: UIUtil.SetIconImage(typeIcon, 31010); break;

            default: typeIcon.sprite = null; break;
            }

            //材料
            materialNode.gameObject.SetActive(true);
            LayoutBlueprintMaterial(blueprint.TID, materialNode);

            //飞船蓝图
            if (blueprint.DrawingType == BlueprintL1.Warship)
            {
                attributeNode.gameObject.SetActive(true);
                attributeANode.gameObject.SetActive(true);
                attributeBNode.gameObject.SetActive(true);
                attributeCNode.gameObject.SetActive(true);
                attributeDNode.gameObject.SetActive(true);
                skillNode.gameObject.SetActive(true);

                modNode.gameObject.SetActive(true);
                LayoutBlueprintModList(blueprint.TID, modNode);
            }
            //武器蓝图
            else if (blueprint.DrawingType == BlueprintL1.Weapon)
            {
                attributeNode.gameObject.SetActive(true);
                attributeANode.gameObject.SetActive(true);
                attributeBNode.gameObject.SetActive(true);
                randomNode.gameObject.SetActive(true);

                modNode.gameObject.SetActive(true);
                LayoutBlueprintModList(blueprint.TID, modNode);
            }
            //转化炉蓝图
            else if (blueprint.DrawingType == BlueprintL1.Reformer)
            {
                attributeNode.gameObject.SetActive(true);
                attributeANode.gameObject.SetActive(true);
                attributeBNode.gameObject.SetActive(true);
                randomNode.gameObject.SetActive(true);
            }
            //装备蓝图
            else if (blueprint.DrawingType == BlueprintL1.Equipment)
            {
                attributeNode.gameObject.SetActive(true);
                attributeANode.gameObject.SetActive(true);
                attributeBNode.gameObject.SetActive(true);
                randomNode.gameObject.SetActive(true);
            }
            //装备模组蓝图
            else if (blueprint.DrawingType == BlueprintL1.EquipmentMod)
            {
                attributeNode.gameObject.SetActive(true);
                randomNode.gameObject.SetActive(true);
            }
            //材料蓝图
            else if (blueprint.DrawingType == BlueprintL1.Material)
            {
            }
        }
        //飞船
        else if (data.MainType == Category.Warship)
        {
            ItemWarShipVO ship = data as ItemWarShipVO;

            typeNode.gameObject.SetActive(true);
            typeField.text = TableUtil.GetLanguageString(ship.WarshipL1);
            UIUtil.SetIconImage(typeIcon, 31005);

            attributeNode.gameObject.SetActive(true);
            attributeANode.gameObject.SetActive(true);
            attributeBNode.gameObject.SetActive(true);
            attributeCNode.gameObject.SetActive(true);
            attributeDNode.gameObject.SetActive(true);
            skillNode.gameObject.SetActive(true);

            modNode.gameObject.SetActive(true);
            LayoutShipOrWeaponModList(ship, EquipmentModL1.WarshipMod, modNode);
        }
        //武器
        else if (data.MainType == Category.Weapon)
        {
            ItemWeaponVO weapon = data as ItemWeaponVO;

            typeNode.gameObject.SetActive(true);
            typeField.text = TableUtil.GetLanguageString(weapon.WeaponType2);
            UIUtil.SetIconImage(typeIcon, 31006);

            tnField.text = "T" + weapon.ItemConfig.Grade;

            attributeNode.gameObject.SetActive(true);
            attributeANode.gameObject.SetActive(true);
            attributeBNode.gameObject.SetActive(true);
            randomNode.gameObject.SetActive(true);

            modNode.gameObject.SetActive(true);
            LayoutShipOrWeaponModList(weapon, EquipmentModL1.WeaponMod, modNode);
        }
        //转化炉
        else if (data.MainType == Category.Reformer)
        {
            ItemReformerVO reformer = data as ItemReformerVO;

            typeNode.gameObject.SetActive(true);
            typeField.text = TableUtil.GetLanguageString(Category.Reformer);
            UIUtil.SetIconImage(typeIcon, 31007);

            tnField.text = "T" + reformer.ItemConfig.Grade;

            attributeNode.gameObject.SetActive(true);
            attributeANode.gameObject.SetActive(true);
            attributeBNode.gameObject.SetActive(true);
            randomNode.gameObject.SetActive(true);
        }
        //装备
        else if (data.MainType == Category.Equipment)
        {
            ItemEquipmentVO equip = data as ItemEquipmentVO;

            typeNode.gameObject.SetActive(true);

            typeField.text = TableUtil.GetLanguageString(equip.EquipmentType);
            UIUtil.SetIconImage(typeIcon, 31009);

            tnField.text = "T" + equip.ItemConfig.Grade;

            attributeNode.gameObject.SetActive(true);
            attributeANode.gameObject.SetActive(true);
            attributeBNode.gameObject.SetActive(true);
            randomNode.gameObject.SetActive(true);
        }
        //MOD
        else if (data.MainType == Category.EquipmentMod)
        {
            ItemModVO mod = data as ItemModVO;

            typeNode.gameObject.SetActive(true);
            typeField.text = TableUtil.GetLanguageString(mod.ModType1);
            UIUtil.SetIconImage(typeIcon, 31008);

            attributeNode.gameObject.SetActive(true);
            randomNode.gameObject.SetActive(true);
        }
        //材料
        else if (data.MainType == Category.Material)
        {
            ItemMaterialVO itemMaterial = data as ItemMaterialVO;

            typeNode.gameObject.SetActive(true);
            typeField.text = TableUtil.GetLanguageString(itemMaterial.MaterialType);
            UIUtil.SetIconImage(typeIcon, 31010);
        }
        //消耗品
        else if (data.MainType == Category.Expendable)
        {
            ItemExpendableVO itemExpendable = data as ItemExpendableVO;

            typeNode.gameObject.SetActive(true);
            typeField.text = TableUtil.GetLanguageString(itemExpendable.ExpendableType);
            UIUtil.SetIconImage(typeIcon, 51027);
        }
    }
Beispiel #21
0
    /// <summary>
    /// 布局蓝图的材料部分
    /// </summary>
    /// <param name="tid">蓝图的TID</param>
    /// <param name="materialNode">材料节点</param>

    private void LayoutBlueprintMaterial(uint tid, Transform materialNode)
    {
        CfgEternityProxy cfg  = GetConfig();
        PackageProxy     pack = GetPackage();

        Produce produce = cfg.GetProduceByKey(tid);

        Transform materialList      = FindComponent <Transform>(materialNode, "Resources");
        TMP_Text  materialTimeField = FindComponent <TMP_Text>(materialNode, "Label_Time");

        materialTimeField.text = TableUtil.GetLanguageString("production_text_1024") + TimeUtil.GetTimeStr(produce.Time);

        int index         = 0;
        int currencyIndex = 0;
        List <EffectElement?> sortedElements = new List <EffectElement?>();

        if (produce.Cost > 0)
        {
            EffectElement?[] elements = cfg.GetEffectElementsByKey((uint)produce.Cost);
            if (elements.Length > 0)
            {
                for (int i = 0; i < elements.Length; i++)
                {
                    EffectElement?element = elements[i];
                    Item          item    = cfg.GetItemByKey((uint)element.Value.ItemId);

                    if (ItemTypeUtil.GetItemType(item.Type).MainType == Category.Currency)
                    {
                        sortedElements.Insert(currencyIndex, element);
                        currencyIndex++;
                    }
                    else
                    {
                        sortedElements.Add(element);
                    }
                }
            }

            for (; index < sortedElements.Count; index++)
            {
                EffectElement?element = sortedElements[index];
                Item          item    = cfg.GetItemByKey((uint)element.Value.ItemId);

                Transform node    = index < materialList.childCount ? materialList.GetChild(index) : UnityEngine.Object.Instantiate(materialList.GetChild(0), materialList);
                Image     icon    = FindComponent <Image>(node, "Icon/Icon");
                Image     quality = FindComponent <Image>(node, "Icon/Quality");
                TMP_Text  name    = FindComponent <TMP_Text>(node, "Label_Name");
                TMP_Text  count   = FindComponent <TMP_Text>(node, "Label_Num");

                node.gameObject.SetActive(true);
                UIUtil.SetIconImageSquare(icon, item.Icon);

                long haveCount = pack.GetItemCountByTID((uint)element.Value.ItemId);
                long needCount = (long)element.Value.Value;

                quality.color = ColorUtil.GetColorByItemQuality(item.Quality);
                name.text     = TableUtil.GetItemName(element.Value.ItemId);
                if (haveCount < needCount)
                {
                    count.text = string.Format("<color=#ff0000>{0}</color>/{1}", haveCount, needCount);
                }
                else
                {
                    count.text = string.Format("<color=#00ff00>{0}</color>/{1}", haveCount, needCount);
                }
            }
        }
        for (; index < materialList.childCount; index++)
        {
            materialList.GetChild(index).gameObject.SetActive(false);
        }
    }
    private void ShowModMessageTips(WarshipModPanelElement cell)
    {
        m_ModTips.transform.localPosition = cell.transform.localPosition;
        m_ModTips.gameObject.SetActive(true);

        TransformUtil.FindUIObject <Transform>(m_ModTips.transform, "Content").gameObject.SetActive(cell.HasData());
        TransformUtil.FindUIObject <Transform>(m_ModTips.transform, "Empty").gameObject.SetActive(!cell.HasData());

        if (cell.HasData())
        {
            UIUtil.SetIconImage(
                TransformUtil.FindUIObject <Image>(m_ModTips.transform, "Content/Image_Icon"),
                TableUtil.GetItemIconBundle(cell.GetModTid()),
                TableUtil.GetItemIconImage(cell.GetModTid()),
                autoSetNativeSize: true);

            TransformUtil.FindUIObject <Image>(m_ModTips.transform, "Content/Image_Quality").color = ColorUtil.GetColorByItemQuality(m_CfgEternityProxy.GetItemByKey(cell.GetModTid()).Quality);

            //数字不足3位,补0 ,并将补充的颜色置灰
            int    lv        = cell.GetLv();
            int    index     = 0;
            char[] charArray = lv.ToString().PadLeft(3, '0').ToCharArray();
            for (int i = 0; i < charArray.Length; i++)
            {
                char cc = charArray[i];
                if (cc != '0')
                {
                    index = i;
                    break;
                }
            }
            string sstr = lv.ToString().PadLeft(3, '0');
            if (index != 0)
            {
                sstr = sstr.Insert(index, "</color>");
                sstr = sstr.Insert(0, "<color=#808080>");
            }
            TransformUtil.FindUIObject <TMP_Text>(m_ModTips.transform, "Content/Label_Lv").text = sstr;

            TransformUtil.FindUIObject <TMP_Text>(m_ModTips.transform, "Content/Label_Name").text = TableUtil.GetItemName(cell.GetModTid());
        }
    }
Beispiel #23
0
    /// <summary>
    /// 渲染单元格
    /// </summary>
    /// <param name="groupIndex">组索引</param>
    /// <param name="cellIndex">列表索引</param>
    /// <param name="cellData">数据</param>
    /// <param name="cellView">视图</param>
    /// <param name="selected">是否选中</param>
    protected override void OnCellRenderer(int groupIndex, int cellIndex, object cellData, RectTransform cellView, bool selected)
    {
        ItemBase itemVO = cellData as ItemBase;

        Animator  animator     = cellView.GetComponent <Animator>();
        Image     icon1        = FindComponent <Image>(cellView, "Content/Image_Icon");
        Image     icon2        = FindComponent <Image>(cellView, "Content/Image_Icon2");
        TMP_Text  nameField    = FindComponent <TMP_Text>(cellView, "Content/Mask/Label_Name");
        TMP_Text  countField   = FindComponent <TMP_Text>(cellView, "Content/Label_Num");
        Image     qualityImage = FindComponent <Image>(cellView, "Content/Image_Quality");
        TMP_Text  typeField    = FindComponent <TMP_Text>(cellView, "Content/Mask/Label_WeaponLabel");
        Transform modContainer = FindComponent <Transform>(cellView, "Content/MOD");
        Transform useFlag      = FindComponent <Transform>(cellView, "Content/Image_Used");
        TMP_Text  levelLabel   = FindComponent <TMP_Text>(cellView, "Content/Label_Lv");
        TMP_Text  levelField   = FindComponent <TMP_Text>(cellView, "Content/Label_Lv2");

        //动画
        animator.SetBool("IsOn", selected);
        //名称
        nameField.text = TableUtil.GetItemName((int)itemVO.TID);
        //品质
        qualityImage.color = ColorUtil.GetColorByItemQuality(itemVO.ItemConfig.Quality);
        //数量
        countField.text = itemVO.Count.ToString();
        //图标
        if (State.GetPageLayoutStyle(State.GetPageIndex()) == UIViewListLayout.Row)
        {
            UIUtil.SetIconImage(icon1, itemVO.ItemConfig.Icon);
            UIUtil.SetIconImage(icon2, itemVO.ItemConfig.Icon);
        }
        else
        {
            UIUtil.SetIconImageSquare(icon1, itemVO.ItemConfig.Icon);
            UIUtil.SetIconImageSquare(icon2, itemVO.ItemConfig.Icon);
        }
        //使用标记
        useFlag.gameObject.SetActive(itemVO.Replicas != null && itemVO.Replicas.Count > 0);
        //等级
        levelLabel.gameObject.SetActive(itemVO.MainType == Category.Weapon || itemVO.MainType == Category.Reformer || itemVO.MainType == Category.Equipment || itemVO.MainType == Category.EquipmentMod);
        levelField.text = levelLabel.gameObject.activeSelf ? FormatLevel(itemVO.Lv) : string.Empty;
        //类型
        switch (itemVO.MainType)
        {
        case Category.Weapon:
            typeField.text = TableUtil.GetLanguageString((cellData as ItemWeaponVO).WeaponType2);
            break;

        case Category.Reformer:
            typeField.text = TableUtil.GetLanguageString(itemVO.MainType);
            break;

        case Category.Equipment:
            typeField.text = TableUtil.GetLanguageString((cellData as ItemEquipmentVO).EquipmentType);
            break;

        case Category.EquipmentMod:
            typeField.text = TableUtil.GetLanguageString((cellData as ItemModVO).ModType1);
            break;

        default:
            typeField.text = TableUtil.GetLanguageString(itemVO.MainType);
            break;
        }
        //模组数量
        UpdateModList(modContainer, itemVO.MainType == Category.Weapon ? GetWeaponModCount(cellData as ItemWeaponVO) : 0);
    }
Beispiel #24
0
    /// <summary>
    /// 普通单元格渲染时
    /// </summary>
    /// <param name="groupIndex"></param>
    /// <param name="cellIndex"></param>
    /// <param name="cellData"></param>
    /// <param name="cellView"></param>
    /// <param name="selected"></param>
    protected override void OnCellRenderer(int groupIndex, int cellIndex, object cellData, RectTransform cellView, bool selected)
    {
        Animator animator        = cellView.GetComponent <Animator>();
        Image    quality         = cellView.Find("Content/Image_Quality").GetComponent <Image>();
        Image    icon1           = cellView.Find("Content/Image_Icon").GetComponent <Image>();
        Image    icon2           = cellView.Find("Content/Image_Icon2").GetComponent <Image>();
        TMP_Text nameLabel       = cellView.Find("Content/Mask/Label_Name").GetComponent <TMP_Text>();
        TMP_Text typeLabel       = cellView.Find("Content/Mask/Label_WeaponLabel").GetComponent <TMP_Text>();
        Image    currentUsedIcon = cellView.Find("Content/Image_Icon_E").GetComponent <Image>();
        Image    otherUsedIcon   = cellView.Find("Content/Image_Icon_E1").GetComponent <Image>();
        TMP_Text lv = cellView.Find("Content/Level/Label_Lv2").GetComponent <TMP_Text>();

        ItemBase item = cellData as ItemBase;

        quality.color = ColorUtil.GetColorByItemQuality(item.ItemConfig.Quality);

        UIViewListLayout style = Parent.State.GetPageLayoutStyle(State.GetPageIndex());

        if (style == UIViewListLayout.Grid)
        {
            UIUtil.SetIconImageSquare(icon1, item.ItemConfig.Icon);
            UIUtil.SetIconImageSquare(icon2, item.ItemConfig.Icon);
        }
        else
        {
            UIUtil.SetIconImage(icon1, item.ItemConfig.Icon);
            UIUtil.SetIconImage(icon2, item.ItemConfig.Icon);
        }
        sb.Clear();
        nameLabel.text = TableUtil.GetItemName(item.TID);
        int zeroCount = 3 - item.Lv.ToString().Length;

        if (zeroCount > 0)
        {
            sb.Append("<color=#808080>");
            do
            {
                sb.Append(0);
            } while (--zeroCount > 0);
            sb.Append("</color>");
        }
        sb.Append(item.Lv);
        lv.text = sb.ToString();

        switch (item)
        {
        case ItemWeaponVO val:
            typeLabel.text = TableUtil.GetLanguageString(val.WeaponType2);
            break;

        case ItemReformerVO val:
            typeLabel.text = TableUtil.GetLanguageString(val.MainType);
            break;

        case ItemEquipmentVO val:
            typeLabel.text = TableUtil.GetLanguageString(val.EquipmentType);
            break;

        case ItemModVO val:
            typeLabel.text = TableUtil.GetLanguageString(val.ModType1) + " " + TableUtil.GetLanguageString(val.ModType2);
            break;
        }

        currentUsedIcon.gameObject.SetActive(m_CurrentItemData?.GetReference() == item.UID);
        otherUsedIcon.gameObject.SetActive(false);
        if (!currentUsedIcon.gameObject.activeSelf)
        {
            if (item.Replicas.Count > 0)
            {
                for (int i = 0; i < item.Replicas.Count; i++)
                {
                    if (Parent.Data.CurrentShip.GetItem(item.Replicas[i]) != null)
                    {
                        otherUsedIcon.gameObject.SetActive(true);
                        break;
                    }
                }
            }
        }

        animator?.SetBool("IsOn", selected);
        if (selected)
        {
            OnItemSelected(item);
            m_CurrentSelectedItemData = item;
        }
    }
Beispiel #25
0
    /// <summary>
    ///  设置商品数据
    /// </summary>
    /// <param name="shopWindowVO"></param>
    /// <param name="isSelect"></param>
    /// <param name="isList"></param>
    public void SetData(ShopWindowVO shopWindowVO, bool isSelect, bool isList = false)
    {
        Init();
        Item m_Item = shopWindowVO.ShopItemConfig.Value.ItemGood.Value;

        m_ShopItemData  = shopWindowVO.ShopItemConfig.Value;
        m_Quality.color = ColorUtil.GetColorByItemQuality(m_Item.Quality);
        if (isList)
        {
            UIUtil.SetIconImage(m_Icon, TableUtil.GetItemIconBundle(m_Item.Id), TableUtil.GetItemIconImage(m_Item.Id));
            UIUtil.SetIconImage(m_Icon2, TableUtil.GetItemIconBundle(m_Item.Id), TableUtil.GetItemIconImage(m_Item.Id));
        }
        else
        {
            UIUtil.SetIconImage(m_Icon, TableUtil.GetItemIconBundle(m_Item.Id), TableUtil.GetItemSquareIconImage(m_Item.Id));
            UIUtil.SetIconImage(m_Icon2, TableUtil.GetItemIconBundle(m_Item.Id), TableUtil.GetItemSquareIconImage(m_Item.Id));
        }
        m_Name.text   = TableUtil.GetItemName(m_Item.Id);
        m_Level.text  = TableUtil.ShowLevel(1);
        m_Bounds.text = m_ShopItemData.Bounds.ToString();
        if (shopWindowVO.LimitCount == -1)
        {
            m_Available.gameObject.SetActive(false);
        }
        else
        {
            m_Available.gameObject.SetActive(true);
            m_Available.text = string.Format(TableUtil.GetLanguageString("shop_text_1012"), shopWindowVO.LimitCount);
        }
        if (shopWindowVO.LimitCount < m_ShopItemData.Bounds)
        {
            m_Available.color = Color.red;
        }
        else
        {
            m_Available.color = isSelect ? new Color(41f / 255f, 41f / 255f, 41f / 255f, 1) : Color.white;
        }

        UIUtil.SetIconImage(m_MoneyIcon, TableUtil.GetItemIconBundle((KNumMoneyType)m_ShopItemData.MoneyType), TableUtil.GetItemIconImage((KNumMoneyType)m_ShopItemData.MoneyType));
        if (m_ShopItemData.DisCount == 1)
        {
            m_Discount.gameObject.SetActive(false);
            m_GoodPrice = m_ShopItemData.BuyCost;
        }
        else
        {
            m_Discount.gameObject.SetActive(true);
            m_Discount.text = m_ShopItemData.BuyCost.ToString();
            m_GoodPrice     = Mathf.CeilToInt(m_ShopItemData.BuyCost * m_ShopItemData.DisCount);
        }
        m_Price.text = m_GoodPrice.ToString();

        if (MoneyeEnough())
        {
            m_Price.color = new Color(30f / 255f, 170f / 255f, 33f / 255f, 1);
        }
        else
        {
            m_Price.color = Color.red;
        }
        if (shopWindowVO.ServerLeftNum == -1)
        {
            m_Stock.text = TableUtil.GetLanguageString("shop_text_1010");
        }
        else if (shopWindowVO.ServerLeftNum == 0)
        {
            m_Stock.text = TableUtil.GetLanguageString("shop_text_1013");
        }
        else
        {
            m_Stock.text = string.Format(TableUtil.GetLanguageString("shop_text_1011"), shopWindowVO.ServerLeftNum);
        }
        m_Stock.color = isSelect ? new Color(41f / 255f, 41f / 255f, 41f / 255f, 1) : Color.white;
        m_Black.gameObject.SetActive(shopWindowVO.IsOpen == 0);
    }