Exemplo n.º 1
0
 //============================================================
 // <T>加载配置信息。</T>
 //
 // @param xconfig 配置信息
 //============================================================
 public void LoadConfig(FXmlNode xconfig)
 {
     // 读取列表
     foreach (FXmlNode xnode in xconfig.Nodes)
     {
         if (xnode.IsName("Geometry"))
         {
             // 获得有效性
             bool valid = false;
             if (xnode.Contains("valid"))
             {
                 valid = xnode.GetBoolean("valid");
             }
             else
             {
                 valid = xnode.GetBoolean("is_valid");
             }
             // 读取属性
             if (valid)
             {
                 // 检查存在性
                 string geometryName = xnode.Get("name");
                 if (_geometryDictionary.Contains(geometryName))
                 {
                     RMoCore.TrackConsole.Write(this, "LoadConfig", "Model geometry name is already exists. (model={0}, geometry={1})", _model.Name, geometryName);
                 }
                 // 创建几何体
                 FDrGeometry geometry = new FDrGeometry(_model);
                 geometry.LoadConfig(xnode);
                 geometry.Index = _geometryDictionary.Count;
                 _geometryDictionary.Set(geometryName, geometry);
             }
         }
     }
 }
Exemplo n.º 2
0
        //============================================================
        // <T>获得指定代码的数据集。</T>
        //============================================================
        public FRsDataset FetchDataset(string code)
        {
            FRsDataset dataset = null;

            if (_datasets.Contains(code))
            {
                dataset = _datasets.Get(code);
                dataset.Open();
            }
            return(dataset);
        }
Exemplo n.º 3
0
 public void Push(IAopNode config)
 {
     if (!_duplicate && _ids.Contains(config.Id))
     {
         throw new FFatalException("Has contains node(id={0})", config.Id);
     }
     base.Push((T)config);
     if (!RString.IsEmpty(config.Id))
     {
         _ids[config.Id] = (T)config;
     }
 }
Exemplo n.º 4
0
        //============================================================
        public override void Serialize(IOutput output)
        {
            base.Serialize(output);
            // 存储属性
            output.WriteInt8((sbyte)_optionLoaded);
            output.WriteInt8((sbyte)_optionSelect);
            output.WriteInt8((sbyte)_optionGround);
            output.WriteInt8((sbyte)_optionMergeVertex);
            output.WriteInt8((sbyte)_optionMergeMaterial);
            output.WriteInt8((sbyte)_optionLightMap);
            //............................................................
            // 统计材质次数
            FDictionary <int> materialsCount = new FDictionary <int>();

            foreach (FDrTemplateRenderable renderable in  _renderables)
            {
                int materialCount = 0;
                if (materialsCount.Contains(renderable.MaterialCode))
                {
                    materialCount = materialsCount.Get(renderable.MaterialCode);
                }
                materialCount++;
                materialsCount.Set(renderable.MaterialCode, materialCount);
            }
            //............................................................
            // 存储渲染列表
            int count = _renderables.Count;

            output.WriteInt16((short)count);
            for (int n = 0; n < count; n++)
            {
                FDrTemplateRenderable renderable = _renderables[n];
                int materialCount = materialsCount.Get(renderable.MaterialCode);
                if (1 == materialCount)
                {
                    renderable.OptionMerge = EDrFlag.No;
                }
                renderable.Id = n + 1;
                renderable.Serialize(output);
            }
            //............................................................
            // 存储动画列表
            if (_animation.IsEmpty)
            {
                output.WriteBool(false);
            }
            else
            {
                output.WriteBool(true);
                _animation.Serialize(output);
            }
        }
Exemplo n.º 5
0
        public override void Push(IAopNode config)
        {
            base.Push(config);
            XAopComponents xcomponent = config as XAopComponents;

            if (xcomponent != null)
            {
                // Set face
                if (!RString.IsEmpty(xcomponent.FaceName))
                {
                    if (_faces.Contains(xcomponent.FaceName))
                    {
                        throw new FFatalException("Components face name({1}) is exists.", xcomponent.FaceName);
                    }
                    _faces[xcomponent.FaceName] = xcomponent;
                }
            }
        }
Exemplo n.º 6
0
        //============================================================
        // <T>加入一个对象设置。</T>
        //
        // @param config 对象设置
        //============================================================
        public new void Push(FXmlObjectConfig config)
        {
            // 检查类名是否重复
            string className = config.ClassName;

            if (_types.Contains(className))
            {
                throw new FFatalException("In configs, type({0}) is duplicate.", className);
            }
            // 设置类名
            _types[className] = config;
            // 检查名称重复
            if (Contains(config.Name))
            {
                throw new FFatalException("In configs, name({0}) is duplicate.", config.Name);
            }
            // 设置名称
            Set(config.Name, config);
        }
Exemplo n.º 7
0
        public override void Push(IAopNode config)
        {
            base.Push(config);
            // Set id
            XAopComponent xcomponent = (XAopComponent)config;

            if (!RString.IsEmpty(xcomponent.Id))
            {
                if (_ids.Contains(xcomponent.Id))
                {
                    throw new FFatalException("Component id({1}) is exists.", xcomponent.Id);
                }
                _ids[xcomponent.Id] = xcomponent;
            }
            // Set face
            if (!RString.IsEmpty(xcomponent.FaceName))
            {
                if (_faces.Contains(xcomponent.FaceName))
                {
                    throw new FFatalException("Component face name({1}) is exists.", xcomponent.FaceName);
                }
                _faces[xcomponent.FaceName] = xcomponent;
            }
        }
Exemplo n.º 8
0
        static void Convert(string inputFileName, string outputFileName)
        {
            FDictionary <string> dateValues = new FDictionary <string>();
            FLineFile            inputFile  = new FLineFile(inputFileName);
            FLineFile            outputFile = new FLineFile();

            foreach (string line in inputFile.Items)
            {
                if (line != null && line.Contains("FPSCounter"))
                {
                    // 解析字符串
                    // 04-10 12:24:50.635: D/FPSCounter(21430): fps=5 span=6
                    //string dateValue = line.Substring(0, 18);
                    //long dateH = RLong.Parse(dateValue.Substring(6, 2));
                    //long dateM = RLong.Parse(dateValue.Substring(9, 2));
                    //long dateS = RLong.Parse(dateValue.Substring(12, 2));
                    string dateValue = "2014-" + line.Substring(0, 14);
                    if (dateValues.Contains(dateValue))
                    {
                        continue;
                    }
                    int    findFps   = line.IndexOf("fps=");
                    int    findEnd   = line.IndexOf(" ", findFps);
                    string fpsValue  = line.Substring(findFps + 4, findEnd - findFps - 4);
                    int    fps       = RInt.Parse(fpsValue);
                    int    findSpan  = line.IndexOf("span=");
                    int    length    = line.Length;
                    string spanValue = line.Substring(findSpan + 5, length - findSpan - 5);
                    int    span      = RInt.Parse(spanValue);
                    Console.WriteLine(dateValue + " Fps=[" + fps + "] Span=[" + span + "]");
                    outputFile.Add(dateValue + "," + fps + "," + span);
                    dateValues.Set(dateValue, line);
                }
            }
            outputFile.SaveFile(outputFileName);
        }
Exemplo n.º 9
0
        //============================================================
        protected bool LoadFileRows(Excel.Worksheet worksheet)
        {
            // 检查列表
            if (_columns.IsEmpty)
            {
                return(false);
            }
            Excel.Range cells = worksheet.Cells;
            // 读取头数据
            int    columnIndex = 0;
            string code        = _columns.Value(0).Name;
            string id          = _columns[0].Name;

            for (int n = 1; n < DATA_COL_MAXCNT; n++)
            {
                string name = cells[DATA_NAME_ROW, n].Text;
                if (RString.IsEmpty(name))
                {
                    break;
                }
                if (_columns.Contains(name))
                {
                    FXlsColumn column = _columns.Get(name);
                    column.Index = n;
                    if (name == code)
                    {
                        columnIndex = n;
                    }
                }
            }
            // 计算最大行数和列数
            int   count    = _columns.Count;
            Range rowRange = worksheet.Rows[1];

            object[,] rowValues = rowRange.get_Value();
            int columnCount = 1;

            for (; columnCount < DATA_COL_MAXCNT; columnCount++)
            {
                if (rowValues[1, columnCount] == null)
                {
                    break;;
                }
            }
            string columnCode = "";
            int    ch         = columnCount / 26;
            int    cl         = columnCount % 26;

            if (ch > 0)
            {
                columnCode += (char)('A' + ch - 1);
            }
            columnCode += (char)('A' + cl);
            Range columnRange = worksheet.Columns[columnIndex];

            object[,] columnValues = columnRange.get_Value();
            int rowCount = 1;

            for (; rowCount < DATA_ROW_MAXCNT; rowCount++)
            {
                if (columnValues[rowCount, 1] == null)
                {
                    break;;
                }
            }
            // 获得数据
            Range range = worksheet.get_Range("A3:" + columnCode + rowCount);

            object[,] values = range.get_Value();
            // 转换数据
            for (int r = 1; r <= rowCount; r++)
            {
                FXlsRow row = new FXlsRow();
                for (int n = 0; n < count; n++)
                {
                    FXlsColumn column = _columns.Value(n);
                    int        index  = column.Index;
                    if (index > 0)
                    {
                        object value    = values[r, index];
                        string valueStr = String.Empty;
                        if (null != value)
                        {
                            valueStr = value.ToString();
                            if (!RString.IsEmpty(valueStr))
                            {
                                valueStr = FormatValue(column, valueStr);
                            }
                        }
                        row.Set(column.Name, valueStr);
                    }
                }
                //for(int n = 0; n < count; n++) {
                //   FXlsColumn column = _columns.Value(n);
                //   int index = column.Index;
                //   if(index > 0) {
                //      string value = cells[r, index].Text;
                //      if(!RString.IsEmpty(value)) {
                //         value = FormatValue(column, value);
                //      }
                //      row.Set(column.Name, value);
                //   }
                //}
                if (!row.Contains(code))
                {
                    break;
                }
                if (RString.IsEmpty(row.Get(code)))
                {
                    break;
                }
                _rows.Push(row);
            }
            return(true);
        }