public static void Initialize() { AppConfigUtility appConfigUtility = new AppConfigUtility(); logPath = appConfigUtility.AppSettings("logPath"); dataFileName = appConfigUtility.AppSettings("dataFileName"); //объявление фабрики в зависимости от типа фабрики factoryType = appConfigUtility.AppSettings("factoryType"); if (factoryType.Equals("split")) { materialFactory = new MaterialSplitFileFactory(); } else if (factoryType.Equals("test")) { materialFactory = new MaterialTestFactory(); } else { throw new Exception("this factory type doesn't exist!!!"); } }
public ResourceManager(IMaterialFactory materialFactory, IShaderFactory shaderFactory, ITextureFactory textureFactory) { if (materialFactory == null) throw new ArgumentNullException("materialFactory"); if (shaderFactory == null) throw new ArgumentNullException("shaderFactory"); if (textureFactory == null) throw new ArgumentNullException("textureFactory"); _materialFactory = new MaterialFactory(); _shaderFactory = shaderFactory; _textureFactory = textureFactory; }
public MatlController(NHibernate.ISession session, IMaterialFactory materialFactory, FlowHelper flowHelper, PalletizationHelper palletizationHelper, OpHelper opHelper, ILogger logger) { _logger = logger; _materialFactory = materialFactory; _opHelper = opHelper; _flowHelper = flowHelper; _palletizationHelper = palletizationHelper; _session = session; }
public void AddMaterialFactory(IMaterialFactory factory) { if (_materialFactories == null) { ProcessAssemblies(); } string name = factory.GetType().Name; _materialFactories[name] = factory; }
private void LoadMap(MapFactory factory, string mapPath, IMaterialFactory materialFactory) { var watch = new Stopwatch(); watch.Start(); var imap = factory.Load(mapPath); if (imap is not H2vMap map) { throw new Exception("Engine only supports Halo 2 Vista maps currently"); } map.UseMaterialFactory(materialFactory); var scene = new Scene(map, new EntityCreator(map)); scene.Load(); watch.Stop(); Console.WriteLine($"Loading map took {watch.ElapsedMilliseconds / 1000f} seconds"); var player = new Player(true); player.FriendlyName = "player_0"; player.Transform.Position = map.Scenario.PlayerSpawnMarkers[0].Position + new Vector3(0, 0, 0.3f); player.Transform.Orientation = Quaternion.CreateFromAxisAngle(EngineGlobals.Up, map.Scenario.PlayerSpawnMarkers[0].Heading); player.Transform.UpdateDerivedData(); scene.AddEntity(player); foreach (var squad in map.Scenario.AiSquadDefinitions) { foreach (var start in squad.StartingLocations) { var entity = ActorFactory.SpawnPointFromStartingLocation(map, start); if (entity != null) { scene.AddEntity(entity); } } } world.LoadScene(scene); var timestamp = DateTime.Now.ToString("yy-MM-ddTHH-mm"); var sinkPath = Path.Combine(Environment.CurrentDirectory, "diagnostics", $"{timestamp}-metrics.csv"); Directory.CreateDirectory(Path.GetDirectoryName(sinkPath)); var sink = new FlatFileMetricSink(sinkPath); scene.UseMetricSink(sink); sink.Start(); }
public Form1() { InitializeComponent(); //Вывести настройки на главную форму tbLogPath.Text = AppGlobalSettings.getLogPath; tbDataFileName.Text = AppGlobalSettings.getDataFileName; //получение объекта фабрики с помощью AppGlobalSettings materialFactory = AppGlobalSettings.GetMaterialFactory; }
public ResourceManager(IMaterialFactory materialFactory, IShaderFactory shaderFactory, ITextureFactory textureFactory) { if (materialFactory == null) { throw new ArgumentNullException("materialFactory"); } if (shaderFactory == null) { throw new ArgumentNullException("shaderFactory"); } if (textureFactory == null) { throw new ArgumentNullException("textureFactory"); } _materialFactory = new MaterialFactory(); _shaderFactory = shaderFactory; _textureFactory = textureFactory; }
private void ProcessAssembly(string assemblyPath) { Type[] exportedTypes; try { if (assemblyPath == null) { Assembly a = Assembly.GetExecutingAssembly(); // We only look at public types for external importers, processors // and type writers. exportedTypes = a.GetExportedTypes(); } else { Assembly a = Assembly.LoadFrom(assemblyPath); // We only look at public types for external importers, processors // and type writers. exportedTypes = a.GetExportedTypes(); } } catch (Exception) { throw; } foreach (Type type in exportedTypes) { // only instanciate types with parameterless constructors. if (type.GetConstructor(Type.EmptyTypes) != null && type.GetInterface("IMaterialFactory") != null) { IMaterialFactory factory = (IMaterialFactory)Activator.CreateInstance(type); if (factory == null) { continue; } _materialFactories[type.Name] = factory; } } }
public CreateRebarSteel(IMaterialFactory factory) { Guard.WhenArgument(factory, "factory").IsNull().Throw(); this.factory = factory; }
public CreateConcrete(IMaterialFactory factory) { Guard.WhenArgument(factory, "factory").IsNull().Throw(); this.factory = factory; }
// TODO: consider if material construction belongs here public void UseMaterialFactory(IMaterialFactory materialFactory) { this.materialFactory = materialFactory; }