當前位置: 首頁>>代碼示例>>C#>>正文


C# Player.PlayerFrame方法代碼示例

本文整理匯總了C#中Terraria.Player.PlayerFrame方法的典型用法代碼示例。如果您正苦於以下問題:C# Player.PlayerFrame方法的具體用法?C# Player.PlayerFrame怎麽用?C# Player.PlayerFrame使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Terraria.Player的用法示例。


在下文中一共展示了Player.PlayerFrame方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: LoadPlayer

 public static Player LoadPlayer(string playerPath)
 {
     bool flag = false;
     if (Main.rand == null)
     {
         Main.rand = new Random((int) DateTime.Now.Ticks);
     }
     Player player = new Player();
     try
     {
         string outputFile = playerPath + ".dat";
         flag = DecryptFile(playerPath, outputFile);
         if (!flag)
         {
             using (FileStream stream = new FileStream(outputFile, FileMode.Open))
             {
                 using (BinaryReader reader = new BinaryReader(stream))
                 {
                     reader.ReadInt32();
                     player.name = reader.ReadString();
                     player.hair = reader.ReadInt32();
                     player.statLife = reader.ReadInt32();
                     player.statLifeMax = reader.ReadInt32();
                     if (player.statLife > player.statLifeMax)
                     {
                         player.statLife = player.statLifeMax;
                     }
                     player.statMana = reader.ReadInt32();
                     player.statManaMax = reader.ReadInt32();
                     if (player.statMana > player.statManaMax)
                     {
                         player.statMana = player.statManaMax;
                     }
                     player.hairColor.R = reader.ReadByte();
                     player.hairColor.G = reader.ReadByte();
                     player.hairColor.B = reader.ReadByte();
                     player.skinColor.R = reader.ReadByte();
                     player.skinColor.G = reader.ReadByte();
                     player.skinColor.B = reader.ReadByte();
                     player.eyeColor.R = reader.ReadByte();
                     player.eyeColor.G = reader.ReadByte();
                     player.eyeColor.B = reader.ReadByte();
                     player.shirtColor.R = reader.ReadByte();
                     player.shirtColor.G = reader.ReadByte();
                     player.shirtColor.B = reader.ReadByte();
                     player.underShirtColor.R = reader.ReadByte();
                     player.underShirtColor.G = reader.ReadByte();
                     player.underShirtColor.B = reader.ReadByte();
                     player.pantsColor.R = reader.ReadByte();
                     player.pantsColor.G = reader.ReadByte();
                     player.pantsColor.B = reader.ReadByte();
                     player.shoeColor.R = reader.ReadByte();
                     player.shoeColor.G = reader.ReadByte();
                     player.shoeColor.B = reader.ReadByte();
                     for (int i = 0; i < 8; i++)
                     {
                         player.armor[i].SetDefaults(reader.ReadString());
                     }
                     for (int j = 0; j < 0x2c; j++)
                     {
                         player.inventory[j].SetDefaults(reader.ReadString());
                         player.inventory[j].stack = reader.ReadInt32();
                     }
                     for (int k = 0; k < Chest.maxItems; k++)
                     {
                         player.bank[k].SetDefaults(reader.ReadString());
                         player.bank[k].stack = reader.ReadInt32();
                     }
                     for (int m = 0; m < 200; m++)
                     {
                         int num5 = reader.ReadInt32();
                         if (num5 == -1)
                         {
                             break;
                         }
                         player.spX[m] = num5;
                         player.spY[m] = reader.ReadInt32();
                         player.spI[m] = reader.ReadInt32();
                         player.spN[m] = reader.ReadString();
                     }
                     reader.Close();
                 }
             }
             player.PlayerFrame();
             File.Delete(outputFile);
             return player;
         }
     }
     catch
     {
         flag = true;
     }
     if (flag)
     {
         string path = playerPath + ".bak";
         if (File.Exists(path))
         {
             File.Delete(playerPath);
             File.Move(path, playerPath);
             return LoadPlayer(playerPath);
//.........這裏部分代碼省略.........
開發者ID:Restrictment,項目名稱:TerrariaAPI,代碼行數:101,代碼來源:Player.cs

示例2: LoadPlayer


//.........這裏部分代碼省略.........
                                 player.buffTime[e] = binaryReader.ReadInt32();
                                 if (player.buffType[e] == 0)
                                 {
                                     e--;
                                     num10--;
                                 }
                             }
                         }
                         for (int f = 0; f < 200; f++)
                         {
                             int num11 = binaryReader.ReadInt32();
                             if (num11 == -1)
                             {
                                 break;
                             }
                             player.spX[f] = num11;
                             player.spY[f] = binaryReader.ReadInt32();
                             player.spI[f] = binaryReader.ReadInt32();
                             player.spN[f] = binaryReader.ReadString();
                         }
                         if (num >= 16)
                         {
                             player.hbLocked = binaryReader.ReadBoolean();
                         }
                         if (num >= 115)
                         {
                             int num12 = 13;
                             for (int g = 0; g < num12; g++)
                             {
                                 player.hideInfo[g] = binaryReader.ReadBoolean();
                             }
                         }
                         if (num >= 98)
                         {
                             player.anglerQuestsFinished = binaryReader.ReadInt32();
                         }
                         player.skinVariant = (int)MathHelper.Clamp((float)player.skinVariant, 0f, 7f);
                         for (int h = 3; h < 8 + player.extraAccessorySlots; h++)
                         {
                             int num13 = player.armor[h].type;
                             if (num13 == 908)
                             {
                                 Player player1 = player;
                                 player1.lavaMax = player1.lavaMax + 420;
                             }
                             if (num13 == 906)
                             {
                                 Player player2 = player;
                                 player2.lavaMax = player2.lavaMax + 420;
                             }
                             if (player.wingsLogic == 0 && player.armor[h].wingSlot >= 0)
                             {
                                 player.wingsLogic = player.armor[h].wingSlot;
                             }
                             if (num13 == 158 || num13 == 396 || num13 == 1250 || num13 == 1251 || num13 == 1252)
                             {
                                 player.noFallDmg = true;
                             }
                             player.lavaTime = player.lavaMax;
                         }
                     }
                     else
                     {
                         player.loadStatus = 1;
                         player.name = binaryReader.ReadString();
                         playerFileDatum1.Player = player;
                         playerFileDatum = playerFileDatum1;
                         return playerFileDatum;
                     }
                 }
             }
         }
         player.PlayerFrame();
         player.loadStatus = 0;
         playerFileDatum1.Player = player;
         playerFileDatum = playerFileDatum1;
     }
     catch
     {
         Player player3 = new Player()
         {
             loadStatus = 2
         };
         if (player.name == "")
         {
             char[] directorySeparatorChar = new char[] { Path.DirectorySeparatorChar };
             string[] strArrays = playerPath.Split(directorySeparatorChar);
             string str = strArrays[(int)strArrays.Length - 1];
             char[] chrArray = new char[] { '.' };
             player.name = str.Split(chrArray)[0];
         }
         else
         {
             player3.name = player.name;
         }
         playerFileDatum1.Player = player3;
         return playerFileDatum1;
     }
     return playerFileDatum;
 }
開發者ID:hastinbe,項目名稱:TerrariaAPI-Server,代碼行數:101,代碼來源:Player.cs

示例3: LoadPlayer


//.........這裏部分代碼省略.........
                         player.inventory[k].stack = binaryReader.ReadInt32();
                         if (num >= 36)
                         {
                             player.inventory[k].Prefix((int)binaryReader.ReadByte());
                         }
                     }
                     if (num >= 15)
                     {
                         for (int l = 44; l < 48; l++)
                         {
                             player.inventory[l].SetDefaults(Item.VersionName(binaryReader.ReadString(), num));
                             player.inventory[l].stack = binaryReader.ReadInt32();
                             if (num >= 36)
                             {
                                 player.inventory[l].Prefix((int)binaryReader.ReadByte());
                             }
                         }
                     }
                     for (int m = 0; m < Chest.maxItems; m++)
                     {
                         player.bank[m].SetDefaults(Item.VersionName(binaryReader.ReadString(), num));
                         player.bank[m].stack = binaryReader.ReadInt32();
                         if (num >= 36)
                         {
                             player.bank[m].Prefix((int)binaryReader.ReadByte());
                         }
                     }
                     if (num >= 20)
                     {
                         for (int n = 0; n < Chest.maxItems; n++)
                         {
                             player.bank2[n].SetDefaults(Item.VersionName(binaryReader.ReadString(), num));
                             player.bank2[n].stack = binaryReader.ReadInt32();
                             if (num >= 36)
                             {
                                 player.bank2[n].Prefix((int)binaryReader.ReadByte());
                             }
                         }
                     }
                     if (num >= 11)
                     {
                         for (int num2 = 0; num2 < 10; num2++)
                         {
                             player.buffType[num2] = binaryReader.ReadInt32();
                             player.buffTime[num2] = binaryReader.ReadInt32();
                         }
                     }
                     for (int num3 = 0; num3 < 200; num3++)
                     {
                         int num4 = binaryReader.ReadInt32();
                         if (num4 == -1)
                         {
                             break;
                         }
                         player.spX[num3] = num4;
                         player.spY[num3] = binaryReader.ReadInt32();
                         player.spI[num3] = binaryReader.ReadInt32();
                         player.spN[num3] = binaryReader.ReadString();
                     }
                     if (num >= 16)
                     {
                         player.hbLocked = binaryReader.ReadBoolean();
                     }
                     binaryReader.Close();
                 }
             }
             player.PlayerFrame();
             File.Delete(text);
             Player result = player;
             return result;
         }
     }
     catch
     {
         flag = true;
     }
     if (flag)
     {
         try
         {
             string text2 = playerPath + ".bak";
             Player result;
             if (File.Exists(text2))
             {
                 File.Delete(playerPath);
                 File.Move(text2, playerPath);
                 result = Player.LoadPlayer(playerPath);
                 return result;
             }
             result = new Player();
             return result;
         }
         catch
         {
             Player result = new Player();
             return result;
         }
     }
     return new Player();
 }
開發者ID:Recon1991,項目名稱:Terraria_TKM_Mod,代碼行數:101,代碼來源:Player.cs

示例4: LoadPlayer


//.........這裏部分代碼省略.........
                         {
                             player.armor[index].SetDefaults(Item.VersionName(binaryReader.ReadString(), release));
                             if (release >= 36)
                                 player.armor[index].Prefix((int)binaryReader.ReadByte());
                         }
                         if (release >= 6)
                         {
                             for (int index = 8; index < 11; ++index)
                             {
                                 player.armor[index].SetDefaults(Item.VersionName(binaryReader.ReadString(), release));
                                 if (release >= 36)
                                     player.armor[index].Prefix((int)binaryReader.ReadByte());
                             }
                         }
                         for (int index = 0; index < 44; ++index)
                         {
                             player.inventory[index].SetDefaults(Item.VersionName(binaryReader.ReadString(), release));
                             player.inventory[index].stack = binaryReader.ReadInt32();
                             if (release >= 36)
                                 player.inventory[index].Prefix((int)binaryReader.ReadByte());
                         }
                         if (release >= 15)
                         {
                             for (int index = 44; index < 48; ++index)
                             {
                                 player.inventory[index].SetDefaults(Item.VersionName(binaryReader.ReadString(), release));
                                 player.inventory[index].stack = binaryReader.ReadInt32();
                                 if (release >= 36)
                                     player.inventory[index].Prefix((int)binaryReader.ReadByte());
                             }
                         }
                         for (int index = 0; index < Chest.maxItems; ++index)
                         {
                             player.bank[index].SetDefaults(Item.VersionName(binaryReader.ReadString(), release));
                             player.bank[index].stack = binaryReader.ReadInt32();
                             if (release >= 36)
                                 player.bank[index].Prefix((int)binaryReader.ReadByte());
                         }
                         if (release >= 20)
                         {
                             for (int index = 0; index < Chest.maxItems; ++index)
                             {
                                 player.bank2[index].SetDefaults(Item.VersionName(binaryReader.ReadString(), release));
                                 player.bank2[index].stack = binaryReader.ReadInt32();
                                 if (release >= 36)
                                     player.bank2[index].Prefix((int)binaryReader.ReadByte());
                             }
                         }
                     }
                     if (release >= 11)
                     {
                         for (int index = 0; index < 10; ++index)
                         {
                             player.buffType[index] = binaryReader.ReadInt32();
                             player.buffTime[index] = binaryReader.ReadInt32();
                         }
                     }
                     for (int index = 0; index < 200; ++index)
                     {
                         int num = binaryReader.ReadInt32();
                         if (num != -1)
                         {
                             player.spX[index] = num;
                             player.spY[index] = binaryReader.ReadInt32();
                             player.spI[index] = binaryReader.ReadInt32();
                             player.spN[index] = binaryReader.ReadString();
                         }
                         else
                             break;
                     }
                     if (release >= 16)
                         player.hbLocked = binaryReader.ReadBoolean();
                     binaryReader.Close();
                 }
             }
             player.PlayerFrame();
             File.Delete(str);
             return player;
         }
     }
     catch
     {
         flag = true;
     }
     if (!flag)
         return new Player();
     try
     {
         string str = playerPath + ".bak";
         if (!File.Exists(str))
             return new Player();
         File.Delete(playerPath);
         File.Move(str, playerPath);
         return Player.LoadPlayer(playerPath);
     }
     catch
     {
         return new Player();
     }
 }
開發者ID:Icehawk78,項目名稱:TerrariaAPI-Server,代碼行數:101,代碼來源:Player.cs

示例5: LoadPlayer


//.........這裏部分代碼省略.........
								}
							}
							for (int num12 = 0; num12 < 20; num12++)
							{
								player.bank.item[num12].SetDefaults(Item.VersionName(binaryReader.ReadString(), num));
								player.bank.item[num12].stack = binaryReader.ReadInt32();
								if (num >= 36)
								{
									player.bank.item[num12].Prefix((int)binaryReader.ReadByte());
								}
							}
							if (num >= 20)
							{
								for (int num13 = 0; num13 < 20; num13++)
								{
									player.bank2.item[num13].SetDefaults(Item.VersionName(binaryReader.ReadString(), num));
									player.bank2.item[num13].stack = binaryReader.ReadInt32();
									if (num >= 36)
									{
										player.bank2.item[num13].Prefix((int)binaryReader.ReadByte());
									}
								}
							}
						}
						if (num < 58)
						{
							for (int num14 = 40; num14 < 48; num14++)
							{
								player.inventory[num14 + 10] = player.inventory[num14].Clone();
								player.inventory[num14].SetDefaults(0, false);
							}
						}
						if (num >= 11)
						{
							int num15 = 22;
							if (num < 74)
							{
								num15 = 10;
							}
							for (int num16 = 0; num16 < num15; num16++)
							{
								player.buffType[num16] = binaryReader.ReadInt32();
								player.buffTime[num16] = binaryReader.ReadInt32();
							}
						}
						for (int num17 = 0; num17 < 200; num17++)
						{
							int num18 = binaryReader.ReadInt32();
							if (num18 == -1)
							{
								break;
							}
							player.spX[num17] = num18;
							player.spY[num17] = binaryReader.ReadInt32();
							player.spI[num17] = binaryReader.ReadInt32();
							player.spN[num17] = binaryReader.ReadString();
						}
						if (num >= 16)
						{
							player.hbLocked = binaryReader.ReadBoolean();
						}
						binaryReader.Close();
					}
				}
				player.PlayerFrame();
				if (decryptedCopy)
				{
					Player.EncryptFile(text, playerPath);
					File.Delete(text);
				}
				else
				{
					File.Delete(text);
				}
				player.loadStatus = 0;
				result = player;
				return result;
			}
			catch
			{
			}
			Player player2 = new Player();
			player2.loadStatus = 2;
			if (player.name != "")
			{
				player2.name = player.name;
			}
			else
			{
				string[] array2 = playerPath.Split(new char[]
				{
					Path.DirectorySeparatorChar
				});
				player.name = array2[array2.Length - 1].Split(new char[]
				{
					'.'
				})[0];
			}
			return player2;
		}
開發者ID:NoviaDroid,項目名稱:TerrariaRefractoring_1.3.2.1,代碼行數:101,代碼來源:Player.cs

示例6: LoadPlayer

 public static Player LoadPlayer(string playerPath)
 {
     if (Main.rand == null)
     Main.rand = new Random((int) DateTime.Now.Ticks);
       Player player = new Player();
       bool flag;
       try
       {
     string str = playerPath + ".dat";
     flag = Player.DecryptFile(playerPath, str);
     if (!flag)
     {
       using (FileStream fileStream = new FileStream(str, FileMode.Open))
       {
     using (BinaryReader binaryReader = new BinaryReader((Stream) fileStream))
     {
       int release = binaryReader.ReadInt32();
       player.name = binaryReader.ReadString();
       player.hair = binaryReader.ReadInt32();
       player.statLife = binaryReader.ReadInt32();
       player.statLifeMax = binaryReader.ReadInt32();
       if (player.statLife > player.statLifeMax)
         player.statLife = player.statLifeMax;
       player.statMana = binaryReader.ReadInt32();
       player.statManaMax = binaryReader.ReadInt32();
       if (player.statMana > player.statManaMax)
         player.statMana = player.statManaMax;
       player.hairColor.R = binaryReader.ReadByte();
       player.hairColor.G = binaryReader.ReadByte();
       player.hairColor.B = binaryReader.ReadByte();
       player.skinColor.R = binaryReader.ReadByte();
       player.skinColor.G = binaryReader.ReadByte();
       player.skinColor.B = binaryReader.ReadByte();
       player.eyeColor.R = binaryReader.ReadByte();
       player.eyeColor.G = binaryReader.ReadByte();
       player.eyeColor.B = binaryReader.ReadByte();
       player.shirtColor.R = binaryReader.ReadByte();
       player.shirtColor.G = binaryReader.ReadByte();
       player.shirtColor.B = binaryReader.ReadByte();
       player.underShirtColor.R = binaryReader.ReadByte();
       player.underShirtColor.G = binaryReader.ReadByte();
       player.underShirtColor.B = binaryReader.ReadByte();
       player.pantsColor.R = binaryReader.ReadByte();
       player.pantsColor.G = binaryReader.ReadByte();
       player.pantsColor.B = binaryReader.ReadByte();
       player.shoeColor.R = binaryReader.ReadByte();
       player.shoeColor.G = binaryReader.ReadByte();
       player.shoeColor.B = binaryReader.ReadByte();
       for (int index = 0; index < 8; ++index)
         player.armor[index].SetDefaults(Item.VersionName(binaryReader.ReadString(), release));
       if (release >= 6)
       {
         for (int index = 8; index < 11; ++index)
           player.armor[index].SetDefaults(Item.VersionName(binaryReader.ReadString(), release));
       }
       for (int index = 0; index < 44; ++index)
       {
         player.inventory[index].SetDefaults(Item.VersionName(binaryReader.ReadString(), release));
         player.inventory[index].stack = binaryReader.ReadInt32();
       }
       for (int index = 0; index < Chest.maxItems; ++index)
       {
         player.bank[index].SetDefaults(Item.VersionName(binaryReader.ReadString(), release));
         player.bank[index].stack = binaryReader.ReadInt32();
       }
       for (int index = 0; index < 200; ++index)
       {
         int num = binaryReader.ReadInt32();
         if (num != -1)
         {
           player.spX[index] = num;
           player.spY[index] = binaryReader.ReadInt32();
           player.spI[index] = binaryReader.ReadInt32();
           player.spN[index] = binaryReader.ReadString();
         }
         else
           break;
       }
       binaryReader.Close();
     }
       }
       player.PlayerFrame();
       File.Delete(str);
       return player;
     }
       }
       catch
       {
     flag = true;
       }
       if (flag)
       {
     string str = playerPath + ".bak";
     if (File.Exists(str))
     {
       File.Delete(playerPath);
       File.Move(str, playerPath);
       return Player.LoadPlayer(playerPath);
     }
     else
//.........這裏部分代碼省略.........
開發者ID:Azerothian,項目名稱:TerrariaLinux,代碼行數:101,代碼來源:Player.cs

示例7: LoadPlayer

 public static Player LoadPlayer(string playerPath)
 {
     bool flag = false;
     if (Main.rand == null)
     {
         Main.rand = new System.Random((int)System.DateTime.Now.Ticks);
     }
     Player player = new Player();
     Player result;
     try
     {
         string text = playerPath + ".dat";
         flag = Player.DecryptFile(playerPath, text);
         if (!flag)
         {
             using (System.IO.FileStream fileStream = new System.IO.FileStream(text, System.IO.FileMode.Open))
             {
                 using (System.IO.BinaryReader binaryReader = new System.IO.BinaryReader(fileStream))
                 {
                     int release = binaryReader.ReadInt32();
                     player.name = binaryReader.ReadString();
                     player.hair = binaryReader.ReadInt32();
                     player.statLife = binaryReader.ReadInt32();
                     player.statLifeMax = binaryReader.ReadInt32();
                     if (player.statLife > player.statLifeMax)
                     {
                         player.statLife = player.statLifeMax;
                     }
                     player.statMana = binaryReader.ReadInt32();
                     player.statManaMax = binaryReader.ReadInt32();
                     if (player.statMana > player.statManaMax)
                     {
                         player.statMana = player.statManaMax;
                     }
                     player.hairColor.R = binaryReader.ReadByte();
                     player.hairColor.G = binaryReader.ReadByte();
                     player.hairColor.B = binaryReader.ReadByte();
                     player.skinColor.R = binaryReader.ReadByte();
                     player.skinColor.G = binaryReader.ReadByte();
                     player.skinColor.B = binaryReader.ReadByte();
                     player.eyeColor.R = binaryReader.ReadByte();
                     player.eyeColor.G = binaryReader.ReadByte();
                     player.eyeColor.B = binaryReader.ReadByte();
                     player.shirtColor.R = binaryReader.ReadByte();
                     player.shirtColor.G = binaryReader.ReadByte();
                     player.shirtColor.B = binaryReader.ReadByte();
                     player.underShirtColor.R = binaryReader.ReadByte();
                     player.underShirtColor.G = binaryReader.ReadByte();
                     player.underShirtColor.B = binaryReader.ReadByte();
                     player.pantsColor.R = binaryReader.ReadByte();
                     player.pantsColor.G = binaryReader.ReadByte();
                     player.pantsColor.B = binaryReader.ReadByte();
                     player.shoeColor.R = binaryReader.ReadByte();
                     player.shoeColor.G = binaryReader.ReadByte();
                     player.shoeColor.B = binaryReader.ReadByte();
                     for (int i = 0; i < 8; i++)
                     {
                         player.armor[i].SetDefaults(Item.VersionName(binaryReader.ReadString(), release));
                     }
                     for (int i = 0; i < 44; i++)
                     {
                         player.inventory[i].SetDefaults(Item.VersionName(binaryReader.ReadString(), release));
                         player.inventory[i].stack = binaryReader.ReadInt32();
                     }
                     for (int i = 0; i < Chest.maxItems; i++)
                     {
                         player.bank[i].SetDefaults(Item.VersionName(binaryReader.ReadString(), release));
                         player.bank[i].stack = binaryReader.ReadInt32();
                     }
                     for (int i = 0; i < 200; i++)
                     {
                         int num = binaryReader.ReadInt32();
                         if (num == -1)
                         {
                             break;
                         }
                         player.spX[i] = num;
                         player.spY[i] = binaryReader.ReadInt32();
                         player.spI[i] = binaryReader.ReadInt32();
                         player.spN[i] = binaryReader.ReadString();
                     }
                     binaryReader.Close();
                 }
             }
             player.PlayerFrame();
             System.IO.File.Delete(text);
             result = player;
             return result;
         }
     }
     catch
     {
         flag = true;
     }
     if (flag)
     {
         string text2 = playerPath + ".bak";
         if (System.IO.File.Exists(text2))
         {
             System.IO.File.Delete(playerPath);
//.........這裏部分代碼省略.........
開發者ID:pandabear41,項目名稱:tLinux,代碼行數:101,代碼來源:Player.cs

示例8: LoadPlayer


//.........這裏部分代碼省略.........
                     if (num >= 11)
                     {
                         int num26 = 22;
                         if (num < 74)
                         {
                             num26 = 10;
                         }
                         for (int num27 = 0; num27 < num26; num27++)
                         {
                             player.buffType[num27] = binaryReader.ReadInt32();
                             player.buffTime[num27] = binaryReader.ReadInt32();
                             if (player.buffType[num27] == 0)
                             {
                                 num27--;
                                 num26--;
                             }
                         }
                     }
                     for (int num28 = 0; num28 < 200; num28++)
                     {
                         int num29 = binaryReader.ReadInt32();
                         if (num29 == -1)
                         {
                             break;
                         }
                         player.spX[num28] = num29;
                         player.spY[num28] = binaryReader.ReadInt32();
                         player.spI[num28] = binaryReader.ReadInt32();
                         player.spN[num28] = binaryReader.ReadString();
                     }
                     if (num >= 16)
                     {
                         player.hbLocked = binaryReader.ReadBoolean();
                     }
                     if (num >= 115)
                     {
                         int num30 = 13;
                         for (int num31 = 0; num31 < num30; num31++)
                         {
                             player.hideInfo[num31] = binaryReader.ReadBoolean();
                         }
                     }
                     if (num >= 98)
                     {
                         player.anglerQuestsFinished = binaryReader.ReadInt32();
                     }
                     player.skinVariant = (int)MathHelper.Clamp((float)player.skinVariant, 0f, 7f);
                     for (int num32 = 3; num32 < 8 + player.extraAccessorySlots; num32++)
                     {
                         int type = player.armor[num32].type;
                         if (type == 908)
                         {
                             player.lavaMax += 420;
                         }
                         if (type == 906)
                         {
                             player.lavaMax += 420;
                         }
                         if (player.wingsLogic == 0 && player.armor[num32].wingSlot >= 0)
                         {
                             player.wingsLogic = (int)player.armor[num32].wingSlot;
                         }
                         if (type == 158 || type == 396 || type == 1250 || type == 1251 || type == 1252)
                         {
                             player.noFallDmg = true;
                         }
                         player.lavaTime = player.lavaMax;
                     }
                 }
             }
         }
         player.PlayerFrame();
         player.loadStatus = 0;
         playerFileData.Player = player;
         result = playerFileData;
         return result;
     }
     catch
     {
     }
     Player player2 = new Player();
     player2.loadStatus = 2;
     if (player.name != "")
     {
         player2.name = player.name;
     }
     else
     {
         string[] array = playerPath.Split(new char[]
             {
                 Path.DirectorySeparatorChar
             });
         player.name = array[array.Length - 1].Split(new char[]
             {
                 '.'
             })[0];
     }
     playerFileData.Player = player2;
     return playerFileData;
 }
開發者ID:itamargreen,項目名稱:ModLoader,代碼行數:101,代碼來源:Player.cs

示例9: LoadPlayer


//.........這裏部分代碼省略.........
                             {
                                 player.inventory[num9].SetDefaults(Item.VersionName(binaryReader.ReadString(), num));
                                 player.inventory[num9].stack = binaryReader.ReadInt32();
                                 if (num >= 36)
                                 {
                                     player.inventory[num9].Prefix((int)binaryReader.ReadByte());
                                 }
                             }
                         }
                         for (int num10 = 0; num10 < 20; num10++)
                         {
                             player.bank[num10].SetDefaults(Item.VersionName(binaryReader.ReadString(), num));
                             player.bank[num10].stack = binaryReader.ReadInt32();
                             if (num >= 36)
                             {
                                 player.bank[num10].Prefix((int)binaryReader.ReadByte());
                             }
                         }
                         if (num >= 20)
                         {
                             for (int num11 = 0; num11 < 20; num11++)
                             {
                                 player.bank2[num11].SetDefaults(Item.VersionName(binaryReader.ReadString(), num));
                                 player.bank2[num11].stack = binaryReader.ReadInt32();
                                 if (num >= 36)
                                 {
                                     player.bank2[num11].Prefix((int)binaryReader.ReadByte());
                                 }
                             }
                         }
                     }
                     if (num < 58)
                     {
                         for (int num12 = 40; num12 < 48; num12++)
                         {
                             player.inventory[num12 + 10] = (Item)player.inventory[num12].Clone();
                             player.inventory[num12].SetDefaults(0, false);
                         }
                     }
                     if (num >= 11)
                     {
                         for (int num13 = 0; num13 < 10; num13++)
                         {
                             player.buffType[num13] = binaryReader.ReadInt32();
                             player.buffTime[num13] = binaryReader.ReadInt32();
                         }
                     }
                     for (int num14 = 0; num14 < 200; num14++)
                     {
                         int num15 = binaryReader.ReadInt32();
                         if (num15 == -1)
                         {
                             break;
                         }
                         player.spX[num14] = num15;
                         player.spY[num14] = binaryReader.ReadInt32();
                         player.spI[num14] = binaryReader.ReadInt32();
                         player.spN[num14] = binaryReader.ReadString();
                     }
                     if (num >= 16)
                     {
                         player.hbLocked = binaryReader.ReadBoolean();
                     }
                     binaryReader.Close();
                 }
             }
             player.PlayerFrame();
             File.Delete(text);
             Player result = player;
             return result;
         }
     }
     catch
     {
         flag = true;
     }
     if (flag)
     {
         try
         {
             string text2 = playerPath + ".bak";
             Player result;
             if (File.Exists(text2))
             {
                 File.Delete(playerPath);
                 File.Move(text2, playerPath);
                 result = Player.LoadPlayer(playerPath);
                 return result;
             }
             result = new Player();
             return result;
         }
         catch
         {
             Player result = new Player();
             return result;
         }
     }
     return new Player();
 }
開發者ID:stevenh,項目名稱:TerrariaAPI-Server,代碼行數:101,代碼來源:Player.cs

示例10: LoadPlayer


//.........這裏部分代碼省略.........
                             if (release >= 36)
                                 player1.bank.item[index].Prefix((int)binaryReader.ReadByte());
                         }
                         if (release >= 20)
                         {
                             for (int index = 0; index < 20; ++index)
                             {
                                 player1.bank2.item[index].SetDefaults(Item.VersionName(binaryReader.ReadString(), release));
                                 player1.bank2.item[index].stack = binaryReader.ReadInt32();
                                 if (release >= 36)
                                     player1.bank2.item[index].Prefix((int)binaryReader.ReadByte());
                             }
                         }
                     }
                     if (release < 58)
                     {
                         for (int index = 40; index < 48; ++index)
                         {
                             player1.inventory[index + 10] = player1.inventory[index].Clone();
                             player1.inventory[index].SetDefaults(0, false);
                         }
                     }
                     if (release >= 11)
                     {
                         int num = 22;
                         if (release < 74)
                             num = 10;
                         for (int index = 0; index < num; ++index)
                         {
                             player1.buffType[index] = binaryReader.ReadInt32();
                             player1.buffTime[index] = binaryReader.ReadInt32();
                             if (player1.buffType[index] == 0)
                             {
                                 --index;
                                 --num;
                             }
                         }
                     }
                     for (int index = 0; index < 200; ++index)
                     {
                         int num = binaryReader.ReadInt32();
                         if (num != -1)
                         {
                             player1.spX[index] = num;
                             player1.spY[index] = binaryReader.ReadInt32();
                             player1.spI[index] = binaryReader.ReadInt32();
                             player1.spN[index] = binaryReader.ReadString();
                         }
                         else
                             break;
                     }
                     if (release >= 16)
                         player1.hbLocked = binaryReader.ReadBoolean();
                     if (release >= 115)
                     {
                         int num = 13;
                         for (int index = 0; index < num; ++index)
                             player1.hideInfo[index] = binaryReader.ReadBoolean();
                     }
                     if (release >= 98)
                         player1.anglerQuestsFinished = binaryReader.ReadInt32();
                     player1.skinVariant = (int)MathHelper.Clamp((float)player1.skinVariant, 0.0f, 7f);
                     for (int index = 3; index < 8 + player1.extraAccessorySlots; ++index)
                     {
                         int num = player1.armor[index].itemId;
                         if (num == 908)
                             player1.lavaMax += 420;
                         if (num == 906)
                             player1.lavaMax += 420;
                         if (player1.wingsLogic == 0 && (int)player1.armor[index].wingSlot >= 0)
                             player1.wingsLogic = (int)player1.armor[index].wingSlot;
                         if (num == 158 || num == 396 || (num == 1250 || num == 1251) || num == 1252)
                             player1.noFallDmg = true;
                         player1.lavaTime = player1.lavaMax;
                     }
                 }
             }
         }
         player1.PlayerFrame();
         player1.loadStatus = 0;
         playerFileData.Player = player1;
         return playerFileData;
     }
     catch
     {
     }
     Player player2 = new Player();
     player2.loadStatus = 2;
     if (player1.name != "")
     {
         player2.name = player1.name;
     }
     else
     {
         string[] strArray = playerPath.Split(Path.DirectorySeparatorChar);
         player1.name = strArray[strArray.Length - 1].Split('.')[0];
     }
     playerFileData.Player = player2;
     return playerFileData;
 }
開發者ID:EmuDevs,項目名稱:EDTerraria,代碼行數:101,代碼來源:Player.cs


注:本文中的Terraria.Player.PlayerFrame方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。