public override void Initialize(AgentDefinition agentDefinition, AgentGroup parentGroup) { base.Initialize(agentDefinition, parentGroup); AIPlayer_MajorEmpire aiplayer_MajorEmpire = base.ContextObject as AIPlayer_MajorEmpire; if (aiplayer_MajorEmpire == null) { Diagnostics.LogError("The agent context object is not an ai player."); return; } this.empire = aiplayer_MajorEmpire.MajorEmpire; if (this.empire == null) { Diagnostics.LogError("Can't retrieve the empire."); return; } Diagnostics.Assert(base.ParentGroup != null); this.netEmpireMoneyAgent = (base.ParentGroup.GetAgent("NetEmpireMoney") as SimulationNormalizedAgent); Diagnostics.Assert(this.netEmpireMoneyAgent != null); this.departmentOfScience = this.empire.GetAgency <DepartmentOfScience>(); IGameService service = Services.GetService <IGameService>(); this.game = (service.Game as global::Game); InfluencedByPersonalityAttribute.LoadFieldAndPropertyValues(this.empire, this); }
public DeviceItem(DeviceDefinition device, ConnectionDefinition connection, AgentDefinition agent) { Connection = new Connection(); Connection.Address = connection.Address; Connection.Port = connection.Port; Connection.PhysicalAddress = connection.PhysicalAddress; Agent = new Agent(); Agent.BufferSize = agent.BufferSize; Agent.InstanceId = agent.InstanceId; Agent.Sender = agent.Sender; Agent.TestIndicator = agent.TestIndicator; Agent.Timestamp = agent.Timestamp; Agent.Version = agent.Version; Id = device.Id; Uuid = device.Uuid; Name = device.Name; Iso841Class = device.Iso841Class; NativeName = device.NativeName; SampleInterval = device.SampleInterval; SampleRate = device.SampleRate; Manufacturer = device.Manufacturer; Model = device.Model; SerialNumber = device.SerialNumber; Description = device.Description; }
public override void Initialize(AgentDefinition agentDefinition, AgentGroup parentGroup) { base.Initialize(agentDefinition, parentGroup); City city = base.ContextObject as City; if (city == null) { Diagnostics.LogError("The agent context object is not a city"); return; } Diagnostics.Assert(city.Empire != null); this.departmentOfTheTreasury = city.Empire.GetAgency <DepartmentOfTheTreasury>(); Diagnostics.Assert(this.departmentOfTheTreasury != null); DepartmentOfIndustry agency = city.Empire.GetAgency <DepartmentOfIndustry>(); Diagnostics.Assert(agency != null); this.aiPlayer = (base.ParentGroup.Parent.ContextObject as AIPlayer_MajorEmpire); if (this.aiPlayer == null) { Diagnostics.LogError("The agent context object is not an ai player."); return; } this.constructionQueue = agency.GetConstructionQueue(city); Diagnostics.Assert(this.constructionQueue != null); InfluencedByPersonalityAttribute.LoadFieldAndPropertyValues(city.Empire, this); }
private static AgentDefinitionForClient MapAgentDefinition(AgentDefinition def) { return(new AgentDefinitionForClient { MainMenuIcon = def.MainMenuIcon, MainMenuSortKey = def.MainMenuSortKey ?? 0m, MainMenuSection = def.MainMenuSection, TitlePlural = def.TitlePlural, TitlePlural2 = def.TitlePlural2, TitlePlural3 = def.TitlePlural3, TitleSingular = def.TitleSingular, TitleSingular2 = def.TitleSingular2, TitleSingular3 = def.TitleSingular3, BankAccountNumberVisibility = MapVisibility(def.BankAccountNumberVisibility), BasicSalaryVisibility = MapVisibility(def.BasicSalaryVisibility), JobVisibility = MapVisibility(def.JobVisibility), OvertimeRateVisibility = MapVisibility(def.OvertimeRateVisibility), StartDateLabel = def.StartDateLabel, StartDateLabel2 = def.StartDateLabel2, StartDateLabel3 = def.StartDateLabel3, StartDateVisibility = MapVisibility(def.StartDateVisibility), TaxIdentificationNumberVisibility = MapVisibility(def.TaxIdentificationNumberVisibility), TransportationAllowanceVisibility = MapVisibility(def.TransportationAllowanceVisibility), }); }
public override void Initialize(AgentDefinition agentDefinition, AgentGroup parentGroup) { base.Initialize(agentDefinition, parentGroup); Diagnostics.Assert(base.ParentGroup != null && base.ParentGroup.Parent != null); AIPlayer_MajorEmpire aiplayer_MajorEmpire = base.ParentGroup.Parent.ContextObject as AIPlayer_MajorEmpire; Diagnostics.Assert(aiplayer_MajorEmpire != null); this.Empire = aiplayer_MajorEmpire.MajorEmpire; if (this.Empire == null) { Diagnostics.LogError("The agent's parent context object is not an empire"); return; } this.EmpireWhichReceives = (base.ParentGroup.ContextObject as global::Empire); if (this.EmpireWhichReceives == null) { Diagnostics.LogError("The agent context object is not an empire"); return; } this.aiEntityEmpire = aiplayer_MajorEmpire.GetEntity <AIEntity_Empire>(); if (this.aiEntityEmpire == null) { Diagnostics.LogError("The AIPlayer has no ai entity empire."); return; } InfluencedByPersonalityAttribute.LoadFieldAndPropertyValues(this.aiEntityEmpire.Empire, this); }
public override void Initialize(AgentDefinition agentDefinition, AgentGroup parentGroup) { base.Initialize(agentDefinition, parentGroup); AIPlayer_MajorEmpire aiPlayer = base.ContextObject as AIPlayer_MajorEmpire; if (aiPlayer == null) { Diagnostics.LogError("The agent context object is not an ai player."); return; } this.empire = aiPlayer.MajorEmpire; if (this.empire == null) { Diagnostics.LogError("Can't retrieve the empire."); return; } Diagnostics.Assert(this.empire != null); this.departmentOfTheInterior = this.empire.GetAgency <DepartmentOfTheInterior>(); Diagnostics.Assert(this.departmentOfTheInterior != null); this.departmentOfTheTreasury = this.empire.GetAgency <DepartmentOfTheTreasury>(); Diagnostics.Assert(this.departmentOfTheTreasury != null); DepartmentOfIndustry agency = this.empire.GetAgency <DepartmentOfIndustry>(); Diagnostics.Assert(agency != null); DepartmentOfIndustry.ConstructibleElement[] availableConstructibleElements = ((IConstructibleElementDatabase)agency).GetAvailableConstructibleElements(new StaticString[] { DistrictImprovementDefinition.ReadOnlyCategory }); Diagnostics.Assert(availableConstructibleElements != null); this.districtImprovement = Array.Find <DepartmentOfIndustry.ConstructibleElement>(availableConstructibleElements, (DepartmentOfIndustry.ConstructibleElement element) => element.Name == aiPlayer.AIData_Faction.DistrictImprovement); Diagnostics.Assert(this.districtImprovement != null && this.districtImprovement.Costs != null); InfluencedByPersonalityAttribute.LoadFieldAndPropertyValues(this.empire, this); }
private static AgentDefinition Create(string deviceId, Headers.MTConnectDevicesHeader header) { var obj = new AgentDefinition(); // TrakHound Properties obj.DeviceId = deviceId; obj.Timestamp = header.CreationTime; // MTConnect Properties obj.InstanceId = header.InstanceId; obj.Sender = header.Sender; obj.Version = header.Version; obj.BufferSize = header.BufferSize; obj.TestIndicator = header.TestIndicator; return(obj); }
public override void Initialize(AgentDefinition agentDefinition, AgentGroup parentGroup) { base.Initialize(agentDefinition, parentGroup); AIPlayer_MajorEmpire aiplayer_MajorEmpire = base.ContextObject as AIPlayer_MajorEmpire; if (aiplayer_MajorEmpire == null) { Diagnostics.LogError("The agent context object is not an ai player."); return; } this.empire = aiplayer_MajorEmpire.MajorEmpire; if (this.empire == null) { Diagnostics.LogError("Can't retrieve the empire."); return; } this.aiEntityEmpire = aiplayer_MajorEmpire.GetEntity <AIEntity_Empire>(); Diagnostics.Assert(this.aiEntityEmpire != null); Diagnostics.Assert(base.ParentGroup != null); this.netEmpireMoneyAgent = (base.ParentGroup.GetAgent("NetEmpireMoney") as SimulationNormalizedAgent); Diagnostics.Assert(this.netEmpireMoneyAgent != null); InfluencedByPersonalityAttribute.LoadFieldAndPropertyValues(this.aiEntityEmpire.Empire, this); }