Esempio n. 1
0
        private void AddControls(SAVEditor p, SlotChangeManager m, SaveFile sav)
        {
            for (int i = 0; i < sav.BoxCount; i++)
            {
                var boxEditor = new BoxEditor
                {
                    Name   = $"BE_Box{i:00}",
                    Margin = new Padding(1),
                    Editor = new BoxEdit(sav),
                };
                boxEditor.Setup(m);
                boxEditor.InitializeGrid();
                boxEditor.Reset();
                foreach (PictureBox pb in boxEditor.SlotPictureBoxes)
                {
                    pb.ContextMenuStrip = p.SlotPictureBoxes[0].ContextMenuStrip;
                }
                boxEditor.CurrentBox           = i;
                boxEditor.CB_BoxSelect.Enabled = false;
                Boxes[i] = boxEditor;
            }
            FLP_Boxes.Controls.AddRange(Boxes);

            // Setup swapping
            foreach (var box in Boxes)
            {
                box.ClearEvents();
                box.B_BoxLeft.Click += (s, e) =>
                {
                    if (s == null)
                    {
                        return;
                    }
                    int index = Array.IndexOf(Boxes, ((Button)s).Parent);
                    int other = (index + Boxes.Length - 1) % Boxes.Length;
                    m.SwapBoxes(index, other, p.SAV);
                };
                box.B_BoxRight.Click += (s, e) =>
                {
                    if (s == null)
                    {
                        return;
                    }
                    int index = Array.IndexOf(Boxes, ((Button)s).Parent);
                    int other = (index + 1) % Boxes.Length;
                    m.SwapBoxes(index, other, p.SAV);
                };
            }
        }
Esempio n. 2
0
    private void OnEnable()
    {
        try
        {
            helper = target as MeshToTerrainBoundsHelper;

            if (target == null || helper == null)
            {
                return;
            }
            if (helper.bounds == default(Bounds))
            {
                DestroyImmediate(helper);
                return;
            }

            boxEditor = new BoxEditor(true, -1);
        }
        catch
        {
        }
    }
Esempio n. 3
0
        private void AddControls(SAVEditor p, SlotChangeManager m, SaveFile sav)
        {
            for (int i = 0; i < sav.BoxCount; i++)
            {
                var boxEditor = new BoxEditor {
                    Name = $"BE_Box{i:00}", Margin = new Padding(1)
                };
                foreach (PictureBox pb in boxEditor.SlotPictureBoxes)
                {
                    pb.ContextMenuStrip = p.SlotPictureBoxes[0].ContextMenuStrip;
                }
                boxEditor.Setup(m);
                boxEditor.Reset();
                boxEditor.CurrentBox           = i;
                boxEditor.CB_BoxSelect.Enabled = false;
                Boxes.Add(boxEditor);
                FLP_Boxes.Controls.Add(Boxes[i]);
            }

            // Setup swapping
            foreach (var box in Boxes)
            {
                box.ClearEvents();
                box.B_BoxLeft.Click += (s, e) =>
                {
                    int index = Boxes.FindIndex(z => z == ((Button)s).Parent);
                    int other = (index + Boxes.Count - 1) % Boxes.Count;
                    m.SwapBoxes(index, other);
                };
                box.B_BoxRight.Click += (s, e) =>
                {
                    int index = Boxes.FindIndex(z => z == ((Button)s).Parent);
                    int other = (index + 1) % Boxes.Count;
                    m.SwapBoxes(index, other);
                };
            }
        }