コード例 #1
0
 public clsHexFeld(int intXmon, int intYmon)
 {
     kod = new clsKoordinaten();
       this.kod.SetHexPos(intXmon, intYmon, 50);
 }
コード例 #2
0
        private void BuildHexMap(string strTex)
        {
            string strPetze = "";
              string strZeile = "";

              Texture2D tex = dicTextures[strTex];
              Vector2 vec = new Vector2(0,0);
              clsKoordinaten kod = new clsKoordinaten();

              string strAdr = "";

              vec.X += (0 - tex.Width / 2);
              //vec.X += (0 - tex.Height / 2);
              vec.Y += (0 - tex.Height / 2);
              bool bOffset = false;

              bool blnInit = this.dicHex.Count == 0;

              while (vec.X < graphics.GraphicsDevice.Viewport.Width)
              {
            strZeile = "";

            while (vec.Y < graphics.GraphicsDevice.Viewport.Height)
            {
              SpriteBatchDraw(tex, vec, 1f);

              if (blnInit)
              {
            kod.SetHexPos(Convert.ToInt32(vec.X), Convert.ToInt32(vec.Y), tex);

            strAdr = kod.intHexX.ToString("00") + kod.intHexY.ToString("00");

            strZeile += strAdr + "|";

            if (!dicHex.ContainsKey(strAdr))
            {
              dicHex.Add(strAdr, new clsHexFeld(kod.intXmon, kod.intYmon));
            }
            else
            {
              string str = "X" + strAdr;
            }
              }
              vec.Y += tex.Height;
              if (vec.Y > (tex.Height * 2))
            break;
            }

            vec.X += tex.Width - (tex.Width / 4);
            vec.Y = (bOffset ? 0 - (tex.Height / 2) : 0);

            bOffset = !bOffset;
            strPetze += strZeile + "\n";

            if (vec.X > (tex.Width * 2))
              break;
              }
        }
コード例 #3
0
 public clsHexFeld(int intXmon, int intYmon)
 {
     kod = new clsKoordinaten();
     this.kod.SetHexPos(intXmon, intYmon, 50);
 }
コード例 #4
0
        private void BuildHexMap(string strTex)
        {
            string strPetze = "";
            string strZeile = "";

            Texture2D      tex = dicTextures[strTex];
            Vector2        vec = new Vector2(0, 0);
            clsKoordinaten kod = new clsKoordinaten();

            string strAdr = "";

            vec.X += (0 - tex.Width / 2);
            //vec.X += (0 - tex.Height / 2);
            vec.Y += (0 - tex.Height / 2);
            bool bOffset = false;

            bool blnInit = this.dicHex.Count == 0;

            while (vec.X < graphics.GraphicsDevice.Viewport.Width)
            {
                strZeile = "";

                while (vec.Y < graphics.GraphicsDevice.Viewport.Height)
                {
                    SpriteBatchDraw(tex, vec, 1f);

                    if (blnInit)
                    {
                        kod.SetHexPos(Convert.ToInt32(vec.X), Convert.ToInt32(vec.Y), tex);

                        strAdr = kod.intHexX.ToString("00") + kod.intHexY.ToString("00");

                        strZeile += strAdr + "|";

                        if (!dicHex.ContainsKey(strAdr))
                        {
                            dicHex.Add(strAdr, new clsHexFeld(kod.intXmon, kod.intYmon));
                        }
                        else
                        {
                            string str = "X" + strAdr;
                        }
                    }
                    vec.Y += tex.Height;
                    if (vec.Y > (tex.Height * 2))
                    {
                        break;
                    }
                }

                vec.X += tex.Width - (tex.Width / 4);
                vec.Y  = (bOffset ? 0 - (tex.Height / 2) : 0);

                bOffset   = !bOffset;
                strPetze += strZeile + "\n";

                if (vec.X > (tex.Width * 2))
                {
                    break;
                }
            }
        }