Example #1
0
        public static ST2USettings LoadSettings()
        {
            // Find the first ST2U setting asset
            const string search = "t:ST2USettings";

            return(AssetDatabaseEx.LoadFirstAssetByFilter <ST2USettings>(search));
        }
Example #2
0
 public void AssignIcons()
 {
     m_SettingsIcon = AssetDatabaseEx.LoadFirstAssetByFilter <Texture2D>("tiled-settings-icon-0x1badd00d");
     m_TmxIcon      = AssetDatabaseEx.LoadFirstAssetByFilter <Texture2D>("tmx-file-icon-0x1badd00d");
     m_TsxIcon      = AssetDatabaseEx.LoadFirstAssetByFilter <Texture2D>("tsx-file-icon-0x1badd00d");
     m_TxIcon       = AssetDatabaseEx.LoadFirstAssetByFilter <Texture2D>("tx-file-icon-0x1badd00d");
 }
Example #3
0
        public static Texture2D GetWorldIcon()
        {
            if (m_WorldIcon == null)
            {
                m_WorldIcon = AssetDatabaseEx.LoadFirstAssetByFilter <Texture2D>("world-file-icon-0x1badd00d");
            }

            return(m_WorldIcon);
        }
Example #4
0
        public static Texture2D GetSettingsIcon()
        {
            if (m_SettingsIcon == null)
            {
                m_SettingsIcon = AssetDatabaseEx.LoadFirstAssetByFilter <Texture2D>("tiled-settings-icon-0x1badd00d");
            }

            return(m_SettingsIcon);
        }
Example #5
0
        internal static ST2USettings GetOrCreateST2USettings()
        {
            var settings = AssetDatabaseEx.LoadFirstAssetByFilterAndExtension <ST2USettings>("t: ST2USettings", "asset");

            if (settings == null)
            {
                // This shouldn't often happen but we need settings in case they get deleted on us
                settings = SuperTiled2Unity_Config.CreateDefaultSettings();
            }

            return(settings);
        }
        internal static ST2USettings GetOrCreateST2USettings()
        {
            var settings = AssetDatabaseEx.LoadFirstAssetByFilterAndExtension <ST2USettings>("t: ST2USettings", "asset");

            if (settings == null)
            {
                // This should only happen when we are first installing SuperTiled2Unity
                // However, should our settings be deleted we would like them to be recreated
                settings = SuperTiled2Unity_Config.CreateDefaultSettings();
            }

            return(settings);
        }
        public static ST2USettings CreateDefaultSettings()
        {
            var scriptPath   = AssetDatabaseEx.GetFirstPathOfScriptAsset <SuperTiled2Unity_Config>();
            var settingsPath = Path.GetDirectoryName(scriptPath);

            settingsPath = Path.Combine(settingsPath, DefaultSettingsFileName).SanitizePath();

            var settings = ScriptableObject.CreateInstance <ST2USettings>();

            AssetDatabase.CreateAsset(settings, settingsPath);
            AssetDatabase.SaveAssets();

            return(settings);
        }
        protected override void InternalOnImportAsset()
        {
            var icon = AssetDatabaseEx.LoadFirstAssetByFilter <Texture2D>("tx-file-icon-0x1badd00d");

            AddSuperAsset <SuperAssetTemplate>();

            // Create our asset and build it out
            m_ObjectTemplate = ScriptableObject.CreateInstance <ObjectTemplate>();
            AssetImportContext.AddObjectToAsset("_template", m_ObjectTemplate, icon);
            AssetImportContext.SetMainObject(m_ObjectTemplate);

            // Tx files are XML that contain the data for one object
            XDocument doc       = XDocument.Load(this.assetPath);
            var       xTemplate = doc.Element("template");

            ProcessTemplate(xTemplate);
        }
Example #9
0
        public static SuperIcons LoadIcons()
        {
            const string search = "t:SuperIcons";

            return(AssetDatabaseEx.LoadFirstAssetByFilter <SuperIcons>(search));
        }