/**
 * Created by rockyl on 2019-04-09.
 */

import {INavigatorViewBase} from "../navigator/VirtualNavigator";
import {alien} from "../navigator/StackNavigator";
import {Entity, resource, instantiate} from "scilla";
import {playAnimation} from "../animation-utils";
import ScillaComponent from "components/base/ScillaComponent";

const animationConfig = {
	enter: {
		/*RuleButton: {
			'components/other/RelativeLayout': {params: {left: 10,}, duration: 500, ease: 'cubicOut'},
		},
		PrizeButton: {
			'components/other/RelativeLayout': {params: {right: 10,}, duration: 500, ease: 'cubicOut'},
		},
		StartButton: {
			'components/other/RelativeLayout': {params: {bottom: 200,}, duration: 500, ease: 'cubicOut'},
		},*/
	},
	leave: {
		/*RuleButton: {
			'components/other/RelativeLayout': {params: {left: -100,}, duration: 500, ease: 'cubicOut'},
		},
		PrizeButton: {
			'components/other/RelativeLayout': {params: {right: -100,}, duration: 500, ease: 'cubicOut'},
		},
		StartButton: {
			'components/other/RelativeLayout': {params: {bottom: -90,}, duration: 500, ease: 'cubicOut'},
		},*/
	},
};

export default class SceneStart extends ScillaComponent implements INavigatorViewBase{
	/*RuleButton: Entity;
	PrizeButton: Entity;
	StartButton: Entity;*/

	onAwake() {
		super.onAwake();

	}

	showRuleDialog(){
		this.bubbling('showDialog', 'Rule');
	}

	onDidEnter(last: string, action: alien.NavigatorAction, parameters: any): void {
	}

	onDidLeave(next: string, action: alien.NavigatorAction, parameters: any): void {
	}

	async onWillEnter(last: string, action: alien.NavigatorAction, parameters: any) {
		await playAnimation(animationConfig.enter, this);
	}

	async onWillLeave(next: string, action: alien.NavigatorAction, parameters: any) {
		await playAnimation(animationConfig.leave, this);
	}

	onWillMount(last: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
		return undefined;
	}

	onWillUnMount(next: string, action: alien.NavigatorAction, parameters: any): Promise<any> {
		return undefined;
	}

}
