예제 #1
0
파일: TagEditor.cs 프로젝트: rycoll/1KBWC
 public void Start()
 {
     if (existingTags.Count == 0)
     {
         BinaryCardLoader cardLoader       = new BinaryCardLoader();
         LoadCardCallback loadCardCallback = LoadExistingTag;
         cardLoader.LoadCardsAsync(loadCardCallback);
     }
 }
예제 #2
0
 public void LoadCards()
 {
     ClearAllCards();
     if (loadCardCallback == null)
     {
         loadCardCallback = LoadCard;
     }
     Debug.Log($"Loading cards with {loadCardCallback}");
     cardLoader.LoadCardsAsync(loadCardCallback);
 }
예제 #3
0
    public void LoadCardsAsync(LoadCardCallback callback)
    {
        string folderPath = FOLDER_NAME;

        string[] filePaths = Directory.GetFiles(folderPath, "*" + FILE_EXTENSION, SearchOption.AllDirectories);

        List <CardData> cards = new List <CardData>();

        foreach (string dataPath in filePaths)
        {
            CardData cardData = LoadCardData(dataPath);
            if (cardData != null)
            {
                cards.Add(cardData);
                string dirName    = Path.GetDirectoryName(dataPath);
                byte[] imageBytes = File.ReadAllBytes(Path.Combine(dirName, cardData.GetID() + IMAGE_FORMAT));
                cardData.ArtTexture = new Texture2D(300, 300, TextureFormat.RGBA32, false, false);
                cardData.ArtTexture.LoadImage(imageBytes, false);
                cardData.ArtTexture.Apply();

                callback(cardData);
            }
        }
    }
예제 #4
0
 public void Start()
 {
     loadCardCallback = LoadCard;
 }