Example #1
0
        //============================================================
        // <T>加载设置信息。</T>
        //
        // @param xconfig 设置节点
        //============================================================
        public void LoadConfig(FXmlNode xconfig)
        {
            // 读取属性
            _isReversed = xconfig.GetBoolean("is_reversed", _isReversed);
            if (xconfig.Contains("reverse_direction"))
            {
                int reverseDirection = xconfig.GetInteger("reverse_direction");
                _reverseDirection = IntToDirction(reverseDirection);
            }
            _frameDelay = xconfig.GetInteger("frame_delay", _frameDelay);
            // 读取剪辑集合
            FXmlNode xframes = xconfig.Find("Frames");

            if (xframes != null)
            {
                foreach (FXmlNode xnode in xframes.Nodes)
                {
                    if (xnode.IsName("Frame"))
                    {
                        int index = xnode.GetInteger("index");
                        FRsResourceFrame frame = _frames.Get(index, null);
                        if (frame != null)
                        {
                            frame.LoadConfig(xnode);
                        }
                    }
                }
            }
        }
Example #2
0
        //============================================================
        // <T>获得指定时间的帧对象。</T>
        //============================================================
        public FFrameInfo SyncFrame(long tick)
        {
            long findTick = tick / 1000000;
            int  count    = _frames.Count;

            if (count > 0)
            {
                FFrameInfo find = _frames.Get(count - 1);
                if (find.Tick == findTick)
                {
                    return(find);
                }
            }
            FFrameInfo info = new FFrameInfo();

            info.Index = _frames.Count;
            info.Tick  = findTick;
            _frames.Push(info);
            return(info);
        }
Example #3
0
        //============================================================
        // <T>序列化数据到输出流。</T>
        //
        // @param output 输出流
        // @return 处理结果
        //============================================================
        public EResult Serialize(IDataOutput output)
        {
            int count = _loggers.Count;

            output.WriteInt32(count);
            for (int n = 0; n < count; n++)
            {
                FLoggerInfo loggerInfo = _loggers.Get(n);
                loggerInfo.Serialize(output);
            }
            return(EResult.Success);
        }
Example #4
0
        //============================================================
        // <T>存储所有信息到文件中。</T>
        //============================================================
        public void StoreFiles()
        {
            // 保存属性
            FByteFile file = new FByteFile();
            // 写入个数
            int count = _infos.Count;

            file.WriteInt32(count);
            // 保存所有程序信息
            for (int n = 0; n < count; n++)
            {
                FApplicationInfo info = _infos.Get(n);
                file.WriteString(info.Name);
                // 保存程序信息
                string fileName = RFile.MakeFileName(_storagePath, info.Name + ".ser");
                info.SaveFile(fileName);
            }
            // 保存文件
            string configName = RFile.MakeFileName(_storagePath, "applications.ser");

            file.SaveFile(configName);
        }
Example #5
0
        //============================================================
        // <T>设计对齐处理。</T>
        //
        // @param alignCd 对齐方式
        // @param step 间隔
        //============================================================
        public void DesignAlign(int alignCd, int step)
        {
            // 检查变量
            if (!HasFocusControl())
            {
                return;
            }
            if (!HasSelectControl())
            {
                return;
            }
            // 获得焦点对象
            int left    = _focusControl.Location.X;
            int right   = _focusControl.Location.X + _focusControl.Size.Width;
            int hmiddle = (left + right) / 2;
            int top     = _focusControl.Location.Y;
            int bottom  = _focusControl.Location.Y + _focusControl.Size.Height;
            int vmiddle = (top + bottom) / 2;
            // 控件集合处理
            int count = Count;
            FObjects <FUiControl> controls = new FObjects <FUiControl>();

            controls.Assign(this);
            if (alignCd == EUiDesignAlign.HorizontalAvg)
            {
                if (count > 3)
                {
                    controls.Sort(new FUiControlLocationComparer(EUiControlLocation.X, true));
                    int firstX = controls.First.CenterX;
                    int lastX  = controls.Last.CenterX;
                    int stepX  = (lastX - firstX) / (count - 1);
                    for (int n = 0; n < count; n++)
                    {
                        FUiControl control = controls.Get(n);
                        control.CenterX = firstX + stepX * n;
                    }
                }
            }
            else if (alignCd == EUiDesignAlign.HorizontalAvgSize)
            {
                if (count > 3)
                {
                    controls.Sort(new FUiControlLocationComparer(EUiControlLocation.X, true));
                    int x = controls.First.Location.X;
                    for (int n = 0; n < count; n++)
                    {
                        FUiControl control = controls.Get(n);
                        control.Location.X = x;
                        x += control.Size.Width + step;
                    }
                }
            }
            else if (alignCd == EUiDesignAlign.VerticalAvg)
            {
                if (count > 3)
                {
                    controls.Sort(new FUiControlLocationComparer(EUiControlLocation.Y, true));
                    int firstY = controls.First.CenterY;
                    int lastY  = controls.Last.CenterY;
                    int stepY  = (lastY - firstY) / (count - 1);
                    for (int n = 0; n < count; n++)
                    {
                        FUiControl control = controls.Get(n);
                        control.CenterY = firstY + stepY * n;
                    }
                }
            }
            else if (alignCd == EUiDesignAlign.VerticalAvgSize)
            {
                if (count > 3)
                {
                    controls.Sort(new FUiControlLocationComparer(EUiControlLocation.Y, true));
                    int y = controls.First.Location.Y;
                    for (int n = 0; n < count; n++)
                    {
                        FUiControl control = controls.Get(n);
                        control.Location.Y = y;
                        y += control.Size.Height + step;
                    }
                }
            }
            else
            {
                // 处理其他情况
                foreach (FUiControl control in this)
                {
                    // 检查控件
                    if (control == _focusControl)
                    {
                        continue;
                    }
                    // 对齐处理
                    switch (alignCd)
                    {
                    case EUiDesignAlign.Center:
                        control.Location.X = hmiddle - (control.Size.Width >> 1);
                        control.Location.Y = vmiddle - (control.Size.Height >> 1);
                        break;

                    case EUiDesignAlign.Left:
                        control.Location.X = left;
                        break;

                    case EUiDesignAlign.HorizontalMiddle:
                        control.Location.X = hmiddle - (control.Size.Width >> 1);
                        break;

                    case EUiDesignAlign.Right:
                        control.Location.X = right - control.Size.Width;
                        break;

                    case EUiDesignAlign.Top:
                        control.Location.Y = top;
                        break;

                    case EUiDesignAlign.VerticalMiddle:
                        control.Location.Y = vmiddle - (control.Size.Height >> 1);
                        break;

                    case EUiDesignAlign.Bottom:
                        control.Location.Y = bottom - control.Size.Height;
                        break;
                    }
                }
            }
        }
Example #6
0
 //============================================================
 // <T>获得指定索引位置的子目录。</T>
 //
 // @param index 索引位置
 // @return 子目录
 //============================================================
 public FCfgFolder GetFolder(int index)
 {
     return((_folders != null) ? _folders.Get(index) : null);
 }
Example #7
0
 //============================================================
 // <T>获得指定索引位置的子对象。</T>
 //
 // @param index 索引位置
 // @return 子对象
 //============================================================
 public FCfgObject GetObject(int index)
 {
     return((_objects != null) ? _objects.Get(index) : null);
 }
Example #8
0
 //============================================================
 // <T>获得或设置指定索引位置的对象。</T>
 //
 // @param index 索引位置
 //============================================================
 public object this[int index] {
     get { return(_collection.Get(index)); }
     set { _collection.Set(index, (T)value); }
 }