Changeset 2640 for 2010


Ignore:
Timestamp:
2011-12-27 19:52:02 (8 years ago)
Author:
hniemi
Message:

Tiedostoformaattia muutettu, ja korjatut bugi, että palikoita voi oikeasti työntää...

Kentät myös siirretty hakemistoihin ja hakemisto lisätty projektiin

Location:
2010/23/hniemi/BlockPusher
Files:
5 added
4 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • 2010/23/hniemi/BlockPusher/Blockpusher/Blockpusher

    • Property svn:ignore set to
      bin
      obj
  • 2010/23/hniemi/BlockPusher/Blockpusher/Blockpusher/BlockLevel.cs

    r2639 r2640  
    1212public class BlockLevel 
    1313{ 
     14    private static readonly string tagPar = "par: "; 
     15    private static readonly string tagName = "name: "; 
     16    private static readonly string tagAuthor = "author: "; 
     17    private static readonly int levelStartRow = 3; 
     18 
     19 
    1420    private Block[,] playfield; 
    1521    private Blockpusher game; 
     
    2026    private int playerY; 
    2127 
    22     private int parMoves; 
    23  
    2428    public delegate void GameEvent(); 
    2529    public event GameEvent Victory; 
     
    3943    public string Name { get; set; } 
    4044 
     45    /// <summary> 
     46    /// Author of level 
     47    /// </summary> 
     48    public string Author { get;set; } 
     49 
     50    /// <summary> 
     51    /// Movecount 
     52    /// </summary> 
    4153    public int Moves { get; set; } 
     54 
     55    /// <summary> 
     56    /// How many moves to par score 
     57    /// </summary> 
     58    public int ParMoves { get; set; } 
    4259 
    4360    /// <summary> 
     
    146163            if (sourType == BlockType.Player) { playfield[endx, endy].Type = BlockType.Player; } 
    147164            if (sourType == BlockType.SatisfiedGoalZone) { playfield[endx, endy].Type = BlockType.Movable; } 
     165            if (sourType == BlockType.Movable) { playfield[endx, endy].Type = BlockType.Movable; } 
    148166        } 
    149167    } 
     
    212230    public void CreateField(IList<string> level) 
    213231    { 
    214         int playfieldWidth = level[0].Length; 
    215         int playfieldHeight = level.Count; 
     232        int playfieldWidth = level[levelStartRow].Length; 
     233        int playfieldHeight = level.Count - levelStartRow; 
     234 
     235        Name = level[0].Substring(tagName.Length); 
     236        Author = level[1].Substring(tagAuthor.Length); 
     237        ParMoves = int.Parse(level[2].Substring(tagPar.Length)); 
     238         
    216239 
    217240        playfield = new Block[playfieldWidth, playfieldHeight]; 
     
    225248                block.Y = -(j * (Blockpusher.BlockSize + 1) + game.Level.Bottom + (Blockpusher.BlockSize / 2)); 
    226249 
    227                 block.Type = FindBlockType(level[j][i]); 
     250                block.Type = FindBlockType(level[j+levelStartRow][i]); 
    228251                if (block.Type == BlockType.Player) 
    229252                { 
     
    267290        List<string> list = new List<string>(); 
    268291 
     292        list.Add(tagName + Name); 
     293        list.Add(tagAuthor + Author); 
     294        list.Add(tagPar + ParMoves); 
     295 
    269296        for (int i = 0; i < playfield.GetLength(1); i++) 
    270297        { 
  • 2010/23/hniemi/BlockPusher/Blockpusher/Blockpusher/Blockpusher.cs

    r2639 r2640  
    8585            level.CreateField(ReadFile(file)); 
    8686 
    87             level.Name = file.Substring(file.LastIndexOf('\\')+1, file.LastIndexOf('.') - file.LastIndexOf('\\')-1); 
     87            //level.Name = file.Substring(file.LastIndexOf('\\')+1, file.LastIndexOf('.') - file.LastIndexOf('\\')-1); 
    8888            levels.Add(level); 
    8989        } 
  • 2010/23/hniemi/BlockPusher/Blockpusher/Blockpusher/Blockpusher.csproj

    r2633 r2640  
    118118  </ItemGroup> 
    119119  <ItemGroup> 
     120    <None Include="Data\Levels\Level2.txt"> 
     121      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 
     122    </None> 
     123    <None Include="Data\Levels\Level3.txt"> 
     124      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 
     125    </None> 
     126    <None Include="Data\Levels\Level1.txt"> 
     127      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 
     128    </None> 
    120129    <Content Include="Game.ico" /> 
    121130    <Content Include="GameThumbnail.png" /> 
     
    154163    </BootstrapperPackage> 
    155164  </ItemGroup> 
     165  <ItemGroup /> 
    156166  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> 
    157167  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" /> 
  • 2010/23/hniemi/BlockPusher/Blockpusher/BlockpusherContent

    • Property svn:ignore set to
      bin
      obj
Note: See TracChangeset for help on using the changeset viewer.