public void FillTest4() { string message = File.ReadAllText("..\\..\\..\\TestFiles\\Client_v7_4\\slots.txt"); var slotCollection = new SlotCollection(); slotCollection.Fill(JsonMessageConnection.GetNextJsonMessage(ref message)); Assert.AreEqual(3, slotCollection.Count); Assert.AreEqual(0, slotCollection[0].Id); Assert.AreEqual("RUNNING", slotCollection[0].Status); Assert.AreEqual(FahSlotStatus.Running, slotCollection[0].StatusEnum); Assert.AreEqual("smp:4", slotCollection[0].Description); Assert.AreEqual("beta", slotCollection[0].SlotOptions.FahClientType); Assert.AreEqual(FahClientType.Beta, slotCollection[0].SlotOptions.FahClientTypeEnum); Assert.AreEqual("big", slotCollection[0].SlotOptions.MaxPacketSize); Assert.AreEqual(MaxPacketSize.Big, slotCollection[0].SlotOptions.MaxPacketSizeEnum); Assert.AreEqual(100, slotCollection[0].SlotOptions.NextUnitPercentage); Assert.AreEqual(1, slotCollection[1].Id); Assert.AreEqual("RUNNING", slotCollection[1].Status); Assert.AreEqual(FahSlotStatus.Running, slotCollection[1].StatusEnum); Assert.AreEqual("gpu:0:\"GT200 [GeForce GTX 260]\"", slotCollection[1].Description); Assert.AreEqual("beta", slotCollection[1].SlotOptions.FahClientType); Assert.AreEqual(FahClientType.Beta, slotCollection[1].SlotOptions.FahClientTypeEnum); Assert.AreEqual("low", slotCollection[1].SlotOptions.CorePriority); Assert.AreEqual(CorePriority.Low, slotCollection[1].SlotOptions.CorePriorityEnum); Assert.AreEqual(2, slotCollection[2].Id); Assert.AreEqual("RUNNING", slotCollection[2].Status); Assert.AreEqual(FahSlotStatus.Running, slotCollection[2].StatusEnum); Assert.AreEqual("gpu:1:\"G92 [GeForce 9800 GTX]\"", slotCollection[2].Description); Assert.AreEqual("beta", slotCollection[2].SlotOptions.FahClientType); Assert.AreEqual(FahClientType.Beta, slotCollection[2].SlotOptions.FahClientTypeEnum); Assert.AreEqual("low", slotCollection[2].SlotOptions.CorePriority); Assert.AreEqual(CorePriority.Low, slotCollection[2].SlotOptions.CorePriorityEnum); }
public void FillTest3() { string message = File.ReadAllText("..\\..\\..\\TestFiles\\Client_v7_3\\slots.txt"); var slotCollection = new SlotCollection(); slotCollection.Fill(JsonMessageConnection.GetNextJsonMessage(ref message)); Assert.AreEqual(1, slotCollection.Count); Assert.AreEqual(0, slotCollection[0].Id); Assert.AreEqual("RUNNING", slotCollection[0].Status); Assert.AreEqual(FahSlotStatus.Running, slotCollection[0].StatusEnum); Assert.AreEqual("smp:8", slotCollection[0].Description); }
public void FillTest1() { string message = File.ReadAllText("..\\..\\..\\TestFiles\\Client_v7_1\\slots.txt"); var slotCollection = new SlotCollection(); slotCollection.Fill(MessageCache.GetNextJsonMessage(ref message)); Assert.AreEqual(1, slotCollection.Count); Assert.AreEqual(0, slotCollection[0].Id); Assert.AreEqual("RUNNING", slotCollection[0].Status); Assert.AreEqual(FahSlotStatus.Running, slotCollection[0].StatusEnum); Assert.AreEqual("smp:4", slotCollection[0].Description); Assert.AreEqual(true, slotCollection[0].SlotOptions.PauseOnStart); }
public void FahClientSettingsModel_RefreshSlots_FromClientObjectModel() { // Arrange var model = new FahClientSettingsModel(); var slotCollection = new SlotCollection(); var slotOptions = new SlotOptions { { Options.ClientType, "foo" }, { Options.MaxPacketSize, "bar" } }; slotCollection.Add(new Slot { ID = 0, Description = "cpu:15", SlotOptions = slotOptions }); // Act model.RefreshSlots(slotCollection); // Assert Assert.AreEqual(1, model.Slots.Count); var slotModel = model.Slots.First(); Assert.AreEqual("00", slotModel.ID); Assert.AreEqual("CPU", slotModel.SlotType); Assert.AreEqual("foo", slotModel.ClientType); Assert.AreEqual("bar", slotModel.MaxPacketSize); }
public void FillTest7() { string message = File.ReadAllText("..\\..\\..\\TestFiles\\Client_v7_7\\slots.txt"); var slotCollection = new SlotCollection(); slotCollection.Fill(MessageCache.GetNextJsonMessage(ref message)); Assert.AreEqual(2, slotCollection.Count); Assert.AreEqual(0, slotCollection[0].Id); Assert.AreEqual("FINISHING", slotCollection[0].Status); Assert.AreEqual(FahSlotStatus.Finishing, slotCollection[0].StatusEnum); Assert.AreEqual("smp:4", slotCollection[0].Description); Assert.AreEqual("beta", slotCollection[0].SlotOptions.FahClientType); Assert.AreEqual(FahClientType.Beta, slotCollection[0].SlotOptions.FahClientTypeEnum); Assert.AreEqual("big", slotCollection[0].SlotOptions.MaxPacketSize); Assert.AreEqual(MaxPacketSize.Big, slotCollection[0].SlotOptions.MaxPacketSizeEnum); Assert.AreEqual(100, slotCollection[0].SlotOptions.NextUnitPercentage); Assert.AreEqual(1, slotCollection[1].Id); Assert.AreEqual("RUNNING", slotCollection[1].Status); Assert.AreEqual(FahSlotStatus.Running, slotCollection[1].StatusEnum); Assert.AreEqual("gpu:0:\"GF106 [GeForce 450 GTS]\"", slotCollection[1].Description); }
private async void FahClientMessageReceived(FahClientMessage message) { AppendTextToMessageDisplayTextBox(String.Empty); AppendTextToMessageDisplayTextBox(FahClientMessageHelper.FormatForDisplay(message)); var identifier = message.Identifier.ToString(); AddTextToStatusMessageListBox(identifier); SetStatusLabelText(identifier); FahClientDataReceived(message.MessageText.Length); if (message.Identifier.MessageType == FahClientMessageType.SlotInfo) { if (message.MessageFormat == FahClientMessage.PyonMessageFormat) { message = new FahClientJsonMessageExtractor().Extract(message.MessageText); } var slotCollection = SlotCollection.Load(message.MessageText); foreach (var slot in slotCollection) { await ExecuteFahClientCommandAsync("slot-options " + slot.ID + " client-type client-subtype cpu-usage machine-id max-packet-size core-priority next-unit-percentage max-units checkpoint pause-on-start gpu-index gpu-usage"); await ExecuteFahClientCommandAsync("simulation-info " + slot.ID); } } }
public void FillTest4() { string message = File.ReadAllText("..\\..\\..\\TestFiles\\Client_v7_4\\slots.txt"); var slotCollection = new SlotCollection(); slotCollection.Fill(MessageCache.GetNextJsonMessage(ref message)); Assert.AreEqual(3, slotCollection.Count); Assert.AreEqual(0, slotCollection[0].Id); Assert.AreEqual("RUNNING", slotCollection[0].Status); Assert.AreEqual(FahSlotStatus.Running, slotCollection[0].StatusEnum); Assert.AreEqual("smp:4", slotCollection[0].Description); Assert.AreEqual("beta", slotCollection[0].SlotOptions.FahClientType); Assert.AreEqual(FahClientType.Beta, slotCollection[0].SlotOptions.FahClientTypeEnum); Assert.AreEqual("big", slotCollection[0].SlotOptions.MaxPacketSize); Assert.AreEqual(MaxPacketSize.Big, slotCollection[0].SlotOptions.MaxPacketSizeEnum); Assert.AreEqual(100, slotCollection[0].SlotOptions.NextUnitPercentage); Assert.AreEqual(1, slotCollection[1].Id); Assert.AreEqual("RUNNING", slotCollection[1].Status); Assert.AreEqual(FahSlotStatus.Running, slotCollection[1].StatusEnum); Assert.AreEqual("gpu:0:\"GT200 [GeForce GTX 260]\"", slotCollection[1].Description); Assert.AreEqual("beta", slotCollection[1].SlotOptions.FahClientType); Assert.AreEqual(FahClientType.Beta, slotCollection[1].SlotOptions.FahClientTypeEnum); Assert.AreEqual("low", slotCollection[1].SlotOptions.CorePriority); Assert.AreEqual(CorePriority.Low, slotCollection[1].SlotOptions.CorePriorityEnum); Assert.AreEqual(2, slotCollection[2].Id); Assert.AreEqual("RUNNING", slotCollection[2].Status); Assert.AreEqual(FahSlotStatus.Running, slotCollection[2].StatusEnum); Assert.AreEqual("gpu:1:\"G92 [GeForce 9800 GTX]\"", slotCollection[2].Description); Assert.AreEqual("beta", slotCollection[2].SlotOptions.FahClientType); Assert.AreEqual(FahClientType.Beta, slotCollection[2].SlotOptions.FahClientTypeEnum); Assert.AreEqual("low", slotCollection[2].SlotOptions.CorePriority); Assert.AreEqual(CorePriority.Low, slotCollection[2].SlotOptions.CorePriorityEnum); }
private void MessageUpdated(object sender, Client.MessageUpdatedEventArgs e) { if (e.DataType.Equals(typeof(SlotCollection))) { _slotCollection = _fahClient.GetMessage<SlotCollection>(); foreach (var slot in _slotCollection) { _fahClient.SendCommand(String.Format(CultureInfo.InvariantCulture, Constants.FahClientSlotOptions, slot.Id)); } _settingsModel.RefreshSlots(_slotCollection); } else if (e.DataType.Equals(typeof(SlotOptions))) { var options = _fahClient.GetMessage<SlotOptions>(); if (options.MachineId.HasValue) { var slot = _slotCollection.FirstOrDefault(x => x.Id == options.MachineId); if (slot != null) { slot.SlotOptions = options; _settingsModel.RefreshSlots(_slotCollection); } } } }
/// <summary> /// Reads the <see cref="AvatarMessageComponent"/> from the specified <see cref="MessageReader"/>. /// </summary> /// <param name="reader"> /// <see cref="MessageReader"/> that will be used to read the <see cref="AvatarMessageComponent"/>. /// </param> /// <exception cref="ArgumentNullException"><paramref name="reader"/> is null.</exception> public override void ReadMessageComponent(MessageReader reader) { ThrowIfReaderNull(reader); UserId = reader.ReadInt64(); HomeId = reader.ReadInt64(); if (reader.ReadBoolean()) { ClanData = new ClanMessageComponent(); ClanData.Id = reader.ReadInt64(); ClanData.Name = reader.ReadString(); ClanData.Badge = reader.ReadInt32(); ClanData.Role = (ClanMemberRole)reader.ReadInt32(); ClanData.Level = reader.ReadInt32(); ClanData.Unknown1 = reader.ReadByte(); // Clan war? if (ClanData.Unknown1 == 1) { ClanData.Unknown2 = reader.ReadInt64(); // Clan war ID? } } LegendaryTrophy = reader.ReadInt32(); BestSeasonEnabled = reader.ReadInt32(); BestSeasonMonth = reader.ReadInt32(); BestSeasonYear = reader.ReadInt32(); BestSeasonPosition = reader.ReadInt32(); BestSeasonTrophies = reader.ReadInt32(); LastSeasonEnabled = reader.ReadInt32(); LastSeasonMonth = reader.ReadInt32(); LastSeasonYear = reader.ReadInt32(); LastSeasonPosition = reader.ReadInt32(); LastSeasonTrophies = reader.ReadInt32(); LeagueLevel = reader.ReadInt32(); AllianceCastleLevel = reader.ReadInt32(); AllianceCastleTotalCapacity = reader.ReadInt32(); AllianceCastleUsedCapacity = reader.ReadInt32(); Unknown13 = reader.ReadInt32(); // 0 = 8.x.x Unknown14 = reader.ReadInt32(); // -1 = 8.x.x TownHallLevel = reader.ReadInt32(); Name = reader.ReadString(); Unknown15 = reader.ReadInt32(); // -1, Facebook ID ExpLevels = reader.ReadInt32(); ExpPoints = reader.ReadInt32(); Gems = reader.ReadInt32(); // Scrambled when not own avatar data. FreeGems = reader.ReadInt32(); // Scrambled when not own avatar data. Unknown16 = reader.ReadInt32(); // 1200 // Scrambled when not own avatar data. Unknown17 = reader.ReadInt32(); // 60 // Scrambled when not own avatar data. Trophies = reader.ReadInt32(); AttacksWon = reader.ReadInt32(); AttacksLost = reader.ReadInt32(); // Scrambled when not own avatar data. DefensesWon = reader.ReadInt32(); DefensesLost = reader.ReadInt32(); // Scrambled when not own avatar data. Unknown18 = reader.ReadInt32(); Unknown19 = reader.ReadInt32(); Unknown20 = reader.ReadInt32(); // 8.511.4 Unknown29 = reader.ReadInt32(); Unknown21 = reader.ReadByte(); // 1, might be a bool Unknown22 = reader.ReadInt64(); // 946720861000 IsNamed = reader.ReadBoolean(); Unknown23 = reader.ReadInt32(); Unknown24 = reader.ReadInt32(); // Scrambled when not own avatar data. Unknown25 = reader.ReadInt32(); Unknown26 = reader.ReadInt32(); // 1 Unknown27 = reader.ReadInt32(); // 0 = 8.x.x Unknown28 = reader.ReadInt32(); // 0 = 8.x.x // 8.551.4 Unknown30 = reader.ReadByte(); ResourcesCapacity = reader.ReadSlotCollection <ResourceCapacitySlot>(); ResourcesAmount = reader.ReadSlotCollection <ResourceAmountSlot>(); Units = reader.ReadSlotCollection <UnitSlot>(); Spells = reader.ReadSlotCollection <SpellSlot>(); UnitUpgrades = reader.ReadSlotCollection <UnitUpgradeSlot>(); SpellUpgrades = reader.ReadSlotCollection <SpellUpgradeSlot>(); HeroUpgrades = reader.ReadSlotCollection <HeroUpgradeSlot>(); HeroHealths = reader.ReadSlotCollection <HeroHealthSlot>(); HeroStates = reader.ReadSlotCollection <HeroStateSlot>(); AllianceUnits = reader.ReadSlotCollection <AllianceUnitSlot>(); TutorialProgress = reader.ReadSlotCollection <TutorialProgressSlot>(); Achievements = reader.ReadSlotCollection <AchievementSlot>(); AchievementProgress = reader.ReadSlotCollection <AchievementProgessSlot>(); NpcStars = reader.ReadSlotCollection <NpcStarSlot>(); NpcGold = reader.ReadSlotCollection <NpcGoldSlot>(); NpcElixir = reader.ReadSlotCollection <NpcElixirSlot>(); Unknown31 = reader.ReadInt32(); UnknownSlot1 = reader.ReadSlotCollection <UnknownSlot>(); UnknownSlot2 = reader.ReadSlotCollection <UnknownSlot>(); UnknownSlot3 = reader.ReadSlotCollection <UnknownSlot>(); // 8.551.4 UnknownSlot4 = reader.ReadSlotCollection <UnknownSlot>(); UnknownSlot5 = reader.ReadSlotCollection <UnknownSlot>(); UnknownSlot6 = reader.ReadSlotCollection <UnknownSlot>(); UnknownSlot7 = reader.ReadSlotCollection <UnitSlot>(); // 8.709.2 // Could be an int32 instead. UnknownSlot8 = reader.ReadSlotCollection <UnknownSlot>(); }
public void SetUp() { _collection = new SlotCollection <ResourceAmountSlot>(); }
public void FillTest12() { string message = File.ReadAllText("..\\..\\..\\TestFiles\\Client_v7_12\\slots.txt"); var slotCollection = new SlotCollection(); slotCollection.Fill(JsonMessageConnection.GetNextJsonMessage(ref message)); Assert.AreEqual(1, slotCollection.Count); Assert.AreEqual(0, slotCollection[0].Id); Assert.AreEqual("PAUSED", slotCollection[0].Status); Assert.AreEqual(FahSlotStatus.Paused, slotCollection[0].StatusEnum); Assert.AreEqual("cpu:4", slotCollection[0].Description); Assert.AreEqual(-1, slotCollection[0].SlotOptions.Cpus); Assert.AreEqual(true, slotCollection[0].SlotOptions.PauseOnStart); Assert.AreEqual("paused", slotCollection[0].Reason); }
public void FillTest10() { string message = File.ReadAllText("..\\..\\..\\TestFiles\\Client_v7_10\\slots.txt"); var slotCollection = new SlotCollection(); slotCollection.Fill(JsonMessageConnection.GetNextJsonMessage(ref message)); Assert.AreEqual(2, slotCollection.Count); Assert.AreEqual(0, slotCollection[0].Id); Assert.AreEqual("RUNNING", slotCollection[0].Status); Assert.AreEqual(FahSlotStatus.Running, slotCollection[0].StatusEnum); Assert.AreEqual("smp:4", slotCollection[0].Description); Assert.AreEqual(true, slotCollection[0].SlotOptions.PauseOnStart); Assert.AreEqual(1, slotCollection[1].Id); Assert.AreEqual("RUNNING", slotCollection[1].Status); Assert.AreEqual(FahSlotStatus.Running, slotCollection[1].StatusEnum); Assert.AreEqual("gpu:0:\"GT200b [GeForce GTX 285]\"", slotCollection[1].Description); Assert.AreEqual(true, slotCollection[0].SlotOptions.PauseOnStart); }
public void FillTest7() { string message = File.ReadAllText("..\\..\\..\\TestFiles\\Client_v7_7\\slots.txt"); var slotCollection = new SlotCollection(); slotCollection.Fill(JsonMessageConnection.GetNextJsonMessage(ref message)); Assert.AreEqual(2, slotCollection.Count); Assert.AreEqual(0, slotCollection[0].Id); Assert.AreEqual("FINISHING", slotCollection[0].Status); Assert.AreEqual(FahSlotStatus.Finishing, slotCollection[0].StatusEnum); Assert.AreEqual("smp:4", slotCollection[0].Description); Assert.AreEqual("beta", slotCollection[0].SlotOptions.FahClientType); Assert.AreEqual(FahClientType.Beta, slotCollection[0].SlotOptions.FahClientTypeEnum); Assert.AreEqual("big", slotCollection[0].SlotOptions.MaxPacketSize); Assert.AreEqual(MaxPacketSize.Big, slotCollection[0].SlotOptions.MaxPacketSizeEnum); Assert.AreEqual(100, slotCollection[0].SlotOptions.NextUnitPercentage); Assert.AreEqual(1, slotCollection[1].Id); Assert.AreEqual("RUNNING", slotCollection[1].Status); Assert.AreEqual(FahSlotStatus.Running, slotCollection[1].StatusEnum); Assert.AreEqual("gpu:0:\"GF106 [GeForce 450 GTS]\"", slotCollection[1].Description); }
/// <summary> /// Initializes a new instance of the <see cref="AvatarMessageComponent"/> class from /// the specified <see cref="Level"/>. /// </summary> /// <param name="level"><see cref="Level"/> from which the data will be set.</param> /// <exception cref="ArgumentNullException"><paramref name="level"/> is null.</exception> public AvatarMessageComponent(Level level) { if (level == null) { throw new ArgumentNullException(nameof(level)); } var avatar = level.Avatar; UserId = avatar.Id; HomeId = avatar.Id; if (avatar.Alliance != null) { var member = avatar.Alliance.Get(avatar.Id); Debug.Assert(member != null); if (member == null) { throw new InvalidOperationException($"Unable to find ClanMember {avatar.Id} in the Alliance {avatar.Alliance.Id}."); } ClanData = new ClanMessageComponent { Id = avatar.Alliance.Id, Name = avatar.Alliance.Name, Badge = avatar.Alliance.Badge, Role = member.Role, Level = avatar.Alliance.ExpLevels }; } else { AllianceCastleLevel = -1; } LeagueLevel = avatar.League; if (level.Village.TownHall == null) { level.Logs.Log("TownHall reference was null; using TownHallLevel 5."); TownHallLevel = 5; } else { TownHallLevel = level.Village.TownHall.UpgradeLevel; } Name = avatar.Name; //Unknown13 = -1; //Unknown14 = -1; Unknown15 = -1; ExpPoints = avatar.ExpPoints; ExpLevels = avatar.ExpLevels; Gems = avatar.Gems; FreeGems = avatar.FreeGems; Unknown16 = 1200; Unknown17 = 60; Trophies = avatar.Trophies; Unknown21 = 1; Unknown22 = 946720861000; //Unknown22 = 4294967516; //Unknown23 = -169129983; IsNamed = avatar.IsNamed; Unknown26 = 1; //Unknown27 = 1; ResourcesAmount = avatar.ResourcesAmount; ResourcesCapacity = avatar.ResourcesCapacity; Units = avatar.Units; Spells = avatar.Spells; UnitUpgrades = avatar.UnitUpgrades; SpellUpgrades = avatar.SpellUpgrades; HeroUpgrades = avatar.HeroUpgrades; HeroHealths = avatar.HeroHealths; HeroStates = avatar.HeroStates; TutorialProgress = avatar.TutorialProgess; Achievements = avatar.Achievements; AchievementProgress = avatar.AchievementProgress; NpcStars = avatar.NpcStars; NpcGold = avatar.NpcGold; NpcElixir = avatar.NpcElixir; UnknownSlot1 = new SlotCollection <UnknownSlot>(); UnknownSlot2 = new SlotCollection <UnknownSlot>(); UnknownSlot3 = new SlotCollection <UnknownSlot>(); UnknownSlot4 = new SlotCollection <UnknownSlot>(); UnknownSlot5 = new SlotCollection <UnknownSlot>(); UnknownSlot6 = new SlotCollection <UnknownSlot>(); UnknownSlot7 = new SlotCollection <UnitSlot>(); }
public void FillNotDerivedTest() { string message = File.ReadAllText("..\\..\\..\\TestFiles\\Client_v7_1\\slots.txt"); var slotCollection = new SlotCollection(); slotCollection.Fill<SlotNotDerived>(MessageCache.GetNextJsonMessage(ref message)); }
public void FillTest5() { string message = File.ReadAllText("..\\..\\..\\TestFiles\\Client_v7_5\\slots.txt"); var slotCollection = new SlotCollection(); slotCollection.Fill(MessageCache.GetNextJsonMessage(ref message)); Assert.AreEqual(2, slotCollection.Count); Assert.AreEqual(0, slotCollection[0].Id); Assert.AreEqual("RUNNING", slotCollection[0].Status); Assert.AreEqual(FahSlotStatus.Running, slotCollection[0].StatusEnum); Assert.AreEqual("smp:4", slotCollection[0].Description); Assert.AreEqual(1, slotCollection[1].Id); Assert.AreEqual("RUNNING", slotCollection[1].Status); Assert.AreEqual(FahSlotStatus.Running, slotCollection[1].StatusEnum); Assert.AreEqual("gpu:0:\"Radeon HD 5870 (Cypress)\"", slotCollection[1].Description); }
private void MessageReceived(MessageReceivedEventArgs e) { if (e.DataType == typeof(SlotCollection)) { _slotCollection = (SlotCollection)e.TypedMessage; foreach (var slot in _slotCollection) { _messageConnection.SendCommand(String.Format(CultureInfo.InvariantCulture, Constants.FahClientSlotOptions, slot.Id)); } _settingsModel.RefreshSlots(_slotCollection); } else if (e.DataType == typeof(SlotOptions)) { var options = (SlotOptions)e.TypedMessage; if (options.MachineId.HasValue) { var slot = _slotCollection.FirstOrDefault(x => x.Id == options.MachineId); if (slot != null) { slot.SlotOptions = options; _settingsModel.RefreshSlots(_slotCollection); } } } }
public virtual void SetInventory(SlotCollection slots) { _slotCollection = slots; LinkSlots(); }
public Player(PlayerController playerController, SlotCollection inventory, Movement movement) { _playerController = playerController; Inventory = inventory; Movement = movement; }
public void RefreshSlots(SlotCollection slots) { if (_syncObject.InvokeRequired) { _syncObject.BeginInvoke(new Action<SlotCollection>(RefreshSlots), new object[] { slots }); return; } _slots.Clear(); foreach (var slot in slots) { _slots.Add(new FahClientSettingsSlotModel { ID = String.Format(CultureInfo.InvariantCulture, "{0:00}", slot.Id), SlotType = slot.SlotOptions.FahClientSubTypeEnum.ToString(), ClientType = slot.SlotOptions.FahClientTypeEnum.ToString(), MaxPacketSize = slot.SlotOptions.MaxPacketSizeEnum.ToString() }); } OnPropertyChanged("Slots"); }
public void RefreshSlots(SlotCollection slots) { _slots.Clear(); foreach (var slot in slots) { _slots.Add(new FahClientSettingsSlotModel { ID = String.Format(CultureInfo.InvariantCulture, "{0:00}", slot.Id), SlotType = slot.SlotOptions.ToSlotType().ToString(), ClientType = slot.SlotOptions.FahClientTypeEnum.ToString(), MaxPacketSize = slot.SlotOptions.MaxPacketSizeEnum.ToString() }); } OnPropertyChanged("Slots"); }
public void Reset() { _lastHeartbeat = null; _unitCollection = null; _unitCollectionUpdated = false; _slotCollection = null; _slotOptions.Clear(); _receivedMessages.Clear(); }
public virtual IWorld Create() { var world = new World(); _log.Info($"Resources Directory Is: {ResourcesDirectory}"); LoadCustomStats(world); world.InjurySystems = GetInjurySystems(); world.MainLua = GetResource("Main.lua")?.Content; _defaultSlots = GetDefaultSlots(); world.PlanningSystem = GetPlanningSystem(world); GenerateFactions(world); world.AdjectiveFactory = GetAdjectiveFactory(); world.Dialogue = new DialogueSystem(); world.RoomFactory = new RoomFactory(); world.ActorFactory = new ActorFactory() { DefaultSlots = _defaultSlots }; world.ItemFactory = new ItemFactory(); world.ActionFactory = new ActionFactory(); world.BehaviourFactory = new BehaviourFactory(); //Get every yaml file under the resources dir foreach (var fi in GetResources("*.yaml")) { _log.Info($"Loading {fi.Location}"); //is a faction dir IFaction faction = GetImplicitFactionFor(fi); if (!SkipContent && IsRoomsFile(fi)) { world.RoomFactory.Blueprints.AddRange(AssignFaction(GetBlueprints <RoomBlueprint>(fi), faction)); } if (!SkipContent && IsItemsFile(fi)) { world.ItemFactory.Blueprints.AddRange(AssignFaction(GetBlueprints <ItemBlueprint>(fi), faction)); } if (!SkipContent && IsActorsFile(fi)) { world.ActorFactory.Blueprints.AddRange(AssignFaction(GetBlueprints <ActorBlueprint>(fi), faction)); } if (IsAdjectivesFile(fi)) { world.AdjectiveFactory.Blueprints.AddRange(AssignFaction(GetBlueprints <AdjectiveBlueprint>(fi), faction)); } if (IsActionsFile(fi)) { world.ActionFactory.Blueprints.AddRange(AssignFaction(GetBlueprints <ActionBlueprint>(fi), faction)); } if (IsBehavioursFile(fi)) { var blueprints = AssignFaction(GetBlueprints <BehaviourBlueprint>(fi), faction).ToList(); if (fi.Location.EndsWith(DefaultActorBehavioursFile, StringComparison.CurrentCultureIgnoreCase)) { world.ActorFactory.DefaultBehaviours.AddRange(blueprints); } world.BehaviourFactory.Blueprints.AddRange(blueprints); } if (!SkipContent && IsDialogueFile(fi)) { world.Dialogue.AllDialogues.AddRange(GetDialogue(fi)); } } LogBlueprints(world.RoomFactory.Blueprints); LogBlueprints(world.ActorFactory.Blueprints); LogBlueprints(world.ItemFactory.Blueprints); LogBlueprints(world.AdjectiveFactory.Blueprints); LogBlueprints(world.ActionFactory.Blueprints); LogBlueprints(world.BehaviourFactory.Blueprints); var zero = new Point3(0, 0, 0); var startingRoom = world.RoomFactory.Create(world, zero); startingRoom.IsExplored = true; world.Map.Add(zero, startingRoom); var player = GetPlayer(startingRoom); AddDefaults(world, player); return(world); }