/* ====================================================================
 * 파    일 :	
 * 목    적 :	
 * 작 성 자 :	정성대
 * 작 성 일 :	2006.08.29
 *
 * 추가내용 :
 *		추가날짜	작업자	추가내용
 *		2006.08.29	정성대	생성
 * 
 * 주의사항 :	
 * =================================================================== */
#pragma once
#include "BaseStage.h"
#include "FileLoader.h"
#include "Skill_Common.h"

struct MSG_MONSTER_INFO;
class cLoadUIManager;

class cLoadStage : public cBaseStage
{
public:
	cLoadStage();
	virtual ~cLoadStage();

	enum eLOADSTATE
	{
		eLOADSTATE_START = 0,
		eLOADSTATE_CLEARINFO,
		eLOADSTATE_TERRAIN,
		eLOADSTATE_NAVIMESH,
		eLOADSTATE_NAVIFIELD,
		eLOADSTATE_SCENE,
		eLOADSTATE_SCENE_PER1,
		eLOADSTATE_SCENE_PER2,
		eLOADSTATE_SCENE_PER3,
		eLOADSTATE_SCENE_PER4,
		eLOADSTATE_MONSTERDATA,
		eLOADSTATE_NPCDATA,
		eLOADSTATE_HEROITEM,
		eLOADSTATE_BASESKILL,
		eLOADSTATE_HEROSKILL,
		eLOADSTATE_GAMEINFO,
		eLOADSTATE_END,

		eLOADSTATE_NONE = 100,

		eLOADTATE_HEROBASEINFO = 1000,
	};

	virtual void Init( cStageManager* pStageManager );
	virtual void InitStage();
	virtual void Exit();
	virtual void Open();
	virtual void Close();
	virtual void Process( unsigned long deltaTime, unsigned long accumTime );

	virtual void NetworkMsgParser( unsigned long connectionindex, char* pMsg, unsigned long length );

protected:

	void Msg_CharacterGameinAck( MSGROOT* pMsg );

	void ChangeLoadState( eLOADSTATE state );

	/// load process
	void LoadFaile( unsigned long error );
	bool BeginSceneLoad( unsigned int mapIdx );
	bool BeginSoundSceneLoad( unsigned int mapIdx );

protected:
	/// monster model list
	unsigned int	mMonsterClassCount;
	unsigned long	mMonsterClassIdx[50];

	/// npc model list
	unsigned int	mNpcClassCount;
	unsigned long	mNpcClassIdx[50];

	/// skill have list
	unsigned int	mSkillCount;
	unsigned int	mInfluenceCount;

	/// 스킬 / 효과
	sHaveSkill			mSkill[100];
	sInfluenceClient	mInfluence[100];

protected:
	eLOADSTATE		mLoadState;
	sLoadFlag		mLoadFlag;

	/// 로드 스테이지 
	cLoadUIManager* mpLoadUIManager;

	/// file
	cFileLoader		mFileLoader;

///
protected:
	static DWORD WINAPI LoadThreadStartFunc( void* ptr );
	DWORD	LoadStageThread();

	HANDLE			mLoadThread;
	float			mGoPercent;
};
