-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameScreen.java
More file actions
80 lines (67 loc) · 2.19 KB
/
Copy pathGameScreen.java
File metadata and controls
80 lines (67 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package com.example.itay.sumika;
import android.content.Context;
import android.view.View;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;
/**
* class that takes care for the screen. ImageViews, boards and more.
**/
public class GameScreen {
int imageTurnId;
Context context;
ImageView turnImage;
TextView timeTv, announceTv;
Board board;
public GameScreen(int numOfColumnsX,
int numOfRowsY,
GridView gridView,
ImageView turnImage,
TextView timetv,
TextView announceTv,
Context context,
int compLevel,
boolean onePlayer,
int validSpace,
int timeForMove) {
this.turnImage = turnImage;
this.timeTv = timetv;
this.announceTv= announceTv;
this.context=context;
this.board = new Board(numOfColumnsX,
numOfRowsY,
gridView,
context,
compLevel,
onePlayer,
this,
validSpace,
timeForMove
);
if(timeForMove!=0)
timetv.setText(Integer.toString(timeForMove));
board.createBoard();
}
public void changeImageTurn(int turn) {
switch (turn % 2) {
case 0:
imageTurnId = R.drawable.cirecle_pink_new;
break;
case 1:
imageTurnId = R.drawable.cirecle_blue_new;
break;
}
turnImage.setImageResource(imageTurnId);
}
public void setTimeTv(int timeLeft){
timeTv.setText(Integer.toString(timeLeft));
}
public void setAnnounceTv2Players(int res,int res2,int winNum){
String announce=context.getString(res)+" "+Integer.toString(winNum)+" "+context.getString(res2);
announceTv.setText(announce);
}
public void setAnnounceTv1Player(int res,int numOfClick){
String announce=context.getString(res)+" "+Integer.toString(numOfClick)+"!";
announceTv.setText(announce);
}
}