public virtual bool CanDraw() { if (inputType == InputType.TextureAtlas) { if (textureAtlas == null || string.IsNullOrEmpty(textureAtlasSpriteGUID) || textureAtlas.GetItem(textureAtlasSpriteGUID) == null) { return(false); } } return(currentTexture != null); }
void DrawInfoPanel() { var rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(74), GUILayout.Width(Screen.width)); string name = ""; string size = ""; string path = ""; if (!string.IsNullOrEmpty(selectedItemGUID)) { var item = atlas.GetItem(selectedItemGUID); if (item != null) { name = item.name; size = item.pixelsWidth + "x" + item.pixelsHeight; path = MadAtlasUtil.GetItemOriginPath(item); GUI.DrawTextureWithTexCoords(new Rect(rect.x + 5, rect.y + 5, 64, 64), atlas.atlasTexture, item.region); } } GUILayout.Space(74); GUILayout.BeginVertical(); GUILayout.Label(name); GUILayout.Label(size); GUILayout.Label(path); GUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); }
public override Material GetMaterial() { if (atlas != null) { if (atlas.GetItem(fontTextureGUID) != null) { return(panel.materialStore.MaterialFor(atlas.atlasTexture, MadLevelManager.MadShaders.UnlitTint)); } else { return(GetFontMaterial()); } } else { return(GetFontMaterial()); } }
public static void AtlasField(SerializedProperty textureField, MadAtlas atlas, string label) { string guid = textureField.stringValue; string spriteName = ""; if (!string.IsNullOrEmpty(guid) && atlas != null) { var item = atlas.GetItem(guid); if (item != null) { spriteName = item.name; } } EditorGUILayout.BeginHorizontal(); EditorGUILayout.TextField(label, spriteName); MadGUI.ConditionallyEnabled(atlas != null, () => { if (GUILayout.Button("Browse", GUILayout.Width(55))) { MadAtlasBrowser.Show(atlas, textureField); } }); EditorGUILayout.EndHorizontal(); }
public static void AtlasField(SerializedProperty textureField, MadAtlas atlas, string label, ScriptableObject parent) { string guid = textureField.stringValue; string spriteName = ""; if (!string.IsNullOrEmpty(guid) && atlas != null) { var item = atlas.GetItem(guid); if (item != null) { spriteName = item.name; } } EditorGUILayout.BeginHorizontal(); EditorGUILayout.TextField(label, spriteName); MadGUI.ConditionallyEnabled(atlas != null, () => { if (GUILayout.Button("Browse", GUILayout.Width(55))) { MadAtlasBrowser.Show(atlas, textureField, parent); } }); EditorGUILayout.EndHorizontal(); }