コード例 #1
0
ファイル: Platform.cs プロジェクト: FooKittens/Baine
 public Platform(Vector2 position, string textureKey, float layer, bool isLadder, Material.Preset materialPreset)
     : base(position, textureKey, layer)
 {
     this.materialPreset = materialPreset;
     origin = new Vector2((baseTexture.Width / 2) - ((baseTexture.Width / 2) % 8), (baseTexture.Height / 2) - ((baseTexture.Height / 2) % 8));
     SetMaterial(materialPreset);
     identifier = SaveFileManager.SaveTypeIdentifier.Platform;
     IsLadder = isLadder;
 }
コード例 #2
0
ファイル: Platform.cs プロジェクト: FooKittens/Baine
        public Platform(System.IO.BinaryReader r)
            : base(r)
        {
            // 7 Set material
            materialPreset = (Material.Preset)r.ReadByte();

            // 8 Set IsLadder
            IsLadder = r.ReadBoolean();

            // Set other data
            origin = new Vector2((baseTexture.Width / 2) - ((baseTexture.Width / 2) % 8), (baseTexture.Height / 2) - ((baseTexture.Height / 2) % 8));
            SetMaterial(materialPreset);
            identifier = SaveFileManager.SaveTypeIdentifier.Platform;
        }
コード例 #3
0
ファイル: Platform.cs プロジェクト: FooKittens/Baine
 public void SetMaterial(Material.Preset materialPreset)
 {
     this.materialPreset = materialPreset;
     material = new Material(materialPreset);
     baseTexture = Repainter.GetTextureCopy(Library.textures[textureKey]);
     Repainter.ReplaceRGB(ref baseTexture, material);
     needsRedraw = true;
 }
コード例 #4
0
ファイル: LevelEditor.cs プロジェクト: FooKittens/Baine
 private void MaterialSelect()
 {
     currentMaterial = (Material.Preset)MaterialMenu.GetIndex();
     Platform p = CurrentSprite as Platform;
     if (p != null)
     {
         p.SetMaterial(currentMaterial);
         CurrentSprite.needsRedraw = true;
     }
 }
コード例 #5
0
ファイル: LevelEditor.cs プロジェクト: FooKittens/Baine
        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);
        }