#pragma once

#include "../interface.h"

class CStoreFrame;
extern CStoreFrame*				g_pStoreFrame;

#define MAX_STORE_ITEM			30

class CStoreFrame : public CInterfaceBase
{
public:
	CStoreFrame(CInterface* object);
	virtual ~CStoreFrame();

	enum {
		eStore_Type_Buy				= 0,
		eStore_Type_Sell			= 1,
	};

	virtual	void				RegisterFunc();
	virtual	void				Update(float elapsedTime);
	virtual	void				Open(int m_npcId, int storeId, int* itemCount);
	virtual	void				Close();
	virtual	bool				IsOpen()						{ return m_shopId != 0; }
	virtual	void				UpdateBuy(int index, int count);
	virtual	void				UpdateSell();
	virtual	void				Cut(int state, int index);
	virtual	void				Paste(int state, int index);
	virtual	void				Buy(int state, int index);
	virtual	void				Sell(int pos);

	virtual	int					GetShopId()						{ return m_shopId; }
	virtual	int					GetNpcId()						{ return m_npcId; }
	virtual	int					GetItemId(int index);
	virtual	int					GetItemCount(int index);
	virtual	int					GetCount()						{ return m_count; }

protected:
	virtual	void				Clear();

protected:
	int							m_shopId;
	int							m_npcId;
	int							m_count;
	int							m_index[MAX_STORE_ITEM];
	int							m_itemCount[MAX_STORE_ITEM];
};