本文整理匯總了C#中Terraria.Player.ClearPluginData方法的典型用法代碼示例。如果您正苦於以下問題:C# Player.ClearPluginData方法的具體用法?C# Player.ClearPluginData怎麽用?C# Player.ClearPluginData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Terraria.Player
的用法示例。
在下文中一共展示了Player.ClearPluginData方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: SavePlayerData
public static bool SavePlayerData(Player player)
{
//If using a flat based system ensure the MODE is stored
string authName = null;
if (Mode == CharacterMode.AUTH)
{
if (!String.IsNullOrEmpty(player.AuthenticatedAs))
authName = player.AuthenticatedAs;
}
else if (Mode == CharacterMode.UUID)
{
if (!String.IsNullOrEmpty(player.ClientUUId))
authName = player.ClientUUId + '@' + player.name;
}
if (!String.IsNullOrEmpty(authName))
{
if (Storage.IsAvailable)
{
// var create = player.GetPluginData<Boolean>(Key_NewCharacter, false);
var existingId = Tables.CharacterTable.GetCharacterId(Mode, player.AuthenticatedAs, player.ClientUUId);
if (existingId <= 0)
{
if (player.ClearPluginData(Key_NewCharacter))
{
var characterId = Tables.CharacterTable.NewCharacter
(
Mode,
player.AuthenticatedAs,
player.ClientUUId,
player.statLife,
player.statLifeMax,
player.statMana,
player.statManaMax,
player.SpawnX,
player.SpawnY,
player.hair,
player.hairDye,
player.hideVisual,
player.difficulty,
player.hairColor,
player.skinColor,
player.eyeColor,
player.shirtColor,
player.underShirtColor,
player.pantsColor,
player.shoeColor,
player.anglerQuestsFinished
);
if (characterId > 0)
{
}
}
else
{
ProgramLog.Error.Log("Failed to save SSC for player: {0}", player.Name);
}
}
else
{
Tables.CharacterTable.UpdateCharacter
(
Mode,
player.AuthenticatedAs,
player.ClientUUId,
player.statLife,
player.statLifeMax,
player.statMana,
player.statManaMax,
player.SpawnX,
player.SpawnY,
player.hair,
player.hairDye,
player.hideVisual,
player.difficulty,
player.hairColor,
player.skinColor,
player.eyeColor,
player.shirtColor,
player.underShirtColor,
player.pantsColor,
player.shoeColor,
player.anglerQuestsFinished
);
var characterId = Tables.CharacterTable.GetCharacterId(Mode, player.AuthenticatedAs, player.ClientUUId);
if (characterId > 0)
{
}
}
}
else
{
var dir = Path.Combine(Globals.CharacterDataPath, Mode.ToString());
if (!Directory.Exists(dir))
Directory.CreateDirectory(dir);
//.........這裏部分代碼省略.........