Skip to content

Instantly share code, notes, and snippets.

@nicloay
Created August 8, 2021 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicloay/3a24f8fe16a7794bb80b06b99ef9fd38 to your computer and use it in GitHub Desktop.
Save nicloay/3a24f8fe16a7794bb80b06b99ef9fd38 to your computer and use it in GitHub Desktop.
using System.Collections;
using UnityEngine;
namespace PaintCraft.Canvas.Configs
{
[CreateAssetMenu(fileName = "FullPageConfig", menuName = "PaintCraft/FullPageConfig")]
public class FullPageConfigSO : ScriptableObject, IPageConfig, ISaveUserChanges, ISaveUserIcon, IOutlineTexture,
IRegionTexture, IDefaultIcon, IStartTexture, IDownloadIconAsync, IDownloadDataAsync
{
[SerializeField] private string streamingAssetPath;
[SerializeField] private int version;
private FullPageConfig fullPageConfig;
private FullPageConfig FullPageConfig =>
fullPageConfig ?? (fullPageConfig =
new FullPageConfig(new FullPageConfigPathInfo(new PagePath(streamingAssetPath, version))));
public Texture DefaultIcon => FullPageConfig.DefaultIcon;
public IEnumerator DownloadData() => FullPageConfig.DownloadData();
public IEnumerator DownloadIcon() => FullPageConfig.DownloadIcon();
public Texture OutlineTexture => FullPageConfig.OutlineTexture;
public void Dispose()
{
fullPageConfig.Dispose();
fullPageConfig = null;
}
public Vector2Int Size => FullPageConfig.Size;
public Texture2D RegionTexture => FullPageConfig.RegionTexture;
public Texture LoadUserChanges() => FullPageConfig.LoadUserChanges();
public void SaveUserChanges(RenderTexture texture) => FullPageConfig.SaveUserChanges(texture);
public Vector2Int IconSize => FullPageConfig.IconSize;
public Texture LoadUserIcon() => FullPageConfig.LoadUserIcon();
public void SaveUserIcon(RenderTexture texture) => FullPageConfig.SaveUserIcon(texture);
public Texture StartTexture => FullPageConfig.StartTexture;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment