Exemplo n.º 1
0
        public dPlanet(Planet_nature x)
        {
            int texID=-1;

            this.radius = x.radius;
            this.type = x.type;

            switch (x.type)
            {
                case PlanetType.flat: texID = 1; break;
                case PlanetType.sun: texID = 15; break;
            }

            ground = new objDrawer(x.radius * 2, x.radius * 2, texID);
            this.name = x.name;

            ground.x = x.x;
            ground.y = x.y;

            if (x.sectors != null && x.sectors.Length > 0)
            {
                sectors = new dSector[x.sectors.Length];
                for (int i = 0; i < x.sectors.Length; i++)
                {
                    if(x.sectors[i]!=null)
                    sectors[i] = new dSector(x.sectors[i], x, i, x.sectors.Length);
                }
            }
        }
Exemplo n.º 2
0
 public static void loadGUIelements()
 {
     for(int i=0; i<10; i++)
     {
         guiElemnts[i] = new objDrawer(playerView.guiSizeElements, playerView.guiSizeElements, i + 5); //5-14 текстуры... магочисла...
         guiElementsText[i] = new textDrawer(20, changeText("", playerView.countIntGuiText, ContentAlignment.TopRight), Color.Black, Color.Transparent, ContentAlignment.MiddleRight);
     }
 }
Exemplo n.º 3
0
        private void glControl1_MouseClick(object sender, MouseEventArgs e)
        {
            float realX = e.X;
            float realY = e.Y;

            realX += Render.ortoX / playerView.scale;

            realX = realX * (Render.ortoX) / (glControl1.Width) - playerView.x;
            realY = realY * (Render.ortoY) / (glControl1.Height) - playerView.y;
            //realX = realX / (playerView.scale * 2);
            //realY = realY / (playerView.scale * 2);

            this.Text = string.Format("x:{0} y:{1}", realX, realY);

            // Рисуем выбор планеты
            foreach (var a in Render.planets)
            {
                float rad = a.radius;
                if (realX > a.ground.x - rad && realX < a.ground.x + rad && realY > a.ground.y - rad && realY < a.ground.y + rad)
                {
                    a.ground.colorMask = Color.Red;
                }
            }

            objDrawer od = new objDrawer(10, 10, 8);
            od.x = realX;
            od.y = realY;
            Render.objects.Add(od);
        }
Exemplo n.º 4
0
            public dSector(sector x, Planet_nature p, int number, int count)
            {
                int texIDb = 3;
                int texIDn = 3;

                if (x.building != null)
                    switch (x.building.type)
                    {

                    }

                if (x.natureBuilding != null)
                    switch (x.natureBuilding.type)
                    {
                        case buildingsEnum.grass: texIDn = 2; break;
                        case buildingsEnum.forest: texIDn = 0; break;
                    }

                if (p.type != PlanetType.sun)
                {
                    building = new objDrawer(sizes.standartSizeSmall, sizes.standartSizeSmall, texIDb);
                    nature = new objDrawer(sizes.standartSizeSmall, sizes.standartSizeSmall, texIDn);
                    ownerOverlay = new objDrawer(sizes.standartSizeSmall, sizes.standartSizeSmall, 4);
                }
                else
                {
                    building = new objDrawer(0, 0, 16);
                    nature = new objDrawer(0, 0, 16);
                    ownerOverlay = new objDrawer(0, 0, 16);
                }

                building.x = p.x;
                nature.x = p.x;
                building.y = p.y;
                nature.y = p.y;
                ownerOverlay.x = p.x;
                ownerOverlay.y = p.y;

                float secAngle = 360 / count * number;

                building.angle = secAngle;
                nature.angle = secAngle;
                ownerOverlay.angle = secAngle;

                Player owner = Render.players.Where(c => c.name == x.owner).FirstOrDefault();
                if (owner != null)
                {
                    building.colorMask = owner.color;
                    ownerOverlay.colorMask = owner.color;
                }

                secAngle = secAngle / 57.0f;

                float xCorr = (float)Math.Sin((double)secAngle) * p.radius;
                float yCorr = (float)Math.Cos((double)secAngle) * p.radius;

                nature.x += xCorr;
                nature.y -= yCorr;

                building.x += xCorr;
                building.y -= yCorr;

                ownerOverlay.x += xCorr / 2;
                ownerOverlay.y -= yCorr / 2;
            }