コード例 #1
0
    public void DisPlay(FormationSelectController controller, int pos, RowHeroDate heroInfo)
    {
        string armorType;

        if (heroInfo == null)
        {
            //armorType = pos == 0 ? "重型" : "轻型";
            if (pos == 0)
            {
                armorType = "重型";
            }
            else if (pos == 1)
            {
                armorType = "轻型";
            }
            else
            {
                armorType = "";
            }
        }
        else
        {
            armorType = heroInfo.ArmorType;
        }
        this.controller = controller;
        for (int i = -1; i < RowDate.Count; i++)
        {
            GameObject go;
            if (i == -1)
            {
                if (heroInfo != null)
                {
                    go = Instantiate <GameObject>(Resources.Load <GameObject>("Prefab/LevelTeam"), View.transform);
                }
                else
                {
                    continue;
                }
            }
            else
            {
                if (armorType != "" && RowDate[i].ArmorType != armorType)
                {
                    continue;
                }
                go = Instantiate <GameObject>(Resources.Load <GameObject>("Prefab/FormationSelect_HeroInfo"), View.transform);
                go.GetComponent <FormationSelectHeroView>().DisPlay(RowDate[i], controller);
            }
            (go.transform as RectTransform).localScale    = Vector3.one;
            (go.transform as RectTransform).localPosition = Vector3.zero;
        }
    }
コード例 #2
0
 void Start()
 {
     controller = GameObject.Find("Canvas/FormationSelect").GetComponent <FormationSelectController>();
 }
コード例 #3
0
    public void DisPlay(RowHeroDate date, FormationSelectController controller)
    {
        this.controller = controller;
        heroInfo        = date;

        Level.text = date.Level.ToString();
        Name.text  = date.Name.ToString();

        string[]    iconData  = date.Icon.Split('#');
        SpriteAtlas iconAtlas = Resources.Load <SpriteAtlas>("Img/SpriteAtlas/" + iconData[0]);

        AvatarIcon.sprite = iconAtlas.GetSprite(iconData[1]);

        SpriteAtlas FrameAtlas = Resources.Load <SpriteAtlas>("Img/SpriteAtlas/FrameAtlas");

        switch (date.Type)
        {
        case "航母":
            TypeIcon.sprite = FrameAtlas.GetSprite("hangmu");
            break;

        case "重巡":
            TypeIcon.sprite = FrameAtlas.GetSprite("zhongxun");
            break;

        case "轻巡":
            TypeIcon.sprite = FrameAtlas.GetSprite("qingxun");
            break;

        case "战列舰":
            TypeIcon.sprite = FrameAtlas.GetSprite("zhanlie");
            break;

        case "驱逐":
            TypeIcon.sprite = FrameAtlas.GetSprite("quzhu");
            break;
        }

        SpriteAtlas BgIconAtlas = Resources.Load <SpriteAtlas>("Img/SpriteAtlas/Detail_CardBgAtlas");

        switch (date.ColorType)
        {
        case "mix":
            Frame.sprite  = FrameAtlas.GetSprite("Mix_Frame");
            BgIcon.sprite = BgIconAtlas.GetSprite("Mix_Bg");
            break;

        case "gold":
            Frame.sprite  = FrameAtlas.GetSprite("Gold_Frame");
            BgIcon.sprite = BgIconAtlas.GetSprite("Gold_Bg");
            break;

        case "purple":
            Frame.sprite  = FrameAtlas.GetSprite("Purple_Frame");
            BgIcon.sprite = BgIconAtlas.GetSprite("Purple_Bg");
            break;

        case "blue":
            Frame.sprite  = FrameAtlas.GetSprite("Blue_Frame");
            BgIcon.sprite = BgIconAtlas.GetSprite("Blue_Bg");
            break;

        case "white":
            Frame.sprite  = FrameAtlas.GetSprite("Gray_Frame");
            BgIcon.sprite = BgIconAtlas.GetSprite("Gray_Bg");
            break;
        }


        for (int i = 0; i < date.Stars; i++)
        {
            Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/StarIcon")).transform.SetParent(Stars.transform);
        }
    }