package com.sencorsta.rabs.obj.ai.scene.fight;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.thread.ThreadUtil;
import com.sencorsta.rabs.annotation.SceneAnnotation;
import com.sencorsta.rabs.obj.ai.AiManage;
import com.sencorsta.rabs.obj.ai.api.BaseScene;
import com.sencorsta.rabs.obj.ai.api.Scene;
import org.opencv.core.Point;

import java.awt.AWTException;
import java.util.Calendar;

/**
 * 对决赛
 */
@SceneAnnotation("SceneMain_Fight")
public class SceneMain_Fight_Gym extends BaseScene implements Scene {
    private static String PathEnter = System.getProperty("user.dir") + "\\opencv\\scene\\fight\\gym\\enter.png";
    private static String PathCheck = System.getProperty("user.dir") + "\\opencv\\scene\\fight\\gym\\check.png";
    private static String PathBack = System.getProperty("user.dir") + "\\opencv\\scene\\fight\\gym\\back.png";

    @Override
    public void back() throws AWTException {
        moveToClick(PathBack, AiManage.getInstance().getCheckPoint());
        ThreadUtil.sleep(4000);
    }

    @Override
    public void open() throws AWTException {
        while (AiManage.getInstance().isRunning() && !check()) {
            AiManage.getInstance().updateWindow();
            ThreadUtil.sleep(2000);
            if (checkHas(PathEnter, AiManage.getInstance().getCheckPoint())) {
                moveToClick(PathEnter, AiManage.getInstance().getCheckPoint());
                continue;
            }
        }
    }

    @Override
    public boolean check() throws AWTException {
        if (checkHas(PathCheck, AiManage.getInstance().getCheckPoint())) {
            return true;
        }
        return false;
    }

    @Override
    public void think() throws AWTException {

    }


    @Override
    public boolean isDone() {
        return hasChildDone();
    }

}
