/* ==========================================================================
* 파    일 : QuestWindow.h
* 목    적 : 
* 작 성 자 : 김가람
* 작 성 일 : 2008-03-19
* 주의사항 :
*===========================================================================*/
#pragma once
#include "QuestDefine.h"
#include "UIWindow.h"
#include "Icon.h"

class cUIImage;
class cIcon;
class cLabel;
class cListFolderBox;
class cTextBox;
class cButton;

struct sRewardIcon
{
	cIcon*		  icon;
	unsigned long index;	/// 스킬 or 아이템 인덱스
	bool		  select;	/// 선택되었는지 여부

	sRewardIcon()
	{
		icon = 0;
		index = 0;
		select = false;
	}
};

class cQuestWindow : public cUIWindow
{
public:
	cQuestWindow();
	virtual ~cQuestWindow();

	void Clear();

	/// 퀘스트 추가
    bool AddQuest( unsigned int arrIdx, unsigned long questIdx, bool complete );

	/// 갱신
	void SetCheck( unsigned int arrIdx, unsigned long questIdx, bool check );
	void SetCompleteQuest( unsigned int arrIdx, unsigned long questIdx );
	
	/// 퀘스트 설명 및 정보 업데이트
	void UpdateQuestInfo();				

	/// 진행중, 완료가능 퀘스트 갯수 갱신
	void UpdateCount( unsigned int progress, unsigned int complete );

protected:
	bool OnCreate( cUINodeProperty* pproperty );
	void OnCommand( cUINode* pcaller, unsigned int id );
	void OnProcess( unsigned long deltaTime, unsigned long accumTime );
	void OnListBoxChanged( cUINode* , unsigned int );
	void OnIconHovered(cUINode* caller, unsigned int id, const cUIPos& pos );
	void OnImageClicked( cUINode* , unsigned int );
	void OnNetLock( int lockTry );
	void OnNetUnLock( int lockTry );
	void OnShow();

	bool SetQuestReward();	/// 보상정보 업데이트
	void UpdateReward( cQuestReward* reward, sRewardIcon* icon );
	
	void SetExp( unsigned int exp );
	void SetSxp( unsigned int sxp );
	void SetMoney( unsigned long money );
	void SetSkillPoint( unsigned int sp );
	void SetSelectCount( unsigned int count );

	void ClearIcon();

protected:
	cListFolderBox*	mpListBox;

	/// 보상정보
	sRewardIcon mDefaultIcon[5];
	sRewardIcon mSelectIcon[5];
	
	cLabel* mpEXP;
	cLabel* mpSXP;
	cLabel* mpSkillPoint;
	cLabel* mpMoney;
	cLabel* mpCount;

	/// 갯수 정보
	cLabel* mpCompleteCount;
	cLabel* mpProgressCount;

	/// 퀘스트 정보 박스
	cTextBox* mpDescBox;

	/// 
	cButton* mpDelete;

	cUIImage*	mpHighImage;
	cUIImage*	mpLowImage;

	/// 남은시간 출력 라인
	int	mTimeLine;
	unsigned long mSelectQuestIndex;
};
