Ejemplo n.º 1
0
        public static void loadTileForm(UI_CanvasForm targetForm, CanvasGrid canvasGrid)
        {
            targetForm.ResizeCanvas(targetForm, canvasGrid);

            for (int x = 0; x < canvasGrid.x; x++)
            {
                for (int y = 0; y < canvasGrid.y; y++)
                {
                    if (canvasGrid.gridComponent[x, y] != null)
                    {
                        targetForm.Text = canvasGrid.GridName;
                        bool DisplayHeader            = (canvasGrid.gridComponentDisplayHeader[x, y].HasValue ? canvasGrid.gridComponentDisplayHeader[x, y].Value : false);
                        var  size                     = canvasGrid.gridComponentSize[x, y];
                        UI_ComponentFormTile tileForm = getTileForm(canvasGrid.gridComponent[x, y], size?.Width, size?.Height, DisplayHeader);
                        tileForm.TopLevel = false;
                        targetForm.Controls.Add(tileForm);
                        tileForm.Location = getTileLocation(x, y);


                        tileForm.Show();
                    }
                }
            }

            targetForm.MinimumSize = targetForm.Size;
        }
        public static void loadTileFormExtraWindow(CanvasGrid canvasGrid, string WindowHeader = "RTC Extra Form")
        {
            CanvasForm extraForm = new CanvasForm(true);

            extraForm.Controls.Clear();
            extraForms.Add(extraForm);
            extraForm.FormBorderStyle = FormBorderStyle.FixedSingle;
            extraForm.MaximizeBox     = false;
            extraForm.Text            = WindowHeader;
            loadTileForm(extraForm, canvasGrid);
            extraForm.Show();
        }
Ejemplo n.º 3
0
        //public void BlockView() => (this as IBlockable)?.BlockView();
        //public void UnblockView() => (this as IBlockable)?.UnblockView();

        public static void loadTileFormExtraWindow(CanvasGrid canvasGrid, string WindowHeader, bool silent = false)
        {
            UI_CanvasForm extraForm;

            if (allExtraForms.ContainsKey(WindowHeader))
            {
                extraForm = allExtraForms[WindowHeader];

                foreach (Control ctr in extraForm?.Controls)
                {
                    if (ctr is UI_ComponentFormTile cft)
                    {
                        cft.ReAnchorToPanel();
                    }
                }
            }
            else
            {
                extraForm = new UI_CanvasForm(true);
                allExtraForms[WindowHeader] = extraForm;
                extraForms.Add(extraForm);
            }

            extraForm.Controls.Clear();
            extraForm.Text = WindowHeader;

            UICore.registerFormEvents(extraForm);
            UICore.registerHotkeyBlacklistControls(extraForm);
            loadTileForm(extraForm, canvasGrid);

            if (canvasGrid.isResizable)
            {
                extraForm.MaximizeBox     = true;
                extraForm.FormBorderStyle = FormBorderStyle.Sizable;
            }
            else
            {
                extraForm.MaximizeBox     = false;
                extraForm.FormBorderStyle = FormBorderStyle.FixedSingle;
            }


            if (!silent)
            {
                extraForm.Show();
                extraForm.Focus();
            }
        }
Ejemplo n.º 4
0
        public static void loadTileFormMain(CanvasGrid canvasGrid)
        {
            clearMainTileForm();
            loadTileForm(mainForm, canvasGrid);

            if (mainForm.Parent is Form f)
            {
                if (canvasGrid.isResizable)
                {
                    f.FormBorderStyle = FormBorderStyle.Sizable;
                    f.MaximizeBox     = true;
                }
                else
                {
                    f.FormBorderStyle = FormBorderStyle.FixedSingle;
                    f.MaximizeBox     = false;
                }
            }

            //thisForm.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right;
        }
Ejemplo n.º 5
0
 public void ResizeCanvas(UI_CanvasForm targetForm, CanvasGrid canvasGrid)
 {
     this.SetSize(getTilePos(canvasGrid.x), getTilePos(canvasGrid.y));
 }
 public static void loadTileFormMain(CanvasGrid canvasGrid)
 {
     clearTileForms();
     loadTileForm(thisForm, canvasGrid);
 }
Ejemplo n.º 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Test button, creates forms using class names and coordinates.

            /*
             * var GlitchHarvester = new CanvasGrid(6, 3);
             * GlitchHarvester.SetTileForm("UI_SavestateManager", 0, 0);
             * GlitchHarvester.SetTileForm("UI_Engine_Blast", 1, 0);
             * GlitchHarvester.SetTileForm("UI_BlastManipulator", 2, 0);
             * GlitchHarvester.SetTileForm("UI_BlastParameters", 1, 1);
             * GlitchHarvester.SetTileForm("UI_StashHistory", 2, 1);
             * GlitchHarvester.SetTileForm("UI_RenderOutput", 1, 2);
             * GlitchHarvester.SetTileForm("UI_StockpileManager", 3, 0);
             */

            //EngineForm.SetTileForm("UI_Engine_MemoryDomains", 0, 2);

            /*
             * var TestForm = new CanvasGrid(5, 4);
             * TestForm.SetTileForm("UI_DummyTileForm3x1", 0, 0);
             * TestForm.SetTileForm("UI_DummyTileForm2x1", 3, 2);
             * TestForm.SetTileForm("UI_DummyTileForm2x2", 3, 0);
             * TestForm.SetTileForm("UI_DummyTileForm1x1", 4, 3);
             * TestForm.SetTileForm("UI_DummyTileForm3x3", 0, 1);
             */

            /*
             * var multiGrid = new MultiGrid(
             *  EngineGrid,
             *  GlitchHarvester,
             *  TestForm
             * );
             *
             * multiGrid.Load();
             */

            var EngineGrid = new CanvasGrid(9, 8, "Engine Config");

            EngineGrid.SetTileForm("General Parameters", 0, 0, 3, 3, false);
            EngineGrid.SetTileForm("Corruption Engine", 3, 0, 6, 3);
            EngineGrid.SetTileForm("Memory Domains", 0, 3, 3, 5);
            EngineGrid.SetTileForm("Advanced Memory Tools", 3, 3, 6, 5, false);
            EngineGrid.LoadToMain();

            var TestGrid = new CanvasGrid(13, 8, "Glitch Harvester");

            TestGrid.SetTileForm("Glitch Harvester", 0, 0, 9, 8, false);
            TestGrid.LoadToNewWindow();

            /*
             * var multiGrid = new MultiGrid(
             *  EngineGrid,
             *  TestGrid
             * );
             */

            //multiGrid.Load();

            //var tileForm = (UI_ComponentFormTile)UI_CanvasForm.getTileForm("UI_ComponentFormTile");
            //tileForm.SetCompoentForm("ComponentForm host", 4, 4);
        }
Ejemplo n.º 8
0
        internal static void LoadCustomLayout()
        {
            string customLayoutPath = Path.Combine(RTCV.CorruptCore.RtcCore.RtcDir, "CustomLayout.txt");

            string[] allLines = File.ReadAllLines(customLayoutPath);

            int        gridSizeX = 26;
            int        gridSizeY = 19;
            string     gridName  = "Custom Grid";
            CanvasGrid cuGrid    = new CanvasGrid(gridSizeX, gridSizeY, gridName);

            //foreach(string line in allLines.Select(it => it.Trim()))
            for (int i = 0; i < allLines.Length; i++)
            {
                string line = allLines[i].Trim();

                if (line == "" || line.StartsWith("//"))
                {
                    continue;
                }

                if (line.Contains("//"))
                {
                    string[] lineParts = line.Split('/');
                    line = lineParts[0].Trim();
                }

                string[] parts = line.Split(':');

                string command = parts[0];
                string data    = (parts.Length > 1 ? parts[1] : "");

                switch (command)
                {
                case "GridName":
                {
                    gridName = data;
                    break;
                }

                case "GridSize":
                {
                    string[] subData = data.Split(',');

                    gridSizeX = Convert.ToInt32(subData[0].Trim());
                    gridSizeY = Convert.ToInt32(subData[1].Trim());

                    break;
                }

                case "CreateGrid":
                {
                    cuGrid = new CanvasGrid(gridSizeX, gridSizeY, gridName);
                    break;
                }

                case "IsResizable":
                {
                    cuGrid.isResizable = true;
                    break;
                }

                case "SetTileForm":
                {
                    string[] subData = data.Split(',');

                    string formName = subData[0].Trim();

                    int formGridPosX  = Convert.ToInt32(subData[1].Trim());
                    int formGridPosY  = Convert.ToInt32(subData[2].Trim());
                    int formGridSizeX = Convert.ToInt32(subData[3].Trim());
                    int formGridSizeY = Convert.ToInt32(subData[4].Trim());

                    AnchorStyles formGridAnchor = (AnchorStyles.Top | AnchorStyles.Left);

                    if (subData.Length > 5)
                    {
                        formGridAnchor = (AnchorStyles)Convert.ToInt32(subData[5].Trim());
                    }

                    Form tileForm = null;

                    if (formName == "MemoryTools")
                    {
                        tileForm = UICore.mtForm;
                    }
                    else
                    {
                        tileForm = (Form)S.GET(Type.GetType("RTCV.UI." + formName));
                    }

                    cuGrid.SetTileForm(tileForm, formGridPosX, formGridPosY, formGridSizeX, formGridSizeY, true, formGridAnchor);

                    break;
                }

                case "LoadTo":
                {
                    if (data == "Main")
                    {
                        cuGrid.LoadToMain();
                    }
                    else
                    {
                        cuGrid.LoadToNewWindow("External");
                    }

                    break;
                }
                }
            }
        }
Ejemplo n.º 9
0
 private void BtnOpenCustomLayout_Click(object sender, EventArgs e)
 {
     CanvasGrid.LoadCustomLayout();
 }