Ejemplo n.º 1
0
        //============================================================
        // <T>创建资源对象。</T>
        //
        // @param typeCd 资源类型
        // @param code 代码
        //============================================================
        public FRsResource CreateResource(int typeCd, int code)
        {
            // 创建资源
            FRsResource resource = null;

            switch (typeCd)
            {
            case ERsResource.Picture:
                resource = new FRsResourcePicture();
                break;

            case ERsResource.Animation:
                resource = new FRsResourceAnimation();
                break;

            case ERsResource.Sound:
                resource = new FRsResourceSound();
                break;

            case ERsResource.Music:
                resource = new FRsResourceMusic();
                break;
            }
            // 检查存在性
            if (_resources.Contains(code))
            {
                RMoCore.TrackConsole.Write(this, "CreateResource", "Duplicate resource code. (code={0})", code);
            }
            // 设置对照表
            _resources.Set(code, resource);
            return(resource);
        }
Ejemplo n.º 2
0
        //============================================================
        // <T>资源点击事件。</T>
        //============================================================
        private void qrsResourceList_ResourceClick(object sender, EventArgs e)
        {
            FRsResource resource = qrsResourceList.SelectedResource;

            if (null != resource)
            {
                // 打开资源
                resource.Open();
                // 显示资源
                SuspendLayout();
                qrsClipViewer.Visible    = false;
                qrsPictureViewer.Visible = false;
                // 显示动画
                if (resource is FRsResourceAnimation)
                {
                    FRsResourceAnimation animation = resource as FRsResourceAnimation;
                    FRsResourceClip      clip      = animation.FristClip;
                    qrsClipViewer.LoadClip(clip);
                    qrsClipViewer.DoPlay();
                    qrsClipViewer.Visible = true;
                }
                // 显示图片
                if (resource is FRsResourcePicture)
                {
                    FRsResourcePicture picture = resource as FRsResourcePicture;
                    qrsPictureViewer.LoadPicture(picture);
                    qrsPictureViewer.Visible = true;
                    labInfo.Text             = picture.Format();
                }
                ResumeLayout();
            }
        }
Ejemplo n.º 3
0
        //============================================================
        public override void LoadResource(FRsResource resource)
        {
            cmbAlphaVelue.Text = null;
            base.LoadResource(resource);
            _resourceAnimation = resource as FRsResourceAnimation;
            // 加载信息
            LoadInformation();
            // 加载剪辑列表
            LoadClipList();
            // 设置延迟
            tbrSystemDelay.Value = 1000 / _resourceAnimation.FrameDelay;
            selectDelay(tbrSystemDelay.Value);
            // 设置关键帧
            tbrModuleDelay.Clear();
            tbrModuleDelay.LoadInfomation(_currentClip);
            switch (_resourceAnimation.TimeoutCd)
            {
            case "none":
                radNull.Checked = true;
                break;

            case "short":
                radShort.Checked = true;
                break;

            case "middle":
                radMiddle.Checked = true;
                break;

            case "long":
                radLong.Checked = true;
                break;
            }
            switch (_resourceAnimation.QualityCd)
            {
            case ERsResourceQuality.Max:
                ranPalettePixel5.Checked = true;
                break;

            case ERsResourceQuality.Middle:
                ranPalettePixel3.Checked = true;
                break;

            case ERsResourceQuality.Lower:
                ranPalettePixel2.Checked = true;
                break;

            case ERsResourceQuality.High:
                ranPalettePixel4.Checked = true;
                break;

            case ERsResourceQuality.Min:
                ranPalettePixel1.Checked = true;
                break;

            default:
                break;
            }
        }
Ejemplo n.º 4
0
        //============================================================
        // <T>递归加载文件信息。</T>
        //
        // @param folders 文件集合
        // @author TYFNG 1203024
        //============================================================
        protected void ScanFolder(FRsResourceFolder parentFolder)
        {
            // 处理所有子文件夹
            FStrings directoryNames = RDirectory.ListDirectories(parentFolder.Directory);

            foreach (string directoryName in directoryNames)
            {
                if (-1 != directoryName.IndexOf(".svn"))
                {
                    continue;
                }
                string fileName = directoryName.Substring(directoryName.LastIndexOf("\\") + 1);
                // 解析动画资源
                if (fileName.StartsWith("RA-"))
                {
                    string name      = fileName.Substring(3);
                    string fullName  = name;
                    string label     = name;
                    int    codeIndex = name.IndexOf("-");
                    if (-1 != codeIndex)
                    {
                        name = name.Substring(0, codeIndex);
                    }
                    name = name.Replace(".", "");
                    // 创建图片资源
                    int code = RInt.Parse(name);
                    FRsResourceAnimation animation = CreateResource(ERsResource.Animation, code) as FRsResourceAnimation;
                    animation.Folder    = parentFolder;
                    animation.Code      = code;
                    animation.Name      = name;
                    animation.Label     = label;
                    animation.FullLabel = parentFolder.FullLabel + "\\" + label;
                    animation.Keyword   = label.Replace(".", "");
                    animation.Directory = directoryName;
                    animation.Scan();
                    parentFolder.Resources.Push(animation);
                }
                else
                {
                    // 创建子文件夹
                    FRsResourceFolder folder = new FRsResourceFolder();
                    folder.Label     = fileName;
                    folder.FullLabel = parentFolder.FullLabel + "\\" + fileName;
                    folder.Directory = directoryName;
                    parentFolder.Folders.Push(folder);
                    // 扫描子文件夹
                    ScanFolder(folder);
                }
            }
            // 扫描文件夹
            parentFolder.Scan();
        }
Ejemplo n.º 5
0
 //============================================================
 // <T>启用反转的时候启用反转选项。</T>
 //
 // @author DYWEN 20120712
 //============================================================
 private void chbReverse_CheckedChanged(object sender, EventArgs e)
 {
     if (chbReverse.CheckState == CheckState.Checked)
     {
         newClip.IsReversed          = true;
         chbReverseDirection.Enabled = true;
         chbReverseCd.Enabled        = true;
     }
     else
     {
         chbReverseDirection.Enabled = false;
         chbReverseCd.Enabled        = false;
         newClip.IsReversed          = false;
         QDsAnimationProperty prop = this.Parent.Parent as QDsAnimationProperty;
         if (prop != null)
         {
             FRsResourceAnimation animtion = prop.animation;
             // animtion.RemoveClip((int)newClip.DirectionCd);
         }
     }
 }
Ejemplo n.º 6
0
        //============================================================
        // <T>获取对象是否反转。</T>
        //
        // @author DYWEN 20120712
        //============================================================
        private void chbDirection_TextChanged(object sender, EventArgs e)
        {
            _controlName = this.Name;
            if (_controlName == "qdsProperty")
            {
                return;
            }
            QDsAnimationProperty prop = this.Parent.Parent as QDsAnimationProperty;

            if (prop != null)
            {
                FRsResourceAnimation animtion = prop.animation;
                if (chbReverse.CheckState == CheckState.Checked)
                {
                    newClip.DirectionCd = nameType(_controlName);
                    //FRsResourceClip clip = animtion.SyncClip(animtion.FristClip, (int)newClip.DirectionCd);
                    //reverseDirectionText = chbReverseDirection.Text;
                    //reverseCdText = chbReverseCd.Text;
                    //clip.ReverseDirection = ReverseDirectionType(reverseDirectionText);
                    //clip.ReverseCd = ReverseCd(reverseCdText);
                    //clip.IsReversed = chbReverse.Checked;
                }
            }
        }
Ejemplo n.º 7
0
 //============================================================
 // <T>选择资源。</T>
 //
 // @param resource 资源
 //============================================================
 public void SelectResource(FRsResource resource)
 {
     // 打开资源
     resource.Open();
     // 显示资源
     qrsClipViewer.Visible    = false;
     qrsPictureViewer.Visible = false;
     // 显示动画
     if (resource is FRsResourceAnimation)
     {
         FRsResourceAnimation animation = resource as FRsResourceAnimation;
         FRsResourceClip      clip      = animation.FristClip;
         qrsClipViewer.LoadClip(clip);
         qrsClipViewer.DoPlay();
         qrsClipViewer.Visible = true;
     }
     // 显示动画
     if (resource is FRsResourcePicture)
     {
         FRsResourcePicture picture = resource as FRsResourcePicture;
         qrsPictureViewer.LoadPicture(picture);
         qrsPictureViewer.Visible = true;
     }
 }