我正在使用Visual Studio for Mac和Xamarin
Shared (Shared Project name)
GameData
Levels
Level1
Level1Data.xml
Level1DataXML.cs
ReadMe.txt
MainMenuSystem
LevelSelectionConfiguration.cs
using System;
using Foundation;
namespace Mind2MindV1.GameData.Levels.Level1
{
[Preserve(AllMembers = true)]
public class Level1DataXML
{
public string Title;
public string Description;
public string LevelPuzzlesData;
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<Level1DataXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Title>Level 1</Title>
<Description>Level 1 Puzzles Data</Description>
<LevelPuzzlesData>GameData/Level1/Lvl1Puzzles/Level1PuzzlesData.xml</LevelPuzzlesData>
</Level1DataXML>
我的Conde in&#34; LevelSelectionConfiguration.cs&#34;
var assembly = typeof(Level1DataXML).GetTypeInfo().Assembly;
Stream stream = assembly.GetManifestResourceStream("GameData.Levels.Level1.Level1Data.xml");
using (var reader = new System.IO.StreamReader(stream)) {
var serializer = new XmlSerializer(typeof(Level1DataXML));
xmlData = (Level1DataXML)serializer.Deserialize(reader);
}
assembly.GetManifestResourceStream(&#34; GameData.Levels.Level1.Level1Data.xml&#34);正在返回&#34; null&#34;
我做错了什么?