Changeset 1846 for 2011/23


Ignore:
Timestamp:
2011-06-10 09:32:23 (12 years ago)
Author:
tueesuih
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2011/23/tueesuih/Barricade/Barricade.cs

    r1812 r1846  
    99public class Peli : PhysicsGame 
    1010{ 
     11    ScoreList topLista = new ScoreList(10, false, 0); 
     12 
     13 
    1114    Vector nopeusVasen = new Vector(-2500, 0); 
    1215    Vector nopeusOikea = new Vector(2500, 0); 
     
    2932    public override void Begin() 
    3033    { 
     34        if (DataStorage.Exists("pisteet.xml")) 
     35            topLista = DataStorage.Load<ScoreList>(topLista, "pisteet.xml"); 
     36 
     37 
    3138 
    3239        Valikko(); 
     
    7279        alus.Destroy(); 
    7380 
     81        Timer.SingleShot(2.5, TopIkkuna); 
     82 
    7483 
    7584    } 
     
    8392        LisääSeinät(); 
    8493        LuoAikaLaskuri(); 
     94 
     95    } 
     96    void TallennaPisteet(Window sender) 
     97    { 
     98        DataStorage.Save<ScoreList>(topLista, "pisteet.xml"); 
     99 
    85100    } 
    86101 
     
    176191        Mouse.ListenOn(kohta1, MouseButton.Left, ButtonState.Pressed, AloitaPeli, null); 
    177192        Mouse.ListenOn(kohta2, MouseButton.Left, ButtonState.Pressed, Lopeta, null); 
     193        Mouse.ListenOn(kohta3, MouseButton.Left, ButtonState.Pressed, NaytaTopten, null); 
     194 
    178195 
    179196        Mouse.IsCursorVisible = true; 
     
    227244 
    228245 
    229  
     246    void NaytaTopten() 
     247    { 
     248        HighScoreWindow topIkkuna = new HighScoreWindow("barricade", "Highscores", topLista); 
     249        Add(topIkkuna); 
     250    } 
     251 
     252    void TopIkkuna() 
     253    { 
     254        HighScoreWindow topIkkuna = new HighScoreWindow("barricade", 
     255       "High scores", 
     256       "CONGRATULATIONS, %p! type your name here:", 
     257       topLista, aikaLaskuri.CurrentTime); 
     258        topIkkuna.Closed += TallennaPisteet; 
     259        Add(topIkkuna); 
     260    } 
    230261 
    231262} 
Note: See TracChangeset for help on using the changeset viewer.