Exemplo n.º 1
0
        //------------------------------------------------------------------------------
        public static void CreateMappingSet()
        {
            TemplateMapping mapping    = ScriptableObject.CreateInstance <TemplateMapping>();
            string          rawPath    = Path.Combine(Const.RPath_CustomTempScript, "NewTemplateMapping.asset");
            string          uniquePath = AssetDatabase.GenerateUniqueAssetPath(rawPath);

            AssetDatabase.CreateAsset(mapping, uniquePath);
            AssetDatabase.SetLabels(mapping, new string[] { MapLabel });
            Selection.activeObject = mapping;
        }
Exemplo n.º 2
0
        //------------------------------------------------------------------------------
        public override void OnInspectorGUI()
        {
            m_targetMapping = target as TemplateMapping;
            Undo.RecordObject(m_targetMapping, "Modify mapping");

            SetupGuiStyles();

            CustomMappingGUI();

            EditorGUILayout.Space();
            EditorGUILayout.Space();

            EnvironmentMappingGUI();

            if (GUI.changed)
            {
                EditorUtility.SetDirty(target);
            }
        }
Exemplo n.º 3
0
        //------------------------------------------------------------------------------
        private static void LoadCustomMappings(ref Dictionary <String, String> tokenReplacements)
        {
            List <String> mappingAssetPaths = EditorUtil.FindAssetPaths(TemplateTool.MapLabel);

            foreach (String path in mappingAssetPaths)
            {
                if (!File.Exists(path))
                {
                    continue;
                }

                TemplateMapping mapping = AssetDatabase.LoadAssetAtPath(path, typeof(TemplateMapping)) as TemplateMapping;

                foreach (KeyValuePair <String, TemplateCustomMappingData> kvp in mapping.CustomMappings)
                {
                    MapCustom(kvp.Key, kvp.Value, ref tokenReplacements);
                }

                foreach (KeyValuePair <String, String> kvp in mapping.EnvironmentMappings)
                {
                    MapEnvVariable(kvp.Key, kvp.Value, ref tokenReplacements);
                }
            }
        }