Ejemplo n.º 1
0
      //============================================================
      // <T>加载配置文件。</T>
      //============================================================
      public void LoadConfig(FXmlNode config) {
         // 加载基本设置
         _tid = config.GetInteger("tid", _tid);
         _name = config.Get("name", _name);
         _label = config.Get("label", _label);
         if (config.Contains("size")) {
            _size.Parse(config.Get("size"));
         }
         if (config.Contains("birth_location")) {
            _birthLocation.Parse(config.Get("birth_location"));
         }

         // 加载层
         _layerListNode = config.Find("Layers");
         if (null == _layerListNode) {
            return;
         }
         foreach (FXmlNode layerNode in _layerListNode.Nodes) {
            FDsMapLayer layer = new FDsMapLayer();
            layer.Resource.LoadConfig(layerNode);
            _layers.Push(layer.Resource);
         }

         // 加载出生点
         _birthListNode = config.Find("Births");
         if (null == _birthListNode) {
            return;
         }
         foreach (FXmlNode birthNode in _birthListNode.Nodes) {
            FDsMapBirth birth = new FDsMapBirth();
            birth.Resource.LoadConfig(birthNode);
            _births.Push(birth.Resource);
         }
      }
Ejemplo n.º 2
0
        //============================================================
        // <T>加载配置文件。</T>
        //============================================================
        public void LoadConfig(FXmlNode config)
        {
            if (config.Contains("cell_count"))
            {
                _cellCount.Parse(config.Get("cell_count"));
            }
            if (config.Contains("cell_size"))
            {
                _cellSize.Parse(config.Get("cell_size"));
            }
            if (config.Contains("type_cd"))
            {
                _typeCd = REnum.ToValue <EMapLayerType>(config.Get("type_cd"));
            }
            if (config.Contains("scroll_cd"))
            {
                _scrollCd = REnum.ToValue <EMapLayerScroll>(config.Get("scroll_cd"));
            }
            if (config.Contains("wrap_cd"))
            {
                _wrapCd = REnum.ToValue <EMapLayerWrap>(config.Get("wrap_cd"));
            }
            if (config.Contains("scroll_speed"))
            {
                _scrollSpeed = config.GetFloat("scroll_speed");
            }
            _tileNode = config.Find("Tiles");
            if (null == _tileNode)
            {
                return;
            }
            // 创建所有格子
            for (int m = 0; m < _cellCount.Height; m++)
            {
                for (int n = 0; n < _cellCount.Width; n++)
                {
                    FMbMapCell cell = new FMbMapCell();
                    cell.Index = new SIntPoint2(n, m);
                    _mapCell.Push(cell);
                }
            }

            // 加载格子资源图片编号
            foreach (FXmlNode cellNode in _tileNode.Nodes)
            {
                FDsMapCell cell = new FDsMapCell();
                cell.Resource.LoadConfig(cellNode);
                SIntPoint2 cellIndex = cell.Resource.Index;
                FMbMapCell c         = FingCellByIndex(cellIndex.X, cellIndex.Y);
                c.ResourceId = cell.Resource.ResourceId;
            }
        }
Ejemplo n.º 3
0
 //============================================================
 // <T>加载设置信息</T>
 //
 // @param xconfig 设置信息
 //============================================================
 public override void OnLoadConfig(FXmlNode xconfig)
 {
     base.OnLoadConfig(xconfig);
     // 加载配置
     _optionVisible = xconfig.GetBoolean("option_visible", _optionVisible);
     _optionEnable  = xconfig.GetBoolean("option_enable", _optionEnable);
     // 加载属性
     if (xconfig.Contains("dock_cd"))
     {
         _dockCd = (ERcDock)REnum.ToValue(typeof(ERcDock), xconfig.Get("dock_cd"));
     }
     // 加载位置
     if (xconfig.Contains("location"))
     {
         _location.Parse(xconfig.Get("location"));
     }
     // 加载尺寸
     if (xconfig.Contains("size"))
     {
         _size.Parse(xconfig.Get("size"));
     }
     // 加载空白
     if (xconfig.Contains("margin"))
     {
         _margin.Parse(xconfig.Get("margin"));
     }
     if (xconfig.Contains("padding"))
     {
         _padding.Parse(xconfig.Get("padding"));
     }
     // 加载边框
     _borderInner.LoadConfig(xconfig, "border_inner");
     _borderOuter.LoadConfig(xconfig, "border_outer");
     // 加载前景
     _foreColor = xconfig.GetHex("fore_color", _foreColor);
     _foreResource.LoadConfig(xconfig, "fore");
     // 加载后景
     _backColor = xconfig.GetHex("back_color", _backColor);
     _backResource.LoadConfig(xconfig, "back");
     // 加载事件
     _onClick       = xconfig.Get("on_click", null);
     _onDoubleClick = xconfig.Get("on_double_click", null);
     _onMouseDown   = xconfig.Get("on_mouse_down", null);
     _onMouseUp     = xconfig.Get("on_mouse_up", null);
     _onMouseEnter  = xconfig.Get("on_mouse_enter", null);
     _onMouseMove   = xconfig.Get("on_mouse_move", null);
     _onMouseLeave  = xconfig.Get("on_mouse_leave", null);
 }