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