Пример #1
0
void AnalysisFeature::activate() {
    //qDebug() << "AnalysisFeature::activate()";
    emit(switchToView(m_sAnalysisViewName));
    if (m_pAnalysisView) {
        emit(restoreSearch(m_pAnalysisView->currentSearch()));
    }
}
Пример #2
0
gsGame::gsGame() {
	g_tm->loadGroup("views");
	g_tm->loadGroup("sprites");
	g_tm->loadGroup("game");

	vars["day"] = 1;
	//vars["day"] = 3;
	vars["nukes"] = 0;
	vars["skips"] = 0;
	vars["current_item"] = "none";
	vars["has_button"] = 0;

	nextView = "bedroom";
	switchToView();

	modules["screen"] = std::unique_ptr<Module>(new Screen());

	line1 = g_fm->getText("blogger.ttf", 30);
	line1.setPosition(0, 650);

	line2 = g_fm->getText("blogger.ttf", 30);
	line2.setPosition(0, 700);

	exl = g_tm->getTexture("sprites", "exclamation.png");
}
Пример #3
0
void Library::slotShowTrackModel(QAbstractItemModel* model) {
    //qDebug() << "Library::slotShowTrackModel" << model;
    TrackModel* trackModel = dynamic_cast<TrackModel*>(model);
    Q_ASSERT(trackModel);
    emit(showTrackModel(model));
    emit(switchToView(m_sTrackViewName));
    emit(restoreSearch(trackModel->currentSearch()));
}
Пример #4
0
void AutoDJFeature::activate() {
    //qDebug() << "AutoDJFeature::activate()";
    emit(switchToView(m_sAutoDJViewName));
    emit(restoreSearch(QString())); //Null String disables search box
}
Пример #5
0
void MixxxLibraryFeature::activateChild(const QModelIndex& index) {
    QString itemName = index.data().toString();
    emit(switchToView(itemName));
}
Пример #6
0
void CrateFeature::activate() {
    emit(switchToView("CRATEHOME"));
    emit(restoreSearch(QString())); //disable search on crate home
    emit(enableCoverArtDisplay(true));
}
Пример #7
0
void BasePlaylistFeature::activate() {
    emit(switchToView(m_rootViewName));
    emit(restoreSearch(QString())); // Null String disables search box
}
Пример #8
0
void RecordingFeature::activate() {
    emit(refreshBrowseModel());
    emit(switchToView(m_sRecordingViewName));
    // Ask the view to emit a restoreSearch signal.
    emit(requestRestoreSearch());
}
Пример #9
0
void Library::slotSwitchToView(const QString& view) {
    //qDebug() << "Library::slotSwitchToView" << view;
    emit(switchToView(view));
}
Пример #10
0
void gsGame::logic(float delta) {
	delta = 0;

	if (hasMoved) {
		showExl = false;
		exl.setPosition(mmx, mmy);

		for (auto directionPair : directions) {
			if (directionPair.second != "") {
				SDL_Rect bounds = directionRects[directionPair.first];
				if (nnb::pointInRect({mmx, mmy}, bounds)) {
					showExl = true;
				}
			}
		}

		for (auto& pair : items) {
			if (pair.second.contains(mmx, mmy)) {
				showExl = true;
			}
		}

		for (auto& pair : inventory) {
			if (pair.second.contains(mmx, mmy)) {
				showExl = true;
			}
		}

		for (auto& clickArea : clickAreas) {
			if (clickArea.contains(mmx, mmy)) {
				if (clickArea.condition.empty()) {
					showExl = true;
				} else if (checkCondition(clickArea.condition)) {
					showExl = true;
				} else {
					if (clickArea.elseActions.size() > 0) {	
						showExl = true;
					}
				}
			}
		}
	}

	if (hasClicked) {
		for (auto directionPair : directions) {
			if (directionPair.second != "" && directionPair.second != "turnmeon") {
				SDL_Rect bounds = directionRects[directionPair.first];
				if (nnb::pointInRect({mx, my}, bounds)) {
					nextView = directionPair.second;

					vars["current_item"] = "none";
					for (auto& pair : inventory) {
						pair.second.isSelected = false;
					}

					break;
				}
			}
		}

		std::string toRemove = "";
		for (auto& pair : items) {
			if (pair.second.contains(mx, my)) {
				inventory[pair.first] = pair.second;
				inventory[pair.first].sprite.setPosition(nextItemX, 560);
				inventory[pair.first].setBounds(nextItemX, 560, inventory[pair.first].sprite.getRenderWidth(), inventory[pair.first].sprite.getRenderHeight());
				toRemove = pair.first;
				nextItemX += 100;
				break;
			}
		}
		if (toRemove != "") {
			items.erase(toRemove);
		}

		for (auto& pair : inventory) {
			if (pair.second.contains(mx, my)) {
				pair.second.isSelected = true;
				vars["current_item"] = pair.first;
				for (auto& otherPair : inventory) {
					if (otherPair.first != pair.first) {
						otherPair.second.isSelected = false;
					}
				}
			}
		}

		NNB_DEBUG << vars["current_item"].get<std::string>();

		if (nextView == "") {
			bool usedCurrentItem = false;

			for (auto& clickArea : clickAreas) {
				if (clickArea.contains(mx, my)) {
					if (clickArea.condition.empty()) {
						for (auto action : clickArea.actions) {
							doAction(action);
						}
					} else {
						if (checkCondition(clickArea.condition)) {
							for (auto action : clickArea.actions) {
								doAction(action);
							}
						} else {
							for (auto action : clickArea.elseActions) {
								doAction(action);
							}
						}
					}
				
					// break; // TODO: Think some more about this
					
					usedCurrentItem = true;
				}
			}

			if (usedCurrentItem) {
				vars["current_item"] = "none";
				for (auto& pair : inventory) {
					pair.second.isSelected = false;
				}
			}
		}
		
		hasClicked = false;
		mx = 0;
		my = 0;
	}

	for (auto module : activeModules) {
		module->logic();
	}

	if (!nextView.empty()) {
		switchToView();
	}
}