コード例 #1
0
    public void SetShowInfo()
    {
        Transform chouka = transform.parent.Find("chouka");

        if (chouka != null)
        {
            chouka.gameObject.SetActive(false);
        }

        if (_drawCardResultVo.Resource == ResourcePB.Signature)
        {
            _signatureImg = transform.GetRawImage("ImageCard/RawImage/Signature");
            _signatureImg.gameObject.SetActive(true);
        }

        Texture texture = null;
        string  markRes = "";

        if (_drawCardResultVo.Resource == ResourcePB.Fans)
        {
            _credit.gameObject.SetActive(false);
            _cardShadowImg.gameObject.SetActive(false);
            markRes = "UIAtlas_DrawCard2_Star";

            texture = ResourceManager.Load <Texture>(CardUtil.GetBigFunsCardPath(_drawCardResultVo.CardId), ModuleConfig.MODULE_DRAWCARD);
            ShowLapiao(false);
        }
        else if (_drawCardResultVo.Resource == ResourcePB.Card ||
                 _drawCardResultVo.Resource == ResourcePB.Puzzle ||
                 _drawCardResultVo.Resource == ResourcePB.Signature)
        {
            _credit.gameObject.SetActive(true);
            _cardShadowImg.gameObject.SetActive(true);
            markRes = _drawCardResultVo.Resource == ResourcePB.Card ? "UIAtlas_DrawCard2_Star" : "UIAtlas_DrawCard2_Puzzle";
            texture = ResourceManager.Load <Texture>(CardUtil.GetBigCardPath(_drawCardResultVo.CardId), ModuleConfig.MODULE_DRAWCARD);

            _credit.sprite = AssetManager.Instance.GetSpriteAtlas("UIAtlas_DrawCard2_07-" + _drawCardResultVo.Credit.ToString());
            _credit.SetNativeSize();
            if (_signatureImg != null)
            {
                _signatureImg.texture = ResourceManager.Load <Texture>(CardUtil.GetCardSignaturePath(_drawCardResultVo.CardId), ModuleConfig.MODULE_DRAWCARD);
                _signatureImg.GetComponent <RectTransform>().sizeDelta = new Vector2(_signatureImg.texture.width, _signatureImg.texture.height);
            }

            if (isCanShowLapiao && (_drawCardResultVo.Resource == ResourcePB.Card || _drawCardResultVo.Resource == ResourcePB.Signature))
            {
                ShowLapiao(true);
            }
        }
        else
        {
            return;
        }

        transform.Find("suipian").GetComponent <Image>().sprite           = AssetManager.Instance.GetSpriteAtlas(markRes);
        transform.Find("suipian/Image (1)").GetComponent <Image>().sprite = AssetManager.Instance.GetSpriteAtlas(markRes);
        _cardFrontImg.gameObject.SetActive(_drawCardResultVo.Resource == ResourcePB.Puzzle ? true : false);

        _name.text = _drawCardResultVo.Resource == ResourcePB.Puzzle ?$"{_drawCardResultVo.Name}({I18NManager.Get("Card_PuzzleTap")})":_drawCardResultVo.Name;
        if (texture == null)
        {
            Debug.LogError("SetShowInfo sprite is null");
            _cardImg.texture = ResourceManager.Load <Texture>("Card/Image/1000", ModuleConfig.MODULE_DRAWCARD);
            _cardImg.gameObject.SetActive(true);
            return;
        }

        _cardImg.texture = texture;
        if (_drawCardResultVo.Resource == ResourcePB.Fans)
        {
            transform.Find("ImageCard").GetComponent <Canvas>().sortingOrder = 786;
            _cardImg.transform.GetComponent <RectTransform>().SetSize(new Vector2(1080, 1920));
        }
        else
        {
            transform.Find("ImageCard").GetComponent <Canvas>().sortingOrder = 789;
            _cardImg.transform.GetComponent <RectTransform>().SetSize(new Vector2(1440, 1920));
        }
        _cardImg.gameObject.SetActive(true);
        //暂时放这里
        //  AudioManager.Instance.PlayEffect("draw_ssr", 1);
    }
コード例 #2
0
    /// <summary>
    /// animation event  在result animation中调用
    /// </summary>
    public void SetShowInfo()
    {
        Debug.Log("SetShowInfo");
        if (_drawCardResultVo == null)
        {
            Debug.LogError("_drawCardResultVo is null");
            return;
        }

        if (_drawCardResultVo.Resource == ResourcePB.Signature)
        {
            _signatureImg = transform.GetRawImage("01/role1/Signature");
            _signatureImg.gameObject.SetActive(true);
        }

        Texture texture = null;

        if (_drawCardResultVo.Resource == ResourcePB.Fans)
        {
            texture = ResourceManager.Load <Texture>(CardUtil.GetBigFunsCardPath(_drawCardResultVo.CardId), ModuleConfig.MODULE_DRAWCARD);
            _ssr.gameObject.Hide();
            ShowLapiao(false);
        }
        else if (_drawCardResultVo.Resource == ResourcePB.Card ||
                 _drawCardResultVo.Resource == ResourcePB.Puzzle ||
                 _drawCardResultVo.Resource == ResourcePB.Signature)
        {
            texture = ResourceManager.Load <Texture>(CardUtil.GetBigCardPath(_drawCardResultVo.CardId), ModuleConfig.MODULE_DRAWCARD);


            _ssr.gameObject.Show();
            _ssr.sprite = AssetManager.Instance.GetSpriteAtlas("UIAtlas_DrawCard_" + _drawCardResultVo.Credit.ToString());
            _ssr.SetNativeSize();
            _ssr_light.sprite = AssetManager.Instance.GetSpriteAtlas("UIAtlas_DrawCard_" + _drawCardResultVo.Credit.ToString());
            _ssr_light.SetNativeSize();

            if (_signatureImg != null)
            {
                _signatureImg.texture = ResourceManager.Load <Texture>(CardUtil.GetCardSignaturePath(_drawCardResultVo.CardId), ModuleConfig.MODULE_DRAWCARD);
                _signatureImg.GetComponent <RectTransform>().sizeDelta = new Vector2(_signatureImg.texture.width, _signatureImg.texture.height);
            }
            if (isCanShowLapiao && (_drawCardResultVo.Resource == ResourcePB.Card || _drawCardResultVo.Resource == ResourcePB.Signature))
            {
                ShowLapiao(true);
            }
            else
            {
                ShowLapiao(false);
            }
        }

        _frontPuzzleObj.SetActive(_drawCardResultVo.Resource == ResourcePB.Puzzle);
        _cardName.text    = _drawCardResultVo.Resource == ResourcePB.Puzzle ? $"{_drawCardResultVo.Name}({I18NManager.Get("Card_PuzzleTap")})" : _drawCardResultVo.Name;
        _showCard.texture = texture;



        if (_drawCardResultVo.Resource == ResourcePB.Fans)
        {
            _showCard.transform.GetComponent <RectTransform>().SetSize(new Vector2(1080, 1920));
            //  _showCard.GetComponent<BackgroundSizeFitter>().Reset();
            //  _showCard.GetComponent<BackgroundSizeFitter>().DoFit();
        }
        else
        {
            _showCard.transform.GetComponent <RectTransform>().SetSize(new Vector2(1440, 1920));
            // _showCard.GetComponent<BackgroundSizeFitter>().Reset();
            // _showCard.GetComponent<BackgroundSizeFitter>().DoFit();
        }
    }