パイプライン経由でMonoGameゲームにXMLファイルを読み込もうとしていますが、エラーが発生しています。MonoGameパイプラインXML読み込みエラー 'Element'は無効なXmlNodeTypeです
'要素'は無効なXmlNodeTypeです。行10、位置6。
外部ポータブルクラスライブラリプロジェクトでXMLファイルのクラスを作成し、そのDLLをパイプラインコンテンツ参照に追加しました。しかし、MonoGame PipelineアプリケーションでXMLファイルを構築しようとすると、上記のエラーが発生します。
すべてのアイデア?
XMLとクラスコードが
MainMenu.xml(Iは、XMLスタイルのコメントとエラー行をマークしている、実際のファイルではありませんコメント)
<?xml version="1.0" encoding="utf-8"?>
<XnaContent xmlns:ns="Microsoft.Xna.Framework">
<Asset Type="Menu">
<Title>Main Menu</Title>
<Background>
<Type>animation</Type>
<Data>MainMenuBackground</Data>
</Background>
<Options>
<Option> <!-- Error Here -->
<Type>text</Type>
<Name>new</Name>
<Disabled>false</Disabled>
<Text>New Game</Text>
<Action>newGame</Action>
</Option>
<Option>
<Type>text</Type>
<Name>save</Name>
<Disabled>true</Disabled>
<Text>Save Game</Text>
<Action>saveGame</Action>
</Option>
<Option>
<Type>text</Type>
<Name>load</Name>
<Disabled>false</Disabled>
<Text>Load Game</Text>
<Action>loadGame</Action>
</Option>
<Option>
<Type>text</Type>
<Name>exit</Name>
<Disabled>false</Disabled>
<Text>Exit Game</Text>
<Action>exitGame</Action>
</Option>
</Options>
<Buttons>
<Keyboard>
<Accept>Enter</Accept>
<Cancel>Esc</Cancel>
</Keyboard>
<Controller>
<Accept>A</Accept>
<Cancel>B</Cancel>
</Controller>
</Buttons>
</Asset>
</XnaContent>
メニューの下にあります。 CS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace XMLMenu
{
public class Menu
{
public String Title;
public Background Background = new Background();
public Option[] Options = new Option[] { };
public Buttons Buttons = new Buttons();
}
}
Background.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace XMLMenu
{
public class Background
{
public String Type;
public String Data;
}
}
Option.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace XMLMenu
{
public class Option
{
public String Type;
public String Name;
public Boolean Disabled;
public String Text;
public string Action;
}
}
Buttons.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace XMLMenu
{
public class Buttons
{
public ControlButtons Keyboard = new ControlButtons();
public ControlButtons Controller = new ControlButtons();
}
}
ControlButtons.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace XMLMenu
{
public class ControlButtons
{
public String Accept;
public String Cancel;
}
}
おかげで、しかし、VSは、私は、私はMicrosoft.Xan.Framework.Contentのための参照を追加できません。詳細については
は、この記事では、「コレクション」と進むのセクションを読んでプロジェクトは標準ライブラリではなく、移植可能なクラスライブラリであると推測します。 monagameのためのこのライブラリのポータブル版はありますか? – Chris
アセンブリへの参照なしで私が認識している唯一のオプションはItemタグに切り替えることです。実際にそのルートに行きたくない場合は、PCLをSharedProjectに切り替え、ターゲットとする各プラットフォームの個別のビルドを作成すると考えるかもしれません。 –
私がやっていることの全体的なポイントは、クロスプラットフォームを作ることです。 – Chris