コード例 #1
0
        protected static void LoopAction(object sender, EventArgs e)
        {
            NumericInputForm entryCount = new NumericInputForm();

            if (entryCount.ShowDialog("Animation Looper", "Number of runthroughs:") == DialogResult.OK)
            {
                GetInstance <CHR0Wrapper>().Loop(entryCount.NewValue - 1);
            }
        }
コード例 #2
0
 protected static void NewStageTableAction <T>(object sender, EventArgs e) where T : StageTableNode, new()
 {
     using (NumericInputForm entryCount = new NumericInputForm())
     {
         if (entryCount.ShowDialog($"{typeof(T).Name} Generation", "Number of Entries:") == DialogResult.OK)
         {
             GetInstance <ARCWrapper>().NewStageTable <T>(entryCount.NewValue);
         }
     }
 }
コード例 #3
0
        public void Resize()
        {
            NumericInputForm n = new NumericInputForm();

            if (_resource is StageTableNode t &&
                n.ShowDialog("Resize", "Enter the new size:", t.NumEntries) == DialogResult.OK)
            {
                List <byte> newList = new List <byte>();
                for (int i = 0; i < n.NewValue * t.NumEntries; i++)
                {
                    newList.Add(i < t.EntryList.Count ? t.EntryList[i] : (byte)0);
                }

                t.EntryList = newList;
                MainForm.Instance.resourceTree_SelectionChanged(this, null);
            }
        }
コード例 #4
0
        public static void ColorSmashTex0(object sender, EventArgs e)
        {
            // If this was selected via keycode when it's invalid, return without error
            if (!CanRunColorSmash || MainForm.Instance.resourceTree.SelectedNodes.Count <= 1)
            {
                return;
            }

            short paletteCount = 0;

            foreach (TreeNode n in MainForm.Instance.resourceTree.SelectedNodes)
            {
                if (n is TEX0Wrapper tw)
                {
                    TEX0Node t = (TEX0Node)tw.Resource;
                    if (paletteCount < 256)
                    {
                        if (!t.HasPalette || t.GetPaletteNode() == null)
                        {
                            paletteCount = 256;
                        }
                        else if (t.HasPalette && t.GetPaletteNode() != null &&
                                 t.GetPaletteNode().Palette.Entries.Length > paletteCount)
                        {
                            paletteCount = (short)Math.Min(t.GetPaletteNode().Palette.Entries.Length, 256);
                        }
                    }
                }
            }

            if (paletteCount == 0)
            {
                paletteCount = 256;
            }

            using (NumericInputForm frm = new NumericInputForm())
            {
                if (frm.ShowDialog("Color Smasher", "How many colors?", paletteCount) == DialogResult.OK)
                {
                    ColorSmashTex0(frm.NewValue);
                }
            }
        }