добавил навыки и привязал к ним донаты и баллы канала
This commit is contained in:
@@ -0,0 +1,197 @@
|
||||
object frEvents: TfrEvents
|
||||
Size.Width = 737.000000000000000000
|
||||
Size.Height = 338.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
object Label1: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Text = #1057#1086#1073#1099#1090#1080#1077
|
||||
TabOrder = 0
|
||||
end
|
||||
object cbEventList: TComboBox
|
||||
Items.Strings = (
|
||||
#1044#1086#1085#1072#1090
|
||||
#1055#1086#1082#1091#1087#1082#1072' '#1085#1072#1075#1088#1072#1076#1099
|
||||
#1055#1083#1072#1090#1085#1072#1103' '#1087#1086#1076#1087#1080#1089#1082#1072
|
||||
#1054#1090#1089#1083#1077#1078#1080#1074#1072#1085#1080#1077
|
||||
#1055#1086#1076#1072#1088#1086#1095#1085#1072#1103' '#1087#1086#1076#1087#1080#1089#1082#1072
|
||||
#1056#1077#1081#1076)
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 33.000000000000000000
|
||||
Size.Width = 193.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 1
|
||||
OnChange = cbEventListChange
|
||||
end
|
||||
object edtIF: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 2
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 88.000000000000000000
|
||||
PopupMenu = PopupMenu1
|
||||
Size.Width = 193.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Visible = False
|
||||
end
|
||||
object Label2: TLabel
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 63.000000000000000000
|
||||
Text = #1059#1089#1083#1086#1074#1080#1077
|
||||
Visible = False
|
||||
TabOrder = 3
|
||||
end
|
||||
object Label3: TLabel
|
||||
Position.X = 209.000000000000000000
|
||||
Position.Y = 8.000000000000000000
|
||||
Text = #1044#1077#1081#1089#1090#1074#1080#1077
|
||||
TabOrder = 4
|
||||
end
|
||||
object cbActions: TComboBox
|
||||
Items.Strings = (
|
||||
#1053#1072#1078#1072#1090#1100' '#1085#1082#1086#1087#1082#1091' '#1085#1072' '#1082#1083#1072#1074#1080#1072#1090#1091#1088#1077
|
||||
#1055#1088#1086#1080#1075#1088#1072#1090#1100' '#1079#1074#1091#1082
|
||||
'Kandinsky'
|
||||
#1047#1072#1087#1091#1089#1090#1080#1090#1100' Web Event'
|
||||
#1053#1072#1087#1080#1089#1072#1090#1100' '#1074' '#1095#1072#1090
|
||||
#1047#1072#1087#1091#1089#1090#1080#1090#1100' '#1087#1088#1086#1075#1088#1072#1084#1084#1091)
|
||||
Position.X = 209.000000000000000000
|
||||
Position.Y = 33.000000000000000000
|
||||
Size.Width = 193.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 5
|
||||
OnChange = cbActionsChange
|
||||
end
|
||||
object cbRevards: TComboBox
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 88.000000000000000000
|
||||
Size.Width = 193.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 6
|
||||
Visible = False
|
||||
end
|
||||
object sgEvents: TStringGrid
|
||||
CanFocus = True
|
||||
ClipChildren = True
|
||||
Position.X = 8.000000000000000000
|
||||
Position.Y = 118.000000000000000000
|
||||
Size.Width = 633.000000000000000000
|
||||
Size.Height = 211.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 7
|
||||
RowCount = 0
|
||||
Options = [ColumnResize, ColumnMove, ColLines, RowLines, Tabs, Header, HeaderClick, AutoDisplacement]
|
||||
Viewport.Width = 629.000000000000000000
|
||||
Viewport.Height = 186.000000000000000000
|
||||
object StringColumn1: TStringColumn
|
||||
Header = #1057#1086#1073#1099#1090#1080#1077
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
Size.Width = 150.000000000000000000
|
||||
end
|
||||
object StringColumn2: TStringColumn
|
||||
Header = #1059#1089#1083#1086#1074#1080#1077
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
Size.Width = 150.000000000000000000
|
||||
end
|
||||
object StringColumn3: TStringColumn
|
||||
Header = #1044#1077#1081#1089#1090#1074#1080#1077
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
Size.Width = 150.000000000000000000
|
||||
end
|
||||
object StringColumn4: TStringColumn
|
||||
Header = #1055#1072#1088#1072#1084#1077#1090#1088#1099
|
||||
HeaderSettings.TextSettings.WordWrap = False
|
||||
Size.Width = 150.000000000000000000
|
||||
end
|
||||
end
|
||||
object Label4: TLabel
|
||||
Position.X = 209.000000000000000000
|
||||
Position.Y = 63.000000000000000000
|
||||
Text = #1055#1072#1088#1072#1084#1077#1090#1088#1099
|
||||
TabOrder = 8
|
||||
end
|
||||
object edtParams: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
TabOrder = 9
|
||||
Position.X = 209.000000000000000000
|
||||
Position.Y = 88.000000000000000000
|
||||
PopupMenu = PopupMenu1
|
||||
Size.Width = 193.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
end
|
||||
object btnAdd: TButton
|
||||
Position.X = 649.000000000000000000
|
||||
Position.Y = 118.000000000000000000
|
||||
TabOrder = 10
|
||||
Text = #1044#1086#1073#1072#1074#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnAddClick
|
||||
end
|
||||
object btnDelete: TButton
|
||||
Position.X = 649.000000000000000000
|
||||
Position.Y = 148.000000000000000000
|
||||
TabOrder = 11
|
||||
Text = #1059#1076#1072#1083#1080#1090#1100
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnDeleteClick
|
||||
end
|
||||
object PopupMenu1: TPopupMenu
|
||||
Left = 544
|
||||
Top = 16
|
||||
object MenuItem1: TMenuItem
|
||||
Text = #1054#1090#1082#1088#1099#1090#1100' '#1092#1072#1081#1083
|
||||
OnClick = MenuItem1Click
|
||||
end
|
||||
end
|
||||
object OpenDialog1: TOpenDialog
|
||||
Left = 496
|
||||
Top = 16
|
||||
end
|
||||
object pVKGenerate: TPanel
|
||||
Position.X = 410.000000000000000000
|
||||
Position.Y = 88.000000000000000000
|
||||
Size.Width = 319.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
Visible = False
|
||||
TabOrder = 21
|
||||
object cbKey1: TComboBox
|
||||
Align = Left
|
||||
TabOrder = 3
|
||||
end
|
||||
object Label54: TLabel
|
||||
Align = Left
|
||||
Position.X = 207.000000000000000000
|
||||
Size.Width = 7.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = '+'
|
||||
TabOrder = 4
|
||||
end
|
||||
object cbKey3: TComboBox
|
||||
Align = Left
|
||||
Position.X = 214.000000000000000000
|
||||
TabOrder = 2
|
||||
end
|
||||
object cbKey2: TComboBox
|
||||
Align = Left
|
||||
Position.X = 107.000000000000000000
|
||||
TabOrder = 0
|
||||
end
|
||||
object Label56: TLabel
|
||||
Align = Left
|
||||
Position.X = 100.000000000000000000
|
||||
Size.Width = 7.000000000000000000
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TextSettings.Trimming = None
|
||||
Text = '+'
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,390 @@
|
||||
unit fEvents;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils, System.Types, System.UITypes, System.Classes,
|
||||
System.Variants, System.Generics.Collections, ShellAPI, uSoundManager,
|
||||
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls,
|
||||
FMX.Edit, FMX.ListBox, FMX.Controls.Presentation, System.Rtti, FMX.Grid.Style,
|
||||
FMX.ScrollBox, FMX.Grid, uRecords, uDataBase, FMX.Menus, uKeyEvent;
|
||||
|
||||
type
|
||||
TfrEvents = class(TFrame)
|
||||
Label1: TLabel;
|
||||
cbEventList: TComboBox;
|
||||
edtIF: TEdit;
|
||||
Label2: TLabel;
|
||||
Label3: TLabel;
|
||||
cbActions: TComboBox;
|
||||
cbRevards: TComboBox;
|
||||
sgEvents: TStringGrid;
|
||||
Label4: TLabel;
|
||||
edtParams: TEdit;
|
||||
StringColumn1: TStringColumn;
|
||||
StringColumn2: TStringColumn;
|
||||
StringColumn3: TStringColumn;
|
||||
StringColumn4: TStringColumn;
|
||||
btnAdd: TButton;
|
||||
btnDelete: TButton;
|
||||
PopupMenu1: TPopupMenu;
|
||||
MenuItem1: TMenuItem;
|
||||
OpenDialog1: TOpenDialog;
|
||||
pVKGenerate: TPanel;
|
||||
cbKey1: TComboBox;
|
||||
Label54: TLabel;
|
||||
cbKey3: TComboBox;
|
||||
cbKey2: TComboBox;
|
||||
Label56: TLabel;
|
||||
procedure cbEventListChange(Sender: TObject);
|
||||
procedure btnAddClick(Sender: TObject);
|
||||
procedure btnDeleteClick(Sender: TObject);
|
||||
procedure MenuItem1Click(Sender: TObject);
|
||||
procedure cbActionsChange(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
procedure toLog(aCode: integer; aMethod: string; aMess: string);
|
||||
public
|
||||
{ Public declarations }
|
||||
ListEvents: TArray<TEventGlobal>;
|
||||
CustomRewards: Tlist<TCustomRevards>;
|
||||
CustomRewardEvents: Tlist<TCustomRewardEvent>;
|
||||
|
||||
procedure UpdateGrid;
|
||||
procedure LoadCustomRevards();
|
||||
procedure ESOnGetCustomReward(CustomReward: TCustomRewardEvent);
|
||||
procedure OnDonate(aNick, aMessage, aSum: string);
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.fmx}
|
||||
|
||||
uses uGeneral;
|
||||
|
||||
procedure TfrEvents.btnAddClick(Sender: TObject);
|
||||
var
|
||||
NewRec: TEventGlobal;
|
||||
begin
|
||||
if (cbEventList.Text = '') or (cbActions.Text = '') then
|
||||
exit;
|
||||
NewRec.Event := cbEventList.ItemIndex;
|
||||
NewRec.Action := cbActions.ItemIndex;
|
||||
NewRec.Param := edtParams.Text;
|
||||
if edtIF.Visible then
|
||||
NewRec.Condition := edtIF.Text;
|
||||
if cbRevards.Visible then
|
||||
NewRec.Condition := cbRevards.Text;
|
||||
|
||||
SetLength(ListEvents, Length(ListEvents) + 1);
|
||||
ListEvents[High(ListEvents)] := NewRec;
|
||||
DB.SaveRecordArray<TEventGlobal>('ListEvents', ListEvents);
|
||||
UpdateGrid;
|
||||
end;
|
||||
|
||||
procedure TfrEvents.btnDeleteClick(Sender: TObject);
|
||||
var
|
||||
i, RowIndex: integer;
|
||||
begin
|
||||
RowIndex := sgEvents.Row;
|
||||
if (RowIndex < 0) or (RowIndex > High(ListEvents)) then
|
||||
exit;
|
||||
for i := RowIndex to High(ListEvents) - 1 do
|
||||
ListEvents[i] := ListEvents[i + 1];
|
||||
SetLength(ListEvents, Length(ListEvents) - 1);
|
||||
DB.SaveRecordArray<TEventGlobal>('ListEvents', ListEvents);
|
||||
UpdateGrid;
|
||||
end;
|
||||
|
||||
procedure TfrEvents.cbActionsChange(Sender: TObject);
|
||||
begin
|
||||
pVKGenerate.Visible := cbActions.ItemIndex = 0;
|
||||
end;
|
||||
|
||||
procedure TfrEvents.cbEventListChange(Sender: TObject);
|
||||
begin
|
||||
edtIF.Visible := cbEventList.ItemIndex = 0;
|
||||
cbRevards.Visible := cbEventList.ItemIndex = 1;
|
||||
Label2.Visible := cbEventList.ItemIndex <= 1;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrEvents.ESOnGetCustomReward(CustomReward: TCustomRewardEvent);
|
||||
var
|
||||
i, i2: integer;
|
||||
req, s: string;
|
||||
hr: TCustomRewardEvent;
|
||||
sm: TSongMachine;
|
||||
myAction: integer;
|
||||
begin
|
||||
sm := TSongMachine.Create;
|
||||
try
|
||||
toLog(3, 'ESOnGetCustomReward', 'Íà÷àëî îáðàáîòêè íàãðàäû: ' +
|
||||
CustomReward.Event.revard.Title);
|
||||
s := '[' + CustomReward.Event.user_name +
|
||||
'] êóïèë çà áàëëû êàíàëà íàãðàäó "' +
|
||||
CustomReward.Event.revard.Title + '" ';
|
||||
if CustomReward.Event.user_input <> '' then
|
||||
begin
|
||||
toLog(0, 'ESOnGetCustomReward', 'Ïîëüçîâàòåëüñêèé ââîä: ' +
|
||||
CustomReward.Event.user_input);
|
||||
s := s + ' è ïåðåäàë ñòðîêó ' + CustomReward.Event.user_input
|
||||
end;
|
||||
|
||||
for i := 0 to high(ListEvents) do
|
||||
begin
|
||||
if ListEvents[i].Event <> 1 then
|
||||
continue;
|
||||
if ListEvents[i].Condition = CustomReward.Event.revard.Title then
|
||||
begin
|
||||
myAction := ListEvents[i].Action;
|
||||
|
||||
{
|
||||
0 Íàæàòü íêîïêó íà êëàâèàòóðå
|
||||
1 Ïðîèãðàòü çâóê
|
||||
2 Kandinsky
|
||||
3 Çàïóñòèòü Web Event
|
||||
4 Íàïèñàòü â ÷àò
|
||||
5 Çàïóñòèòü ïðîãðàììó
|
||||
|
||||
}
|
||||
case myAction of
|
||||
0:
|
||||
begin // íàæàòü êíîïêó
|
||||
toLog(0, 'ESOnGetCustomReward', 'Ñèìóëÿöèÿ íàæàòèÿ: ' +
|
||||
ListEvents[i].Param);
|
||||
kePoints.SimulateKeyPress(ListEvents[i].Param, 500);
|
||||
end;
|
||||
1:
|
||||
begin // âîñïðîèçâåäåíèå çâóêà
|
||||
toLog(0, 'ESOnGetCustomReward', 'Âîñïðîèçâåäåíèå çâóêà: ' +
|
||||
ListEvents[i].Param);
|
||||
sm.PlayPublic(ListEvents[i].Param, '100');
|
||||
end;
|
||||
2:
|
||||
begin // Kandinsky
|
||||
toLog(0, 'ESOnGetCustomReward', 'Ãåíåðàöèÿ Kandinsky äëÿ: ' +
|
||||
CustomReward.Event.user_input);
|
||||
Kandinsky.generate(CustomReward.Event.user_input,
|
||||
CustomReward.Event.user_login);
|
||||
end;
|
||||
4:
|
||||
begin // Íàïèñàòü â ÷àò
|
||||
|
||||
toLog(0, 'ESOnGetCustomReward', 'Íàïèñàòü â ÷àò: ' +
|
||||
CustomReward.Event.user_input);
|
||||
end;
|
||||
5:
|
||||
begin // çàïóñê ôàéëà
|
||||
toLog(0, 'ESOnGetCustomReward', 'Çàïóñê ôàéëà: ' + ListEvents
|
||||
[i].Param);
|
||||
ShellExecute(0, 'open', pwidechar(ListEvents[i].Param),
|
||||
nil, nil, 0);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
sm.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrEvents.LoadCustomRevards();
|
||||
var
|
||||
cr: TCustomRevards;
|
||||
begin
|
||||
CustomRewards.Clear;
|
||||
cbRevards.Items.Clear;
|
||||
TTW_Bot.toLog('fEvents', 'LoadCustomRevards', 'Çàïðîñ íàãðàä ñ ñåðâåðà', 3);
|
||||
ttw_API.getCustomReward(CustomRewards);
|
||||
for cr in CustomRewards do
|
||||
begin
|
||||
cbRevards.Items.Add(cr.Title);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrEvents.MenuItem1Click(Sender: TObject);
|
||||
begin
|
||||
if OpenDialog1.Execute then
|
||||
TEdit(PopupMenu1.PopupComponent).Text := OpenDialog1.FileName;
|
||||
end;
|
||||
|
||||
procedure TfrEvents.OnDonate(aNick, aMessage, aSum: string);
|
||||
var
|
||||
i, i2: integer;
|
||||
req, s: string;
|
||||
hr: TCustomRewardEvent;
|
||||
sm: TSongMachine;
|
||||
myAction: integer;
|
||||
|
||||
j: integer;
|
||||
aSumInt: integer;
|
||||
BestRow: integer;
|
||||
BestPriority: integer;
|
||||
BestValue: integer;
|
||||
Condition: string;
|
||||
CurrentPriority: integer;
|
||||
CurrentValue: integer;
|
||||
MinVal, MaxVal: integer;
|
||||
Parts: tstringlist;
|
||||
se: TStyleEvent;
|
||||
notify: TEventGlobal;
|
||||
|
||||
begin
|
||||
|
||||
aSumInt := StrToIntDef(aSum, 0);
|
||||
BestRow := -1;
|
||||
BestPriority := -1;
|
||||
BestValue := 0;
|
||||
|
||||
for i := 0 to high(ListEvents) do
|
||||
begin
|
||||
if ListEvents[i].Event = 0 then
|
||||
begin
|
||||
Condition := ListEvents[i].Condition;
|
||||
CurrentPriority := -1;
|
||||
CurrentValue := 0;
|
||||
|
||||
// Ïðîâåðêà íà òî÷íîå çíà÷åíèå
|
||||
if Pos('-', Condition) = 0 then
|
||||
begin
|
||||
if Pos('>', Condition) = 0 then
|
||||
begin
|
||||
if Pos('<', Condition) = 0 then
|
||||
begin
|
||||
// Òî÷íîå çíà÷åíèå
|
||||
CurrentValue := StrToIntDef(Condition, -1);
|
||||
if aSumInt = CurrentValue then
|
||||
CurrentPriority := 4;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
if CurrentPriority = -1 then
|
||||
begin
|
||||
if Pos('-', Condition) > 0 then
|
||||
begin
|
||||
// Äèàïàçîí
|
||||
Parts := tstringlist.Create;
|
||||
try
|
||||
Parts.Delimiter := '-';
|
||||
Parts.StrictDelimiter := True;
|
||||
Parts.DelimitedText := Condition;
|
||||
if Parts.Count = 2 then
|
||||
begin
|
||||
MinVal := StrToIntDef(Trim(Parts[0]), 0);
|
||||
MaxVal := StrToIntDef(Trim(Parts[1]), 0);
|
||||
if (aSumInt >= MinVal) and (aSumInt <= MaxVal) then
|
||||
begin
|
||||
CurrentPriority := 3;
|
||||
CurrentValue := MinVal; // Ïðèîðèòåò ïî MinVal
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
Parts.Free;
|
||||
end;
|
||||
end
|
||||
else if Pos('>', Condition) > 0 then
|
||||
begin
|
||||
// Óñëîâèå ">X"
|
||||
CurrentValue :=
|
||||
StrToIntDef(Trim(StringReplace(Condition, '>', '',
|
||||
[rfReplaceAll])), 0);
|
||||
if aSumInt >= CurrentValue then
|
||||
CurrentPriority := 2;
|
||||
end
|
||||
else if Pos('<', Condition) > 0 then
|
||||
begin
|
||||
// Óñëîâèå "<X"
|
||||
CurrentValue :=
|
||||
StrToIntDef(Trim(StringReplace(Condition, '<', '',
|
||||
[rfReplaceAll])), 0);
|
||||
if aSumInt <= CurrentValue then
|
||||
CurrentPriority := 1;
|
||||
end;
|
||||
end;
|
||||
|
||||
if CurrentPriority <> -1 then
|
||||
begin
|
||||
// Îïðåäåëåíèå íàèëó÷øåãî óñëîâèÿ
|
||||
if (CurrentPriority > BestPriority) or (CurrentPriority = BestPriority)
|
||||
and ((CurrentPriority = 3) and (CurrentValue > BestValue) or
|
||||
(CurrentPriority = 2) and (CurrentValue > BestValue) or
|
||||
(CurrentPriority = 1) and (CurrentValue < BestValue)) then
|
||||
begin
|
||||
BestPriority := CurrentPriority;
|
||||
BestValue := CurrentValue;
|
||||
BestRow := i;
|
||||
notify := ListEvents[i];
|
||||
end;
|
||||
end;
|
||||
if BestRow = -1 then
|
||||
Break;
|
||||
|
||||
end;
|
||||
end;
|
||||
if BestRow = -1 then
|
||||
exit;
|
||||
sm := TSongMachine.Create;
|
||||
try
|
||||
myAction := ListEvents[i].Action;
|
||||
case myAction of
|
||||
0:
|
||||
begin // íàæàòü êíîïêó
|
||||
toLog(0, 'OnDonate', 'Ñèìóëÿöèÿ íàæàòèÿ: ' + ListEvents[i].Param);
|
||||
kePoints.SimulateKeyPress(ListEvents[i].Param, 500);
|
||||
end;
|
||||
1:
|
||||
begin // âîñïðîèçâåäåíèå çâóêà
|
||||
toLog(0, 'OnDonate', 'Âîñïðîèçâåäåíèå çâóêà: ' + ListEvents[i].Param);
|
||||
sm.PlayPublic(ListEvents[i].Param, '100');
|
||||
end;
|
||||
2:
|
||||
begin // Kandinsky
|
||||
toLog(0, 'OnDonate', 'Ãåíåðàöèÿ Kandinsky äëÿ: ' + aNick);
|
||||
Kandinsky.generate(aMessage, aNick);
|
||||
end;
|
||||
4:
|
||||
begin // Íàïèñàòü â ÷àò
|
||||
|
||||
toLog(0, 'OnDonate', 'Íàïèñàòü â ÷àò: ' + aNick);
|
||||
end;
|
||||
5:
|
||||
begin // çàïóñê ôàéëà
|
||||
toLog(0, 'OnDonate', 'Çàïóñê ôàéëà: ' + ListEvents[i].Param);
|
||||
ShellExecute(0, 'open', pwidechar(ListEvents[i].Param), nil, nil, 0);
|
||||
end;
|
||||
end;
|
||||
|
||||
finally
|
||||
sm.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrEvents.toLog(aCode: integer; aMethod, aMess: string);
|
||||
begin
|
||||
TTW_Bot.toLog('fEvents', aMethod, aMess, aCode);
|
||||
end;
|
||||
|
||||
procedure TfrEvents.UpdateGrid;
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
sgEvents.BeginUpdate;
|
||||
try
|
||||
sgEvents.RowCount := 0; // Ñáðàñûâàåì ñòðîêè (îñòàâëÿåì òîëüêî çàãîëîâêè)
|
||||
|
||||
for i := 0 to High(ListEvents) do
|
||||
begin
|
||||
sgEvents.RowCount := i + 1;
|
||||
sgEvents.Cells[0, i] := cbEventList.Items[ListEvents[i].Event];
|
||||
sgEvents.Cells[1, i] := ListEvents[i].Condition;
|
||||
sgEvents.Cells[2, i] := cbActions.Items[ListEvents[i].Action];
|
||||
sgEvents.Cells[3, i] := ListEvents[i].Param;
|
||||
end;
|
||||
finally
|
||||
sgEvents.EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
@@ -47,6 +47,7 @@ object frNotify: TfrNotify
|
||||
TabOrder = 7
|
||||
Text = '...'
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnNotifyOpenClick
|
||||
end
|
||||
object btnNotifyCheck: TButton
|
||||
Position.X = 624.000000000000000000
|
||||
@@ -57,6 +58,7 @@ object frNotify: TfrNotify
|
||||
TabOrder = 8
|
||||
Text = '>'
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnNotifyCheckClick
|
||||
end
|
||||
object cbNotifyFileAgain1: TCheckBox
|
||||
Position.X = 656.000000000000000000
|
||||
@@ -76,6 +78,7 @@ object frNotify: TfrNotify
|
||||
TabOrder = 26
|
||||
Text = '>'
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnNotifyCheckClick
|
||||
end
|
||||
object btnNotifyOpenMod: TButton
|
||||
Position.X = 592.000000000000000000
|
||||
@@ -86,6 +89,7 @@ object frNotify: TfrNotify
|
||||
TabOrder = 24
|
||||
Text = '...'
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnNotifyOpenClick
|
||||
end
|
||||
object edtNotifyFileNameMod: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
@@ -168,6 +172,7 @@ object frNotify: TfrNotify
|
||||
TabOrder = 21
|
||||
Text = '...'
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnNotifyOpenClick
|
||||
end
|
||||
object btnNotifyCheckVip: TButton
|
||||
Position.X = 624.000000000000000000
|
||||
@@ -178,6 +183,7 @@ object frNotify: TfrNotify
|
||||
TabOrder = 25
|
||||
Text = '>'
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnNotifyCheckClick
|
||||
end
|
||||
object cbNotifyFileAgain2: TCheckBox
|
||||
Position.X = 656.000000000000000000
|
||||
@@ -206,6 +212,7 @@ object frNotify: TfrNotify
|
||||
TabOrder = 23
|
||||
Text = '>'
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnNotifyCheckClick
|
||||
end
|
||||
object btnNotifyOpenSub: TButton
|
||||
Position.X = 592.000000000000000000
|
||||
@@ -216,6 +223,7 @@ object frNotify: TfrNotify
|
||||
TabOrder = 19
|
||||
Text = '...'
|
||||
TextSettings.Trimming = None
|
||||
OnClick = btnNotifyOpenClick
|
||||
end
|
||||
object edtNotifyFileNameSub: TEdit
|
||||
Touch.InteractiveGestures = [LongTap, DoubleTap]
|
||||
|
||||
+39
-1
@@ -3,7 +3,8 @@ unit fNotify;
|
||||
interface
|
||||
|
||||
uses
|
||||
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
|
||||
System.SysUtils, System.Types, System.UITypes, System.Classes,
|
||||
System.Variants, uSoundManager,
|
||||
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls,
|
||||
FMX.Edit, FMX.Controls.Presentation;
|
||||
|
||||
@@ -37,6 +38,8 @@ type
|
||||
Label52: TLabel;
|
||||
chEnNotifySub: TSwitch;
|
||||
OpenDialog1: TOpenDialog;
|
||||
procedure btnNotifyOpenClick(Sender: TObject);
|
||||
procedure btnNotifyCheckClick(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
@@ -47,4 +50,39 @@ implementation
|
||||
|
||||
{$R *.fmx}
|
||||
|
||||
procedure TfrNotify.btnNotifyCheckClick(Sender: TObject);
|
||||
var sm:TSongMachine;
|
||||
begin
|
||||
sm:=TSongMachine.Create;
|
||||
try
|
||||
if TButton(Sender).Name = 'btnNotifyCheck' then
|
||||
sm.PlayPublic(edtNotifyFileName.Text, tbNotifyVolume.Value.ToString);
|
||||
if TButton(Sender).Name = 'btnNotifyCheckMod' then
|
||||
sm.PlayPublic(edtNotifyFileNameMod.Text, tbNotifyVolumeMod.Value.ToString);
|
||||
if TButton(Sender).Name = 'btnNotifyCheckVip' then
|
||||
sm.PlayPublic(edtNotifyFileNameVip.Text, tbNotifyVolumeVip.Value.ToString);
|
||||
if TButton(Sender).Name = 'btnNotifyCheckSub' then
|
||||
sm.PlayPublic(edtNotifyFileNameSub.Text, tbNotifyVolumeSub.Value.ToString);
|
||||
finally
|
||||
sm.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrNotify.btnNotifyOpenClick(Sender: TObject);
|
||||
begin
|
||||
if OpenDialog1.Execute then
|
||||
begin
|
||||
if TButton(Sender).Name = 'btnNotify' then
|
||||
edtNotifyFileName.Text := OpenDialog1.FileName;
|
||||
if TButton(Sender).Name = 'btnNotifyMod' then
|
||||
edtNotifyFileNameMod.Text := OpenDialog1.FileName;
|
||||
if TButton(Sender).Name = 'btnNotifyVip' then
|
||||
edtNotifyFileNameVip.Text := OpenDialog1.FileName;
|
||||
if TButton(Sender).Name = 'btnNotifySub' then
|
||||
edtNotifyFileNameSub.Text := OpenDialog1.FileName;
|
||||
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
@@ -369,6 +369,9 @@ end;
|
||||
procedure TfrSettings.HandleWSDonate(aNick, aMessage, aSum: string);
|
||||
begin
|
||||
// fDonats.OnDADonate(aNick, aMessage, aSum);
|
||||
TTW_Bot.frOBS1.toEventWebServer(aNick,aSum,aMessage);
|
||||
TTW_Bot.frEvents1.OnDonate(aNick, aMessage, aSum);
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrSettings.HandleWSStatus(AStatusText: string; AStatusCode: integer);
|
||||
|
||||
@@ -15,6 +15,7 @@ object frTTS: TfrTTS
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 1
|
||||
OnChange = cbVoicesChange
|
||||
end
|
||||
object btnUpdateVoices: TButton
|
||||
Position.X = 177.000000000000000000
|
||||
@@ -59,6 +60,7 @@ object frTTS: TfrTTS
|
||||
Size.Height = 22.000000000000000000
|
||||
Size.PlatformDefault = False
|
||||
TabOrder = 6
|
||||
OnChange = cbOutputChange
|
||||
end
|
||||
object btnSend: TButton
|
||||
Position.X = 8.000000000000000000
|
||||
|
||||
@@ -20,6 +20,8 @@ type
|
||||
cbOutput: TComboBox;
|
||||
procedure btnUpdateVoicesClick(Sender: TObject);
|
||||
procedure btnSendClick(Sender: TObject);
|
||||
procedure cbVoicesChange(Sender: TObject);
|
||||
procedure cbOutputChange(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
tts: TTTS;
|
||||
@@ -83,4 +85,14 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrTTS.cbOutputChange(Sender: TObject);
|
||||
begin
|
||||
db.WriteSetting('cbOutput',inttostr(cbOutput.ItemIndex));
|
||||
end;
|
||||
|
||||
procedure TfrTTS.cbVoicesChange(Sender: TObject);
|
||||
begin
|
||||
db.WriteSetting('cbVoices',inttostr(cbVoices.ItemIndex));
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user