Beispiel #1
0
 private void ClearShowList()
 {
     foreach (var obj in showGunList)
     {
         GunCard.CacheInstance(obj);
     }
     showGunList.Clear();
 }
Beispiel #2
0
 private void ClearShowList()
 {
     foreach (var obj in gunChipList)
     {
         GunCard.CacheInstance(obj);
     }
     gunChipList.Clear();
 }
Beispiel #3
0
        private void ShowGunCard()
        {
            ClearShowList();

            foreach (var item in cardDataList)
            {
                if (PlayerDataMgr.singleton.GetUseWeaponID() == item.cardID)
                {
                    continue;
                }

                if (opt == GunListOpt.ReplaceFuseGun || opt == GunListOpt.AddFuseGun)
                {
                    if (PlayerDataMgr.singleton.DB.fusedCardList.Contains(item.cardID))
                    {
                        continue;
                    }
                }

                var res = TableMgr.singleton.GunCardTable.GetItemByID(item.cardID);
                if (res == null)
                {
                    continue;
                }

                var itemUI = GunCard.GetInstance();
                itemUI.Init(res);
                itemUI.transform.SetParent(WeaponContent.gameObject.transform);
                itemUI.OnCardClick += OnCardClick;
                itemUI.transform.SetAsLastSibling();
                showGunList.Add(itemUI);
            }

            if (showGunList.Count <= 0)
            {
                GotoBtn.gameObject.SetActive(true);
            }
            else
            {
                GotoBtn.gameObject.SetActive(false);
            }

            if (opt == GunListOpt.ReplaceUseGun || opt == GunListOpt.ReplaceFuseGun)
            {
                var itemUI = GunCard.GunCard;
                itemUI.Init(optCardRes);
                //itemUI.transform.SetParent(WeaponContent.gameObject.transform);
                //itemUI.OnCardClick += OnCardClick;
                //showGunList.Add(itemUI);
                GunCard.gameObject.SetActive(true);
                EmptyTxt.gameObject.SetActive(false);
                CurImage.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(TableMgr.singleton.ValueTable.GetCardQualityEquipFrame(optCardRes.rarity));
                CurImage.gameObject.SetActive(true);
            }
            else
            {
                GunCard.gameObject.SetActive(false);
                EmptyTxt.gameObject.SetActive(true);
                CurImage.gameObject.SetActive(false);
            }
        }
Beispiel #4
0
        private void ShowCardInfo()
        {
            ClearShowList();
            //chipDic.Clear();

            //NameTxt.text.text = LanguageMgr.GetText(gunCardRes.tid_name);
            gunChipList.Clear();
            StarUpBtn.button.interactable = false;

            var cardData = PlayerDataMgr.singleton.GetGunCardData(gunCardRes.id);

            if (cardData == null)
            {
                return;
            }

            var curStarRes = TableMgr.singleton.CardStarTable.GetItemByID(cardData.star);

            if (curStarRes == null)
            {
                return;
            }

            upStarRes = TableMgr.singleton.CardStarTable.GetItemByID(cardData.star + 1);
            if (upStarRes == null)
            {
                return;
            }

            for (int i = 0; i < upStarRes.slotCount; ++i)
            {
                List <CardChipData> chipList;
                if (!chipDic.TryGetValue(i, out chipList))
                {
                    chipList   = new List <CardChipData>();
                    chipDic[i] = chipList;
                }

                var itemUI = GunCard.GetInstance();
                itemUI.Init(i, gunCardRes.gunType, upStarRes.needCardRarityList[i]);
                itemUI.transform.SetParent(ChipRoot.gameObject.transform);
                itemUI.OnCardClick = null;
                itemUI.gameObject.SetActive(true);

                gunChipList.Add(itemUI);

                var count = 0;
                if ((StarUpChipType)upStarRes.needCardTypeList[i] == StarUpChipType.SameName)
                {
                    if (cardData.count < upStarRes.needCardCountList[i])
                    {
                        count = cardData.count;
                    }
                    else
                    {
                        count = upStarRes.needCardCountList[i];
                        StarUpBtn.button.interactable = true;
                    }
                    itemUI.IconBtn.image.sprite = Resources.Load(gunCardRes.icon, typeof(Sprite)) as Sprite;
                    //itemUI.IconBtn.image.enabled = true;

                    var data = new CardChipData();
                    data.cardID = cardData.cardID;
                    data.count  = count;
                    chipList.Add(data);
                }
                else
                {
                    //for (int j = 0;j < chipList.Count;++j)
                    //{
                    //    count += chipList[j].count;
                    //}
                    //itemUI.IconBtn.image.enabled = false;

                    itemUI.OnCardClick = OpenChipRoot;
                }

                itemUI.Frame.image.sprite = Resources.Load(TableMgr.singleton.ValueTable.GetCardQualityFrame(upStarRes.needCardRarityList[i]),
                                                           typeof(Sprite)) as Sprite;

                itemUI.ChipCount.text.text = string.Format("{0}/{1}", count, upStarRes.needCardCountList[i]);
            }


            for (int i = 0; i < curStarList.Count; ++i)
            {
                if (i < curStarRes.star)
                {
                    curStarList[i].SetActive(true);
                }
                else
                {
                    curStarList[i].SetActive(false);
                }
            }

            for (int i = 0; i < upStarList.Count; ++i)
            {
                if (i < upStarRes.star)
                {
                    upStarList[i].SetActive(true);
                }
                else
                {
                    upStarList[i].SetActive(false);
                }
            }

            CurAtk.text.text  = cardData.GetAtk().ToString("f0");
            NextAtk.text.text = cardData.GetAtk(cardData.level, cardData.star + 1).ToString("f0");
            CurDPS.text.text  = (cardData.DPS() / TableMgr.singleton.ValueTable.combat_capability).ToString("f0");
            NextDPS.text.text = (cardData.DPS(cardData.level, cardData.star + 1) /
                                 TableMgr.singleton.ValueTable.combat_capability).ToString("f0");
            CurLevel.text.text  = curStarRes.maxLevel.ToString();
            NextLevel.text.text = upStarRes.maxLevel.ToString();
            //CurAtkSpeed.text.text = cardData.GetAtkSpeed().ToString();
            //NextAtkSpeed.text.text = cardData.GetAtkSpeed().ToString();

            var fuseSkillRes = TableMgr.singleton.FuseGunSkillTable.GetItemByID(cardData.fuseSkillID);

            if (fuseSkillRes == null)
            {
                return;
            }

            SkillName.text.text  = LanguageMgr.GetText(fuseSkillRes.tid_name);
            SkillLevel.text.text = string.Format("Lv.{0}", fuseSkillRes.level);
        }
Beispiel #5
0
        private void ShowGunCard()
        {
            ClearShowList();
            SortCards();

            foreach (var point in fuesRedPointList)
            {
                point.gameObject.SetActive(true);
            }


            curMainWeaponRes = TableMgr.singleton.GunCardTable.GetItemByID(PlayerDataMgr.singleton.GetUseWeaponID());
            if (curMainWeaponRes != null)
            {
                var itemUI = GunCard.GetInstance();
                itemUI.Init(curMainWeaponRes);
                itemUI.transform.SetParent(MainGunBtn.gameObject.transform);
                itemUI.transform.localPosition = Vector3.zero;
                itemUI.transform.localScale    = Vector3.one;
                itemUI.gameObject.SetActive(true);
                showGunList.Add(itemUI);
            }

            var cardData = PlayerDataMgr.singleton.GetGunCardData(curMainWeaponRes.id);

            if (cardData != null)
            {
                var skillUI = GunSkill.GetInstance();
                skillUI.InitFuseSkill(cardData.fuseSkillID);
                skillUI.transform.SetParent(MainGunSkillBtn.gameObject.transform);
                skillUI.transform.localPosition = Vector3.zero;
                skillUI.gameObject.SetActive(true);
                showSkillList.Add(skillUI);

                FirePower.text.text = (PlayerDataMgr.singleton.GetUseWeaponPower() /
                                       TableMgr.singleton.ValueTable.combat_capability).ToString("f0");
            }

            for (int i = 0; i < PlayerDataMgr.singleton.DB.fusedCardList.Count; i++)
            {
                var cardRes = TableMgr.singleton.GunCardTable.GetItemByID(PlayerDataMgr.singleton.DB.fusedCardList[i]);
                if (cardRes == null)
                {
                    continue;
                }

                var itemUI = GunCard.GetInstance();
                itemUI.Init(cardRes);
                itemUI.transform.SetParent(fuesRootList[i].transform);
                itemUI.transform.localPosition = Vector3.zero;
                itemUI.gameObject.SetActive(true);
                showGunList.Add(itemUI);
                fuesRedPointList[i].gameObject.SetActive(false);

                cardData = PlayerDataMgr.singleton.GetGunCardData(cardRes.id);
                if (cardData == null)
                {
                    continue;
                }

                var skillUI = GunSkill.GetInstance();
                skillUI.InitFuseSkill(cardData.fuseSkillID);
                skillUI.transform.SetParent(skillRootList[i].transform);
                skillUI.transform.localPosition = Vector3.zero;
                skillUI.gameObject.SetActive(true);
                showSkillList.Add(skillUI);
            }

            foreach (var item in cardResList)
            {
                if (PlayerDataMgr.singleton.DB.fusedCardList.Contains(item.id) || item.id == curMainWeaponRes.id)
                {
                    //obj = ResourceMgr.singleton.AddGameInstanceAsSubObject("UI/HeroCard", chooseRoot);
                    continue;
                }
                else
                {
                    if (PlayerDataMgr.singleton.GetGunCardData(item.id) == null)
                    {
                        var itemUI = GunCard.GetInstance();
                        itemUI.Init(item);
                        itemUI.transform.SetParent(LockCards.gameObject.transform);
                        itemUI.transform.localPosition = Vector3.zero;
                        itemUI.gameObject.SetActive(true);
                        showGunList.Add(itemUI);
                    }
                    else
                    {
                        var itemUI = GunCard.GetInstance();
                        itemUI.Init(item);
                        itemUI.transform.SetParent(HeroCards.gameObject.transform);
                        itemUI.transform.localPosition = Vector3.zero;
                        itemUI.gameObject.SetActive(true);
                        showGunList.Add(itemUI);
                    }
                }
            }

            GunCount.text.text = string.Format("{0}/{1}", PlayerDataMgr.singleton.GetCollectCardCount(),
                                               TableMgr.singleton.GunCardTable.ItemCount);

            GunCard.gameObject.SetActive(false);

            foreach (var child in ScrollView.gameObject.GetComponentsInChildren <ContentSizeFitter>(true))
            {
                LayoutRebuilder.ForceRebuildLayoutImmediate(child.GetComponent <RectTransform>());
            }

            InitRole();
        }