예제 #1
0
        private void OnImportImageClicked(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() != DialogResult.OK)
                return;

            try
            {
                System.Drawing.Image texture = System.Drawing.Image.FromFile(openFileDialog1.FileName);
                String name = Path.GetFileName(openFileDialog1.FileName);
                if (name.LastIndexOf('.') > 0)
                    name = name.Substring(0, name.LastIndexOf('.'));

                ImagesetInfo info = new ImagesetInfo(name, openFileDialog1.FileName);
                SettingDlg dlg = new SettingDlg("Import image", info);
                if (dlg.ShowDialog() != DialogResult.OK)
                    return;

                if (ImagesetManager.Instance.Contains(info.Name))
                    throw new Exception(String.Format("The image name '{0}' already exist!!!", info.Name));

                Imageset imageset = new Imageset();
                imageset.Name = info.Name;
                imageset.FileName = info.FileName;
                imageset.Width = texture.Width;
                imageset.Height = texture.Height;

                ImagesetManager.Instance.Add(imageset);

                ShowImagesets();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Import failed!!!");
            }
        }
예제 #2
0
        private void OnAddAnimKeyClicked(object sender, EventArgs e)
        {
            AnimationTrack animTrack = listView4.Tag as AnimationTrack;
            if (animTrack == null)
                return;

            AnimationKey animKey = new AnimationKey();
            SettingDlg dlg = new SettingDlg("New Animation Key", animKey);
            if (dlg.ShowDialog() != DialogResult.OK)
                return;

            animTrack.AnimKeys.Add(animKey);

            ShowAnimationTrack(animTrack);

            listView3.Items[listView3.Items.Count - 1].Selected = true;
        }
예제 #3
0
        private void OnNewAnimClicked(object sender, EventArgs e)
        {
            AnimationSet animationSet = listView2.Tag as AnimationSet;
            if (animationSet == null)
                return;

            Animation animation = new Animation();
            animation.Name = "Animation" + animationSet.Animations.Count;

            SettingDlg dlg = new SettingDlg("New Animation", animation);
            if (dlg.ShowDialog() != DialogResult.OK)
                return;

            animationSet.Animations.Add(animation);

            ShowAnimationSet(animationSet);

            listView2.Items[listView2.Items.Count - 1].Selected = true;
        }
예제 #4
0
        private void OnListViewDoubleClicked(object sender, EventArgs e)
        {
            ListView listView = sender as ListView;
            if (listView == null || listView.SelectedItems.Count == 0)
                return;

            Object select = listView.SelectedItems[0].Tag;
            if (select == null)
                return;

            SettingDlg dlg = new SettingDlg("Edit", select);
            dlg.ShowDialog();
        }
예제 #5
0
        private void OnNewAnimSetClicked(object sender, EventArgs e)
        {
            AnimationSet animationSet = new AnimationSet();
            animationSet.Name = "AnimationSet" + AnimationSetManager.Instance.AnimationSets.Count;

            SettingDlg dlg = new SettingDlg("New Animation Set", animationSet);
            if (dlg.ShowDialog() != DialogResult.OK)
                return;

            if (AnimationSetManager.Instance.Contains(animationSet.Name))
            {
                MessageBox.Show(string.Format("Animation '{0}' already exist!!!", animationSet.Name));
                return;
            }

            AnimationSetManager.Instance.Add(animationSet);

            ShowAnimationSets();

            listView1.Items[listView1.Items.Count - 1].Selected = true;
        }
예제 #6
0
        void NewImage(Imageset imageset, GameData.Image image)
        {
            SettingDlg dlg = new SettingDlg("New image", image);
            if (dlg.ShowDialog() != DialogResult.OK)
                return;

            if (imageset.Contains(image.Name))
            {
                MessageBox.Show(String.Format("The image '{0}' already exist!!", image.Name));
                return;
            }

            imageset.Add(image);
            image.Imageset = imageset;

            ShowImageset(imageset);

            listView2.Items[listView2.Items.Count - 1].Selected = true;
        }
예제 #7
0
        private void OnDoubleClicked(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count != 1)
                return;

            SettingDlg dlg = new SettingDlg("Edit", listView1.SelectedItems[0].Tag);
            dlg.ShowDialog();
        }
예제 #8
0
        private void treeView1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (treeView1.SelectedNode == null)
                return;

            SettingDlg dlg = new SettingDlg("Edit", treeView1.SelectedNode.Tag);
            dlg.ShowDialog();
        }
예제 #9
0
 private void OnKeyButtonEditClicked(object sender, EventArgs e)
 {
     AnimationKey key = mCurrnetKeyButton.Tag as AnimationKey;
     SettingDlg dlg = new SettingDlg("Edit", key);
     dlg.ShowDialog();
 }
예제 #10
0
        private void OnNewImageClicked(object sender, EventArgs e)
        {
            Imageset imageset = panel1.Tag as Imageset;
            if (imageset == null)
                return;

            GameData.Image image = new GameData.Image();
            image.Name = "NewImage";

            SettingDlg dlg = new SettingDlg("New image", image);
            if (dlg.ShowDialog() != DialogResult.OK)
                return;

            if (imageset.Contains(image.Name))
            {
                MessageBox.Show(String.Format("The image '{0}' already exist!!", image.Name));
                return;
            }

            imageset.Add(image);

            ShowImageset(imageset);

            listView2.Items[listView2.Items.Count - 1].Selected = true;
        }