Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
        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()
        {
            int W   = D3DDevice.Instance.Width;
            int H   = D3DDevice.Instance.Height;
            int x0  = W / 2;
            int y0  = H / 2;
            int dy  = 80;
            int dy2 = dy;
            int dx  = 200;

            drawer2D = new Drawer2D();

            backgroundSprite          = new CustomSprite();
            backgroundSprite.Bitmap   = new CustomBitmap(MediaDir + "\\Bitmaps\\noteView.PNG", D3DDevice.Instance.Device);
            backgroundSprite.Position = new TGCVector2(W * 0.2f, H * 0.2f);
            backgroundSprite.Scaling  = new TGCVector2(0.75f, 0.35f);

            gui.Create(MediaDir);
            gui.InitDialog(false, false);

            //gui.InsertMenuItem(ID_CLOSE, "Cerrar", "close.png", x0, y0, MediaDir, dx, dy);
            gui.InsertButton(ID_CLOSE, "Cerrar", x0 - 150, y0 + 150, dx, dy, Color.DarkRed);
        }
Exemplo n.º 4
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);
                }
            }
        }