Example #1
0
 public void LoadArt(CardArt artData)
 {
     if (string.IsNullOrEmpty(artData.imageDir))
     {
         print("no dir");
         art.color = Color.clear;
     }
     else if (!File.Exists(Path.Combine(CardLoader.GetSavePath(""), artData.imageDir)))
     {
         print("dir doesn't exist");
         art.color = Color.clear;
     }
     else
     {
         LoadArt(CastleTools.LoadImage(Path.Combine(CardLoader.GetSavePath(""), artData.imageDir)));
         art.color = Color.white;
     }
     if (string.IsNullOrEmpty(artData.lightingDir))
     {
         print("no dir");
         lighting.color = Color.clear;
     }
     else if (!File.Exists(Path.Combine(CardLoader.GetSavePath(""), artData.lightingDir)))
     {
         print("dir doesn't exist");
         lighting.color = Color.clear;
     }
     else
     {
         LoadLighting(CastleTools.LoadImage(Path.Combine(CardLoader.GetSavePath(""), artData.lightingDir)));
         lighting.color = Color.white;
     }
     ApplyMask(artData.masked);
 }
Example #2
0
    public IEnumerator LoadArt(bool light = false)
    {
        coll.enabled = false;
        string loadedArtPath = "";

        yield return(dirViewer.StartCoroutine(dirViewer.SearchForFile(CardLoader.GetSavePath(""), result => loadedArtPath = result)));

        if (!string.IsNullOrEmpty(loadedArtPath))
        {
            loadedArtPath = SanitizePath(loadedArtPath);
            ArtTab currTab = tabs.ActiveToggles().First().GetComponent <ArtTab>();
            if (currTab.artLayer == art)
            {
                if (light)
                {
                    data.mainArt.lightingDir = loadedArtPath;
                }
                else
                {
                    data.mainArt.imageDir = loadedArtPath;
                }
                currTab.artLayer.LoadArt(data.mainArt);
            }
            else
            {
                for (int i = 0; i < foregroundLayers.Count; i++)
                {
                    if (currTab.artLayer == foregroundLayers[i])
                    {
                        if (light)
                        {
                            data.foregroundLayers[i].lightingDir = loadedArtPath;
                        }
                        else
                        {
                            data.foregroundLayers[i].imageDir = loadedArtPath;
                        }
                        currTab.artLayer.LoadArt(data.foregroundLayers[i]);
                    }
                }
                for (int i = 0; i < backgroundLayers.Count; i++)
                {
                    if (currTab.artLayer == backgroundLayers[i])
                    {
                        if (light)
                        {
                            data.backgroundLayers[i].lightingDir = loadedArtPath;
                        }
                        else
                        {
                            data.backgroundLayers[i].imageDir = loadedArtPath;
                        }
                        currTab.artLayer.LoadArt(data.backgroundLayers[i]);
                    }
                }
            }
        }
        coll.enabled = true;
        Save();
    }
Example #3
0
 public string SanitizePath(string path)
 {
     path = path.Remove(0, CardLoader.GetSavePath("").Length + 1);
     return(path);
 }