/* ==========================================================================
* 파    일 : ItemTipWindow.h
* 목    적 : 
* 작 성 자 : 김가람
* 작 성 일 : 2007-09-06
* 주의사항 :
*===========================================================================*/
#pragma once
#include "TipWindow.h"

const int SLOT_GAP = 2;

class cItemDefine;
class cUIRoundGauge;
class cUIImage;
/// 아이템용 팁 윈도우
class cItemTipWindow : public cTipWindow
{
public:
	cItemTipWindow();
	virtual ~cItemTipWindow();

	bool SetItemInfo( eTip_Kind tipkind, const cUIPos& pos, sInventory& inven, bool checkTime );


	/// 위치, 아이템인덱스, 슬롯인덱스 
//	bool SetItem( eTip_Kind tipkind, const cUIPos& pos, unsigned long itemIndex, int slotIndex, cUIRoundGauge* gauge );
//	bool SetItem( eTip_Kind tipkind, const cUIPos& pos, unsigned long itemIndex, unsigned int enhance );

	/// 다른유저가 가지고 있는 아이템 툴팁 보기
//	bool SetOtherItem( eTip_Kind tipkind, const cUIPos& pos, sInventory& inven );

protected:
	bool OnCreate( cUINodeProperty* prop );
	void OnRender( cUIFontItemKeeper* fontKeeper );
	void OnTimer();

	/// 툴팁 설정 
//	void SetNormalTip( cItemDefine* itemDefine, bool store = false );
//	bool SetName( cItemDefine* itemDefine );
	bool SetName( cItemDefine* itemDefine, unsigned int enhance );
	bool SetRare( cItemDefine* itemDefine );

//	bool SetBasic( cItemDefine* itemDefine );
	bool SetBasic( cItemDefine* itemDefine, unsigned int enhance );

	bool SetType( unsigned char type, unsigned char subtype, short defenseType );
	bool SetSpecial( cItemDefine* itemDefine );
	bool SetSpecialCard( cItemDefine* itemDefine );
	bool SetLimit( cItemDefine* itemDefine );
	bool SetEffect( cItemDefine* itemDefine );
	bool SetUseTime( cItemDefine* itemDefine );
	void SetPrice( unsigned long type, cItemDefine* itemDefine, unsigned long priceTooltipIdx, unsigned long price );
	unsigned long GetTooltipIdxByOpt( short type );

	bool AddSpecial( bool usePrint, unsigned long tooltipIdx, short value, bool usePercent );
	bool AddSpecialEquipCard( bool addfront, unsigned long tooltipIdx, short value, bool usePercent );

	/// 툴팁 배경 이미지 세팅
	virtual void SetBackImg( const cUIPos& pos );
	virtual void Clear();

	///
//	void SetCard();
	void SetCard( sInventory& inven );
	bool SetCardData( int i, unsigned long cardIndex );

protected:
	cUIRoundGauge* mGauge;
	unsigned int mTimeTipIdx;
	/// 재사용시간, 사용대기시간 변경시 저장용
	cStringT	mSaveCoolTime;
	bool		mUpdateSizebyTime;	/// 재사용시간 출력시 바탕이미지 재계산

	/// 임시
	unsigned long mItemIndex;
	unsigned int mSlotIndex;

	bool mCheckTime;

	/// 카드 이미지
	bool			mShowImage[MAX_CARD_SLOT];
	cUIImage*		mImage[MAX_CARD_SLOT];
	cUIImage*		mSlotImage[MAX_CARD_SLOT];
	cUISize			mSlotSize;
	
	cUIPos			mTexPos[4];
	unsigned int	mSlotCount;
	
	/// 이미지 찍힐 좌표
	unsigned int	mImagePosY;
};


/// 채팅 팁 윈도우
class cChatTipWindow : public cItemTipWindow
{
public:
	cChatTipWindow();
	virtual ~cChatTipWindow();

protected:
	bool OnCreate( cUINodeProperty* prop );
	void OnRender( cUIFontItemKeeper* fontKeeper );
	void OnCommand(cUINode* , unsigned int );
	void UpdateRect();
	void UpdateSkin();

	void SetBackImg( const cUIPos& pos );

private:
	cUINode*		mpClose;
};
