---------------------------------------------------------------------------------------------------
--  Copyright © 2009 PoBros, Incorporated. All Rights Reserved.
--
--  This source code is the proprietary confidential property of PoBros Incorporated.
--  Modification, reproduction, publication, or distribution in any form to any party 
--  other than the licensee is strictly prohibited.
--
--  FOR USE BY AUTHORIZED PERSONS ONLY
---------------------------------------------------------------------------------------------------

require( "scripts/style.lua" );

local kYOffset = 0;
local kTileX = 300;
local kTileY = 108;
local kTileW = 66
local kTileH = 84;

dialogs =
{
	mahjong_dialog_intro =
	{
		name = "mahjong_dialog_intro";
		image = "autumn_thoughtful";
		sound = "autumn_mahjong_tiles_arranged";
		text = "autumn_mahjong_tiles_arranged";
	};
	
	mahjong_dialog_oncomplete =
	{
		name = "mahjong_dialog_oncomplete";
		image = "autumn_amused";
		sound = "autumn_jade_emperor_green_wealth";
		text = "autumn_jade_emperor_green_wealth";
	};
};

---------------------------------------------------------------------------------------------------

MakeDialog
{
	SetStyle( MinigameJigsawStyle );
	
	MinigameMahjong
	{
		name = "mahjong";
		lockcorrectpieces = false;
		lockinitialpieces = true;
		returnpiecesonmiss = true;
		timetoholdpiece = 350;
		skippiecedelay = 50;
		
		windowsprite =
		{
			sprite = "minigames/mahjong/background";
			xcenter = 400;
			ycenter = 300 - kYOffset;
		};
		
		playfield =
		{
			field1 =
			{
				x = 40;
				y = 118 + kYOffset;
				w = 196;
				h = 244;
			};
			
			field2 =
			{
				x = 556;
				y = 118 + kYOffset;
				w = 194;
				h = 244;
			};
		};

		pieces =
		{
			piece00 = { x = kTileX + ( kTileW * 0 ); y = kYOffset + kTileY + ( kTileH * 0 ); index = 0; };
			piece01 = { x = kTileX + ( kTileW * 1 ); y = kYOffset + kTileY + ( kTileH * 0 ); index = 1; };
			piece02 = { x = kTileX + ( kTileW * 2 ); y = kYOffset + kTileY + ( kTileH * 0 ); index = 2; };
			piece03 = { x = kTileX + ( kTileW * 3 ); y = kYOffset + kTileY + ( kTileH * 0 ); index = 3; };
			piece04 = { x = kTileX + ( kTileW * 0 ); y = kYOffset + kTileY + ( kTileH * 1 ); index = 4; };
			piece05 = { x = kTileX + ( kTileW * 1 ); y = kYOffset + kTileY + ( kTileH * 1 ); index = 5; };
			piece06 = { x = kTileX + ( kTileW * 2 ); y = kYOffset + kTileY + ( kTileH * 1 ); index = 6; };
			piece07 = { x = kTileX + ( kTileW * 3 ); y = kYOffset + kTileY + ( kTileH * 1 ); index = 7; };
			piece08 = { x = kTileX + ( kTileW * 0 ); y = kYOffset + kTileY + ( kTileH * 0 ); index = 8; };
			piece09 = { x = kTileX + ( kTileW * 0 ); y = kYOffset + kTileY + ( kTileH * 2 ); index = 9; };
			piece10 = { x = kTileX + ( kTileW * 1 ); y = kYOffset + kTileY + ( kTileH * 2 ); index = 10; };
			piece11 = { x = kTileX + ( kTileW * 2 ); y = kYOffset + kTileY + ( kTileH * 2 ); index = 11; };
			piece12 = { x = kTileX + ( kTileW * 3 ); y = kYOffset + kTileY + ( kTileH * 2 ); index = 12; };
			piece13 = { x = kTileX + ( kTileW * 0 ); y = kYOffset + kTileY + ( kTileH * 3 ); index = 13; };
			piece14 = { x = kTileX + ( kTileW * 1 ); y = kYOffset + kTileY + ( kTileH * 3 ); index = 14; };
			piece15 = { x = kTileX + ( kTileW * 2 ); y = kYOffset + kTileY + ( kTileH * 3 ); index = 15; };
			piece16 = { x = kTileX + ( kTileW * 3 ); y = kYOffset + kTileY + ( kTileH * 3 ); index = 16; };
			piece17 = { x = kTileX + ( kTileW * 0 ); y = kYOffset + kTileY + ( kTileH * 0 ); index = 17; };
		};
		
		slots =
		{
			slot00 = { x = 75;  y = kYOffset + 150; index = {0;}; startindex = -1; };
			slot01 = { x = 142; y = kYOffset + 150; index = {1;}; startindex = -1; };
			slot02 = { x = 208; y = kYOffset + 150; index = {2;}; startindex = -1; };
			slot03 = { x = 75;  y = kYOffset + 234; index = {3;}; startindex = -1; };
			slot04 = { x = 142; y = kYOffset + 234; index = {4;}; startindex = -1; };
			slot05 = { x = 208; y = kYOffset + 234; index = {5;}; startindex = -1; };
			slot06 = { x = 75;  y = kYOffset + 317; index = {6;}; startindex = -1; };
			slot07 = { x = 142; y = kYOffset + 317; index = {7;}; startindex = -1; };
			slot08 = { x = 208; y = kYOffset + 317; index = {8;}; startindex = 8; };
			slot09 = { x = 590; y = kYOffset + 150; index = {9;}; startindex = -1; };
			slot10 = { x = 657; y = kYOffset + 150; index = {10;}; startindex = -1; };
			slot11 = { x = 724; y = kYOffset + 150; index = {11;}; startindex = -1; };
			slot12 = { x = 590; y = kYOffset + 234; index = {12;}; startindex = -1; };
			slot13 = { x = 657; y = kYOffset + 234; index = {13;}; startindex = -1; };
			slot14 = { x = 724; y = kYOffset + 234; index = {14;}; startindex = -1; };
			slot15 = { x = 590; y = kYOffset + 317; index = {15;}; startindex = -1; };
			slot16 = { x = 657; y = kYOffset + 317; index = {16;}; startindex = -1; };
			slot17 = { x = 724; y = kYOffset + 317; index = {17;}; startindex = 17; };
		};
		
		pieceinfo =
		{
			movetime = 200;
			maxalphahilight = 0.3;
			minalphahilight = 0.1;
			timehilight = 400;
			hidewheninslot = false;
			image = "minigames/mahjong/tile";
		};

		slotinfo =
		{
			validdistance = 30;
			rejectincorrectpieces = false;
			allowmultiplepieces = false;
		};
		
		MinigameButtons();
		AddMinigameTutorial( 400, 300, "mahjongtutorial", "tutorial", -1 );
	};
};

---------------------------------------------------------------------------------------------------
