예제 #1
0
파일: Map.cs 프로젝트: nistck/Jx
            public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
            {
                if (value == null || Instance == null)
                {
                    return(null);
                }

                string valueString = Convert.ToString(value);

                if (string.IsNullOrEmpty(valueString))
                {
                    return(Instance.RootEditorLayer);
                }

                string[]    dirs  = valueString.Split(Path.AltDirectorySeparatorChar);
                EditorLayer layer = Instance.RootEditorLayer;

                for (int i = 1; i < dirs.Length; i++)
                {
                    layer = layer.FindChild(dirs[i]);
                    if (layer == null)
                    {
                        return(Instance.RootEditorLayer);
                    }
                }
                return(layer);
            }
예제 #2
0
파일: Map.cs 프로젝트: nistck/Jx
            public EditorLayer Find(string p)
            {
                if (p == null)
                {
                    return(null);
                }

                string[]    ps          = p.Split('\\');
                EditorLayer editorLayer = Instance.RootEditorLayer;

                for (int i = 1; i < ps.Length && editorLayer != null; i++)
                {
                    string      psi   = ps[i];
                    EditorLayer layer = editorLayer.FindChild(psi);
                    if (layer == null)
                    {
                        editorLayer = null;
                        break;
                    }
                    editorLayer = layer;
                }
                return(editorLayer);
            }