12345678910111213141516171819202122 |
- using Blue;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class XunJianUIItem_Texture : MonoBehaviour,IController
- {
- public void GetSprite(Dictionary<int, ByteClass> byteDic, int mItemID, int Index)
- {
- //Debug.LogError($"mItemID:{mItemID}, Index:{Index}");
- LangChaoMinIo.Instance.getFile(this.GetService<IInspectionService>().InspectionInfo.id, mItemID.ToString(), Index, Texture2D =>
- {
- if (Texture2D != null)
- {
- byteDic.Add(Index, new ByteClass() { upload = false, bytes = Texture2D.EncodeToPNG() });
- Sprite sprite = Sprite.Create(Texture2D, new Rect(0, 0, Texture2D.width, Texture2D.height), Vector2.zero);
- sprite.name = Index.ToString();
- GetComponent<Image>().sprite = sprite;
- }
- });
- }
- }
|