Beispiel #1
0
/*! Отображает в окне выбраный список рекордов
*/
void stats::show_records()
{
	QString statistics; //Процент побед
	QString records; //Рекорды

	if(ui.rb_noob->isChecked())
	{//выбран нуб - тип = 0
		statistics = QString().setNum(proc_wins[0]);
		records = showStat(0);
	}
	else if(ui.rb_lover->isChecked())
	{//выбран любитель - тип = 1
		statistics = QString().setNum(proc_wins[1]);
		records = showStat(1);
	}
	else if(ui.rb_proff->isChecked())
	{//выбран профи - тип = 2
		statistics = QString().setNum(proc_wins[2]);
		records = showStat(2);
	}
	else
	{// выбран особый режим - тип 3
		statistics = QString().setNum(proc_wins[3]);
		records = showStat(3);
	}
	//Отображение инфомрации
	ui.lbl_stats->setText("Процент побед: " + statistics + "%"); 
	ui.lbl_record->setText(records);
}
Beispiel #2
0
// 处理输入槽
void WdgGuess::processInput(const QString &text)
{
	int i;
	Q_UNUSED(text); // 未使用的参数,避免产生编译警告
	QLineEdit *edit = (QLineEdit *)sender(); // 得到信号的发送者
	if (!edit) return;
	// 查找信号的发送者是哪一个编辑框
	for (i = 0; i < nrNum && edit == editNum[times][i]; i++) {}
	if (i == nrNum) return; // 未找到,返回
	// 查找本行内有没有未输入的编辑框
	for (i = 0; i < nrNum && !editNum[times][i]->text().isEmpty(); i++) {}
	if (i == nrNum) { // 没有未输入的编辑框,说明本次尝试已结束
		endThisTime(); // 结束本次尝试
		if (showStat()) { // 显示统计结果,如果成功
			victory(); // 成功
			return;
		}
		times++; // 尝试次数增加
		if (times == nrTimes) { // 如果尝试次数达到限定次数,说明失败
			failed(); // 失败
			return;
		} else {
			beginThisTime(); // 开始本次尝试(尝试次数已增加)
		}
	} else { // 还有未输入的编辑框
		editNum[times][i]->setFocus(); // 将焦点放在未输入的编辑框上
	}
}
Beispiel #3
0
int main(int argc, char **argv) {
    sqlite3 *db;
    int rc;
    const char *zTab;
    const char *zCmd;

    if( argc<2 ) usage(argv[0]);
    rc = sqlite3_open(argv[1], &db);
    if( rc ) {
        fprintf(stderr, "Cannot open %s\n", argv[1]);
        exit(1);
    }
    if( argc==2 ) {
        sqlite3_stmt *pStmt;
        int cnt = 0;
        pStmt = prepare(db, "SELECT b.sql"
                        "  FROM sqlite_master a, sqlite_master b"
                        " WHERE a.name GLOB '*_segdir'"
                        "   AND b.name=substr(a.name,1,length(a.name)-7)"
                        " ORDER BY 1");
        while( sqlite3_step(pStmt)==SQLITE_ROW ) {
            cnt++;
            printf("%s;\n", sqlite3_column_text(pStmt, 0));
        }
        sqlite3_finalize(pStmt);
        if( cnt==0 ) {
            printf("/* No FTS3/4 tables found in database %s */\n", argv[1]);
        }
        return 0;
    }
    if( argc<4 ) usage(argv[0]);
    zTab = argv[2];
    zCmd = argv[3];
    nExtra = argc-4;
    azExtra = argv+4;
    if( strcmp(zCmd,"big-segments")==0 ) {
        listBigSegments(db, zTab);
    } else if( strcmp(zCmd,"doclist")==0 ) {
        if( argc<7 ) usage(argv[0]);
        showDoclist(db, zTab);
    } else if( strcmp(zCmd,"schema")==0 ) {
        showSchema(db, zTab);
    } else if( strcmp(zCmd,"segdir")==0 ) {
        showSegdirMap(db, zTab);
    } else if( strcmp(zCmd,"segment")==0 ) {
        if( argc<5 ) usage(argv[0]);
        showSegment(db, zTab);
    } else if( strcmp(zCmd,"segment-stats")==0 ) {
        showSegmentStats(db, zTab);
    } else if( strcmp(zCmd,"stat")==0 ) {
        showStat(db, zTab);
    } else if( strcmp(zCmd,"vocabulary")==0 ) {
        showVocabulary(db, zTab);
    } else {
        usage(argv[0]);
    }
    return 0;
}
Beispiel #4
0
void MainWindow::createActions()
{
	openAct = new QAction("&Open", this);
	connect(openAct, SIGNAL(triggered()), this, SLOT(openImageFile()));

	exitAct = new QAction("E&xit", this);
    connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));

    aboutAct = new QAction("&About", this);
    connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
    
    statAct = new QAction("&Stat", this);
    connect(statAct, SIGNAL(triggered()), this, SLOT(showStat()));
}
Beispiel #5
0
void MainWindow::createActions()
{
	openAct = new QAction("&Open", this);
	connect(openAct, SIGNAL(triggered()), this, SLOT(openAndReadFile()));

	exitAct = new QAction("E&xit", this);
    connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));

    aboutAct = new QAction("&About", this);
    connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));

    statAct = new QAction("&Stat", this);
    connect(statAct, SIGNAL(triggered()), this, SLOT(showStat()));

    resetAct = new QAction("&Reset position", this);
    resetAct->setStatusTip("Reset the position");
    connect(resetAct, SIGNAL(triggered()), this, SLOT(reset()));

    reseteffectAct = new QAction("&Reset", this);
    reseteffectAct->setStatusTip("Reset all material");
    connect(reseteffectAct, SIGNAL(triggered()), this, SLOT(reseteffect()));

    //ANIMATION-----------------------------------------------------
    animationShownAct = new QAction("&Shown", this);
    animationShownAct->setStatusTip("Show animation");
    animationShownAct->setCheckable(true);
    connect(animationShownAct, SIGNAL(triggered()), this, SLOT(showAnimation()));

    animationHiddenAct = new QAction("&Hidden", this);
    animationHiddenAct->setStatusTip("Hide animation");
    animationHiddenAct->setCheckable(true);
    connect(animationHiddenAct, SIGNAL(triggered()), this, SLOT(hideAnimation()));

    animationGroup = new QActionGroup(this);
    animationGroup->addAction(animationShownAct);
    animationGroup->addAction(animationHiddenAct);
    animationHiddenAct->setChecked(true);

    //COLOR-----------------------------------------------------
    color0Act = new QAction("&No light",this);
    color0Act->setStatusTip("No light");
    color0Act->setCheckable(true);
    connect(color0Act, SIGNAL(triggered()), this, SLOT(color0()));

    color1Act = new QAction("&Red",this);
    color1Act->setStatusTip("Red");
    color1Act->setCheckable(true);
    connect(color1Act, SIGNAL(triggered()), this, SLOT(color1()));

    color2Act = new QAction("&Green",this);
    color2Act->setStatusTip("Green");
    color2Act->setCheckable(true);
    connect(color2Act, SIGNAL(triggered()), this, SLOT(color2()));

    color3Act = new QAction("&Blue",this);
    color3Act->setStatusTip("Blue");
    color3Act->setCheckable(true);
    connect(color3Act, SIGNAL(triggered()), this, SLOT(color3()));

    color10Act = new QAction("&White",this);
    color10Act->setStatusTip("White");
    color10Act->setCheckable(true);
    connect(color10Act, SIGNAL(triggered()), this, SLOT(color10()));

    colorGroup = new QActionGroup(this);
    colorGroup->addAction(color0Act);
    colorGroup->addAction(color1Act);
    colorGroup->addAction(color2Act);
    colorGroup->addAction(color3Act);
    colorGroup->addAction(color10Act);
    color10Act->setChecked(true);

    //EFFECT-----------------------------------------------------
    effect0Act = new QAction("&No effect",this);
    effect0Act->setStatusTip("No effect");
    effect0Act->setCheckable(true);
    connect(effect0Act, SIGNAL(triggered()), this, SLOT(effect0()));

    effect1Act = new QAction("&Ambient",this);
    effect1Act->setStatusTip("Ambient");
    effect1Act->setCheckable(true);
    connect(effect1Act, SIGNAL(triggered()), this, SLOT(effect1()));

    effect2Act = new QAction("&Diffuse",this);
    effect2Act->setStatusTip("Diffuse");
    effect2Act->setCheckable(true);
    connect(effect2Act, SIGNAL(triggered()), this, SLOT(effect2()));

    effect10Act = new QAction("&All",this);
    effect10Act->setStatusTip("All effect");
    effect10Act->setCheckable(true);
    connect(effect10Act, SIGNAL(triggered()), this, SLOT(effect10()));

    effectGroup = new QActionGroup(this);
    effectGroup->addAction(effect0Act);
    effectGroup->addAction(effect1Act);
    effectGroup->addAction(effect2Act);
    effectGroup->addAction(effect10Act);
    effect10Act->setChecked(true);

    //AMBIENT-----------------------------------------------------
    ambient0Act = new QAction("&No Ambient",this);
    ambient0Act->setStatusTip("No Ambient");
    ambient0Act->setCheckable(true);
    connect(ambient0Act, SIGNAL(triggered()), this, SLOT(ambient0()));

    ambient1Act = new QAction("&Ambient",this);
    ambient1Act->setStatusTip("Ambient");
    ambient1Act->setCheckable(true);
    connect(ambient1Act, SIGNAL(triggered()), this, SLOT(ambient1()));

    ambient2Act = new QAction("&Ambient Color",this);
    ambient2Act->setStatusTip("Ambient Color");
    ambient2Act->setCheckable(true);
    connect(ambient2Act, SIGNAL(triggered()), this, SLOT(ambient2()));

    ambientGroup = new QActionGroup(this);
    ambientGroup->addAction(ambient0Act);
    ambientGroup->addAction(ambient1Act);
    ambientGroup->addAction(ambient2Act);
    ambient0Act->setChecked(true);

    //DIFFUSE-----------------------------------------------------
    diffuse0Act = new QAction("&No Diffuse",this);
    diffuse0Act->setStatusTip("No Diffuse");
    diffuse0Act->setCheckable(true);
    connect(diffuse0Act, SIGNAL(triggered()), this, SLOT(diffuse0()));

    diffuse1Act = new QAction("&Diffuse",this);
    diffuse1Act->setStatusTip("Diffuse");
    diffuse1Act->setCheckable(true);
    connect(diffuse1Act, SIGNAL(triggered()), this, SLOT(diffuse1()));

    diffuseGroup = new QActionGroup(this);
    diffuseGroup->addAction(diffuse0Act);
    diffuseGroup->addAction(diffuse1Act);
    diffuse0Act->setChecked(true);

    //SPECULAR-----------------------------------------------------
    specular0Act = new QAction("&No Specular",this);
    specular0Act->setStatusTip("No Specular");
    specular0Act->setCheckable(true);
    connect(specular0Act, SIGNAL(triggered()), this, SLOT(specular0()));

    specular1Act = new QAction("&Specular",this);
    specular1Act->setStatusTip("Specular");
    specular1Act->setCheckable(true);
    connect(specular1Act, SIGNAL(triggered()), this, SLOT(specular1()));

    specularGroup = new QActionGroup(this);
    specularGroup->addAction(specular0Act);
    specularGroup->addAction(specular1Act);
    specular0Act->setChecked(true);

    //SPECULAR-----------------------------------------------------
    shininess0Act = new QAction("&No Shininess",this);
    shininess0Act->setStatusTip("No Shininess");
    shininess0Act->setCheckable(true);
    connect(shininess0Act, SIGNAL(triggered()), this, SLOT(shininess0()));

    shininess1Act = new QAction("&Low Shininess",this);
    shininess1Act->setStatusTip("Low Shininess");
    shininess1Act->setCheckable(true);
    connect(shininess1Act, SIGNAL(triggered()), this, SLOT(shininess1()));

    shininess2Act = new QAction("&High Shininess",this);
    shininess2Act->setStatusTip("High Shininess");
    shininess2Act->setCheckable(true);
    connect(shininess2Act, SIGNAL(triggered()), this, SLOT(shininess2()));

    shininessGroup = new QActionGroup(this);
    shininessGroup->addAction(shininess0Act);
    shininessGroup->addAction(shininess1Act);
    shininessGroup->addAction(shininess2Act);
    shininess0Act->setChecked(true);

    //EMISSION-----------------------------------------------------
    emission0Act = new QAction("&No Emission",this);
    emission0Act->setStatusTip("No Emission");
    emission0Act->setCheckable(true);
    connect(emission0Act, SIGNAL(triggered()), this, SLOT(emission0()));

    emission1Act = new QAction("&Emission",this);
    emission1Act->setStatusTip("eEmission");
    emission1Act->setCheckable(true);
    connect(emission1Act, SIGNAL(triggered()), this, SLOT(emission1()));

    emissionGroup = new QActionGroup(this);
    emissionGroup->addAction(emission0Act);
    emissionGroup->addAction(emission1Act);
    emission0Act->setChecked(true);

    //SHADING-------------------------------------------------
    shading0Act = new QAction("&No shading", this);
    shading0Act->setStatusTip("No shading");
    shading0Act->setCheckable(true);
    connect(shading0Act, SIGNAL(triggered()), this, SLOT(shading0()));

    shading1Act = new QAction("&Flat shading", this);
    shading1Act->setStatusTip("Flat shading");
    shading1Act->setCheckable(true);
    connect(shading1Act, SIGNAL(triggered()), this, SLOT(shading1()));

    shading2Act = new QAction("&Smooth shading", this);
    shading2Act->setStatusTip("Smooth shading");
    shading2Act->setCheckable(true);
    connect(shading2Act, SIGNAL(triggered()), this, SLOT(shading2()));

    shadingGroup = new QActionGroup(this);
    shadingGroup->addAction(shading0Act);
    shadingGroup->addAction(shading1Act);
    shadingGroup->addAction(shading2Act);
    shading0Act->setChecked(true);

    //NORMAL----------------------------------------------------
    normal0Act = new QAction("&No normal",this);
    normal0Act->setStatusTip("No normal");
    normal0Act->setCheckable(true);
    connect(normal0Act, SIGNAL(triggered()), this, SLOT(normal0()));

    normal1Act = new QAction("&normal",this);
    normal1Act->setStatusTip("Has normal");
    normal1Act->setCheckable(true);
    connect(normal1Act, SIGNAL(triggered()), this, SLOT(normal1()));

    normalGroup = new QActionGroup(this);
    normalGroup->addAction(normal0Act);
    normalGroup->addAction(normal1Act);
    normal0Act->setChecked(true);
}
   ~Engine()
    {
     clean();

     showStat();
    }
Beispiel #7
0
void checkFight(Room room, Personaggio *eroe){
	switch (room.enemy) {
		case 1:
			printf("\nIn questa stanza e' presente la Cusimano ");
			if (flagCusy == 1){
				printf("che non ha buone intenzioni.\n\n");
				Personaggio Cusimano;
				Cusimano.nome = "La Cusimano";
				generaStat(&Cusimano);
				Cusimano.vita = 100;
				startFIght(&Cusimano, *eroe);
				flagCusy = 0;
			}
			else{
				printf("che e' in fin di vita,\n e ti lascia proseguire\n\n");
			}
			break;
		case 2:   
			if (flagFazio == 1){
				printf("\nIn questa stanza e' presente il Prof. Fazio che ti Regala 50HP!\n");
				flagFazio = 0;
			    eroe->vita += 50;
			    showStat(*eroe);
				getchar();
				}
			break;
		case 3:
			if (flagVincent == 1){
				char ans;
				int luck;
				printf("\nIn questa stanza e' presente la Stagliano' che ti chiede di seguirla nel suo ufficio\n"
					"...per parlare...\n"
					"Vuoi seguirla? (S/N)");
				scanf("%c", &ans);
				if (ans == 'S' || ans == 's'){
					luck = rand() % 2;
					switch (luck) {
					case 0:
						system(clear);
						getchar();
						printf("...");
						getchar();
						printf("\nSi sentono dei gemiti...");
						getchar();
						printf("\nVai via soddisfatto e con 50 HP in piu'!");
						eroe->vita += 50;
						getchar();
						break;
					case 1:
						system(clear);
						printf("La Stagliano' chiude la porta a chiave...");
						getchar();
						printf("\n...");
						getchar();
						printf("\nOh no! La Stagliano' in realta' e' Vincent! E adesso siete soli, chiusi nel suo ufficio!");
						getchar();
						printf("\nVai via con 25 HP in meno ed uno strano dolore al fondoschiena!");
						eroe->vita -= 25;
						getchar();
						break;
					default:
						break;
					}
				}
			}
			fflush(stdin);
			system(clear);
			flagVincent = 0;
			break; //case 3
		default:
			break;
			        
	}		// Switch principale
}	//Chiusura funzione