#include "MenuTextSlotEmpty.h"

MenuTextSlotEmpty::MenuTextSlotEmpty()
{
	ani.png = L"menu_CS_title";
	ani.sprite_index = L"";
}

void MenuTextSlotEmpty::Step()
{
	if (bOnce)
	{
		//检测存档情况
		//文件./data/save/xxx.sav是否存在
		wchar_t wbuff[MAX_PATH];
		swprintf_s(wbuff, L"./data/save/%s.sav", el.eventName.c_str());
		FILE* fp;
		_wfopen_s(&fp, wbuff, L"rb");
		if (fp)
		{
			fclose(fp);
			ani.sprite_index = L"";
		}
		else
		{
			ani.sprite_index = L"slotempty";
		}
		bOnce = false;
	}
}

void MenuTextSlotEmpty::SetState(int stateID, int lr)
{
	bOnce = lr;
}

std::shared_ptr<Entity> CreateMenuTextSlotEmpty()
{
	return std::make_shared<MenuTextSlotEmpty>();
}
