예제 #1
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            cursor      = new MagicTexture(Content.Load <Texture2D>("cursor"), new Rectangle(0, 0, 100, 100), Facing.L, 0);
            tex         = Content.Load <Texture2D>("grad");

            buttons = new List <Button>();

            string str = "abcdefghijklmnopqrstuvwxyz0123456789.!?,':;() ";

            fDrawer = new FontDrawer(LoadFont());

            overlay = new MagicTexture(Content.Load <Texture2D>("overlay"), new Rectangle(0, 0, 200, 100), Facing.N, 0);

            SetupMenu();

            Texture2D           frameSrc = Content.Load <Texture2D>("frame");
            List <MagicTexture> style1   = new List <MagicTexture>();

            style1.Add(new MagicTexture(frameSrc, new Rectangle(0, 0, 30, 30), Facing.N, 0, "UL"));
            style1.Add(new MagicTexture(frameSrc, new Rectangle(270, 0, 30, 30), Facing.N, 0, "UR"));
            style1.Add(new MagicTexture(frameSrc, new Rectangle(0, 30, 30, 240), Facing.N, 0, "L"));
            style1.Add(new MagicTexture(frameSrc, new Rectangle(270, 30, 30, 240), Facing.N, 0, "R"));
            style1.Add(new MagicTexture(frameSrc, new Rectangle(0, 270, 30, 30), Facing.N, 0, "DL"));
            style1.Add(new MagicTexture(frameSrc, new Rectangle(270, 270, 30, 30), Facing.N, 0, "DR"));
            style1.Add(new MagicTexture(frameSrc, new Rectangle(30, 0, 240, 30), Facing.N, 0, "U"));
            style1.Add(new MagicTexture(frameSrc, new Rectangle(30, 270, 240, 30), Facing.N, 0, "D"));
            style1.Add(new MagicTexture(frameSrc, new Rectangle(30, 30, 240, 240), Facing.N, 0, "M"));
            //style1.Add(new MagicTexture(frameSrc, new Rectangle(0, 90, 90, 30), Facing.N, 0,"UC"));
            frDrawer = new FrameDrawer();
            frDrawer.GetStyle(style1.ToArray());

            inv = new Inventory(10);
        }
예제 #2
0
        void SetupMenu()
        {
            MagicTexture test2 = new MagicTexture(tex, new Rectangle(0, 0, tex.Width, tex.Height), Facing.N, 0);

            buttons.Clear();
            buttons.Add(new Button(test2, new Vector2(300, 100), "TilesetEditor"));
            buttons.Add(new Button(test2, new Vector2(300, 300), "GameStart"));
        }
예제 #3
0
 void ToggleSkillSelectButtons()
 {
     if (gim == GameInputMode.SkillSelect)
     {
         for (int x = 0; x < actors[actorKey].skills.Count; x++)
         {
             MagicTexture tex = new MagicTexture(Content.Load <Texture2D>("grad"), new Rectangle(0, 0, 1000, 100), Facing.N, 0);
             buttons.Add(new Button(tex, new Vector2(920, 0 + (x * 100)), "SelectSkillKey", actors[actorKey].skills[x].name, x));
         }
     }
     else
     {
         for (int i = buttons.Count - 1; i >= 0; i--)
         {
             if (buttons[i].actionName == "SelectSkillKey")
             {
                 buttons.RemoveAt(i);
             }
         }
     }
 }
예제 #4
0
        void CheckActorMenuButtons()
        {
            //add or remove button
            for (int i = buttons.Count - 1; i >= 0; i--)
            {
                if (buttons[i].actionName == "EndTurn")
                {
                    buttons.RemoveAt(i); if (buttons.Count <= 0)
                    {
                        break;
                    }
                }

                if (buttons[i].actionName == "SelectSkill")
                {
                    buttons.RemoveAt(i); if (buttons.Count <= 0)
                    {
                        break;
                    }
                }

                if (buttons[i].actionName == "MoveActor")
                {
                    buttons.RemoveAt(i); if (buttons.Count <= 0)
                    {
                        break;
                    }
                }
            }
            if (actors[actorKey].isPlayer)
            {
                MagicTexture tex = new MagicTexture(Content.Load <Texture2D>("grad"), new Rectangle(0, 0, 1000, 100), Facing.N, 0);
                buttons.Add(new Button(tex, new Vector2(920, 980), "EndTurn"));
                tex = new MagicTexture(Content.Load <Texture2D>("grad"), new Rectangle(0, 0, 1000, 100), Facing.N, 0);
                buttons.Add(new Button(tex, new Vector2(920, 880), "SelectSkill"));
                tex = new MagicTexture(Content.Load <Texture2D>("grad"), new Rectangle(0, 0, 1000, 100), Facing.N, 0);
                buttons.Add(new Button(tex, new Vector2(920, 700), "MoveActor"));
            }
        } //adds or removes buttons based on the current actor
예제 #5
0
 public Item(MagicTexture icon_, int ID_, string name_)
 {
     icon = icon_;
     name = name_;
     ID   = ID_;
 }
예제 #6
0
 public Entity(MagicTexture tex_, Vector2 pos_, Point tsPos_, int ID_) : base(tex_, pos_)
 {
     ID    = ID_;
     tsPos = tsPos_;
 }
예제 #7
0
 public Sprite(MagicTexture tex_, Vector2 pos_)
 {
     tex = tex_;
     pos = pos_;
 }
예제 #8
0
 public Button(MagicTexture tex_, Vector2 pos_, string action_, string keyname_, int key_) : base(tex_, pos_)
 {
     keyname    = keyname_;
     key        = key_;
     actionName = action_;
 }
예제 #9
0
 public Button(MagicTexture tex_, Vector2 pos_, string action_) : base(tex_, pos_)
 {
     actionName = action_;
 }
예제 #10
0
 public Tile(MagicTexture tex_, Vector2 pos_, Point tsPos_, string name_, int ID_) : base(tex_, pos_, tsPos_, ID_)
 {
     name = name_;
 }
예제 #11
0
        public void Draw(Rectangle rec_, SpriteBatch sb_)
        {
            if (hasStyle)
            {
                int l  = 0;
                int r  = 0;
                int u  = 0;
                int d  = 0;
                int mx = 0;
                int my = 0;

                MagicTexture L  = GetPiece("L");
                MagicTexture R  = GetPiece("R");
                MagicTexture U  = GetPiece("U");
                MagicTexture D  = GetPiece("D");
                MagicTexture UR = GetPiece("UR");
                MagicTexture UL = GetPiece("UL");
                MagicTexture DL = GetPiece("DL");
                MagicTexture DR = GetPiece("DR");
                MagicTexture M  = GetPiece("M");

                MagicTexture UC = GetPiece("UC");

                for (int x = 0; x *L.frame.Height < rec_.Height; x++)
                {
                    l = x + 1;
                }
                for (int x = 0; x *R.frame.Height < rec_.Height; x++)
                {
                    r = x + 1;
                }
                for (int x = 0; x *U.frame.Width < rec_.Width; x++)
                {
                    u = x + 1;
                }
                for (int x = 0; x *D.frame.Width < rec_.Width; x++)
                {
                    d = x + 1;
                }
                for (int x = 0; x *D.frame.Width < rec_.Width; x++)
                {
                    mx = x + 1;
                }
                for (int x = 0; x *M.frame.Height < rec_.Height; x++)
                {
                    my = x + 1;
                }

                //draw corners
                UL.Draw(sb_, new Vector2(rec_.X, rec_.Y), 1f, false);
                UR.Draw(sb_, new Vector2(rec_.X + U.frame.Width * u + UL.frame.Width, rec_.Y), 1f, false);
                DL.Draw(sb_, new Vector2(rec_.X, rec_.Y + L.frame.Height * l + UL.frame.Height), 1f, false);
                DR.Draw(sb_, new Vector2(rec_.X + U.frame.Width * u + UL.frame.Width, rec_.Y + L.frame.Height * l + UL.frame.Height), 1f, false);

                for (int x = 0; x < u; x++) //draw up parts
                {
                    U.Draw(sb_, new Vector2(rec_.X + UL.frame.Width + U.frame.Width * x, rec_.Y), 1f, false);
                }
                if (UC != null)
                {
                    UC.Draw(sb_, new Vector2(rec_.X + UL.frame.Width + (U.frame.Width * u) / 2 - UC.frame.Width / 2, rec_.Y), 1f, false);
                }
                for (int x = 0; x < l; x++) //draw left parts
                {
                    L.Draw(sb_, new Vector2(rec_.X, rec_.Y + L.frame.Height * x + UL.frame.Height), 1f, false);
                }
                for (int x = 0; x < d; x++) //draw down parts
                {
                    D.Draw(sb_, new Vector2(rec_.X + UL.frame.Width + U.frame.Width * x, rec_.Y + L.frame.Height * l + UL.frame.Height), 1f, false);
                }
                for (int x = 0; x < r; x++) //draw right parts
                {
                    R.Draw(sb_, new Vector2(rec_.X + UL.frame.Width + U.frame.Width * u, rec_.Y + L.frame.Height * x + UL.frame.Height), 1f, false);
                }
                for (int x = 0; x < mx; x++) //draw middle
                {
                    for (int y = 0; y < my; y++)
                    {
                        M.Draw(sb_, new Vector2(rec_.X + UL.frame.Width + M.frame.Width * x, rec_.X + UL.frame.Height + M.frame.Height * y), 1f, false);
                    }
                }
            }
        }