Example #1
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();
                }
            }
        }
Example #2
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
        }
Example #3
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();
        }
Example #4
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();
            }
        }