public void LoadAtlasTexture(AtlasType atlasType, string fileName = null) { if (atlasType == AtlasType.None && _spriteDictionary.ContainsKey(fileName) || _spriteDictionary.ContainsKey(atlasType.ToString())) { return; } GlobalUtil.AddString(AtlasPath, fileName); switch (atlasType) { case AtlasType.Lobby: AddAtlasSprite(Lobby, Lobby); AddAtlasSprite(Lobby, "Icon_Atlas"); break; case AtlasType.InGAME: AddAtlasSprite(Game, "GameTexture"); AddAtlasSprite(Game, "Icon_Atlas"); AddAtlasSprite(Game, "GCP_Hud"); break; break; default: // 팝업 단위로 아틀라스 생성시 AddAtlasSprite(PopAtlasPath, fileName); break; } }
/// <summary> /// 创建材质 /// </summary> /// <param name="tpsPath"></param> static void CreateMaterial(string tpsPath, AtlasType type) { string typeName = type.ToString(); var materialPath = tpsPath.Replace(".tps", ".mat"); string path = AppDataPath + "/Templates/Materials/" + typeName + "Material.mat"; string name = Path.GetFileNameWithoutExtension(materialPath); File.Copy(path, materialPath, true); AssetDatabase.Refresh(); }
public void SetTextureForADC(UnityEngine.Texture inTex) { myMaterial.mainTexture = inTex; myMaterialAdditive.mainTexture = myMaterial.mainTexture; myMaterialTransparent.mainTexture = myMaterial.mainTexture; AtlasType myType = (AtlasType)myId; Debug.Log("Texture has been set for ADC for ZAtlas " + myType.ToString() + " with w:" + myMaterial.mainTexture.width + " and h:" + myMaterial.mainTexture.height); }