当前位置: 首页>>代码示例>>C#>>正文


C# Material.LoadAreasDefinition方法代码示例

本文整理汇总了C#中Material.LoadAreasDefinition方法的典型用法代码示例。如果您正苦于以下问题:C# Material.LoadAreasDefinition方法的具体用法?C# Material.LoadAreasDefinition怎么用?C# Material.LoadAreasDefinition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Material的用法示例。


在下文中一共展示了Material.LoadAreasDefinition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadAssets

        private static void LoadAssets(XmlDocument doc, SceneBase scene)
        {
            string _lastValidName = "";
            try
            {
                XmlNode _el = doc.SelectSingleNode("IceScene/Assets");
                int _count = _el.ChildNodes.Count;
                int _current = 0;
                foreach (XmlNode _node in _el.ChildNodes)
                {
                    _current++;
                    int perc = (int)((double)_current / (double)_count * 100); ;
                    FireStatusUpdate(string.Format("Loading Asset {0}/{1}", _current, _count), perc);

                    IceAsset asset = null;
                    if (_node.Name.ToUpper() == "MATERIAL")
                    {
                        Material newMat = new Material();
                        asset = newMat;
                        scene.Materials.Add(newMat);
                        TraceLogger.TraceInfo("Loading Material");
                        if (_node.Attributes.GetNamedItem("areas_definition") != null)
                        {
                            newMat.AreasDefinitionFilename
                                = _node.Attributes["areas_definition"].InnerText;
                            String definitionPath = Path.Combine(SceneSerializer.RootPath, newMat.AreasDefinitionFilename);
                            TraceLogger.TraceVerbose("Loading AreasDefinitionFilename: " + newMat.AreasDefinitionFilename);
                            newMat.LoadAreasDefinition(definitionPath);
                        }
                    }
                    else if (_node.Name.ToUpper() == "FONT")
                    {
                        asset = new IceFont();
                        scene.Fonts.Add(asset as IceFont);
                        TraceLogger.TraceInfo("Loading Font");
                    }
                    else if (_node.Name.ToUpper() == "EFFECT")
                    {
						#if !XNATOUCH
                        asset = CreateEffectInstance(_node.Attributes["type"].InnerText);
                        scene.Effects.Add(asset as IceEffect);
                        TraceLogger.TraceInfo("Loading Effect");
#endif
                    }
                    else if (_node.Name.ToUpper() == "TILESHEET")
                    {
                        TileSheet newTileSheet = LoadTileSheet(_node, scene);
                        asset = newTileSheet;
                        scene.TileSheets.Add(newTileSheet);                       
                        TraceLogger.TraceInfo("Loading TileSheet");
                    }
                    asset.Scope = AssetScope.Local;
                    if (scene == SceneManager.GlobalDataHolder)
                    {
                        asset.Scope = AssetScope.Global;
                    }
                    asset.Parent = scene;
                    asset.Name = _node.Attributes["name"].InnerText;
                    _lastValidName = asset.Name;
                    if (_node.Attributes.GetNamedItem("location") != null)
                    {
                        asset.Filename = _node.Attributes["location"].InnerText;
                    }
                    else
                    {
                        asset.Filename = "";
                    }
                    TraceLogger.TraceInfo("Name : " + asset.Name);
                    TraceLogger.TraceVerbose("FileName : " + asset.Filename);
                    TraceLogger.TraceVerbose("Scope : " + asset.Scope.ToString());
                }
            }
            catch (Exception err)
            {
                if (err != null)
                {
                    #if(WINDOWS)
                    Trace.TraceError("ERROR In Load Assets - " + _lastValidName);
                    #endif
                    throw new ArgumentException("Error in load materials: " + err.Message);
                }
            }
        }
开发者ID:dekk7,项目名称:xEngine,代码行数:83,代码来源:SceneSerializer.cs


注:本文中的Material.LoadAreasDefinition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。