Esempio n. 1
0
void GameLayer::NextLevel()
{
	_level += 1;
	if (_level > MAX_LEVEL||_iplife<=0)
	{
		_level--;
		GameOver();
	}
	else
	{
		//ClearPreLevel();
		//_enemyTankCount = _gameLevel;
		//initCreate();
		//showLeve();
		//showLife();
		//showEnemyCount();
		//this->scheduleUpdate();
		//////////////////////////////////////////////////////////////////////////
		ClearAllItem();
		//ClearAllItem();
		auto theScene = LevelSwitchLayer::createScene(_level);
		//Director::getInstance()->replaceScene(theScene);

		//
		//CCTransitionMoveInR::transitionWithDuration(t, s);//新场景从右移入覆盖  
		//Director::getInstance()->replaceScene(TransitionMoveInB::create(2.0f, theScene));

		//CCTransitionFade::transitionWithDuration(t, s)
		Director::getInstance()->replaceScene(TransitionFade::create(1.5f, theScene));
		//////////////////////////////////////////////////////////////////////////

		//ClearAllItem();
		//init_Create();
		//this->showLevel();
		//this->showIpLifeCount();
		//this->showEnemy();
	}
}
Esempio n. 2
0
bool Panel::ExecShortcutFolder(string strShortcutFolder, const GUID& PluginGuid, const string& strPluginFile, const string& strPluginData, bool CheckType, bool TryClosest, bool Silent)
{
	auto SrcPanel = shared_from_this();
	const auto AnotherPanel = Parent()->GetAnotherPanel(this);

	if(CheckType)
	{
		switch (GetType())
		{
		case panel_type::FILE_PANEL:
			break;

		case panel_type::TREE_PANEL:
		case panel_type::QVIEW_PANEL:
		case panel_type::INFO_PANEL:
			if (AnotherPanel->GetType() == panel_type::FILE_PANEL)
				SrcPanel=AnotherPanel;
			break;
		}
	}

	bool CheckFullScreen=SrcPanel->IsFullScreen();

	if (PluginGuid != FarGuid)
	{
		bool Result = false;
		ShortcutInfo Info;
		GetShortcutInfo(Info);
		if (Info.PluginGuid == PluginGuid && Info.PluginFile == strPluginFile && Info.PluginData == strPluginData)
		{
			Result = SetPluginDirectory(strShortcutFolder, Silent);
		}
		else
		{
			if (ProcessPluginEvent(FE_CLOSE, nullptr))
			{
				return false;
			}

			if (const auto pPlugin = Global->CtrlObject->Plugins->FindPlugin(PluginGuid))
			{
				if (pPlugin->has(iOpen))
				{
					if (!strPluginFile.empty())
					{
						auto strRealDir = strPluginFile;
						if (CutToSlash(strRealDir))
						{
							SrcPanel->SetCurDir(strRealDir,true);
							SrcPanel->GoToFile(PointToName(strPluginFile));

							SrcPanel->ClearAllItem();
						}
					}

					const auto IsActive = SrcPanel->IsFocused();
					OpenShortcutInfo info=
					{
						sizeof(OpenShortcutInfo),
						strPluginFile.empty()? nullptr : strPluginFile.c_str(),
						strPluginData.empty()? nullptr : strPluginData.c_str(),
						IsActive? FOSF_ACTIVE : FOSF_NONE
					};

					if (auto hNewPlugin = Global->CtrlObject->Plugins->Open(pPlugin, OPEN_SHORTCUT, FarGuid, reinterpret_cast<intptr_t>(&info)))
					{
						const auto NewPanel = Parent()->ChangePanel(SrcPanel, panel_type::FILE_PANEL, TRUE, TRUE);
						NewPanel->SetPluginMode(std::move(hNewPlugin), {}, IsActive || !Parent()->GetAnotherPanel(NewPanel)->IsVisible());
						Result = NewPanel->SetPluginDirectory(strShortcutFolder, Silent);
					}
				}
			}
		}
		return Result;
	}

	strShortcutFolder = os::env::expand(strShortcutFolder);

	if (!CheckShortcutFolder(strShortcutFolder, TryClosest, Silent) || ProcessPluginEvent(FE_CLOSE, nullptr))
	{
		return false;
	}

	SrcPanel->SetCurDir(strShortcutFolder,true);

	if (CheckFullScreen!=SrcPanel->IsFullScreen())
		Parent()->GetAnotherPanel(SrcPanel)->Show();

	SrcPanel->Refresh();
	return true;
}