Exemplo n.º 1
0
        public static void SetValue(int opcao, bool valor)
        {
            switch (opcao)
            {
            case 0:
                if (!Screen.fullscreen && valor)
                {
                    Screen.Fullscreen(true, true);
                }
                else if (Screen.fullscreen && !valor)
                {
                    Screen.Fullscreen(false, true);
                }
                break;

            case 1:
                if (!Configuracoes.vsync && valor)
                {
                    Configuracoes.VSync(true, true);
                }
                else if (Configuracoes.vsync && !valor)
                {
                    Configuracoes.VSync(false, true);
                }
                break;
            }
        }
Exemplo n.º 2
0
        public static void TelaPrincipal()
        {
            V.window.SetView(V.view);

            foreach (Chao x in V.chao.ToList())
            {
                x.Draw();
            }

            foreach (Limite x in V.limites.ToList())
            {
                x.Draw();
            }

            foreach (Teleporte x in V.teleportes.ToList())
            {
                x.Draw();
            }

            V.objetos.Sort((x, y) => x.zindex.CompareTo(y.zindex));
            foreach (Geral x in V.objetos.ToList())
            {
                x.Draw();
            }

            V.window.SetView(V.hud);

            Configuracoes.Draw();
            Efeitos.BackdropRun();
            if (menu)
            {
                F.Menu();
            }

            foreach (IC x in V.interacaoContinua.ToList())
            {
                x.x1.Interagir(1);
            }

            foreach (TempText x in V.temptexts.ToList())
            {
                x.Draw();
            }

            foreach (PopUp x in V.popups.ToList())
            {
                x.Draw();
            }
        }
Exemplo n.º 3
0
        public static void LoadFile(int file)
        {
            SQLiteDataReader reader;
            int mapa = 1, x = 400, y = 500;

            V.objetos.Clear();
            V.tempObjects.Clear();
            V.lockedObjects.Clear();

            List <Item>    a = new List <Item>();
            List <Recurso> b = new List <Recurso>();

            reader = Conexao.LoadData("select x, y, mapa from saveFile A inner join savePoint B where A.savePoint = B.id and A.id = '" + file + "'");
            while (reader.Read())
            {
                x    = Convert.ToInt32(reader["x"]);
                y    = Convert.ToInt32(reader["y"]) + 50;
                mapa = Convert.ToInt32(reader["mapa"]);
            }

            reader = Conexao.LoadData("select * from objeto_item where objeto_id = 1 and saveFile_id = '" + file + "'");
            while (reader.Read())
            {
                a.Add(V.itens[Convert.ToInt32(reader["item_id"]) - 1]);
            }

            reader = Conexao.LoadData("select * from objeto_recurso where objeto_id = 1 and saveFile_id = '" + file + "'");
            while (reader.Read())
            {
                Recurso r = V.recursos[Convert.ToInt32(reader["recurso_id"]) - 1];
                Recurso n = (Recurso)r.Clone();
                b.Add(n);

                b[b.IndexOf(n)].Add(Convert.ToInt32(reader["quantidade"]));
            }

            reader = Conexao.LoadData("select B.id, A.width, A.height, A.xp, A.vida, C.interior from objeto A inner join objeto_mapa B inner join mapa C on A.id = B.objeto_id and B.mapa = C.id where categoria = 1 and playable = 'true'");
            while (reader.Read())
            {
                V.personagem = null;
                V.personagem = new Personagem(Convert.ToInt32(reader["id"]), Data.Nick(), x, y, Convert.ToInt32(reader["width"]), Convert.ToInt32(reader["height"]), Convert.ToInt32(reader["xp"]), Convert.ToInt32(reader["vida"]), Convert.ToBoolean(reader["interior"]), mapa, a, b);
                Configuracoes.Set(V.personagem);
            }

            reader = Conexao.LoadData("select * from objeto_savefile where saveFile_id = '" + file + "' and activated = 'true'");
            while (reader.Read())
            {
                V.tempObjects[Convert.ToInt32(reader["objeto_id"])] = Convert.ToBoolean(reader["activated"]);
            }

            reader = Conexao.LoadData("select * from objeto_locked where saveFile_id = '" + file + "' and locked = 'false'");
            while (reader.Read())
            {
                V.lockedObjects[Convert.ToInt32(reader["objeto_id"])] = Convert.ToBoolean(reader["locked"]);
            }

            V.personagem.AddSkill(V.skills[0]);
            V.personagem.AddSkill(V.skills[1]);
            V.personagem.AddSkill(V.skills[3]);
            V.personagem.AddSkill(V.skills[2]);

            V.personagem.AddSkill(V.skills[4]);
            V.personagem.AddSkill(V.skills[5]);

            Idk.LoadMap(mapa, false);
            CurrentScreen.Change("localmap");
        }
Exemplo n.º 4
0
        public static void TelaPrincipal()
        {
            V.window.SetView(V.view);

            V.cameraX = V.view.Center.X - ((Screen.width / V.Delta) / 2);
            V.cameraY = V.view.Center.Y - ((Screen.height / V.Delta) / 2);

            if (menuCreatorTab > -1)
            {
                criarMapaX = (int)((V.mouseX + ((V.view.Center.X - (V.view.Size.X / 2)) * V.Delta)) / (V.IMG_CAT[menuCreatorTab][spriteTemp].Size.X * V.Delta));
                criarMapaY = (int)((V.mouseY + ((V.view.Center.Y - (V.view.Size.Y / 2)) * V.Delta)) / (V.IMG_CAT[menuCreatorTab][spriteTemp].Size.Y * V.Delta));
            }

            if (F.Key("esc") && !F.TeclaDesativada("esc"))
            {
                if (menuCreatorTab == -1 || !menuCreator)
                {
                    menuCreator = !menuCreator;
                }
                else
                {
                    menuCreatorTab = -1;
                }

                F.DesativarTecla("esc", 200);
            }
            if (V.mouseButton == "Right")
            {
                V.view.Move(new Vector2f(-((V.mouseX - oldMouseX) / V.Delta), -((V.mouseY - oldMouseY) / V.Delta)));
            }

            if (F.Key("enter"))
            {
                V.personagem = new Personagem(1, Data.Nick(), 50, 40, 130, 50, 0, 100, false, 0, new List <Item>(), new List <Recurso>());
                V.personagem.recursos[0].Add(20);
                V.personagem.recursos[1].Add(20);

                Configuracoes.Set(V.personagem);

                CurrentScreen.Change("localmap");
            }

            if (criarMapaX >= 0 && criarMapaY >= 0 && !menuCreator && menuCreatorPos == 0)
            {
                if (F.Key("lcontrol"))
                {
                    V.img[0].Color = (V.mouseButton == "Left") ? new Color(255, 0, 0, 255) : new Color(255, 0, 0, 120);
                }
                else
                {
                    V.img[0].Color = (V.mouseButton == "Left") ? new Color(255, 255, 255, 255) : new Color(255, 255, 255, 120);
                }

                if (V.mouseButton == "Left" && !F.TeclaDesativada("mouseLeft"))
                {
                    Geral geral;
                    Chao  criarchao;

                    switch (menuCreatorTab)
                    {
                    case -1:
                        geral = V.objetos.Find(item => F.MouseIn((item.x - (V.view.Center.X - (V.view.Size.X / 2))) * V.Delta, (item.y - (V.view.Center.Y - (V.view.Size.Y / 2))) * V.Delta, item.imgWidth * V.Delta, item.imgHeight * V.Delta));
                        if (geral != null)
                        {
                            EditarMateria(geral);
                        }
                        break;

                    case 1:
                        geral = V.objetos.Find(item => item.x == criarMapaX * V.IMG_CAT[menuCreatorTab][spriteTemp].Size.X && item.y == criarMapaY * V.IMG_CAT[menuCreatorTab][spriteTemp].Size.Y);
                        if (geral != null && F.Key("lcontrol"))
                        {
                            V.objetos.RemoveAt(V.objetos.IndexOf(geral));
                        }
                        if (geral == null && !F.Key("lcontrol"))
                        {
                            V.objetos.Add(new Npc(0, spriteTemp, criarMapaX * V.IMG_CAT[menuCreatorTab][spriteTemp].Size.X, criarMapaY * V.IMG_CAT[menuCreatorTab][spriteTemp].Size.Y, 120, 120, 0, 0, 100, 5, false, false, false, "", new int[] {}, false));
                        }
                        break;

                    case 2:
                        criarchao = V.chao.Find(item => item.x == criarMapaX * V.IMG_CAT[menuCreatorTab][spriteTemp].Size.X && item.y == criarMapaY * V.IMG_CAT[menuCreatorTab][spriteTemp].Size.Y);
                        if (criarchao != null && F.Key("lcontrol"))
                        {
                            V.chao.RemoveAt(V.chao.IndexOf(criarchao));
                        }
                        if (criarchao == null && !F.Key("lcontrol"))
                        {
                            V.chao.Add(new Chao(spriteTemp, criarMapaX, criarMapaY));
                        }
                        break;
                    }
                }

                if (menuCreatorTab >= 0)
                {
                    V.img[0].Position    = new Vector2f(V.IMG_CAT[menuCreatorTab][spriteTemp].Size.X * criarMapaX, V.IMG_CAT[menuCreatorTab][spriteTemp].Size.Y * criarMapaY);
                    V.img[0].TextureRect = new IntRect(0, 0, (int)V.IMG_CAT[menuCreatorTab][spriteTemp].Size.X, (int)V.IMG_CAT[menuCreatorTab][spriteTemp].Size.Y);
                    V.img[0].Texture     = V.IMG_CAT[menuCreatorTab][spriteTemp];
                    V.window.Draw(V.img[0]);
                }

                V.img[0].Color = new Color(255, 255, 255, 255);
            }

            V.window.SetView(V.hud);

            if (menuCreator && menuCreatorPos < 250)
            {
                menuCreatorPos += 25;
            }
            else if (!menuCreator && !editarMateria1 && menuCreatorPos > 0)
            {
                menuCreatorPos -= 25;
            }

            F.DesenharShape(Screen.width - menuCreatorPos, 0, 250, Screen.height, 19, 19, 19, 230);


            if (menuCreatorTab == -1 && !editarMateria1)
            {
                int m = 0;

                foreach (var tab in V.mapCreatorTabs)
                {
                    if (tab.Value)
                    {
                        F.DesenharShape(Screen.width - menuCreatorPos, 110 * m, menuCreatorPos, 55, 35, 35, 35, 230);

                        F.Escrever(tab.Key, false, Screen.width - menuCreatorPos + 125 - (F.TxtWidth(tab.Key, 32, false) / 2), 5 + (55 * m), 32, 255, 255, 255, 255);

                        if (V.mouseButton == "Left" && F.MouseIn(Screen.width - menuCreatorPos, 55 * m, menuCreatorPos, 55) && tab.Value && menuCreator)
                        {
                            F.DesativarTecla("mouseLeft", 500);
                            menuCreatorTab = m;
                        }

                        m++;
                    }
                }
            }

            if (menuCreatorTab != -1)
            {
                F.Escrever(V.mapCreatorTabs.ElementAt(menuCreatorTab).Key, false, Screen.width - menuCreatorPos + 125 - (F.TxtWidth(V.mapCreatorTabs.ElementAt(menuCreatorTab).Key, 32, false) / 2), 5, 32, 255, 255, 255, 255);

                if (F.Button("Upload", 32, Screen.width - menuCreatorPos + 25, Screen.height - 75, 200, 50, 221, 66, 82, 255) && !F.TeclaDesativada("mouseLeft") && menuCreator)
                {
                    int m = 0;

                    OpenFileDialog theDialog = new OpenFileDialog();
                    theDialog.Title  = "Selecione uma imagem";
                    theDialog.Filter = "PNG|*.png";
                    V.mouseButton    = "";
                    if (theDialog.ShowDialog() == DialogResult.OK)
                    {
                        while (System.IO.File.Exists(@"res\img\chao\" + m + ".png"))
                        {
                            m++;
                        }
                        string destFile = System.IO.Path.Combine(@"res\img\chao", m + ".png");

                        System.IO.File.Copy(theDialog.FileName, destFile, true);

                        V.IMG_CAT[menuCreatorTab].Clear();
                        V.ImgLoad();
                    }
                }
            }


            V.window.SetView(V.menuCreator);

            if (menuCreatorTab != -1)
            {
                paddingTop = 0;
                for (int m = 0; m < V.IMG_CAT[menuCreatorTab].Count; m++)
                {
                    paddingTop += (int)V.IMG_CAT[menuCreatorTab][m].Size.Y + 10;
                }

                if (V.menuCreator.Center.Y >= 215 && V.menuCreator.Center.Y <= paddingTop - 225 && menuCreator)
                {
                    V.menuCreator.Move(new Vector2f(0, V.smoothScroll));

                    if (V.mouseWheel > 0 || V.mouseWheel < 0)
                    {
                        V.smoothScroll += -V.mouseWheel * 10;
                    }
                }

                if (V.menuCreator.Center.Y <= 215)
                {
                    V.smoothScroll = 0;
                    V.menuCreator.Move(new Vector2f(0, 216 - V.menuCreator.Center.Y));
                }
                if (V.menuCreator.Center.Y >= paddingTop - 225)
                {
                    V.smoothScroll = 0;
                    V.menuCreator.Move(new Vector2f(0, -(V.menuCreator.Center.Y - (paddingTop - 226))));
                }


                if (V.smoothScroll > 0)
                {
                    V.smoothScroll--;
                }
                if (V.smoothScroll < 0)
                {
                    V.smoothScroll++;
                }

                paddingTop = 0;

                for (int m = 0; m < V.IMG_CAT[menuCreatorTab].Count; m++)
                {
                    if (V.IMG_CAT[menuCreatorTab][m].Size.X > 115)
                    {
                        V.img[0].Scale    = new Vector2f((float)(115 / (float)V.IMG_CAT[menuCreatorTab][m].Size.X), (float)(115 / (float)V.IMG_CAT[menuCreatorTab][m].Size.X));
                        V.img[0].Position = new Vector2f(250 - menuCreatorPos + 125 - ((V.IMG_CAT[menuCreatorTab][m].Size.X * (float)(115 / (float)V.IMG_CAT[menuCreatorTab][m].Size.X)) / 2), paddingTop);
                    }
                    else
                    {
                        V.img[0].Position = new Vector2f(250 - menuCreatorPos + 125 - (V.IMG_CAT[menuCreatorTab][m].Size.X / 2), paddingTop);
                    }

                    V.img[0].TextureRect = new IntRect(0, 0, 115, (int)V.IMG_CAT[menuCreatorTab][m].Size.Y);
                    V.img[0].Texture     = V.IMG_CAT[menuCreatorTab][m];
                    V.window.Draw(V.img[0]);

                    if (V.mouseButton == "Left" && F.MouseIn(Screen.width - menuCreatorPos + 70, (100 * m) + 275 - V.menuCreator.Center.Y, 115, 90) && !F.TeclaDesativada("mouseLeft") && menuCreator)
                    {
                        spriteTemp  = m;
                        menuCreator = false;
                        F.DesativarTecla("mouseLeft", 500);
                    }


                    paddingTop += V.IMG_CAT[menuCreatorTab][m].Size.X > 115 ? (int)(V.IMG_CAT[menuCreatorTab][m].Size.Y * (float)(115 / (float)V.IMG_CAT[menuCreatorTab][m].Size.X)) + 10 : (int)V.IMG_CAT[menuCreatorTab][m].Size.Y + 10;

                    V.img[0].Scale = new Vector2f(1, 1);
                }
            }


            V.window.SetView(V.hud);

            if (!menuCreator)
            {
                float zoom = 1;
                zoom -= (float)V.mouseWheel / 10;
                V.view.Zoom(zoom);
                V.Delta = Screen.width / V.view.Size.X;

                F.Escrever(V.Delta + "x", true, Screen.width - F.TxtWidth(V.Delta + "x", 32, true) - 10, Screen.height - 40, 32, 255, 255, 255, 255, 0, 0, 0, 255, 2);
            }

            if (editarMateria1)
            {
                EditarMateriaF();
            }

            oldMouseX = V.mouseX;
            oldMouseY = V.mouseY;
        }
Exemplo n.º 5
0
        public static void TelaPrincipal()
        {
            if (F.Key("esc") && !menu && !F.TeclaDesativada("esc") && state == 2)
            {
                V.backdrop = false;
                menu       = true;
                state      = 1;
                F.DesativarTecla("esc", 300);
                Efeitos.Backdrop("fade-in", 125, 25);
            }

            if (F.Key("shift") && especial_count == 100 && !F.TeclaDesativada("shift") && state == 2)
            {
                for (int i = 0; i < 15; i++)
                {
                    V.objetos.Add(new Player("ally_" + i, 52 * i + 36, Screen.height + 128 + 50, 32, 32));
                }

                especial_count = 0;
                F.DesativarTecla("shift", 300);
            }

            Raid();

            V.window.SetView(V.view);

            foreach (Background x in V.background.ToList())
            {
                x.Draw();
            }

            foreach (Limite x in V.limites.ToList())
            {
                x.Draw();
            }

            foreach (Bullet x in V.bullets.ToList())
            {
                x.Draw();
            }

            foreach (Bonus x in V.bonus.ToList())
            {
                x.Draw();
            }

            foreach (Geral x in V.objetos.ToList())
            {
                x.Draw();
            }

            V.window.SetView(V.hud);

            Configuracoes.Draw();
            F.Escrever("SCORE " + score, true, Screen.width - F.TxtWidth("SCORE " + score, 32, true) - 40, 20, 32, 255, 255, 255, 255, 000, 000, 47, 255, 2);

            if (especial_count > 100)
            {
                especial_count = 100;
            }

            F.DesenharShape(Screen.width - 122, Screen.height - 42, especial_count, 20, 181, 230, 29, 255);

            if (especial && especial_count == 100)
            {
                F.Escrever("Press Shift!", true, Screen.width - F.TxtWidth("Press Shift!", 16, true) - 30, Screen.height - 64, 16, 255, 255, 255, 255, 000, 000, 47, 255, 2);
            }

            if (!F.TeclaDesativada("especial") && especial_count == 100)
            {
                especial = !especial;
                F.DesativarTecla("especial", 1000);
            }
        }
Exemplo n.º 6
0
        public static void DbLoad()
        {
            SQLiteDataReader reader;

            reader = Conexao.LoadData("select * from configuracoes");
            while (reader.Read())
            {
                switch (Convert.ToInt32(reader["id"]))
                {
                case 1:
                    if (Convert.ToBoolean(reader["valor"]))
                    {
                        Screen.Fullscreen(true, false);
                    }
                    break;

                case 2:
                    Configuracoes.VSync(Convert.ToBoolean(reader["valor"]), false);
                    break;
                }
            }

            reader = Conexao.LoadData("select * from item");
            while (reader.Read())
            {
                V.itens.Add(new Item(Convert.ToInt32(reader["id"]), Convert.ToInt32(reader["sprite"]), Convert.ToString(reader["nome"]), Convert.ToString(reader["descricao"]), Convert.ToString(reader["categoria"]), Convert.ToInt32(reader["efeito"])));
            }

            reader = Conexao.LoadData("select * from recurso");
            while (reader.Read())
            {
                V.recursos.Add(new Recurso(Convert.ToInt32(reader["id"]), Convert.ToString(reader["nome"]), Convert.ToString(reader["descricao"]), Convert.ToInt32(reader["sprite"])));
            }

            reader = Conexao.LoadData("select * from mapa");
            while (reader.Read())
            {
                LoadFileState.mapas.Add(Convert.ToString(reader["nome"]));
            }


            skills.Add(new Skill("Attack", "attack", 1, 30, 20));
            skills.Add(new Skill("Heal", "heal", 1, 30, 20));
            skills.Add(new Skill("Envenenado", "status", 1, 0, 20));
            skills.Add(new Skill("Paralisado", "status", 1, 1, 20));
            skills.Add(new Skill("Fraqueza", "status", 1, 2, 20));
            skills.Add(new Skill("Confuso", "status", 1, 3, 20));

            puzzleObjects.Add(new Puzzle("Estrela", "-", "Vermelho"));
            puzzleObjects.Add(new Puzzle("-", "2", "Azul"));
            puzzleObjects.Add(new Puzzle("-", "1", "-"));
            puzzleObjects.Add(new Puzzle("-", "-", "Verde"));
            puzzleObjects.Add(new Puzzle("-", "1", "Amarelo"));
            puzzleObjects.Add(new Puzzle("Quadrado", "-", "-"));
            puzzleObjects.Add(new Puzzle("Losango", "4", "-"));
            puzzleObjects.Add(new Puzzle("Triângulo", "-", "-"));

            puzzle2.Add(new Puzzle("Estrela", "1", "Vermelho"));
            puzzle2.Add(new Puzzle("Quadrado", "2", "Azul"));
            puzzle2.Add(new Puzzle("Triângulo", "3", "Verde"));
            puzzle2.Add(new Puzzle("Losango", "4", "Verde"));
            puzzle2.Add(new Puzzle("Estrela", "3", "Vermelho"));
            puzzle2.Add(new Puzzle("Quadrado", "1", "Amarelo"));
            puzzle2.Add(new Puzzle("Triângulo", "2", "Azul"));
            puzzle2.Add(new Puzzle("Losango", "4", "Amarelo"));
        }