abstract class implementation
This commit is contained in:
@@ -28,36 +28,37 @@ public class CanvasView extends View
|
||||
super.setBackgroundColor(Color.BLACK);
|
||||
|
||||
Foreground = new GamePlay();
|
||||
Foreground.Instance = Foreground;
|
||||
}
|
||||
|
||||
public void SetActivity(Activity activity)
|
||||
{
|
||||
GamePlay.Instance.SetActivity(activity);
|
||||
GamePlay.Instance.SetCanvas(this);
|
||||
GamePlay.Instance.SetStartLevel(startLevel);
|
||||
GamePlay.Instance.SetPayedVersion(PayedVersion);
|
||||
((GamePlay)Foreground.Instance).Instance.SetActivity(activity);
|
||||
((GamePlay)Foreground.Instance).SetCanvas(this);
|
||||
((GamePlay)Foreground.Instance).SetStartLevel(startLevel);
|
||||
((GamePlay)Foreground.Instance).SetPayedVersion(PayedVersion);
|
||||
|
||||
GamePlay.Instance.SetGameState(GamePlay.GS_LOAD);
|
||||
((GamePlay)Foreground.Instance).SetGameState(GamePlay.GS_LOAD);
|
||||
|
||||
// Start Game.
|
||||
if (GamePlay.Instance.GetGameState() == GamePlay.GS_READY)
|
||||
GamePlay.Instance.SetGameState(GamePlay.GS_START);
|
||||
if (((GamePlay)Foreground.Instance).GetGameState() == GamePlay.GS_READY)
|
||||
((GamePlay)Foreground.Instance).SetGameState(GamePlay.GS_START);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas)
|
||||
{
|
||||
GamePlay.Instance.DrawFrame(canvas);
|
||||
Foreground.Instance.DrawFrame(canvas);
|
||||
}
|
||||
|
||||
public void onPause()
|
||||
{
|
||||
GamePlay.Instance.onPause();
|
||||
Foreground.Instance.onPause();
|
||||
}
|
||||
|
||||
public void sendMove(float x, float y, boolean pointerUp)
|
||||
{
|
||||
GamePlay.Instance.SendMove(x, y, pointerUp);
|
||||
Foreground.Instance.SendMove(x, y, pointerUp);
|
||||
}
|
||||
|
||||
public void OnGameStateChanged(int gameState)
|
||||
|
||||
@@ -19,9 +19,6 @@ import java.util.TimerTask;
|
||||
|
||||
public class GamePlay extends GameStateInterface
|
||||
{
|
||||
// Instance.
|
||||
public static GamePlay Instance = new GamePlay();
|
||||
|
||||
// GameState.
|
||||
protected int GameState = GS_STOPPED;
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ import android.graphics.Canvas;
|
||||
|
||||
public abstract class GameStateInterface
|
||||
{
|
||||
public GameStateInterface Instance;
|
||||
|
||||
// GameState Parameters
|
||||
final static int GS_STOPPED = 0;
|
||||
final static int GS_LOADING = 1;
|
||||
|
||||
Reference in New Issue
Block a user