public void ApplyRemap()
        {
            string tag = CreateCurrentTag();

            VirtualAssetManager.activeTag = tag;
            VirtualAssetManager.ApplyRemap(tag);
            Debug.Log(string.Format("Remap => {0}", tag));
        }
    private void ApplyVASetting()
    {
        VirtualAssetManager.RemoveAllVariantMappingForObject(m_activeObject);

        foreach (var t in m_setting)
        {
            VirtualAssetManager.AddVariantMapping(t.tag, m_activeObject, t.obj);
        }
    }
示例#3
0
    void UpdateActiveTag(string newTag)
    {
        // Hackweek!
        if (newTag == "English")
        {
            newTag = "";
        }

        VirtualAssetManager.activeTag = newTag;
        VirtualAssetManager.ApplyRemap(newTag);
    }
    private void SelectObject(UnityEngine.Object obj)
    {
        m_activeObject = obj;

        m_setting.Clear();

        var tags = VirtualAssetManager.GetAllTagsForObject(obj);

        foreach (var t in tags)
        {
            m_setting.Add(new VAEntry(t, VirtualAssetManager.GetRemappedObjectForTag(obj, t)));
        }
    }
 public void ResetRemap()
 {
     VirtualAssetManager.ApplyRemap(string.Empty);
 }
 public void RemoveVariantMapping()
 {
     VirtualAssetManager.RemoveVariantAllMapping();
     Debug.Log(string.Format("ALL REMOVED"));
 }
 public void RemoveAllVariantMappingForObject(UnityEngine.Object src)
 {
     VirtualAssetManager.RemoveAllVariantMappingForObject(src);
     Debug.Log(string.Format("Remove ALL {0}", src.name));
 }
 public void RemoveAllVariantMappingForTag(string tagName)
 {
     VirtualAssetManager.RemoveAllVariantMappingForTag(tagName);
     Debug.Log(string.Format("Remove ALL TAG {0}", tagName));
 }
 public void RemoveVariantMapping(string tagName, UnityEngine.Object src)
 {
     VirtualAssetManager.RemoveVariantMapping(tagName, src);
     Debug.Log(string.Format("Remove {0} for {1}", src.name, tagName));
 }
//        public UnityEngine.Object[] GetSourceObjectsContainsVariantOf(string tagName) {
//            return new UnityEngine.Object[]{};
//        }

//        public UnityEngine.Object GetRemappedObject(UnityEngine.Object src) {
//            return null;
//        }
//
//        public UnityEngine.Object GetRemappedObjectForTag(UnityEngine.Object src, string tagName ) {
//            return null;
//        }
//
//        public string[] GetAllTagsForObject(UnityEngine.Object src) {
//            return new string[]{};
//        }

        public void AddVariantMapping(string tagName, UnityEngine.Object src, UnityEngine.Object dst)
        {
            VirtualAssetManager.AddVariantMapping(tagName, src, dst);
            Debug.Log(string.Format("Add {0} => {1}: {2}", src.name, dst.name, tagName));
        }
    public void OnGUI()
    {
        using (new EditorGUILayout.VerticalScope()) {
            GUILayout.Label("VA Setting", new GUIStyle("BoldLabel"));
            GUILayout.Space(8f);

            if (m_activeObject == null)
            {
                return;
            }

            VAEntry removing = null;

            foreach (var info in m_setting)
            {
                using (new EditorGUILayout.HorizontalScope()) {
                    var newTag = EditorGUILayout.TextField("Tag", info.tag);
                    if (newTag != info.tag)
                    {
                        info.tag = newTag;
                    }
                    if (GUILayout.Button("-", GUILayout.Width(32f)))
                    {
                        removing = info;
                    }
                }
                var newObj = EditorGUILayout.ObjectField("Object", info.obj, m_activeObject.GetType(), false);
                if (newObj != info.obj)
                {
                    info.obj = newObj;
                }
                GUILayout.Space(8f);
            }

            if (removing != null)
            {
                m_setting.Remove(removing);
            }

            GUILayout.Space(8f);
            if (GUILayout.Button("+"))
            {
                m_setting.Add(new VAEntry("<new entry>", null));
            }

            if (GUILayout.Button("Apply"))
            {
                ApplyVASetting();
            }

            GUILayout.Space(20f);

            var newActiveTag = EditorGUILayout.TextField("Active Tag", m_activeTag);
            if (newActiveTag != m_activeTag)
            {
                m_activeTag = newActiveTag;
            }

            if (GUILayout.Button("Update Active Tag"))
            {
                VirtualAssetManager.activeTag = newActiveTag;
                VirtualAssetManager.ApplyRemap(m_activeTag);
            }
        }
    }