当前位置: 首页>>代码示例>>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;未经允许,请勿转载。