#include "Data/Levels/Common/Tutorial/Scripts/DialogsFades.bhass"
#include "Data/Levels/Common/Tutorial/Scripts/PatchFades.bhass"
#include "Data/Levels/Common/Tutorial/Scripts/SkinFades.bhass"
#include "Data/Levels/Common/Tutorial/Scripts/Utilities.bhass"

CTutorial@ pTutorial;
CLocalizer@ pLocalizer;
CGameText@ pText;
CFloat2 vLeftPosition;
CFloat2 vRightPosition;
CGameSkin@ pMagman;
CGameSkin@ pHeather;
CGameText@ pLeftNameBlack;
CGameText@ pRightNameBlack;
CGameText@ pLeftNameWhite;
CGameText@ pRightNameWhite;
uint64 musicID;

//------------------------------------------------ Init/Release ---------------------------------------------------
void InitTutorial()
{
    @pTutorial = GetGame().GetCurrentLevel().GetTutorial();
    @pLocalizer = GetGame().GetLocalizer();
    @pText = pTutorial.GetGameText("Text");
    vLeftPosition.x = -350.0f;
    vLeftPosition.y = 250.0f;
    vRightPosition.x = 350.0f;
    vRightPosition.y = 250.0f;
	@pLeftNameBlack = pTutorial.GetGameText("LeftNameBlack");
    @pRightNameBlack = pTutorial.GetGameText("RightNameBlack");
	@pLeftNameWhite = pTutorial.GetGameText("LeftNameWhite");
    @pRightNameWhite = pTutorial.GetGameText("RightNameWhite");
	@pHeather = cast<CGameSkin>(pTutorial.GetGameObject("Heather"));
    @pMagman = cast<CGameSkin>(pTutorial.GetGameObject("Magman"));
	ChangeSkinAnimation(pMagman, "Data/Levels/Chars/Magman/Poses/A_MagmanNormalRight.ahsanimation");
    ChangeSkinAnimation(pHeather, "Data/Levels/Chars/Heather/Poses/A_HeatherCuteLeft.ahsanimation");
	musicID = PlayMusic("Data/Musics/Upgrade.ogg", true);
}

void ReleaseTutorial()
{
	StopMusic(musicID, 0.5f);
}

//------------------------------------------------ Fade Chars ---------------------------------------------------
void FadeInHeatherLeftMagmanRightEnter()				
{				
	pHeather.SetPosition(vLeftPosition);			
	pMagman.SetPosition(vRightPosition);			
	FadeInSkinEnter(pHeather);			
	FadeInSkinEnter(pMagman);			
}				
void FadeInHeatherLeftMagmanRightUpdate(float _Delta)				
{				
	FadeInSkinUpdate(pHeather);			
	FadeInSkinUpdate(pMagman);			
}				

//------------------------------------------------ Script Functions ---------------------------------------------------
void HideText()
{
    pText.SetText("");
}

void EnterVolcano_7_100()
{
	pText.SetVisible(true);
	ChangeSkinAnimation(pHeather, "Data/Levels/Chars/Heather/Poses/A_HeatherCuteLeft.ahsanimation");
	ChangeSkinAnimation(pMagman, "Data/Levels/Chars/Magman/Poses/A_MagmanNormalRight.ahsanimation");
	pLeftNameBlack.SetVisible(true);
	pLeftNameWhite.SetVisible(true);
	pLeftNameBlack.SetText(GetGame().GetLocalizer().LocalizeText("HEATHER_NAMETAG"));
	pLeftNameWhite.SetText(GetGame().GetLocalizer().LocalizeText("HEATHER_NAMETAG"));
		pRightNameBlack.SetVisible(true);
	pRightNameWhite.SetVisible(true);
	pRightNameBlack.SetText(GetGame().GetLocalizer().LocalizeText("MAGMAN_NAMETAG"));
	pRightNameWhite.SetText(GetGame().GetLocalizer().LocalizeText("MAGMAN_NAMETAG"));

	pText.SetText(pLocalizer.LocalizeText("VOLCANO_7_100"));
}

void ExitVolcano_7_100()
{
	pText.SetText("");
}

void EnterVolcano_7_200()
{
	ChangeSkinAnimation(pHeather, "Data/Levels/Chars/Heather/Poses/A_HeatherNormalLeft.ahsanimation");
	pText.SetText(pLocalizer.LocalizeText("VOLCANO_7_200"));
}

void ExitVolcano_7_200()
{
	pText.SetText("");
}

void EnterVolcano_7_300()
{
	pText.SetText(pLocalizer.LocalizeText("VOLCANO_7_300"));
}

void ExitVolcano_7_300()
{
	pText.SetText("");
}

void EnterVolcano_7_400()
{
	pText.SetText(pLocalizer.LocalizeText("VOLCANO_7_400"));
}


void EnterVolcano_7_500()
{
	ChangeSkinAnimation(pHeather, "Data/Levels/Chars/Heather/Poses/A_HeatherWorriedLeft.ahsanimation");
	ChangeSkinAnimation(pMagman, "Data/Levels/Chars/Magman/Poses/A_MagmanAngryRight.ahsanimation");
	pText.SetText(pLocalizer.LocalizeText("VOLCANO_7_500"));
}


void EnterVolcano_7_600()
{
	ChangeSkinAnimation(pHeather, "Data/Levels/Chars/Heather/Poses/A_HeatherNormalLeft.ahsanimation");
	ChangeSkinAnimation(pMagman, "Data/Levels/Chars/Magman/Poses/A_MagmanSorryRight.ahsanimation");
	pText.SetText(pLocalizer.LocalizeText("VOLCANO_7_600"));
}

void ExitVolcano_7_600()
{
	pText.SetText("");
}

void EnterVolcano_7_700()
{
	ChangeSkinAnimation(pHeather, "Data/Levels/Chars/Heather/Poses/A_HeatherCuteLeft.ahsanimation");
	pText.SetText(pLocalizer.LocalizeText("VOLCANO_7_700"));
}


void EnterVolcano_7_800()
{
	ChangeSkinAnimation(pHeather, "Data/Levels/Chars/Heather/Poses/A_Heather4thWallWorriedLeft.ahsanimation");
	pText.SetText(pLocalizer.LocalizeText("VOLCANO_7_800"));
}

void ExitVolcano_7_800()
{
	pText.SetText("");
}