mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
Added .sln for spine-csharp that compiles under MonoDevelop. Modifie spine-csharp.csproj to compile under MonoDevelop (mac).
42 lines
946 B
C#
42 lines
946 B
C#
using System;
|
|
using System.IO;
|
|
using UnityEngine;
|
|
using UnityEditor;
|
|
using Spine;
|
|
|
|
public class AtlasAsset : ScriptableObject {
|
|
public TextAsset atlasFile;
|
|
public Material material;
|
|
private Atlas atlas;
|
|
|
|
public void Clear () {
|
|
atlas = null;
|
|
}
|
|
|
|
/// <returns>The atlas or null if it could not be loaded.</returns>
|
|
public Atlas GetAtlas () {
|
|
if (atlasFile == null) {
|
|
Debug.LogWarning("Atlas file not set for atlas asset: " + name, this);
|
|
Clear();
|
|
return null;
|
|
}
|
|
|
|
if (material == null) {
|
|
Debug.LogWarning("Material not set for atlas asset: " + name, this);
|
|
Clear();
|
|
return null;
|
|
}
|
|
|
|
if (atlas != null)
|
|
return atlas;
|
|
|
|
try {
|
|
atlas = new Atlas(new StringReader(atlasFile.text), material, material.mainTexture.width, material.mainTexture.height);
|
|
return atlas;
|
|
} catch (Exception) {
|
|
Debug.LogException(new Exception("Error reading atlas file for atlas asset: " + name), this);
|
|
return null;
|
|
}
|
|
}
|
|
}
|