当前位置: 首页>>代码示例>>C#>>正文


C# Player.GetModPlayer方法代码示例

本文整理汇总了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);
				}
			}
		}
开发者ID:JavidPack,项目名称:TerraCustom,代码行数:32,代码来源:MysteryPlayer.cs

示例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);
				}
			}
		}
开发者ID:DrakoGlyph,项目名称:tModLoader,代码行数:24,代码来源:MysteryPlayer.cs

示例3: SendClientChanges

 public static void SendClientChanges(Player player, Player clientPlayer)
 {
     foreach (ModPlayer modPlayer in player.modPlayers)
     {
         modPlayer.SendClientChanges(clientPlayer.GetModPlayer(modPlayer.mod, modPlayer.Name));
     }
 }
开发者ID:bluemagic123,项目名称:tModLoader,代码行数:7,代码来源:PlayerHooks.cs

示例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
                     {
                     }
                 }
             }
         }
     }
 }
开发者ID:bluemagic123,项目名称:tModLoader,代码行数:28,代码来源:PlayerHooks.cs

示例5: clientClone

 public static void clientClone(Player player, Player clientClone)
 {
     foreach (ModPlayer modPlayer in player.modPlayers)
     {
         modPlayer.clientClone(clientClone.GetModPlayer(modPlayer.mod, modPlayer.Name));
     }
 }
开发者ID:bluemagic123,项目名称:tModLoader,代码行数:7,代码来源:PlayerHooks.cs

示例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);
         }
     }
 }
开发者ID:bluemagic123,项目名称:tModLoader,代码行数:27,代码来源:PlayerIO.cs

示例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);
         }
     }
 }
开发者ID:bluemagic123,项目名称:tModLoader,代码行数:39,代码来源:PlayerIO.cs


注:本文中的Player.GetModPlayer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。