Commit 86db5e0bfa0b0663dd0cea29551afb2d260a8a41
1 parent
b63a0a48
Exists in
master
gui incremental work
Showing
6 changed files
with
86 additions
and
63 deletions
Show diff stats
units/game_actors.pas
| ... | ... | @@ -594,7 +594,7 @@ begin |
| 594 | 594 | FMessage := TPopupNotifier.Create(Self); |
| 595 | 595 | FTimer := TTimer.Create(Self); |
| 596 | 596 | FTimer.Enabled:=False; |
| 597 | - FTimer.Interval:=10000; | |
| 597 | + FTimer.Interval:=5000; | |
| 598 | 598 | FTimer.OnTimer:=@SelfDestroy; |
| 599 | 599 | FConsequenceByPlayerID := TStringList.Create; |
| 600 | 600 | end; | ... | ... |
units/game_control.pas
| ... | ... | @@ -988,7 +988,7 @@ procedure TGameControl.ReceiveMessage(AMessage: TStringList); |
| 988 | 988 | begin |
| 989 | 989 | MID := ExtractDelimited(1,AMessage[i],['+']); |
| 990 | 990 | ShowConsequenceMessage(MID, ExtractDelimited(2,AMessage[i],['+']),MID = 'M'); |
| 991 | - | |
| 991 | + // TODO: QMESSAGE present only one message with all information... | |
| 992 | 992 | {$IFDEF DEBUG} |
| 993 | 993 | WriteLn('A Prompt consequence should have shown.'); |
| 994 | 994 | {$ENDIF} |
| ... | ... | @@ -1310,7 +1310,7 @@ procedure TGameControl.ReceiveReply(AReply: TStringList); |
| 1310 | 1310 | // The Announcer sends a message, waits interval time until all messages have been sent and then destroys itself. |
| 1311 | 1311 | LAnnouncer := TIntervalarAnnouncer.Create(nil); |
| 1312 | 1312 | LAnnouncer.OnStart := @FZMQActor.SendMessage; |
| 1313 | - LAnnouncer.Interval := 500; | |
| 1313 | + LAnnouncer.Interval := 5000; | |
| 1314 | 1314 | LCount := WordCount(AReply[6],['+']); |
| 1315 | 1315 | |
| 1316 | 1316 | // individual consequences | ... | ... |
units/game_file_methods.pas
| ... | ... | @@ -18,14 +18,7 @@ uses |
| 18 | 18 | , game_experiment |
| 19 | 19 | ; |
| 20 | 20 | |
| 21 | -type | |
| 22 | 21 | |
| 23 | - { TCIniFile } | |
| 24 | - | |
| 25 | - TCIniFile = class (TIniFile) | |
| 26 | - public | |
| 27 | - procedure ReadSectionValues(const Section: string; Strings: TStrings); override; | |
| 28 | - end; | |
| 29 | 22 | function LoadExperimentFromResource(var AExperiment: TExperiment):Boolean; |
| 30 | 23 | function LoadExperimentFromFile(var AExperiment: TExperiment; AFilename : string):Boolean; |
| 31 | 24 | procedure SaveExperimentToFile(AExperiment: TExperiment; AFilename : string); |
| ... | ... | @@ -38,7 +31,7 @@ resourcestring |
| 38 | 31 | |
| 39 | 32 | implementation |
| 40 | 33 | |
| 41 | -uses LCLIntf, game_resources, game_actors, game_actors_helpers, string_methods, regdata, zhelpers; | |
| 34 | +uses LCLIntf, game_resources, game_actors, game_actors_helpers, string_methods, regdata; | |
| 42 | 35 | |
| 43 | 36 | function LoadExperimentFromResource(var AExperiment: TExperiment): Boolean; |
| 44 | 37 | var |
| ... | ... | @@ -92,7 +85,7 @@ begin |
| 92 | 85 | Turn.Value:=2; |
| 93 | 86 | Turn.Random:=False; |
| 94 | 87 | Cycles.Count:=0; |
| 95 | - Cycles.Value:=20; | |
| 88 | + Cycles.Value:=2; | |
| 96 | 89 | Cycles.Generation:=0; |
| 97 | 90 | EndCriterium.AbsoluteCycles := 15; |
| 98 | 91 | EndCriterium.InterlockingPorcentage := 80; |
| ... | ... | @@ -127,7 +120,7 @@ end; |
| 127 | 120 | |
| 128 | 121 | function LoadExperimentFromFile(var AExperiment: TExperiment; AFilename: string):Boolean; |
| 129 | 122 | var |
| 130 | - LIniFile : TCIniFile; | |
| 123 | + LIniFile : TIniFile; | |
| 131 | 124 | |
| 132 | 125 | //procedure HandleRootPath(var APath : string); |
| 133 | 126 | //begin |
| ... | ... | @@ -166,7 +159,7 @@ var |
| 166 | 159 | begin |
| 167 | 160 | Turn := ReadInteger(LS,KEY_PLAYER_TURN,i); |
| 168 | 161 | Choice := GetChoiceFromString(ReadString(LS,KEY_PLAYER_CHOICE_LAST,'0,NONE,')); |
| 169 | - ID := ReadString(LS,KEY_PLAYER_ID,s_random(20)); | |
| 162 | + ID := ReadString(LS,KEY_PLAYER_ID,'ID'); | |
| 170 | 163 | Nicname := ReadString(LS,KEY_PLAYER_NICNAME,GenResourceName(i)); |
| 171 | 164 | Login := ReadString(LS,KEY_PLAYER_LOGIN,'jogador'+IntToStr(i+1)); |
| 172 | 165 | Password := ReadString(LS,KEY_PLAYER_PASSWORD,'1234'); |
| ... | ... | @@ -267,7 +260,7 @@ begin |
| 267 | 260 | Result := False; |
| 268 | 261 | if FileExists(AFileName) then |
| 269 | 262 | begin |
| 270 | - LIniFile:= TCIniFile.Create(AFileName); | |
| 263 | + LIniFile:= TIniFile.Create(AFileName); | |
| 271 | 264 | with LIniFile do |
| 272 | 265 | if SectionExists(SEC_EXPERIMENT) then |
| 273 | 266 | begin |
| ... | ... | @@ -291,13 +284,13 @@ procedure SaveExperimentToFile(AExperiment: TExperiment; AFilename: string); |
| 291 | 284 | var |
| 292 | 285 | i,j : Integer; |
| 293 | 286 | LWriter : TRegData; |
| 294 | - LIniFile : TCIniFile; | |
| 287 | + LIniFile : TIniFile; | |
| 295 | 288 | LC, |
| 296 | 289 | LCK : string; |
| 297 | 290 | |
| 298 | 291 | begin |
| 299 | 292 | LWriter := TRegData.Create(nil,AFilename); |
| 300 | - LIniFile:= TCIniFile.Create(LWriter.FileName); | |
| 293 | + LIniFile:= TIniFile.Create(LWriter.FileName); | |
| 301 | 294 | LWriter.Free; |
| 302 | 295 | |
| 303 | 296 | LIniFile.WriteString(SEC_EXPERIMENT,KEY_RESEARCHER,AExperiment.Researcher); |
| ... | ... | @@ -354,30 +347,5 @@ begin |
| 354 | 347 | end; |
| 355 | 348 | end; |
| 356 | 349 | |
| 357 | - | |
| 358 | -procedure TCIniFile.ReadSectionValues(const Section: string; Strings: TStrings); | |
| 359 | -var | |
| 360 | - KeyList: TStringList; | |
| 361 | - I: Integer; | |
| 362 | -begin | |
| 363 | - KeyList := TStringList.Create; | |
| 364 | - //KeyList.Sorted := False; | |
| 365 | - KeyList.CaseSensitive := False; | |
| 366 | - KeyList.Duplicates := dupIgnore; | |
| 367 | - try | |
| 368 | - ReadSection(Section, KeyList); | |
| 369 | - //showmessage(Keylist.Text); | |
| 370 | - //Strings.BeginUpdate; | |
| 371 | - //try | |
| 372 | - for I := 0 to KeyList.Count - 1 do | |
| 373 | - Strings.Add(KeyList[I] + '=' + ReadString(Section, KeyList[I], '')) | |
| 374 | - //finally | |
| 375 | - // Strings.EndUpdate; | |
| 376 | - //end; | |
| 377 | - finally | |
| 378 | - KeyList.Free; | |
| 379 | - end; | |
| 380 | -end; | |
| 381 | - | |
| 382 | 350 | end. |
| 383 | 351 | ... | ... |
units/game_resources.pas
| ... | ... | @@ -24,10 +24,14 @@ resourcestring |
| 24 | 24 | SEC_EXPERIMENT = 'Experimento'; |
| 25 | 25 | KEY_NAME = 'Nome'; |
| 26 | 26 | KEY_AIM = 'Objetivo'; |
| 27 | - KEY_RESEARCHER = 'Pesquisador.Responsável'; | |
| 28 | - KEY_GEN_PLAYER_AS_NEEDED = 'GerarJogadoresAutomaticamente'; | |
| 27 | + KEY_RESEARCHER = 'Pesquisador.Nome'; | |
| 28 | + KEY_RESEARCHER_CANCHAT = 'Pesquisador.BatePapo'; | |
| 29 | + KEY_RESEARCHER_CANPLAY = 'Pesquisador.PodeJogar'; | |
| 30 | + KEY_GEN_PLAYER_AS_NEEDED = 'Jogadores.GerarAutomaticamente'; | |
| 31 | + KEY_CHAT_HISTORY_FOR_NEW_PLAYERS = 'Jogadores.Novos.Enviar_Histórico_do_BatePapo'; | |
| 29 | 32 | KEY_CURRENT_CONDITION = 'ComeçarNaCondição'; |
| 30 | 33 | KEY_MATRIX_TYPE= 'TipoDaMatrix'; |
| 34 | + KEY_POINTS_TYPE= 'TipoDePontuação'; | |
| 31 | 35 | |
| 32 | 36 | SEC_PLAYER = 'Jogador.'; |
| 33 | 37 | KEY_PLAYER_TEMP = 'Data.X'; |
| ... | ... | @@ -57,13 +61,16 @@ resourcestring |
| 57 | 61 | //KEY_PROMPT_VALUE = 'Questão.Apresentar'; // BOOL,CSQPROMPTCODE |
| 58 | 62 | KEY_PROMPT_STYLE = 'Questão.Estilo'; // string |
| 59 | 63 | KEY_PROMPT_MESSAGE = 'Questão.Mensagem'; // string |
| 60 | - KEY_ENDCRITERIA = 'Critério.DeFinalizaçãoDaCondição'; //2,50,10,30, | |
| 64 | + KEY_ENDCRITERIA = 'Critério_de_Finalização.Estilo'; //2,50,10,30, | |
| 65 | + KEY_ENDCRITERIA_CYCLES = 'Critério_de_Finalização.Ciclos'; // 20 | |
| 66 | + KEY_ENDCRITERIA_PORCENTAGE = 'Critério_de_Finalização.Porcentagem'; // 80|10 | |
| 67 | + | |
| 61 | 68 | |
| 62 | 69 | KEY_CONTINGENCY = 'Contingência.'; |
| 63 | 70 | KEY_METACONTINGENCY = 'Metacontingência.'; |
| 64 | 71 | |
| 65 | 72 | // ROW,COLOR,OPCODE |
| 66 | - KEY_CRITERIA = '.EsquemaDeReforço'; | |
| 73 | + KEY_CRITERIA = '.Resposta'; | |
| 67 | 74 | KEY_CONSEQUE = '.Consequência'; // A,B,G,CSQCODE |
| 68 | 75 | KEY_CONSEQUE_MESSAGE_PREPEND = '.Consequência.Mensagem.Prefixo'; |
| 69 | 76 | KEY_CONSEQUE_MESSAGE_APPENDS = '.Consequência.Mensagem.Sufixo.Singular'; | ... | ... |
units/string_methods.pas
| ... | ... | @@ -53,6 +53,9 @@ function GetPointsString(APoints : TPoints) : string; |
| 53 | 53 | function GetChoiceString(AChoice : TPlayerChoice) : string; |
| 54 | 54 | function GetChoiceFromString(S:string) : TPlayerChoice; |
| 55 | 55 | |
| 56 | +function GetEndCriteriaLastCyclesFromString(S:string):integer; | |
| 57 | +function GetEndCriteriaPorcentageFromString(S:string):integer; | |
| 58 | +function GetEndCriteriaStyleString(AEndCriteriaStyle : TGameEndCondition):string; | |
| 56 | 59 | function GetEndCriteriaString(AEndCriterium:TEndConditionCriterium) : string; |
| 57 | 60 | function GetEndCriteriaFromString(S:string) : TEndConditionCriterium; |
| 58 | 61 | |
| ... | ... | @@ -60,6 +63,8 @@ function GetEndCriteriaFromString(S:string) : TEndConditionCriterium; |
| 60 | 63 | function GetPlayerFromString(s: string): TPlayer; |
| 61 | 64 | function GetPlayerAsString(P: TPlayer): string; |
| 62 | 65 | |
| 66 | +// gui helpers | |
| 67 | + | |
| 63 | 68 | implementation |
| 64 | 69 | |
| 65 | 70 | uses strutils; |
| ... | ... | @@ -108,11 +113,12 @@ end; |
| 108 | 113 | function GetPromptStyleFromString(S:string):TPromptStyle; |
| 109 | 114 | var |
| 110 | 115 | i : integer; |
| 116 | + LCount : integer; | |
| 111 | 117 | begin |
| 112 | - // Yes,All,Metacontingency,RecoverLostPoints, | |
| 113 | 118 | Result := []; |
| 114 | - for i := 1 to 4 do | |
| 115 | - Result := Result + [GetGamePromptStyleFromString(ExtractDelimited(i,S,[',']))]; | |
| 119 | + LCount := WordCount(S,[',']); | |
| 120 | + for i := 1 to LCount do | |
| 121 | + Result += [GetGamePromptStyleFromString(ExtractDelimited(i,S,[',']))]; | |
| 116 | 122 | end; |
| 117 | 123 | |
| 118 | 124 | function GetAndDelFirstValue(var S: string;Sep:Char=','): string; |
| ... | ... | @@ -204,8 +210,8 @@ begin |
| 204 | 210 | 'NÃO','NAO','N' : Result := gsNo; |
| 205 | 211 | 'CONTINGÊNCIA','CONTINGENCIA','CONTINGENCY','OPERANTE', 'OPERANT': Result := gsContingency; |
| 206 | 212 | 'METACONTINGÊNCIA','METACONTINGENCIA','METACONTINGENCY','META': Result := gsMetacontingency; |
| 207 | - 'RECUPERA','RECUPERAR','RECUPERAR PONTOS','RECOVER','RESETAR', 'RESET': Result := gsRevertPoints; | |
| 208 | - 'TIRAR DE A AO INVES DE B','TIRAR DE A AO INVÉS DE B', 'B as A' : Result := gsBasA; | |
| 213 | + 'REVERTER','RECUPERA','RECUPERAR','RECUPERAR PONTOS','RECOVER','RESETAR', 'RESET': Result := gsRevertPoints; | |
| 214 | + 'TIRAR DE A AO INVES DE B','TIRAR DE A AO INVÉS DE B', 'B as A','B->A' : Result := gsBasA; | |
| 209 | 215 | end; |
| 210 | 216 | end; |
| 211 | 217 | |
| ... | ... | @@ -216,13 +222,13 @@ begin |
| 216 | 222 | for Style in AStyle do |
| 217 | 223 | case Style of |
| 218 | 224 | //gsNone: Result:= Result+'nenhum'+VV_SEP; |
| 219 | - gsAll: Result:= Result+'todos'+VV_SEP; | |
| 220 | - gsYes: Result:= Result+'s'+VV_SEP; | |
| 221 | - gsNo: Result:= Result+'n'+VV_SEP; | |
| 222 | - gsContingency: Result:= Result+'operante'+VV_SEP; | |
| 223 | - gsMetacontingency: Result:= Result+'meta'+VV_SEP; | |
| 224 | - gsRevertPoints: Result:= Result+'recupera'+VV_SEP; | |
| 225 | - gsBasA: Result:= Result+'b as a'+VV_SEP; | |
| 225 | + gsAll: Result += 'TODOS'+VV_SEP; | |
| 226 | + gsYes: Result += 'SIM'+VV_SEP; | |
| 227 | + gsNo: Result += 'NÃO'+VV_SEP; | |
| 228 | + gsContingency: Result += 'OPERANTE'+VV_SEP; | |
| 229 | + gsMetacontingency: Result += 'META'+VV_SEP; | |
| 230 | + gsRevertPoints: Result += 'REVERTER'+VV_SEP; | |
| 231 | + gsBasA: Result += 'B->A'+VV_SEP; | |
| 226 | 232 | end; |
| 227 | 233 | end; |
| 228 | 234 | |
| ... | ... | @@ -372,15 +378,41 @@ begin |
| 372 | 378 | end; |
| 373 | 379 | end; |
| 374 | 380 | |
| 381 | +function GetEndCriteriaLastCyclesFromString(S: string): integer; | |
| 382 | +begin | |
| 383 | + try | |
| 384 | + Result := StrToInt(ExtractDelimited(2,S,[','])); | |
| 385 | + except | |
| 386 | + On E : Exception do | |
| 387 | + Result := 0; | |
| 388 | + end; | |
| 389 | +end; | |
| 390 | + | |
| 391 | +function GetEndCriteriaPorcentageFromString(S: string): integer; | |
| 392 | +begin | |
| 393 | + try | |
| 394 | + Result := StrToInt(ExtractDelimited(1,S,[','])); | |
| 395 | + except | |
| 396 | + On E : Exception do | |
| 397 | + Result := 0; | |
| 398 | + end; | |
| 399 | +end; | |
| 400 | + | |
| 401 | + | |
| 402 | +function GetEndCriteriaStyleString(AEndCriteriaStyle: TGameEndCondition): string; | |
| 403 | +begin | |
| 404 | + case AEndCriteriaStyle of | |
| 405 | + gecAbsoluteCycles: Result := 'CICLOS'; | |
| 406 | + gecInterlockingPorcentage: Result := 'PORCENTAGEM'; | |
| 407 | + gecWhichComeFirst: Result := 'O QUE OCORRER PRIMEIRO'; | |
| 408 | + end; | |
| 409 | +end; | |
| 410 | + | |
| 375 | 411 | function GetEndCriteriaString(AEndCriterium: TEndConditionCriterium |
| 376 | 412 | ): string; |
| 377 | 413 | begin |
| 378 | 414 | // 2,20,10,10, |
| 379 | - case AEndCriterium.Style of | |
| 380 | - gecAbsoluteCycles: Result := '0'; | |
| 381 | - gecInterlockingPorcentage: Result := '1'; | |
| 382 | - gecWhichComeFirst: Result := '2'; | |
| 383 | - end; | |
| 415 | + Result := GetEndCriteriaStyleString(AEndCriterium.Style); | |
| 384 | 416 | Result := Result + VV_SEP; |
| 385 | 417 | Result := Result + IntToStr(AEndCriterium.AbsoluteCycles) + VV_SEP; |
| 386 | 418 | Result := Result + IntToStr(AEndCriterium.InterlockingPorcentage) + VV_SEP; |
| ... | ... | @@ -489,6 +521,7 @@ begin |
| 489 | 521 | Result += M[i] + '|'; |
| 490 | 522 | end; |
| 491 | 523 | |
| 524 | + | |
| 492 | 525 | function GetPlayerFromString(s: string): TPlayer; |
| 493 | 526 | |
| 494 | 527 | function RowFromString(S: string): TGameRow; | ... | ... |