Exemple #1
0
 // Token: 0x060005BE RID: 1470 RVA: 0x0007F700 File Offset: 0x0007D900
 public void pushIcon(EmojiUnit inIcon)
 {
     inIcon.EmojiTransform.gameObject.SetActive(false);
     if (inIcon.EmojiSpriteRenderer == null)
     {
         inIcon.EmojiImage.type              = Image.Type.Simple;
         inIcon.EmojiImage.material          = this.EmojiImageMaterial;
         inIcon.EmojiTransform.localPosition = Vector3.zero;
         inIcon.EmojiTransform.localScale    = Vector3.one;
         inIcon.EmojiTransform.SetParent(this.ImagePoolLayout, false);
         inIcon.EmojiImage.SetNativeSize();
         inIcon.EmojiImage = null;
     }
     else
     {
         inIcon.EmojiSpriteRenderer.material = this.EmojiSpriteRendererMaterial;
         inIcon.EmojiTransform.localPosition = Vector3.zero;
         inIcon.EmojiTransform.localScale    = Vector3.one;
         inIcon.EmojiTransform.SetParent(this.SpriteRendererPoolLayout, false);
         inIcon.EmojiSpriteRenderer = null;
     }
     inIcon.EmojiTransform = null;
     inIcon.SpriteMove     = null;
     if (inIcon.poolID != this.EmojiUnitPoolCount)
     {
         EmojiUnit emojiUnit = this.EmojiUnitPool[this.EmojiUnitPoolCount];
         this.EmojiUnitPool[this.EmojiUnitPoolCount] = inIcon;
         this.EmojiUnitPool[inIcon.poolID]           = emojiUnit;
         emojiUnit.poolID = inIcon.poolID;
         inIcon.poolID    = this.EmojiUnitPoolCount;
     }
     this.EmojiUnitPoolCount++;
 }
Exemple #2
0
        // Token: 0x0600151F RID: 5407 RVA: 0x0024131C File Offset: 0x0023F51C
        private float GetIconScale(EmojiUnit icon)
        {
            float result = 0f;

            if (icon != null)
            {
                Rect  rect = icon.EmojiImage.rectTransform.rect;
                float num  = (rect.width >= rect.height) ? rect.width : rect.height;
                result = 46f / num;
            }
            return(result);
        }
Exemple #3
0
    // Token: 0x060005BD RID: 1469 RVA: 0x0007F50C File Offset: 0x0007D70C
    public EmojiUnit pullIcon(ushort iconid, byte defaultSpriteID = 0, bool isSpriteRenderer = false)
    {
        this.EmojiCenterIni();
        if (!this.IconIdMapEmojiSprites.ContainsKey(iconid) && !this.AddEmojiSprite(iconid))
        {
            iconid = 0;
        }
        EmojiCenter.EmojiSprite emojiSprite = this.IconIdMapEmojiSprites[iconid];
        EmojiUnit emojiUnit;

        if (this.EmojiUnitPoolCount == 0)
        {
            emojiUnit        = new EmojiUnit();
            emojiUnit.poolID = this.EmojiUnitPool.Count;
            this.EmojiUnitPool.Add(emojiUnit);
        }
        else
        {
            emojiUnit        = this.EmojiUnitPool[--this.EmojiUnitPoolCount];
            emojiUnit.poolID = this.EmojiUnitPoolCount;
        }
        emojiUnit.EmojiUnitIni(defaultSpriteID);
        emojiUnit.IconID     = iconid;
        emojiUnit.SpriteMove = this.EmojiSpriteLayout.GetChild(emojiSprite.LayoutID).GetComponent <UISpritesArray>().m_Sprites;
        GameObject gameObject;

        if (isSpriteRenderer)
        {
            if (this.SpriteRendererPoolLayout.childCount == 0)
            {
                gameObject = new GameObject("eicon_sr");
                gameObject.AddComponent <SpriteRenderer>().material = this.EmojiSpriteRendererMaterial;
            }
            else
            {
                gameObject = this.SpriteRendererPoolLayout.GetChild(this.SpriteRendererPoolLayout.childCount - 1).gameObject;
                gameObject.transform.SetParent(null, false);
            }
            emojiUnit.EmojiImage          = null;
            emojiUnit.EmojiSpriteRenderer = gameObject.GetComponent <SpriteRenderer>();
            if (emojiUnit.SpriteMove.Length <= 1)
            {
                emojiUnit.EmojiSpriteRenderer.sprite = emojiUnit.SpriteMove[0];
            }
        }
        else
        {
            if (this.ImagePoolLayout.childCount == 0)
            {
                gameObject = new GameObject("eicon_ig");
                gameObject.AddComponent <Image>().material = this.EmojiImageMaterial;
            }
            else
            {
                gameObject = this.ImagePoolLayout.GetChild(this.ImagePoolLayout.childCount - 1).gameObject;
                gameObject.transform.SetParent(null, false);
            }
            emojiUnit.EmojiSpriteRenderer = null;
            emojiUnit.EmojiImage          = gameObject.GetComponent <Image>();
            emojiUnit.setImagePivot();
        }
        emojiUnit.EmojiTransform = gameObject.transform;
        gameObject.SetActive(true);
        return(emojiUnit);
    }