当前位置: 首页>>代码示例>>C#>>正文


C# Objects.GetString方法代码示例

本文整理汇总了C#中System.Objects.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# Objects.GetString方法的具体用法?C# Objects.GetString怎么用?C# Objects.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Objects的用法示例。


在下文中一共展示了Objects.GetString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Load

 /// <summary>
 /// Loads data (waypoints, loot, targets, settings) from a binary file loaded into a Objects.Packet object.
 /// </summary>
 /// <param name="version">The version of LibreBot which created the file.</param>
 /// <param name="p">The Objects.Packet object.</param>
 /// <returns></returns>
 private bool Load(ushort version, Objects.Packet p)
 {
     while (p.GetPosition < p.Length)
     {
         Enums.CavebotDatType type = (Enums.CavebotDatType)p.GetByte();
         ushort count = 0;
         switch (type)
         {
             case Enums.CavebotDatType.Settings:
                 switch (version)
                 {
                     case 212:
                     case 213:
                         this.CurrentSettings.EatFood = p.GetBool();
                         this.CurrentSettings.Exhaust = p.GetUInt16();
                         this.CurrentSettings.MinimumHealthToShoot = p.GetUInt16();
                         this.CurrentSettings.NodeRadius = p.GetByte();
                         this.CurrentSettings.NodeSkipRange = p.GetByte();
                         this.CurrentSettings.OpenContainers = p.GetBool();
                         this.CurrentSettings.PrioritizeDanger = p.GetBool();
                         this.CurrentSettings.StickToCreature = p.GetBool();
                         this.CurrentSettings.StopAttackingWhenOutOfRange = p.GetBool();
                         this.CurrentSettings.UseGoldStacks = p.GetBool();
                         this.CurrentSettings.CanUseMagicRope = p.GetBool();
                         this.CurrentSettings.UseAlternateNodeFinder = p.GetBool();
                         this.CurrentSettings.KillBeforeLooting = p.GetBool();
                         break;
                     default:
                         this.CurrentSettings.EatFood = p.GetBool();
                         this.CurrentSettings.Exhaust = p.GetUInt16();
                         this.CurrentSettings.MinimumHealthToShoot = p.GetUInt16();
                         this.CurrentSettings.NodeRadius = p.GetByte();
                         this.CurrentSettings.NodeSkipRange = p.GetByte();
                         this.CurrentSettings.OpenContainers = p.GetBool();
                         this.CurrentSettings.PrioritizeDanger = p.GetBool();
                         this.CurrentSettings.StickToCreature = p.GetBool();
                         this.CurrentSettings.StopAttackingWhenOutOfRange = p.GetBool();
                         this.CurrentSettings.UseGoldStacks = p.GetBool();
                         this.CurrentSettings.CanUseMagicRope = p.GetBool();
                         break;
                 }
                 break;
             case Enums.CavebotDatType.Loot:
                 count = p.GetUInt16();
                 for (int i = 0; i < count; i++)
                 {
                     switch (version)
                     {
                         default:
                             Loot l = new Loot();
                             l.ID = p.GetUInt16();
                             l.Name = p.GetString();
                             l.Cap = p.GetUInt16();
                             string destination = p.GetString();
                             switch (destination.ToLower())
                             {
                                 case "ground":
                                     l.Destination = Loot.Destinations.Ground;
                                     break;
                                 default:
                                     l.Destination = Loot.Destinations.EmptyContainer;
                                     l.Index = byte.Parse(destination[1].ToString());
                                     break;
                             }
                             this.AddLoot(l);
                             break;
                         case 213:
                             this.AddLoot(new Loot(p.GetUInt16(),
                                 p.GetString(),
                                 p.GetUInt16(),
                                 (Loot.Destinations)p.GetByte(),
                                 p.GetByte()));
                             break;
                     }
                 }
                 break;
             case Enums.CavebotDatType.Targetting:
                 count = p.GetUInt16();
                 for (int i = 0; i < count; i++)
                 {
                     Target t = new Target(this);
                     t.Name = p.GetString();
                     if (version < 212) // load old settings (single setting environment)
                     {
                         Target.Setting setting = new Target.Setting(t);
                         setting.Count = p.GetByte();
                         setting.Range = p.GetByte();
                         setting.DistanceRange = 3;
                         setting.FightMode = (Enums.FightMode)p.GetByte();
                         setting.FightStance = (Enums.FightStance)p.GetByte();
                         p.GetString(); // ring
                         p.GetString(); // rune
                         setting.Spell = p.GetString();
                         setting.DangerLevel = p.GetByte();
//.........这里部分代码省略.........
开发者ID:KyLuaa,项目名称:bot,代码行数:101,代码来源:Cavebot.cs


注:本文中的System.Objects.GetString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。