Esempio n. 1
0
        private void btnChangeDelay_Click(object sender, EventArgs e)
        {
            if (Package.PackageState != AMTUtil.State.READY)
            {
                return;
            }
            if (lbFrames.SelectedIndex == -1)
            {
                MessageBox.Show("You need to select a frame!");
                return;
            }
            string PromptValue = InputPrompt.ShowDialog("Input a new time in milliseconds", "Edit time",
                                                        Package.Animation.Actions[lbActions.SelectedIndex].Frames[lbFrames.SelectedIndex].Delay.ToString());

            //User Cancel Action
            if (PromptValue == null)
            {
                return;
            }
            if (PromptValue == "")
            {
                MessageBox.Show("Input Empty!");
            }
            else
            {
                foreach (object o in lbFrames.SelectedItems)
                {
                    Package.Animation.Actions[lbActions.SelectedIndex].Frames[lbFrames.Items.IndexOf(o)].Delay = Convert.ToInt32(AMTUtil.GetNumbers(PromptValue));
                }
            }
            PopulateFrames();
        }
Esempio n. 2
0
        private void btnOpen_Click(object sender, EventArgs e)
        {
            ClearElements();
            InitData();
            string PromptValue = InputPrompt.ShowDialog("Name of the project", "New Project");

            if (PromptValue == null)
            {
                return;
            }
            if (PromptValue == "")
            {
                MessageBox.Show("Input Empty!");
            }
            FolderBrowserDialog FolderDialog = new FolderBrowserDialog();

            if (FolderDialog.ShowDialog() == DialogResult.OK)
            {
                Package.Name         = PromptValue;
                tssProjectName.Text  = Package.Name;
                Package.PackageState = AMTUtil.State.LOADED;
                Package.WorkingDir   = FolderDialog.SelectedPath;
                tssWorkingDir.Text   = Package.WorkingDir;
            }

            /*OpenFileDialog OpenFileDialog = new OpenFileDialog();
             * OpenFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
             * OpenFileDialog.Filter = "gif files (*.gif)|*.*";
             * OpenFileDialog.FilterIndex = 2;
             * OpenFileDialog.RestoreDirectory = true;
             * if (OpenFileDialog.ShowDialog() == DialogResult.OK)
             * {
             *  Package.PackageState = AMTUtil.State.LOADED;
             *  //Clear UI Before this and Data
             *  ClearElements();
             *  InitData();
             *  AMTUtil.LoadAsset(Package, OpenFileDialog.FileName);
             *  tssProjectName.Text = OpenFileDialog.FileName;
             *  //Creating New Dir
             *  Package.WorkingDir = Path.GetDirectoryName(OpenFileDialog.FileName);
             *  Package.WorkingDir = Directory.CreateDirectory(AMTUtil.GetAbsPath(Package.WorkingDir, Path.GetFileNameWithoutExtension(OpenFileDialog.FileName))).FullName;
             *  tssWorkingDir.Text = Package.WorkingDir;
             *  //Copy
             *  File.Copy(OpenFileDialog.FileName, AMTUtil.GetAbsPath(Package.WorkingDir, "asset.gif"));
             *  AMTUtil.InitAnimation(Package, (int)nudDefaultDelay.Value);
             *  FileType = "amf";
             *  PopulateImage();
             *  PopulateUI();
             * }*/
        }
Esempio n. 3
0
        private void btnNewAsset_Click(object sender, EventArgs e)
        {
            if (Package.PackageState == AMTUtil.State.EMPTY)
            {
                return;
            }
            string PromptValue = InputPrompt.ShowDialog("Name of the resource", "New Resource");

            if (PromptValue == null)
            {
                return;
            }
            if (PromptValue == "")
            {
                MessageBox.Show("Input Empty!");
            }
            OpenFileDialog OpenFileDialog = new OpenFileDialog();

            OpenFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            OpenFileDialog.Filter           = "gif files (*.gif)|*.gif";
            OpenFileDialog.FilterIndex      = 2;
            OpenFileDialog.RestoreDirectory = true;
            if (OpenFileDialog.ShowDialog() == DialogResult.OK)
            {
                if (!Package.AddResource(PromptValue, OpenFileDialog.FileName, ResourceType.GIF))
                {
                    MessageBox.Show("Resource Load Error!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                PopulateResources();
            }
            if (Package.PackageState != AMTUtil.State.READY)
            {
                if (MessageBox.Show("Do you want to initialize animation using this resource?", "Initialize Animation",
                                    MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    AMTUtil.InitAnimation(Package, Package.CurrentResource.Name);
                    PopulateUI();
                }
            }
        }
Esempio n. 4
0
        private void btnRandom_Click(object sender, EventArgs e)
        {
            if (Package.PackageState != AMTUtil.State.READY)
            {
                return;
            }
            if (lbFrames.SelectedIndex == -1)
            {
                MessageBox.Show("You need to select a frame!");
                return;
            }
            string PromptValue = InputPrompt.ShowDialog("Input a new randomness", "Edit Randomness",
                                                        Package.Animation.Actions[lbActions.SelectedIndex].Frames[lbFrames.SelectedIndex].Randomness.ToString());

            //User Cancel Action
            if (PromptValue == null)
            {
                return;
            }
            if (PromptValue == "")
            {
                MessageBox.Show("Input Empty!");
            }
            else
            {
                foreach (object o in lbFrames.SelectedItems)
                {
                    if (Package.Animation.Actions[lbActions.SelectedIndex].Frames[lbFrames.Items.IndexOf(o)].ActionRef != null)
                    {
                        MessageBox.Show("Action reference frames are not changed.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        Package.Animation.Actions[lbActions.SelectedIndex].Frames[lbFrames.Items.IndexOf(o)].Randomness = Convert.ToDouble(AMTUtil.GetDouble(PromptValue));
                    }
                }
            }
            PopulateFrames();
        }
Esempio n. 5
0
        private void btnEditTag_Click(object sender, EventArgs e)
        {
            string tags = "";

            if (Package.PackageState != AMTUtil.State.READY)
            {
                return;
            }
            if (lbFrames.SelectedIndex == -1)
            {
                MessageBox.Show("You need to select a frame!");
                return;
            }
            foreach (string s in Package.Animation.Actions[lbActions.SelectedIndex].Frames[lbFrames.SelectedIndex].Tags)
            {
                tags += (s + ",");
            }
            string PromptValue = InputPrompt.ShowDialog("Input tags, seperated by comma", "Edit Tags",
                                                        tags);

            //User Cancel Action
            if (PromptValue == null)
            {
                return;
            }
            foreach (object o in lbFrames.SelectedItems)
            {
                Package.Animation.Actions[lbActions.SelectedIndex].Frames[lbFrames.Items.IndexOf(o)].Tags.Clear();
                foreach (string s in PromptValue.Split(','))
                {
                    if (s != "")
                    {
                        Package.Animation.Actions[lbActions.SelectedIndex].Frames[lbFrames.Items.IndexOf(o)].Tags.Add(s);
                    }
                }
            }
            PopulateFrames();
            //No Previous Selection Recovery
        }
Esempio n. 6
0
        private void btnCreateAsNew_Click(object sender, EventArgs e)
        {
            if (Package.PackageState != AMTUtil.State.READY)
            {
                return;
            }
            string PromptValue = InputPrompt.ShowDialog("Input New Action Name", "New Action");

            if (PromptValue == null)
            {
                return;
            }
            if (PromptValue == "")
            {
                MessageBox.Show("Input Empty!");
            }
            else if (Package.Animation.Manifest.ActionFileName.Contains(PromptValue))
            {
                MessageBox.Show("Action Already Exist!");
            }
            else
            {
                Package.Animation.Manifest.ActionFileName.Add(PromptValue);
                Package.Animation.Actions.Add(new AMTAction());
                Package.Animation.Actions.Last().Name = PromptValue;
                foreach (object o in lbGifFrames.SelectedItems)
                {
                    Package.Animation.Actions.Last().Frames.Add(new AMTFrame());
                    Package.Animation.Actions.Last().Frames.Last().Resource = Package.CurrentResource.Name;
                    Package.Animation.Actions.Last().Frames.Last().Delay = (int)nudDefaultDelay.Value;
                    Package.Animation.Actions.Last().Frames.Last().FrameRef = lbGifFrames.Items.IndexOf(o);
                    Package.Animation.Actions.Last().Frames.Last().MD5 = Package.CurrentResource.FrameUID[lbGifFrames.Items.IndexOf(o)];
                    Package.Animation.Actions.Last().Frames.Last().Tags.Add("null");
                }
                PopulateUI();
            }
        }