отремонтировал и анимировал смайлики для вебчатов

This commit is contained in:
PC1\PTyTb
2025-08-14 19:58:19 +03:00
parent 3ac578b6e6
commit bad576dd4d
10 changed files with 217 additions and 567 deletions
+62 -1
View File
@@ -1041,7 +1041,11 @@ var
EmoteObj: TJSONObject;
ImagesObj: TJSONObject;
Emote: TEmotes;
I: Integer;
I, J: Integer;
chosenFormat, chosenTheme, chosenScale: string;
foundAnimated, foundNonStatic, foundDark: Boolean;
scaleVal, maxScale: Double;
s: string;
begin
if JSONString = '' then Exit;
@@ -1069,11 +1073,68 @@ begin
Emote.format := GetStringArray(EmoteObj, 'format');
Emote.scale := GetStringArray(EmoteObj, 'scale');
Emote.theme_mode := GetStringArray(EmoteObj, 'theme_mode');
// Âûáîð ôîðìàòà (format)
foundAnimated := False;
foundNonStatic := False;
chosenFormat := 'static'; // çíà÷åíèå ïî óìîë÷àíèþ
// Ïðîâåðêà íàëè÷èÿ "animated"
for s in Emote.format do
if s = 'animated' then
begin
chosenFormat := 'animated';
foundAnimated := True;
Break;
end;
// Åñëè íå íàéäåí "animated", èùåì ëþáîé íå-"static"
if not foundAnimated then
for s in Emote.format do
if s <> 'static' then
begin
chosenFormat := s;
foundNonStatic := True;
Break;
end;
// Âûáîð òåìû (theme_mode)
foundDark := False;
for s in Emote.theme_mode do
if s = 'dark' then
begin
chosenTheme := 'dark';
foundDark := True;
Break;
end;
if not foundDark then
chosenTheme := 'light';
// Âûáîð ìàñøòàáà (scale)
maxScale := 0;
for s in Emote.scale do
begin
if TryStrToFloat(s, scaleVal, TFormatSettings.Invariant) then
if scaleVal > maxScale then
maxScale := scaleVal;
end;
// Åñëè ìàñøòàáû îòñóòñòâóþò, èñïîëüçóåì 1.0
if maxScale = 0 then maxScale := 1.0;
chosenScale := Format('%.1f', [maxScale], TFormatSettings.Invariant);
// Ôîðìèðîâàíèå ññûëêè
Emote.topImage := 'https://static-cdn.jtvnw.net/emoticons/v2/' +
Emote.id + '/' +
chosenFormat + '/' +
chosenTheme + '/' +
chosenScale;
EmotesList.Add(Emote);
end;
finally
RootObj.Free;
end;
end;
procedure TTTW_API.GetChannelEmotes(var ce: TList<TEmotes>);