//-------------------------------------- // PRIVATE METHODS //-------------------------------------- private static void fillAtlasesDictionary() { TPAtlasesData.registerAtlases = new Dictionary <string, string>(); string[] l = EditorPrefs.GetString(TP_ATLASES_INTFO).Split("," [0]); bool key = true; string AtlasName = string.Empty; string AtlasPath = string.Empty; foreach (System.Object s in l) { if (key) { AtlasName = System.Convert.ToString(s); } else { AtlasPath = System.Convert.ToString(s); if (AtlasName != string.Empty && AtlasPath != string.Empty) { TPAtlasesData.AddAtlasInfo(AtlasName, AtlasPath); } } key = !key; } }
//-------------------------------------- // EVENTS //-------------------------------------- public void OnAtlasChange(string atlasName) { string path = TPAtlasesData.getAtlasPath(atlasName); meshTexture.atlas = path; if (replaceMaterial) { Material m = Resources.Load(path + "Material") as Material; if (gameObject.GetComponent <Renderer>().sharedMaterial != m) { gameObject.GetComponent <Renderer>().sharedMaterial = m; } } }
//-------------------------------------- // GET / SET //-------------------------------------- private TPAtlas getAtlas(string atlasName) { string path = TPAtlasesData.getAtlasPath(atlasName); return(TPackManager.getAtlas(path)); }
//-------------------------------------- // EVENTS //-------------------------------------- public virtual void OnAtlasChange(string atlasName) { string path = TPAtlasesData.getAtlasPath(atlasName); SwitchAtlas(path); }