示例#1
0
int InitLuaSystem() {
	InitLuaCore();
	InitLuaFamily(g_LuaState);
	RegisterLuaObjects(g_LuaState, g_LuaSettlementObjects);
	RegisterLuaEnums(g_LuaState, g_LuaSettlementEnums);
	lua_getglobal(g_LuaState, "Plot");
	luaL_getmetatable(g_LuaState, "Plot");
	lua_setmetatable(g_LuaState, -2);
	lua_pop(g_LuaState, 1);
	//LuaSettlementObjects(g_LuaState);
	RegisterLuaObjects(g_LuaState, g_LuaAIObjects);

	InitMissionLua(g_LuaState);
	InitVideoLua(g_LuaState);
	lua_newtable(g_LuaState);
	lua_pushstring(g_LuaState, "__index");
	lua_pushvalue(g_LuaState, LUA_REGISTRYINDEX);
	lua_pushstring(g_LuaState, "Animation");
	lua_rawget(g_LuaState, -2);
	lua_pop(g_LuaState, 1);
	lua_rawset(g_LuaState, -3);
	lua_setmetatable(g_LuaState, -2);
	LuaSetEnv(g_LuaState, "Animation");
	lua_pop(g_LuaState, 1);

	LuaWorldInit();
	Log(ELOG_INFO, "Loading Missions");
	++g_Log.Indents;
	LoadAllMissions(g_LuaState, &g_MissionEngine);
	--g_Log.Indents;
	return 1;
}
示例#2
0
bool InitApp()
{
	if (!InitXLUE())
	{
		return false;
	}

	if (!InitLuaCore())
	{
		return false;
	}

	WizardApp::GetInstance()->Init();

    if (!LoadSkin())
    {
        ::MessageBox(NULL, L"Load Skin Error!", L"Error", MB_OK);
        return true;
    }

	if (!LoadXAR())
	{
		return false;
	}

	return true;
}