~ubuntu-branches/ubuntu/wily/swell-foop/wily

« back to all changes in this revision

Viewing changes to src/game.vala

  • Committer: Package Import Robot
  • Author(s): Andreas Henriksson
  • Date: 2015-05-19 14:54:40 UTC
  • mfrom: (4.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20150519145440-5gvlqn2aijuq2xzw
Tags: 1:3.16.1-1
* New upstream release.
* Switch build-dependency from appdata-tools to appstream-util

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
public class Game : Object
70
70
{
71
71
    private Tile[,] tiles;
 
72
    private bool is_started = false;
72
73
 
73
74
    /* Game score */
74
75
    public int score { get; set; default = 0; }
92
93
 
93
94
    public signal void update_score (int points_awarded);
94
95
    public signal void complete ();
 
96
    public signal void started ();
95
97
 
96
98
    /* Constructor */
97
99
    public Game (int rows, int columns, int color_num)
111
113
                tiles[y, x] = new Tile (x, y, c);
112
114
            }
113
115
        }
 
116
 
 
117
        is_started = false;
114
118
    }
115
119
 
116
120
    /* Recursively find all the connected tile from li */
197
201
            }
198
202
 
199
203
            /* append closed tiles to not-closed tiles */
200
 
            not_closed_tiles.concat ( (owned) closed_tiles);
 
204
            not_closed_tiles.concat ((owned) closed_tiles);
201
205
 
202
206
            /* update tile array at the current column, not-closed tiles aret at the bottom, closed ones top */
203
207
            for (int y = 0; y < rows; y++)
232
236
 
233
237
        increment_score_from_tiles ((int)cl.length ());
234
238
 
 
239
        if (!is_started) {
 
240
            is_started = true;
 
241
            started ();
 
242
        }
 
243
 
235
244
        if (this.has_completed ())
236
245
        {
237
246
            if (this.has_won ())