package sample.game.model.hotToPlay;

import java.util.ArrayList;

import library.core.listener.OnCoreTouchUpListener;
import library.core.model.CoreModel;
import library.core.system.CoreImageData;
import sample.game.controller.HowToPlayController;


public class HowToPlayText extends CoreModel implements OnCoreTouchUpListener{


	private ArrayList<CoreImageData> textDatas;
	private HowToPlayController controller;

	private boolean isTouch;


	private int page;

	public HowToPlayText(HowToPlayController controller,ArrayList<CoreImageData> texts, float centerX, float centerY,
			float width, float height) {
		super(texts.get(0), centerX, centerY, width, height);

		isTouch=true;

		this.controller=controller;
		this.textDatas=texts;
		this.page=0;

	}

	@Override
	public void onTouchUp() {
		if(!isTouch) return;

		page++;
		if(page>=textDatas.size()){
			page=textDatas.size()-1;
			controller.goEndPhase();
		}

		this.controller.nextScreen();
		this.setImageData(textDatas.get(page));

	}

	public void setTouch(boolean isTouch) {
		this.isTouch = isTouch;
	}




}
