Commit 74c507e3598dd549c388b04e9f5cde9b25a81f9e
1 parent
992809a6
Exists in
master
improve customization of messages and stringgrid
Showing
1 changed file
with
81 additions
and
30 deletions
Show diff stats
units/game_actors.pas
@@ -23,7 +23,8 @@ type | @@ -23,7 +23,8 @@ type | ||
23 | TGameActor = ( gaNone, gaAdmin, gaPlayer, gaWatcher ); | 23 | TGameActor = ( gaNone, gaAdmin, gaPlayer, gaWatcher ); |
24 | TGamePlayerStatus = (gpsWaiting, gpsPlaying, gpsPlayed); | 24 | TGamePlayerStatus = (gpsWaiting, gpsPlaying, gpsPlayed); |
25 | 25 | ||
26 | - TGameMatrix = (gmRows,gmColumns, gmDots,gmClearDots); | 26 | + TGameMatrix = (gmColors, gmRows, gmColumns, gmDots, gmClearDots,gmDotsClearDots); |
27 | + | ||
27 | TGameMatrixType = set of TGameMatrix; | 28 | TGameMatrixType = set of TGameMatrix; |
28 | 29 | ||
29 | TGameRow = (grNone, | 30 | TGameRow = (grNone, |
@@ -88,8 +89,13 @@ type | @@ -88,8 +89,13 @@ type | ||
88 | 89 | ||
89 | TConsequence = class(TComponent) | 90 | TConsequence = class(TComponent) |
90 | private | 91 | private |
91 | - FAppendicePlural: string; | ||
92 | - FAppendiceSingular: string; | 92 | + FPrependEarn, |
93 | + FPrependLoss, | ||
94 | + FAppendiceZero, | ||
95 | + FAppendiceLossPlural, | ||
96 | + FAppendiceLossSingular, | ||
97 | + FAppendiceEarnPlural, | ||
98 | + FAppendiceEarnSingular, | ||
93 | FNicname: string; | 99 | FNicname: string; |
94 | FStyle : TConsequenceStyle; | 100 | FStyle : TConsequenceStyle; |
95 | FP : TGamePoint; | 101 | FP : TGamePoint; |
@@ -101,7 +107,9 @@ type | @@ -101,7 +107,9 @@ type | ||
101 | procedure StopTimer(Sender:TObject;var ACloseAction:TCloseAction); | 107 | procedure StopTimer(Sender:TObject;var ACloseAction:TCloseAction); |
102 | procedure SelfDestroy(Sender:TOBject);virtual; | 108 | procedure SelfDestroy(Sender:TOBject);virtual; |
103 | public | 109 | public |
104 | - constructor Create(AOwner:TComponent; AP:TGamePoint; AStyle:TConsequenceStyle; AAppendiceSingular,AAppendicePlural:string);overload; | 110 | + constructor Create(AOwner:TComponent; AP:TGamePoint; AStyle:TConsequenceStyle; ANicname, |
111 | + APrependLoss,AAppendiceLossSingular,AAppendiceLossPlural, | ||
112 | + APrependEarn,AAppendiceEarnSingular,AAppendiceEarnPlural,AAppendiceZero:string);overload; | ||
105 | constructor Create(AOwner:TComponent; AP:integer; AStyle: TConsequenceStyle; AMessage:array of string);overload; | 113 | constructor Create(AOwner:TComponent; AP:integer; AStyle: TConsequenceStyle; AMessage:array of string);overload; |
106 | constructor Create(AOwner:TComponent; AConsequenceString: string);virtual;overload; | 114 | constructor Create(AOwner:TComponent; AConsequenceString: string);virtual;overload; |
107 | destructor Destroy;override; | 115 | destructor Destroy;override; |
@@ -113,8 +121,13 @@ type | @@ -113,8 +121,13 @@ type | ||
113 | procedure PresentPoints(APlayerBox: TPlayerBox; G: TLabel); overload; | 121 | procedure PresentPoints(APlayerBox: TPlayerBox; G: TLabel); overload; |
114 | property ShouldPublishMessage : Boolean read GetShouldPublishMessage; | 122 | property ShouldPublishMessage : Boolean read GetShouldPublishMessage; |
115 | property PlayerNicname : string read FNicname write FNicname; | 123 | property PlayerNicname : string read FNicname write FNicname; |
116 | - property AppendiceSingular : string read FAppendiceSingular; | ||
117 | - property AppendicePlural : string read FAppendicePlural; | 124 | + property AppendiceLossSingular : string read FAppendiceLossSingular; |
125 | + property AppendiceLossPlural : string read FAppendiceLossPlural; | ||
126 | + property AppendiceEarnSingular : string read FAppendiceEarnSingular; | ||
127 | + property AppendiceEarnPlural : string read FAppendiceEarnPlural; | ||
128 | + property AppendiceZero : string read FAppendiceZero; | ||
129 | + property PrependLoss : string read FPrependLoss; | ||
130 | + property PrependEarn : string read FPrependEarn; | ||
118 | property Style : TConsequenceStyle read FStyle; | 131 | property Style : TConsequenceStyle read FStyle; |
119 | property ConsequenseByPlayerID : TStringList read FConsequenceByPlayerID; | 132 | property ConsequenseByPlayerID : TStringList read FConsequenceByPlayerID; |
120 | end; | 133 | end; |
@@ -463,8 +476,10 @@ end; | @@ -463,8 +476,10 @@ end; | ||
463 | function TPrompt.AsString: TStringList; | 476 | function TPrompt.AsString: TStringList; |
464 | var | 477 | var |
465 | j,i : integer; | 478 | j,i : integer; |
466 | - LAppendiceSingular, | ||
467 | - LAppendicePlural, | 479 | + LPrependLoss,LPrependEarn, |
480 | + LAppendiceLossSingular,LAppendiceLossPlural, | ||
481 | + LAppendiceEarnSingular,LAppendiceEarnPlural, | ||
482 | + LAppendiceZero, | ||
468 | LConsequence, | 483 | LConsequence, |
469 | LID : string; | 484 | LID : string; |
470 | LCsqStyle : TConsequenceStyle; | 485 | LCsqStyle : TConsequenceStyle; |
@@ -500,8 +515,13 @@ var | @@ -500,8 +515,13 @@ var | ||
500 | if not FPromptTargets[i].Meta then | 515 | if not FPromptTargets[i].Meta then |
501 | if gscA in FPromptTargets[i].Consequence.Style then | 516 | if gscA in FPromptTargets[i].Consequence.Style then |
502 | begin | 517 | begin |
503 | - LAppendiceSingular := FPromptTargets[i].Consequence.AppendiceSingular; | ||
504 | - LAppendicePlural := FPromptTargets[i].Consequence.AppendicePlural; | 518 | + LPrependLoss := FPromptTargets[i].Consequence.PrependLoss; |
519 | + LAppendiceLossSingular := FPromptTargets[i].Consequence.AppendiceLossSingular; | ||
520 | + LAppendiceLossPlural := FPromptTargets[i].Consequence.AppendiceLossPlural; | ||
521 | + LPrependEarn := FPromptTargets[i].Consequence.PrependEarn; | ||
522 | + LAppendiceEarnSingular := FPromptTargets[i].Consequence.AppendiceEarnSingular; | ||
523 | + LAppendiceEarnPlural := FPromptTargets[i].Consequence.AppendiceEarnPlural; | ||
524 | + LAppendiceZero := FPromptTargets[i].Consequence.AppendiceZero; | ||
505 | Break; | 525 | Break; |
506 | end; | 526 | end; |
507 | end; | 527 | end; |
@@ -515,8 +535,13 @@ var | @@ -515,8 +535,13 @@ var | ||
515 | IntToStr(Pts) +'|'+ | 535 | IntToStr(Pts) +'|'+ |
516 | GetConsequenceStylesString(LCsqStyle) +'|'+ | 536 | GetConsequenceStylesString(LCsqStyle) +'|'+ |
517 | ExtractDelimited(3,LConsequence, ['|']) +'|'+ | 537 | ExtractDelimited(3,LConsequence, ['|']) +'|'+ |
518 | - LAppendiceSingular +'|'+ | ||
519 | - LAppendicePlural; | 538 | + LPrependLoss +'|'+ |
539 | + LAppendiceLossSingular +'|'+ | ||
540 | + LAppendiceLossPlural +'|'+ | ||
541 | + LPrependEarn +'|'+ | ||
542 | + LAppendiceEarnSingular +'|'+ | ||
543 | + LAppendiceEarnPlural +'|'+ | ||
544 | + LAppendiceZero; | ||
520 | end; | 545 | end; |
521 | begin | 546 | begin |
522 | Result := TStringList.Create; | 547 | Result := TStringList.Create; |
@@ -531,22 +556,25 @@ begin | @@ -531,22 +556,25 @@ begin | ||
531 | LConsequence := FPromptTargets[i].Consequence.ConsequenseByPlayerID.Values[LID]; | 556 | LConsequence := FPromptTargets[i].Consequence.ConsequenseByPlayerID.Values[LID]; |
532 | LCsqStyle := GetConsequenceStylesFromString(ExtractDelimited(2,LConsequence, ['|'])); | 557 | LCsqStyle := GetConsequenceStylesFromString(ExtractDelimited(2,LConsequence, ['|'])); |
533 | 558 | ||
534 | - // BasA must revert appendices | ||
535 | - LAppendiceSingular := ExtractDelimited(4,LConsequence, ['|']); | ||
536 | - LAppendicePlural := ExtractDelimited(5,LConsequence, ['|']); | 559 | + // BasA must revert message variables |
560 | + LPrependLoss := ExtractDelimited(4,LConsequence, ['|']); | ||
561 | + LAppendiceLossSingular := ExtractDelimited(5,LConsequence, ['|']); | ||
562 | + LAppendiceLossPlural := ExtractDelimited(6,LConsequence, ['|']); | ||
563 | + LPrependEarn := ExtractDelimited(7,LConsequence, ['|']); | ||
564 | + LAppendiceEarnSingular := ExtractDelimited(8,LConsequence, ['|']); | ||
565 | + LAppendiceEarnPlural := ExtractDelimited(9,LConsequence, ['|']); | ||
566 | + LAppendiceZero := ExtractDelimited(10,LConsequence, ['|']); | ||
537 | 567 | ||
538 | if gsContingency in FPromptStyle then | 568 | if gsContingency in FPromptStyle then |
539 | if (FPromptTargets[i].Fired) and (not FPromptTargets[i].Meta) then | 569 | if (FPromptTargets[i].Fired) and (not FPromptTargets[i].Meta) then |
540 | if (gscA in LCsqStyle) or (gscB in LCsqStyle) then | 570 | if (gscA in LCsqStyle) or (gscB in LCsqStyle) then |
541 | ApplyPointsConditions(False); | 571 | ApplyPointsConditions(False); |
542 | 572 | ||
543 | - | ||
544 | if gsMetacontingency in FPromptStyle then | 573 | if gsMetacontingency in FPromptStyle then |
545 | if (FPromptTargets[i].Fired) and FPromptTargets[i].Meta then | 574 | if (FPromptTargets[i].Fired) and FPromptTargets[i].Meta then |
546 | if gscG in LCsqStyle then | 575 | if gscG in LCsqStyle then |
547 | ApplyPointsConditions(True); | 576 | ApplyPointsConditions(True); |
548 | 577 | ||
549 | - | ||
550 | Result.Add(LConsequence); | 578 | Result.Add(LConsequence); |
551 | end; | 579 | end; |
552 | 580 | ||
@@ -554,14 +582,21 @@ end; | @@ -554,14 +582,21 @@ end; | ||
554 | 582 | ||
555 | { TConsequence } | 583 | { TConsequence } |
556 | 584 | ||
557 | -constructor TConsequence.Create(AOwner: TComponent; AP: TGamePoint; | ||
558 | - AStyle: TConsequenceStyle; AAppendiceSingular, AAppendicePlural: string); | 585 | +constructor TConsequence.Create(AOwner: TComponent; AP: TGamePoint;AStyle: TConsequenceStyle; ANicname, |
586 | + APrependLoss, AAppendiceLossSingular, AAppendiceLossPlural, | ||
587 | + APrependEarn, AAppendiceEarnSingular, AAppendiceEarnPlural, AAppendiceZero: string); | ||
559 | begin | 588 | begin |
560 | inherited Create(AOwner); | 589 | inherited Create(AOwner); |
561 | FStyle:=AStyle; | 590 | FStyle:=AStyle; |
562 | - FNicname:=''; | ||
563 | - FAppendiceSingular:=AAppendiceSingular; | ||
564 | - FAppendicePlural:=AAppendicePlural; | 591 | + FNicname:=ANicname; |
592 | + FPrependLoss:=APrependLoss; | ||
593 | + FAppendiceLossSingular:=AAppendiceLossSingular; | ||
594 | + FAppendiceLossPlural:=AAppendiceLossPlural; | ||
595 | + FPrependEarn:=APrependEarn; | ||
596 | + FAppendiceEarnSingular:=AAppendiceEarnSingular; | ||
597 | + FAppendiceEarnPlural:=AAppendiceEarnPlural; | ||
598 | + FAppendiceZero:=AAppendiceZero; | ||
599 | + | ||
565 | FP := AP; | 600 | FP := AP; |
566 | FMessage := TPopupNotifier.Create(AOwner); | 601 | FMessage := TPopupNotifier.Create(AOwner); |
567 | FConsequenceByPlayerID := TStringList.Create; | 602 | FConsequenceByPlayerID := TStringList.Create; |
@@ -574,9 +609,13 @@ begin | @@ -574,9 +609,13 @@ begin | ||
574 | FP := TGamePoint.Create(AOwner,AP); | 609 | FP := TGamePoint.Create(AOwner,AP); |
575 | FStyle:=AStyle; | 610 | FStyle:=AStyle; |
576 | FNicname:=AMessage[0]; | 611 | FNicname:=AMessage[0]; |
577 | - FAppendiceSingular:=AMessage[1]; | ||
578 | - FAppendicePlural:=AMessage[2]; | ||
579 | - | 612 | + FPrependLoss:=AMessage[1]; |
613 | + FAppendiceLossSingular:=AMessage[2]; | ||
614 | + FAppendiceLossPlural:=AMessage[3]; | ||
615 | + FPrependEarn:=AMessage[4]; | ||
616 | + FAppendiceEarnSingular:=AMessage[5]; | ||
617 | + FAppendiceEarnPlural:=AMessage[6]; | ||
618 | + FAppendiceZero:=AMessage[7]; | ||
580 | FMessage := TPopupNotifier.Create(AOwner); | 619 | FMessage := TPopupNotifier.Create(AOwner); |
581 | FConsequenceByPlayerID := TStringList.Create; | 620 | FConsequenceByPlayerID := TStringList.Create; |
582 | end; | 621 | end; |
@@ -588,8 +627,13 @@ begin | @@ -588,8 +627,13 @@ begin | ||
588 | FP := TGamePoint.Create(AOwner,ExtractDelimited(1,AConsequenceString,['|'])); | 627 | FP := TGamePoint.Create(AOwner,ExtractDelimited(1,AConsequenceString,['|'])); |
589 | FStyle:=GetConsequenceStylesFromString(ExtractDelimited(2,AConsequenceString,['|'])); | 628 | FStyle:=GetConsequenceStylesFromString(ExtractDelimited(2,AConsequenceString,['|'])); |
590 | FNicname:=ExtractDelimited(3,AConsequenceString,['|']); | 629 | FNicname:=ExtractDelimited(3,AConsequenceString,['|']); |
591 | - FAppendiceSingular:=ExtractDelimited(4,AConsequenceString,['|']); | ||
592 | - FAppendicePlural:=ExtractDelimited(5,AConsequenceString,['|']); | 630 | + FPrependLoss:=ExtractDelimited(4,AConsequenceString,['|']); |
631 | + FAppendiceLossSingular:=ExtractDelimited(5,AConsequenceString,['|']); | ||
632 | + FAppendiceLossPlural:=ExtractDelimited(6,AConsequenceString,['|']); | ||
633 | + FPrependEarn:=ExtractDelimited(7,AConsequenceString,['|']); | ||
634 | + FAppendiceEarnSingular:=ExtractDelimited(8,AConsequenceString,['|']); | ||
635 | + FAppendiceEarnPlural:=ExtractDelimited(9,AConsequenceString,['|']); | ||
636 | + FAppendiceZero:=ExtractDelimited(10,AConsequenceString,['|']); | ||
593 | 637 | ||
594 | FMessage := TPopupNotifier.Create(Self); | 638 | FMessage := TPopupNotifier.Create(Self); |
595 | FTimer := TTimer.Create(Self); | 639 | FTimer := TTimer.Create(Self); |
@@ -610,14 +654,21 @@ begin | @@ -610,14 +654,21 @@ begin | ||
610 | Result := IntToStr(FP.ValueWithVariation) + '|'; | 654 | Result := IntToStr(FP.ValueWithVariation) + '|'; |
611 | Result += GetConsequenceStylesString(FStyle)+'|'; | 655 | Result += GetConsequenceStylesString(FStyle)+'|'; |
612 | Result += FNicname +'|'; | 656 | Result += FNicname +'|'; |
613 | - Result += FAppendiceSingular + '|'; | ||
614 | - Result += FAppendicePlural + '|+'; | 657 | + Result += FPrependLoss + '|'; |
658 | + Result += FAppendiceLossSingular + '|'; | ||
659 | + Result += FAppendiceLossPlural + '|'; | ||
660 | + Result += FPrependEarn + '|'; | ||
661 | + Result += FAppendiceEarnSingular + '|'; | ||
662 | + Result += FAppendiceEarnPlural + '|'; | ||
663 | + Result += FAppendiceZero + '|'; | ||
664 | + | ||
615 | FConsequenceByPlayerID.Values[AID]:=Result; | 665 | FConsequenceByPlayerID.Values[AID]:=Result; |
616 | end; | 666 | end; |
617 | 667 | ||
618 | function TConsequence.GenerateMessage(ForGroup: Boolean): string; | 668 | function TConsequence.GenerateMessage(ForGroup: Boolean): string; |
619 | begin | 669 | begin |
620 | - Result := FP.PointMessage(FNicname,FAppendicePlural, FAppendiceSingular,ForGroup); | 670 | + Result := FP.PointMessage(FNicname,FPrependLoss,FAppendiceLossSingular,FAppendiceLossPlural, |
671 | + FPrependEarn,FAppendiceEarnSingular,FAppendiceEarnPlural,FAppendiceZero, ForGroup); | ||
621 | FMessage.Text := Result; | 672 | FMessage.Text := Result; |
622 | end; | 673 | end; |
623 | 674 |