Example #1
0
            public Item(int index, RadialMenu parent, Function function, Texture2D icon)
            {
                texture = icon;
                origin = new Vector2((float)texture.Width / 2, (float)texture.Height / 2);

                int bigSide = Math.Max(texture.Height, texture.Width);
                if (bigSide > 64)
                    textureScale = 64 / (float)bigSide;
                else
                    textureScale = 1;

                this.index = index;
                this.function = function;
                this.parent = parent;
                if (index == 0)
                    isHighlighted = true;
                else
                    isHighlighted = false;
            }
Example #2
0
        public LevelEditor()
        {
            CurrentLevel = 1;
            snapToGrid = true;
            gridSize = new Vector2(8);
            currentMaterial = Material.Preset.Dirt;
            currentLayer = Level.BaineLayer;
            isLadder = false;

            // Create tile selection menu
            List<RadialMenu.Function> tileFunctions = new List<RadialMenu.Function>();
            List<Texture2D> tileTextures = new List<Texture2D>();
            tileFunctions.Add(TilesNull);
            tileTextures.Add(Library.textures["Cursor"]);
            for (int i = 0; i < (int)Level.PlatformType.COUNT; i++)
            {
                Texture2D t;
                t = Repainter.GetTextureCopy(Library.textures[((Level.PlatformType)i).ToString()]);
                Repainter.ReplaceRGB(ref t, Color.Gray, Color.LightGray, Color.DarkGray);
                tileTextures.Add(t);
                tileFunctions.Add(TilesSelect);
            }

            TileMenu = new RadialMenu(tileFunctions, tileTextures, true, TilesOpen, TilesClose);

            // Create material selection menu
            List<RadialMenu.Function> materialFunctions = new List<RadialMenu.Function>();
            List<Texture2D> materialTextures = new List<Texture2D>();

            Texture2D temp8x8 = Library.textures["MaterialPreview"];
            for (int i = 0; i < (int)Material.Preset.COUNT; i++)
            {
                Texture2D t;
                t = Repainter.GetTextureCopy(temp8x8);
                Repainter.ReplaceRGB(ref t, new Material((Material.Preset)i));
                materialTextures.Add(t);
                materialFunctions.Add(MaterialSelect);
            }

            MaterialMenu = new RadialMenu(materialFunctions, materialTextures, true, MaterialsOpen, MaterialsClose);

            // Create trap selection menu
            List<RadialMenu.Function> trapFunctions = new List<RadialMenu.Function>();
            List<Texture2D> trapTextures = new List<Texture2D>();

            for (int i = 0; i < (int)Level.TrapType.COUNT; i++)
            {
                Texture2D t;
                t = Repainter.GetTextureCopy(Library.textures[((Level.TrapType)i).ToString()]);
                Repainter.ReplaceRGB(ref t, Color.Gray, Color.LightGray, Color.DarkGray);
                trapTextures.Add(t);
                trapFunctions.Add(TrapSelect);
            }

            TrapMenu = new RadialMenu(trapFunctions, trapTextures, true, TrapsOpen, TrapsClose);

            // Create potion selection menu
            List<RadialMenu.Function> potionFunctions = new List<RadialMenu.Function>();
            List<Texture2D> potionTextures = new List<Texture2D>();

            for (int i = 0; i < (int)Level.PotionType.COUNT; i++)
            {
                Texture2D t;
                t = Library.textures[((Level.PotionType)i).ToString()];
                potionTextures.Add(t);
                potionFunctions.Add(HealthPotionSelect);
            }

            PotionMenu = new RadialMenu(potionFunctions, potionTextures, true, PotionsOpen, PotionsClose);

            // Create enemy selection menu
            List<RadialMenu.Function> enemyFunctions = new List<RadialMenu.Function>();
            List<Texture2D> enemyTextures = new List<Texture2D>();

            enemyTextures.Add(Library.textures["Enemy2Moving"]);
            enemyFunctions.Add(EnemySelect);

            EnemyMenu = new RadialMenu(enemyFunctions, enemyTextures, true, EnemiesOpen, EnemiesClose);
        }