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


C# Player.ClearPluginData方法代碼示例

本文整理匯總了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);

//.........這裏部分代碼省略.........
開發者ID:Narkun,項目名稱:Terraria-s-Dedicated-Server-Mod,代碼行數:101,代碼來源:CharacterManager.cs


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