package sample.game.builder;

import java.util.ArrayList;

import library.core.model.CoreModel;
import library.core.object.CoreObjectFactory;
import library.core.system.CoreImageData;
import library.core.view.CoreView;
import sample.game.controller.HowToPlayController;
import sample.game.main.HowToPlay;
import sample.game.model.hotToPlay.HowToPlayScreen;
import sample.game.model.hotToPlay.HowToPlayText;

public class HowToPlayBuilder {



	private CoreObjectFactory objectFactory;

	public HowToPlayBuilder(CoreObjectFactory coreObjectFactory){
		this.objectFactory=coreObjectFactory;
	}

	public HowToPlayController build(HowToPlay palent){

		HowToPlayController controller=new HowToPlayController(palent);


		ArrayList<CoreImageData> screens=new ArrayList<CoreImageData>();
		screens.add(new CoreImageData("image/back/howtoplay1.png"));
		screens.add(new CoreImageData("image/back/howtoplay2.png"));
		screens.add(new CoreImageData("image/back/howtoplay3.png"));
		screens.add(new CoreImageData("image/back/howtoplay4.png"));
		screens.add(new CoreImageData("image/back/howtoplay5.png"));
		screens.add(new CoreImageData("image/back/howtoplay6.png"));
		screens.add(new CoreImageData("image/back/howtoplay7.png"));

		HowToPlayScreen s=new HowToPlayScreen(screens, 640, 360, 1280, 720);
		objectFactory.create(s, new CoreView(s, 0));
		controller.setScreen(s);

		ArrayList<CoreImageData> texts=new ArrayList<CoreImageData>();
		texts.add(new CoreImageData("image/howToPlay/textbox_l_1.png"));
		texts.add(new CoreImageData("image/howToPlay/textbox_l_2.png"));
		texts.add(new CoreImageData("image/howToPlay/textbox_l_3.png"));
		texts.add(new CoreImageData("image/howToPlay/textbox_l_4.png"));
		texts.add(new CoreImageData("image/howToPlay/textbox_l_5.png"));
		texts.add(new CoreImageData("image/howToPlay/textbox_l_6.png"));
		texts.add(new CoreImageData("image/howToPlay/textbox_l_7.png"));
		texts.add(new CoreImageData("image/howToPlay/textbox_l_8.png"));

		HowToPlayText t=new HowToPlayText(controller,texts, 640, 610, 1088, 128);
		objectFactory.create(t, new CoreView(t, 1));
		controller.setText(t);


		CoreModel nextIcon=new CoreModel(new CoreImageData("image/howToPlay/textbox_click.png"),
				999, 638, 16, 16);
		objectFactory.create(nextIcon, new CoreView(nextIcon, 3));
		controller.setNextIcon(nextIcon);


		//フェイド用のマスク
		CoreModel fadeMask=new CoreModel(new CoreImageData("image/game/screen/fadeMask.png"),
				640, 360, 1280, 720);
		fadeMask.setShowView(false);
		fadeMask.setAlpha(0);
		objectFactory.create(fadeMask, new CoreView(fadeMask, 20));
		controller.setFadeMask(fadeMask);

		controller.checkInitProduction();

		return controller;


	}


}
