コード例 #1
0
 public void SetButton(QuestRewardData data, int count, int costAP)
 {
     headText.text = data.quest_name;
     for (int i = 0; i < equipmentIcons.Count; i++)
     {
         if (data.rewardEquips.Count > i)
         {
             string equip_path = "equipments/icon_equipment_" + data.rewardEquips[i];
             Sprite sprite     = MainManager.LoadSourceSprite(equip_path);
             if (sprite == null)
             {
                 sprite = MainManager.LoadSourceSprite("equipments/icon_equipment_999999");
             }
             equipmentIcons[i].sprite = sprite;
             oddTexts[i].text         = data.odds[i] + "%";
         }
         else
         {
             equipmentIcons[i].sprite = MainManager.LoadSourceSprite("equipments/icon_equipment_999999");
             oddTexts[i].text         = "???";
         }
     }
     countText.text  = count + "";
     costAPText.text = costAP + "";
 }
コード例 #2
0
        /// <summary>
        /// 设置组件
        /// </summary>
        /// <param name="data">角色详情</param>
        public void SetButton(UnitData data)
        {
            int unitid = data.unitId;

            stars.SetStars(data.rarity);
            int    charid = data.rarity >= 3 ? unitid + 30 : unitid + 10;
            string path   = "";

            if (buttonType == ButtonType.typeA)
            {
                path = "pictures/unit_plate_" + charid;
            }
            else if (buttonType == ButtonType.typeB || buttonType == ButtonType.typeC)
            {
                path = "charicons/fav_push_notif_" + unitid;
            }
            Sprite sprite = MainManager.LoadSourceSprite(path);

            if (sprite != null)
            {
                characterImage.sprite = MainManager.LoadSourceSprite(path);
            }
            int backtype = 0;

            if (data.rank <= 1)
            {
                backtype = 0;
            }
            else if (data.rank <= 3)
            {
                backtype = 1;
            }
            else if (data.rank <= 6)
            {
                backtype = 2;
            }
            else if (data.rank <= 12)
            {
                backtype = 3;
            }
            else
            {
                backtype = 4;
            }
            backImage.sprite = backgrounds[backtype];
            if (buttonType == ButtonType.typeA)
            {
                levelText.text = "等级" + data.level;
            }
            else if (buttonType == ButtonType.typeB)
            {
                levelText_B.text = "lv:" + data.level;
                if (showPosition)
                {
                    PositionType k = MainManager.Instance.UnitRarityDic[unitid].unitPositionType;
                    characterPositionImage_B.sprite = positionSprites_B[(int)k];
                }
            }
        }
コード例 #3
0
        private void SetDetails()
        {
            un = MainManager.Instance.UnitRarityDic[unitId];
            equipmentID.Clear();
            for (int i = 0; i < 6; i++)
            {
                int equipmentid = un.GetRankEquipments(data.rank)[i];
                equipmentID.Add(equipmentid);
                string equip_path = "equipments/icon_equipment_" + equipmentid;
                if (data.equipLevel[i] == -1)
                {
                    equip_path = "equipments/icon_equipment_invalid_" + equipmentid;
                }
                Sprite im = MainManager.LoadSourceSprite(equip_path);
                if (im != null)
                {
                    equipmentImages[i].sprite = im;
                }
                else
                {
                    equipmentImages[i].sprite = MainManager.LoadSourceSprite("equipments/icon_equipment_999999");
                }
                int maxStar = 0;
                if (MainManager.Instance.EquipmentDic.ContainsKey(equipmentid))
                {
                    maxStar = MainManager.Instance.EquipmentDic[equipmentid].GetMaxLevel();
                }
                equipmentStars[i].SetStars(data.equipLevel[i], maxStar);
            }
            if (MainManager.Instance.UnitName_cn.ContainsKey(unitId))
            {
                nameText.text = MainManager.Instance.UnitName_cn[unitId];
            }
            else
            {
                nameText.text = un.unitName;
            }
            rankText.text = "RANK " + data.rank;
            BaseData b = un.GetUnitData(data);

            data_save = MainManager.Instance.unitDataDic_save[unitId];
            BaseData c = un.GetUnitData(data_save, true);

            SetDetailTexts(b, c);
        }
コード例 #4
0
        public void SetEquipmentIcon(int equipmentid, int num)
        {
            string equip_path = "equipments/icon_equipment_" + equipmentid;
            Sprite im         = MainManager.LoadSourceSprite(equip_path);

            if (im != null)
            {
                equipmentIcon.sprite = im;
            }
            else
            {
                equipmentIcon.sprite = MainManager.LoadSourceSprite("equipments/icon_equipment_999999");
            }

            if (num >= 2)
            {
                numText.text = "x" + num;
                numText.gameObject.SetActive(true);
            }
            else
            {
                numText.gameObject.SetActive(false);
            }
        }