procedure FrameResize(Sender: TObject);
private
FSsParser: TSsParser;
- FLog: TLogItem;
+ FGhost: String;
+ FScript: String;
FWholeHeight: integer;
procedure SetSsParser(const Value: TSsParser);
protected
public
{ Public \90é\8c¾ }
property SsParser: TSsParser read FSsParser write SetSsParser;
- procedure View(ALog: TLogItem);
+ procedure View(ALog: TLogItem); overload;
+ procedure View(Script, Ghost: String); overload;
end;
implementation
procedure TfrmTalkShow.View(ALog: TLogItem);
begin
- if FLog <> nil then
- begin
- if (ALog.Ghost = FLog.Ghost) and (ALog.Script = FLog.Script) then
- Exit
- else
- FreeAndNil(FLog);
- end;
+ if (ALog.Ghost = FGhost) and (ALog.Script = FScript) then
+ Exit;
+ FGhost := ALog.Ghost;
+ FScript := ALog.Script;
FSsParser.InputString := ALog.Script;
- FLog := TLogItem.Create(ALog);
FWholeHeight := -1; // \96¢\92è\8b`
PaintBoxPaint(self);
end;
FillRect(Rect(0, 0, PaintBox.Width, PaintBox.Height));
Brush.Style := bsClear;
end;
+ if FSsParser.InputString <> FScript then
+ FSsParser.InputString := FScript;
if FWholeHeight < 0 then // -1\82Í\96¢\92è\8b`
y := 2
//
for i := 0 to FSsParser.Count-1 do
begin
- if (FSsParser[i] = '\h') and UnyuTalking then
+ if (FSsParser[i] = '\h') and UnyuTalking and not InSync then
begin
TalkEnd;
UnyuTalking := false;
- end else if (FSsParser[i] = '\u') and not UnyuTalking then
+ end else if (FSsParser[i] = '\u') and not UnyuTalking and not InSync then
begin
TalkEnd;
UnyuTalking := true;
sur1 := sur
else
sur0 := sur;
+ end else if FSsParser.Match(FSsParser[i], '\n') > 2 then
+ begin
+ Talk := Talk + #13#10;
end else if FSsParser.MarkUpType[i] in [mtStr, mtMeta] then
begin
Talk := Talk + FSsParser[i];
ARect := Rect(X + 10, VertPos, PaintBox.Width-5, VertPos+10000);
H := DrawTextEx(PaintBox.Canvas.Handle, PChar(Talk), -1, ARect,
- DT_WORDBREAK, nil);
+ DT_WORDBREAK or DT_NOPREFIX, nil);
if H > BH then
Result := H
Result := 0;
Bmp := TBitmap.Create;
try
- if Spps.TryGetImage(FLog.Ghost, Surface, Bmp) then
+ if Spps.TryGetImage(FGhost, Surface, Bmp) then
begin
Result := Bmp.Width;
PaintBox.Canvas.Draw(X, Y, Bmp);
FWholeHeight := -1; // \8d\82\82³\82ª\82í\82©\82ç\82È\82\82È\82é
end;
+procedure TfrmTalkShow.View(Script, Ghost: String);
+begin
+ if (Ghost = FGhost) and (Script = FScript) then
+ Exit;
+ FGhost := Ghost;
+ FScript := Script;
+ FSsParser.InputString := FScript;
+ FWholeHeight := -1; // \96¢\92è\8b`
+ PaintBoxPaint(self);
+end;
+
end.