Exemplo n.º 1
0
        private void LoadMaterialDefinitionsByXPathNavigator(XPathNavigator navigator)
        {
            XPathNodeIterator materialDefinitions;

            try
            {
                materialDefinitions =
                    navigator.Select("/Object/Array[@Name='MaterialDefinitions']/Object[@Class='MaterialDefinition']");
            }
            catch (Exception)
            {
                return;
            }

            while (materialDefinitions.MoveNext())
            {
                MaterialDefinition materialDefinition =
                    MaterialDefinition.LoadFromXPathNavigator(materialDefinitions.Current);

                if (materialDefinition != null && false == MaterialDefinitions.ContainsKey(materialDefinition.NameHash))
                {
                    MaterialDefinitions.Add(materialDefinition.NameHash, materialDefinition);
                }
            }
        }
Exemplo n.º 2
0
        public MaterialDefinition GetMaterialDefinitionFromHash(UInt32 materialDefinitionHash)
        {
            MaterialDefinition materialDefinition = null;

            try
            {
                MaterialDefinitions.TryGetValue(materialDefinitionHash, out materialDefinition);
            }
            catch (Exception)
            {
                throw new Exception("Material definition could not be found.");
            }

            return(materialDefinition);
        }
 public async Task LoadSystem(StatusReporter progress)
 {
     await new WaitForBackgroundThread();
     materialDefinitions = assetManager.LoadPackAsset <MaterialDefinitions>(MATERIALS_ASSET);
     progress.ReportProgress("Loading Material Definitions", 1, 1);
 }