本文整理汇总了C#中Player.GetModPlayer方法的典型用法代码示例。如果您正苦于以下问题:C# Player.GetModPlayer方法的具体用法?C# Player.GetModPlayer怎么用?C# Player.GetModPlayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player.GetModPlayer方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RestoreData
internal void RestoreData(Player player)
{
int k = 0;
while (k < data.Count)
{
Mod mod = ModLoader.GetMod(data[k].modName);
ModPlayer modPlayer = mod == null ? null : player.GetModPlayer(mod, data[k].name);
if (modPlayer == null)
{
k++;
}
else
{
using (MemoryStream memoryStream = new MemoryStream(data[k].data))
{
using (BinaryReader reader = new BinaryReader(memoryStream))
{
try
{
modPlayer.LoadCustomData(reader);
}
catch (Exception e)
{
throw new CustomModDataException(mod,
"Error in loading custom player data for " + mod.Name, e);
}
}
}
data.RemoveAt(k);
}
}
}
示例2: RestoreData
internal void RestoreData(Player player)
{
int k = 0;
while (k < data.Count)
{
Mod mod = ModLoader.GetMod(data[k].modName);
ModPlayer modPlayer = mod == null ? null : player.GetModPlayer(mod, data[k].name);
if (modPlayer == null)
{
k++;
}
else
{
using (MemoryStream memoryStream = new MemoryStream(data[k].data))
{
using (BinaryReader reader = new BinaryReader(memoryStream))
{
modPlayer.LoadCustomData(reader);
}
}
data.RemoveAt(k);
}
}
}
示例3: SendClientChanges
public static void SendClientChanges(Player player, Player clientPlayer)
{
foreach (ModPlayer modPlayer in player.modPlayers)
{
modPlayer.SendClientChanges(clientPlayer.GetModPlayer(modPlayer.mod, modPlayer.Name));
}
}
示例4: ReceiveCustomBiomes
public static void ReceiveCustomBiomes(Player player, BinaryReader reader)
{
int count = reader.ReadUInt16();
for (int k = 0; k < count; k++)
{
string modName = reader.ReadString();
string name = reader.ReadString();
byte[] data = reader.ReadBytes(reader.ReadByte());
Mod mod = ModLoader.GetMod(modName);
ModPlayer modPlayer = mod == null ? null : player.GetModPlayer(mod, name);
if (modPlayer != null)
{
using (MemoryStream stream = new MemoryStream(data))
{
using (BinaryReader customReader = new BinaryReader(stream))
{
try
{
modPlayer.ReceiveCustomBiomes(customReader);
}
catch
{
}
}
}
}
}
}
示例5: clientClone
public static void clientClone(Player player, Player clientClone)
{
foreach (ModPlayer modPlayer in player.modPlayers)
{
modPlayer.clientClone(clientClone.GetModPlayer(modPlayer.mod, modPlayer.Name));
}
}
示例6: LoadModData
internal static void LoadModData(Player player, IList<TagCompound> list)
{
foreach (var tag in list)
{
var mod = ModLoader.GetMod(tag.GetString("mod"));
var modPlayer = mod == null ? null : player.GetModPlayer(mod, tag.GetString("name"));
if (modPlayer != null)
{
try
{
if (tag.HasTag("legacyData"))
modPlayer.LoadLegacy(new BinaryReader(new MemoryStream(tag.GetByteArray("legacyData"))));
else
modPlayer.Load(tag.GetCompound("data"));
}
catch (Exception e)
{
throw new CustomModDataException(mod,
"Error in reading custom player data for " + mod.Name, e);
}
}
else
{
player.GetModPlayer<MysteryPlayer>(ModLoader.GetMod("ModLoader")).data.Add(tag);
}
}
}
示例7: LoadLegacyModData
private static void LoadLegacyModData(Player player, BinaryReader reader)
{
int count = reader.ReadUInt16();
for (int k = 0; k < count; k++)
{
string modName = reader.ReadString();
string name = reader.ReadString();
byte[] data = reader.ReadBytes(reader.ReadUInt16());
Mod mod = ModLoader.GetMod(modName);
ModPlayer modPlayer = mod == null ? null : player.GetModPlayer(mod, name);
if (modPlayer != null)
{
using (MemoryStream stream = new MemoryStream(data))
{
using (BinaryReader customReader = new BinaryReader(stream))
{
try
{
modPlayer.LoadLegacy(customReader);
}
catch (Exception e)
{
throw new CustomModDataException(mod,
"Error in reading custom player data for " + mod.Name, e);
}
}
}
}
else
{
var tag = new TagCompound {
["mod"] = modName,
["name"] = name,
["legacyData"] = data
};
player.GetModPlayer<MysteryPlayer>(ModLoader.GetMod("ModLoader")).data.Add(tag);
}
}
}