import org.frice.game.Game;
import org.frice.game.anim.move.SimpleMove;
import org.frice.game.event.OnClickEvent;
import org.frice.game.event.OnMouseEvent;
import org.frice.game.event.OnWindowEvent;
import org.frice.game.obj.FObject;
import org.frice.game.obj.ImageObject;
import org.frice.game.obj.ShapeObject;
import org.frice.game.resource.ColorResource;
import org.frice.game.resource.FileImageResource;
import org.frice.game.utils.message.FDialog;
import org.frice.game.utils.message.log.FLog;
import org.frice.game.utils.shape.FOval;
import org.frice.game.utils.time.FTimeListener;
import org.frice.game.utils.time.FTimer;

import java.util.ArrayList;

/**
 * Created by ice1000 on 2016/8/13.
 *
 * @author ice1000
 */
public class Demo1 extends Game {

	private ArrayList<FObject> objects = new ArrayList<>();
	private FTimer timer;
	private int fuck = 0;
	private int mode = 0;
	private FDialog dialog = new FDialog(this);

	@Override
	public void onInit() {
		timer = new FTimer(800);
		setBack(ColorResource.Companion.getPINK());
		setBounds(100, 100, 800, 800);
		setTitle("Fuck Fuck Fuck");
		addObject(new ShapeObject(ColorResource.Companion.getDARK_GRAY(), new FOval(50, 50)) {{
			getAnims().add(new SimpleMove(10, 20));
		}});
		addTimeListener(new FTimeListener(200, () -> {
			if (fuck > 500) mode = 1;
			if (fuck < 1) mode = 0;
		}));
	}

	@Override
	public void onExit() {
		System.exit(0);
	}

	@Override
	public void onRefresh() {
		if (timer.ended()) {
			FObject object;
			switch (mode) {
				case 1:
					object = objects.get(objects.size() - 1);
					removeObject(object);
					objects.remove(object);
					fuck -= 100;
					break;
				case 0:
					fuck += 100;
					object = new ImageObject(new FileImageResource("test.png"), fuck, fuck);
					addObject(object);
					objects.add(object);
					break;
			}
		}
	}

	@Override
	public void onClick(OnClickEvent onClickEvent) {
//		dialog.show("fuck!!!!!!");
		FLog.i(dialog.confirm("Choose"));
	}

	@Override
	public void onMouse(OnMouseEvent onFrameMouseEvent) {
	}

	@Override
	public void onLoseFocus(OnWindowEvent e) {
		setPaused(true);
	}

	@Override
	public void onFocus(OnWindowEvent e) {
		setPaused(false);
	}

	public static void main(String[] args) {
		new Demo1();
	}
}

@@ -450,54 +450,8 @@
 og;%0A
-import org.frice.game.utils.message.log.FLog;%0A
 impo
@@ -1888,14 +1888,15 @@
 ;%0A%09%09
-FLog.i
+switch 
 (dia
@@ -1917,17 +1917,220 @@
 hoose%22))
-;
+ %7B%0A%09%09%09case 0:%0A%09%09%09%09dialog.show(%22Yes!%22);%0A%09%09%09%09break;%0A%09%09%09case 1:%0A%09%09%09%09dialog.show(%22No!%22);%0A%09%09%09%09break;%0A%09%09%09case 2:%0A%09%09%09%09dialog.show(%22Canceled!%22);%0A%09%09%09%09break;%0A%09%09%09default:%0A%09%09%09%09dialog.show(%22???WTF???%22);%0A%09%09%09%09break;%0A%09%09%7D
 %0A%09%7D%0A%0A%09@O

add demo stuffs