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


C# Player.SetSSCReadyForSave方法代碼示例

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


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

示例1: ApplyToPlayer


//.........這裏部分代碼省略.........
            //            try
            //            {
            //                //Reset and populate inventory
            //                //                player.inventory = Enumerable.Repeat(new Item(){ name = String.Empty }, player.inventory.Length).ToArray();
            //                player.inventory = new Item[player.inventory.Length];
            //                for (var i = 0; i < player.inventory.Length; i++)
            //                {
            //                    player.inventory[i] = new Item();
            //                    player.inventory[i].name = String.Empty;
            //                    player.inventory[i].SetDefaults(0);
            //                }
            //
            //                if (this.Inventory != null)
            //                    foreach (var slotItem in this.Inventory)
            //                    {
            //                        var item = player.inventory[slotItem.Slot];
            //
            //                        item.netDefaults(slotItem.NetId);
            //                        item.stack = slotItem.Stack;
            //                        item.Prefix(slotItem.Prefix);
            //                        item.favorited = slotItem.Favorite;
            //
            //                        player.inventory[slotItem.Slot] = item;
            //                    }
            //            }
            //            catch (Exception e)
            //            {
            //                ProgramLog.Log(e, "Failed to apply player inventory");
            //            }
            //
            //            try
            //            {
            //                //Reset and populate dye
            //                //                player.dye = Enumerable.Repeat(new Item(){ name = String.Empty }, player.dye.Length).ToArray();
            //                player.dye = new Item[player.dye.Length];
            //                for (var i = 0; i < player.dye.Length; i++)
            //                {
            //                    player.dye[i] = new Item();
            //                    player.dye[i].name = String.Empty;
            //                    player.dye[i].SetDefaults(0);
            //                }
            //                if (this.Dye != null)
            //                    foreach (var slotItem in this.Dye)
            //                    {
            //                        var item = player.dye[slotItem.Slot];
            //
            //                        item.netDefaults(slotItem.NetId);
            //                        item.stack = slotItem.Stack;
            //                        item.Prefix(slotItem.Prefix);
            //                        item.favorited = slotItem.Favorite;
            //
            //                        player.dye[slotItem.Slot] = item;
            //                    }
            //            }
            //            catch (Exception e)
            //            {
            //                ProgramLog.Log(e, "Failed to apply player dye");
            //            }
            //
            //            try
            //            {
            //                //Reset and populate armor
            //                //                player.armor = Enumerable.Repeat(new Item(){ name = String.Empty }, player.armor.Length).ToArray();
            //                player.armor = new Item[player.armor.Length];
            //                for (var i = 0; i < player.armor.Length; i++)
            //                {
            //                    player.armor[i] = new Item();
            //                    player.armor[i].name = String.Empty;
            //                    player.armor[i].SetDefaults(0);
            //                }
            //                if (this.Armor != null)
            //                    foreach (var slotItem in this.Armor)
            //                    {
            //                        var item = player.armor[slotItem.Slot];
            //
            //                        item.netDefaults(slotItem.NetId);
            //                        item.stack = slotItem.Stack;
            //                        item.Prefix(slotItem.Prefix);
            //                        item.favorited = slotItem.Favorite;
            //
            //                        player.armor[slotItem.Slot] = item;
            //                    }
            //            }
            //            catch (Exception e)
            //            {
            //                ProgramLog.Log(e, "Failed to apply player armor");
            //            }

            try
            {
                //Update client
                this.Send(player);
            }
            catch (Exception e)
            {
                ProgramLog.Log(e, "Failed to send player data");
            }

            player.SetSSCReadyForSave(true);
        }
開發者ID:carriercomm,項目名稱:Terraria-s-Dedicated-Server-Mod,代碼行數:101,代碼來源:ServerCharacter.cs

示例2: ApplyToPlayer


//.........這裏部分代碼省略.........

                player.hair = this.Hair;
                player.difficulty = this.Difficulty;

                player.hairColor = this.HairColor;
                player.skinColor = this.SkinColor;
                player.eyeColor = this.EyeColor;
                player.shirtColor = this.ShirtColor;
                player.underShirtColor = this.UnderShirtColor;
                player.pantsColor = this.PantsColor;
                player.shoeColor = this.ShoeColor;

                player.anglerQuestsFinished = this.AnglerQuests;

                //Trash
                player.trashItem = new Item();
                player.trashItem.name = String.Empty;
                player.trashItem.SetDefaults(0);
                if (this.Trash != null)
                {
                    player.trashItem.netDefaults(this.Trash.NetId);
                    player.trashItem.stack = this.Trash.Stack;
                    player.trashItem.Prefix(this.Trash.Prefix);
                    player.trashItem.favorited = this.Trash.Favorite;
                }
            }
            catch (Exception e)
            {
                ProgramLog.Log(e, "Failed to apply player settings");
            }

            try
            {
                ApplyItems(ref player.inventory, this.Inventory);
            }
            catch (Exception e)
            {
                ProgramLog.Log(e, "Failed to apply player inventory");
            }
            try
            {
                ApplyItems(ref player.armor, this.Armor);
            }
            catch (Exception e)
            {
                ProgramLog.Log(e, "Failed to apply player armor");
            }
            try
            {
                ApplyItems(ref player.dye, this.Dye);
            }
            catch (Exception e)
            {
                ProgramLog.Log(e, "Failed to apply player dye");
            }
            try
            {
                ApplyItems(ref player.miscEquips, this.Equipment);
            }
            catch (Exception e)
            {
                ProgramLog.Log(e, "Failed to apply player equipment");
            }
            try
            {
                ApplyItems(ref player.miscDyes, this.MiscDyes);
            }
            catch (Exception e)
            {
                ProgramLog.Log(e, "Failed to apply player misc dyes");
            }
            try
            {
                ApplyItems(ref player.bank.item, this.Bank);
            }
            catch (Exception e)
            {
                ProgramLog.Log(e, "Failed to apply player bank items");
            }
            try
            {
                ApplyItems(ref player.bank2.item, this.Bank2);
            }
            catch (Exception e)
            {
                ProgramLog.Log(e, "Failed to apply player bank (2) items");
            }

            try
            {
                //Update client
                this.Send(player);
            }
            catch (Exception e)
            {
                ProgramLog.Log(e, "Failed to send player data");
            }

            player.SetSSCReadyForSave(true);
        }
開發者ID:DeathCradle,項目名稱:Terraria-s-Dedicated-Server-Mod,代碼行數:101,代碼來源:ServerCharacter.cs


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