コード例 #1
0
ファイル: taskLayer.cpp プロジェクト: joyfish/TowerTD
bool taskLayer::init() {

	if (!Layer::init())
	{
		return false;
	}
	audioFlag = DataXML::getInstence()->getInitialValue("sound");
	allCondition["multi2long"] =0;
	allCondition["useablebloodbutton"] = 0;
	allCondition["plus50"] = 0;
	allCondition["multi2short"] = 0;
	allCondition["blood_drop"] = 0;
	allCondition["beartrap"] = 0;
	allCondition["campfire"] = 0;
	allCondition["plaster"] = 0;
	allCondition["blade_low"] = 0;
	allCondition["e_fence"] = 0;
	count = 0;

	addSprite();
 	showTask();
 	addTool();
	

	NotificationCenter::getInstance()->addObserver(this,callfuncO_selector(taskLayer::testMessage),"task",NULL);
	return true;
}
コード例 #2
0
ファイル: taskLayer.cpp プロジェクト: joyfish/TowerTD
//修改lebal显示
void taskLayer::changeDisplay(std::string name) {

	int i = 0;
	ValueMap taskMap = DataXML::getInstence()->getTask();

		Label *  rects = dynamic_cast<Label *> (this->getChildByName(name)->getChildByName(name));
		for (auto v : taskMap)
		{
			std::string taskName = v.first;
			if (taskName == name)
			{
				
				rects->setString(StringUtils::format("%d/%d",allCondition.at(v.first).asInt(),v.second.asInt()));
				if (allCondition.at(v.first) == v.second)
				{
					
					count++;
					Sprite * fangKuang  = dynamic_cast<Sprite *> (this->getChildByName(name));
					EFFECT_MUSIC("unlocked_row.mp3", audioFlag);
					fangKuang->setTexture(CONDITION_YES_FILENAME);
				}

				if (count == 3)
				{
					count = 0;
					for (auto v : allCondition)
					{
						allCondition.at(v.first) = 0;
					}
					//完成任务,写入XML,更改isfinish,任务完成后计数清零!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
					//解锁道具,写入XML,更改isOpen
					for (int i = 0; i < taskSprites.size(); i++)
					{
						taskSprites.at(i)->removeFromParentAndCleanup(true);
					}

					taskSprites.clear();

					DataXML::getInstence()->finishTask();
					//更换任务,添加任务全部完成的情况,别忘了!!!!!!!!!!!!!!!!!!还有道具!!!!!!!!!!!!!!!
					showTask();
					setLabel();
					//移除并更换新道具
					taskTool->removeFromParentAndCleanup(true);
					//播放音效
					EFFECT_MUSIC("unlocked_rooster.mp3", audioFlag);
					addTool();
				} 
			}
		}
		i++;
}
コード例 #3
0
ファイル: TaskEditor.cpp プロジェクト: seeyousystems/core
TaskEditor::TaskEditor(TaskList *tasks, QWidget *parent) : QWidget(parent) {

	// Init
	this->tasks = tasks;
	timer = new QTimer();

	// Gui stuff...
	this->setWindowTitle("emss Task Editor");
	this->setLayout(new QVBoxLayout());

	lstTasks = new QListWidget();
	this->layout()->addWidget(lstTasks);

	txtTaskInfo = new QTextEdit();
	Util::setTextEditAsLogger(txtTaskInfo);
	this->layout()->addWidget(txtTaskInfo);

	btnStopTask = new QPushButton("Stop Task");
	btnStopTask->setEnabled(false);
	this->layout()->addWidget(btnStopTask);

	btnClose = new QPushButton("Close");
	this->layout()->addWidget(btnClose);

	// Load tasks
	refreshList();

	// Connections
	connect(timer, SIGNAL(timeout()), this, SLOT(refreshList()));
	connect(btnClose, SIGNAL(clicked()), this, SLOT(close()));
	connect(btnStopTask, SIGNAL(clicked()), this, SLOT(stopTask()));
	connect(lstTasks, SIGNAL(clicked(QModelIndex)), this, SLOT(showTask(QModelIndex)));

	// Start timer
	timer->setInterval(500); // 500 ms
	timer->start();
}
コード例 #4
0
bool TestingWidgetFacade::connectToTestingLogic(QObject* testinglogic) {
    if(!QObject::connect(this, SIGNAL(setCurrentTest(ExamsTest)), testinglogic, SLOT(setTest(ExamsTest)), Qt::AutoConnection)) {
        return 0;
    }
    if(!QObject::connect(this, SIGNAL(taskRequest(QString)), testinglogic, SLOT(returnTask(QString)), Qt::AutoConnection)) {
        return 0;
    }
    if(!QObject::connect(this, SIGNAL(helpRequest(QString)), testinglogic, SLOT(returnHelp(QString)), Qt::AutoConnection)) {
        return 0;
    }
    if(!QObject::connect(testinglogic, SIGNAL(tossTestTask(TestTask)), this, SLOT(showTask(TestTask)), Qt::AutoConnection)) {
        return 0;
    }
    if(!QObject::connect(testinglogic, SIGNAL(tossHelpCodes(QList<Key>, QList<Key>)), this, SLOT(showHelp(QList<Key>, QList<Key>)), Qt::AutoConnection)) {
        return 0;
    }
    if(!QObject::connect(testinglogic, SIGNAL(tossStats(User_informations)), this, SLOT(showStats(User_informations)), Qt::AutoConnection)) {
        return 0;
    }
    if(!QObject::connect(this, SIGNAL(firstTaskRequest()), testinglogic, SLOT(returnFirstTask()), Qt::AutoConnection)) {
        return 0;
    }
    return 1;
}
コード例 #5
0
ファイル: taskwindow.cpp プロジェクト: AtlantisCD9/Qt
TaskWindow::TaskWindow(TaskHub *taskhub) : d(new TaskWindowPrivate)
{
    d->m_defaultHandler = 0;

    d->m_model = new Internal::TaskModel(this);
    d->m_filter = new Internal::TaskFilterModel(d->m_model);
    d->m_listview = new Internal::TaskView;

    d->m_listview->setModel(d->m_filter);
    d->m_listview->setFrameStyle(QFrame::NoFrame);
    d->m_listview->setWindowTitle(tr("Issues"));
    d->m_listview->setSelectionMode(QAbstractItemView::SingleSelection);
    Internal::TaskDelegate *tld = new Internal::TaskDelegate(this);
    d->m_listview->setItemDelegate(tld);
    d->m_listview->setWindowIcon(QIcon(QLatin1String(Constants::ICON_WINDOW)));
    d->m_listview->setContextMenuPolicy(Qt::ActionsContextMenu);
    d->m_listview->setAttribute(Qt::WA_MacShowFocusRect, false);

    d->m_taskWindowContext = new Internal::TaskWindowContext(d->m_listview);
    d->m_taskHub = taskhub;

    Core::ICore::addContextObject(d->m_taskWindowContext);

    connect(d->m_listview->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
            tld, SLOT(currentChanged(QModelIndex,QModelIndex)));

    connect(d->m_listview, SIGNAL(activated(QModelIndex)),
            this, SLOT(triggerDefaultHandler(QModelIndex)));

    d->m_contextMenu = new QMenu(d->m_listview);
    connect(d->m_contextMenu, SIGNAL(triggered(QAction*)),
            this, SLOT(contextMenuEntryTriggered(QAction*)));

    d->m_listview->setContextMenuPolicy(Qt::CustomContextMenu);

    connect(d->m_listview, SIGNAL(customContextMenuRequested(QPoint)),
            this, SLOT(showContextMenu(QPoint)));

    d->m_filterWarningsButton = createFilterButton(d->m_model->taskTypeIcon(Task::Warning),
                                                   tr("Show Warnings"),
                                                   this, SLOT(setShowWarnings(bool)));

    d->m_categoriesButton = new QToolButton;
    d->m_categoriesButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_FILTER)));
    d->m_categoriesButton->setToolTip(tr("Filter by categories"));
    d->m_categoriesButton->setProperty("noArrow", true);
    d->m_categoriesButton->setAutoRaise(true);
    d->m_categoriesButton->setPopupMode(QToolButton::InstantPopup);

    d->m_categoriesMenu = new QMenu(d->m_categoriesButton);
    connect(d->m_categoriesMenu, SIGNAL(aboutToShow()), this, SLOT(updateCategoriesMenu()));
    connect(d->m_categoriesMenu, SIGNAL(triggered(QAction*)), this, SLOT(filterCategoryTriggered(QAction*)));

    d->m_categoriesButton->setMenu(d->m_categoriesMenu);

    connect(d->m_taskHub, SIGNAL(categoryAdded(Core::Id,QString,bool)),
            this, SLOT(addCategory(Core::Id,QString,bool)));
    connect(d->m_taskHub, SIGNAL(taskAdded(ProjectExplorer::Task)),
            this, SLOT(addTask(ProjectExplorer::Task)));
    connect(d->m_taskHub, SIGNAL(taskRemoved(ProjectExplorer::Task)),
            this, SLOT(removeTask(ProjectExplorer::Task)));
    connect(d->m_taskHub, SIGNAL(taskLineNumberUpdated(uint,int)),
            this, SLOT(updatedTaskLineNumber(uint,int)));
    connect(d->m_taskHub, SIGNAL(taskFileNameUpdated(uint,QString)),
            this, SLOT(updatedTaskFileName(uint,QString)));
    connect(d->m_taskHub, SIGNAL(tasksCleared(Core::Id)),
            this, SLOT(clearTasks(Core::Id)));
    connect(d->m_taskHub, SIGNAL(categoryVisibilityChanged(Core::Id,bool)),
            this, SLOT(setCategoryVisibility(Core::Id,bool)));
    connect(d->m_taskHub, SIGNAL(popupRequested(bool)),
            this, SLOT(popup(bool)));
    connect(d->m_taskHub, SIGNAL(showTask(uint)),
            this, SLOT(showTask(uint)));
}