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


C# Objects.GetByte方法代碼示例

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


在下文中一共展示了Objects.GetByte方法的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.GetByte方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。