public void Configurar() { gui.InitDialog(false, false); profiling = true; int W = GuiController.Instance.Panel3d.Width; int H = GuiController.Instance.Panel3d.Height; int x0 = 50; int y0 = 50; int dy = H - 100; int dx = W - 100; gui_item frame = gui.InsertIFrame("Profiling", x0, y0, dx, dy, Color.FromArgb(140, 240, 140)); frame.c_font = Color.FromArgb(0, 0, 0); gui.InsertButton(IDOK, "OK", x0 + dx - 300, y0 + dy - 60, 120, 60); gui.InsertButton(IDCANCEL, "Salir", x0 + dx - 140, y0 + dy - 60, 120, 60); gui.InsertItem("Configure el color", x0 + 50, y0 + 130); int cdx = 50; int pos_x = x0 + 100; int pos_y = y0 + 220; int s = 0; for (int i = 0; i < cant_colores; ++i) { gui_item item = gui.InsertItemColor(pos_x, pos_y, lst_colores[i], 1000 + i); if ((i + 1) % 4 == 0) { if (s % 2 == 1) { pos_x = x0 + 100; } else { pos_x = x0 + 100 - 38; } pos_y += cdx / 2; s++; } else { pos_x += cdx + cdx / 2; } // uso el texto para meter el dato del nro de color item.text = "" + i; } }
private void CreateInterface() { GUIItem guiText = new GUIItem(); int W = D3DDevice.Instance.Width; int H = D3DDevice.Instance.Height; int dy = H - 50; int dy2 = dy; int dx = W / 2; int posEnX = (W / 2) - (dx / 2); int posEnY = (H / 2) - (dy / 2); int x0 = posEnX + 150; int y0 = posEnY + 100; int x1 = x0; int y1 = y0; DrawIFrame(); shipHelmGuiItem = gui.InsertImage("timon.jpg", x1, y1 + 30, MediaDir); shipHelmGuiItemText = gui.InsertItem("Timon", x1 += 50, y1 + 20); shipHelmGuiItemButton = gui.InsertButton(ID_CRAFT_SHIP_HELM, "Crear", x1 += 300, y1, 120, 60); noelementsMsg.Text = "No tienes elementos suficientes"; noelementsMsg.Color = Color.Red; noelementsMsg.Align = TgcText2D.TextAlign.RIGHT; noelementsMsg.Position = new Point((W / 2) - 180, (H / 2) - 5); noelementsMsg.Size = new Size(300, 100); noelementsMsg.changeFont(new Font("TimesNewRoman", 14)); craftElementMsg.Text = "Creaste un timon. Revisa el inventario"; craftElementMsg.Color = Color.Green; craftElementMsg.Align = TgcText2D.TextAlign.RIGHT; craftElementMsg.Position = new Point((W / 2) - 180, (H / 2) - 5); craftElementMsg.Size = new Size(300, 100); craftElementMsg.changeFont(new Font("TimesNewRoman", 14)); }
public override void init() { GuiController.Instance.CustomRenderEnabled = true; Cursor.Hide(); Device d3dDevice = GuiController.Instance.D3dDevice; MyMediaDir = GuiController.Instance.ExamplesDir + "Shaders\\WorkshopShaders\\Media\\"; MyShaderDir = GuiController.Instance.ExamplesDir + "Shaders\\WorkshopShaders\\Shaders\\"; // levanto el GUI gui.Create(); // menu principal gui.InitDialog(false, false); int W = GuiController.Instance.Panel3d.Width; int H = GuiController.Instance.Panel3d.Height; int x0 = 70; int y0 = 10; int dy = 30; int dy2 = dy; int dx = 250; gui_item item = gui.InsertImage("transformers//custom_char.png", x0, y0); item.image_centrada = false; y0 += dy; gui.InsertItem(new static_text(gui, "SCOUT", x0, y0, 400, 25)); y0 += 45; item = gui.InsertImage("transformers//scout.png", x0 + dx, y0); item.image_centrada = false; gui.InsertItem(new menu_item(gui, "SCOUT 1", "transformers//scout1.png", ID_SCOUT, x0, y0, dx, dy)); y0 += dy + 5; gui.InsertItem(new menu_item(gui, "SCOUT 2", "transformers//scout2.png", ID_SCOUT, x0, y0, dx, dy)); y0 += 2 * dy; gui.InsertItem(new static_text(gui, "HUNTER", x0, y0, 400, 25)); y0 += 45; item = gui.InsertImage("transformers//hunter.png", x0 + dx, y0); item.image_centrada = false; menu_item hunter1 = (menu_item)gui.InsertItem(new menu_item(gui, "HUNTER 1", "transformers//hunter1.png", ID_HUNTER, x0, y0, dx, dy)); hunter1.pos_imagen.Y = y0; y0 += 2 * dy; gui.InsertItem(new static_text(gui, "COMMANDER", x0, y0, 400, 25)); y0 += 45; item = gui.InsertImage("transformers//commander.png", x0 + dx, y0); item.image_centrada = false; menu_item commander1 = (menu_item)gui.InsertItem(new menu_item(gui, "COMMANDER 1", "transformers//commander1.png", ID_COMMANDER, x0, y0, dx, 25)); commander1.pos_imagen.Y = y0; y0 += 2 * dy; gui.InsertItem(new static_text(gui, "WARRIOR", x0, y0, 400, 25)); y0 += 45; item = gui.InsertImage("transformers//warrior.png", x0 + dx, y0); item.image_centrada = false; menu_item warrior1 = (menu_item)gui.InsertItem(new menu_item(gui, "WARRIOR 1", "transformers//warrior1.png", ID_WARRIOR, x0, y0, dx, 30)); warrior1.pos_imagen.Y = y0; dialog_sel = 0; }
public void ShowInventory() { bool itemAdded = false; active = !active; if (active) { bool hammerAdded = false; int cantWood = 0, cantRope = 0; GUIItem woodGUIText = new GUIItem(); GUIItem ropeGUIText = new GUIItem(); int W = D3DDevice.Instance.Width; int H = D3DDevice.Instance.Height; int dy = H - 50; int dy2 = dy; int dx = W / 2; int posEnX = (W / 2) - (dx / 2); int posEnY = (H / 2) - (dy / 2); int x0 = posEnX + 150; int y0 = posEnY + 50; int x1 = x0; int y1 = y0; GUIItem frame = gui.InsertIFrame("", posEnX, posEnY, dx, dy, Color.FromArgb(92, 43, 43)); frame.c_font = Color.FromArgb(0, 0, 0); frame.scrolleable = true; collectedItems.ForEach(item => { GUIItem itemGui = new GUIItem(); if (item.Mesh.Name.Contains("wood")) { if (cantWood == 0) { itemAdded = true; itemGui = gui.InsertImage("wood2.png", x1, y1 + 30, MediaDir); woodGUIText = gui.InsertItem("Madera " + "(x" + ++cantWood + ")", x1 += 50, y1 + 20); } else { woodGUIText.text = "Madera " + "(x" + ++cantWood + ")"; } } else if (item.Mesh.Name.Contains("hammer") && !hammerAdded) { hammerAdded = true; itemAdded = true; itemGui = gui.InsertImage("hammer2.png", x1, y1 + 30, MediaDir); gui.InsertItem("Martillo", x1 += 50, y1 + 20); } else if (item.Mesh.Name.Contains("rope")) { if (cantRope == 0) { itemAdded = true; itemGui = gui.InsertImage("rope.png", x1, y1 + 30, MediaDir); ropeGUIText = gui.InsertItem("Soga " + "(x" + ++cantRope + ")", x1 += 50, y1 + 20); } else { ropeGUIText.text = "Soga " + "(x" + ++cantRope + ")"; } } else if (item.Mesh.Name.Contains("fatherNote")) { itemAdded = true; itemGui = gui.InsertImage("note.png", x1, y1 + 30, MediaDir); gui.InsertItem("Nota de papá", x1 += 50, y1 + 20); gui.InsertButton(1, "Usar", x1 += 300, y1, 120, 60); } if (itemAdded) { x1 = x0; y1 = y1 + 100; itemAdded = false; } }); if (ShowShipHelm) { GUIItem itemGui = new GUIItem(); itemAdded = true; itemGui = gui.InsertImage("timon.jpg", x1, y1 + 30, MediaDir); gui.InsertItem("Timon", x1 += 50, y1 + 20); gui.InsertItem("Se puede usar en la proa del barco", x1, y1 + 70); gui.InsertButton(2, "Usar", x1 += 300, y1, 120, 60); } } }