Exemplo n.º 1
0
    public void Open(MasterData.CharacterData data)
    {
        gameObject.SetActive(true);

        nameText.text  = data.Name;
        rareText.text  = "★" + data.Rare.ToString();
        hpText.text    = data.HP.ToString();
        powerText.text = data.Power.ToString();

        stilImage.sprite = IconManager.GetIconSprite(data.Stiliconid);
    }
Exemplo n.º 2
0
    public void Open(MasterData.GachaItemData[] datas)
    {
        gameObject.SetActive(true);

        RectTransform baseRectTrans = gachaItemBase.transform as RectTransform;
        float         sizeY         = baseRectTrans.sizeDelta.y;

        // 降順
        Array.Sort(datas, (a, b) => b.Groupid - a.Groupid);

        int maxCount = datas.Length;

        for (int i = 0; i < maxCount; i++)
        {
            var itemData = datas[i];
            var instance = Instantiate(gachaItemBase);
            instance.SetActive(true);

            instance.transform.SetParent(contentsTrans);
            instance.transform.localPosition = gachaItemBase.transform.localPosition + (Vector3.down * sizeY * i);

            UIGachaItemData uiData = new UIGachaItemData();
            uiData.trans     = instance.transform as RectTransform;
            uiData.nameText  = uiData.trans.Find("Text_Name").GetComponent <Text>();
            uiData.rareText  = uiData.trans.Find("Text_Rare").GetComponent <Text>();
            uiData.rateText  = uiData.trans.Find("Text_Rate").GetComponent <Text>();
            uiData.iconImage = uiData.trans.Find("Image_Icon").GetComponent <Image>();

            var characterData  = GachaManager.GetCharacterData(itemData.Characterid);
            var rareWeightData = GachaManager.GetGachaRareWeightData(itemData.Topid, itemData.Groupid);
            uiData.nameText.text    = characterData.Name;
            uiData.rareText.text    = "★" + characterData.Rare;
            uiData.rateText.text    = "排出率:" + rareWeightData.Weight + "%";
            uiData.iconImage.sprite = IconManager.GetIconSprite(characterData.Iconid);

            uiGachaItemData.Add(uiData);
        }

        var size = contentsTrans.sizeDelta;

        size.y = maxCount * sizeY;
        contentsTrans.sizeDelta = size;

        gachaItemData = datas;
    }