예제 #1
0
파일: Map.cs 프로젝트: nistck/Jx
            internal bool OnLoad(TextBlock block)
            {
                if (block == null)
                {
                    return(false);
                }

                if (block.IsAttributeExist("name"))
                {
                    this.Name = block.GetAttribute("name");
                }
                if (block.IsAttributeExist("visible"))
                {
                    this.Visible = bool.Parse(block.GetAttribute("visible"));
                }
                if (block.IsAttributeExist("allowSelect"))
                {
                    this.AllowSelect = bool.Parse(block.GetAttribute("allowSelect"));
                }
                if (block.IsAttributeExist("allowEdit"))
                {
                    this.AllowEdit = bool.Parse(block.GetAttribute("allowEdit"));
                }

                foreach (TextBlock child in block.Children)
                {
                    EditorLayer layer = new EditorLayer(this);
                    if (!layer.OnLoad(child))
                    {
                        return(false);
                    }
                    children.Add(layer);
                }
                return(true);
            }
예제 #2
0
파일: Map.cs 프로젝트: nistck/Jx
        protected override bool OnLoad(TextBlock block)
        {
            if (!base.OnLoad(block))
            {
                return(false);
            }

            TextBlock editorLayersBlock = block.FindChild("editorLayers");

            if (editorLayersBlock != null && rootEditorLayer.OnLoad(editorLayersBlock))
            {
                if (Instance.RootEditorLayer != null)
                {
                    Instance.Children.OfType <MapObject>().Any(_mo =>
                    {
                        _mo.EditorLayer = Instance.RootEditorLayer.Find(_mo._editorLayerLast);
                        return(false);
                    });
                }
            }

            return(true);
        }