var SpyFallForm:TclForm JoinRoomBtn,CopyBtn:TClProButton; JoinRoomEdt:TclProEdit; OneSpy,DoubleSpy:TCLRadioButton; OneSpyImage,DoubleSpyImage:TClProImage; GameTimeCombo:TCLComboBox; PlayersPanel,panelPlayer:TclProPanel; userName:TClProLabel; playerStatusImage:TClProImage; TestHorz : TClHorzScrollBox; RoomId:TClProLabel; roomIDStr:String; ModMQTT,PlayerMQTT:TclMQTT; JoinTimer:TCLTimer; void PlayerMQTTStatusChanged; { if (PlayerMQTT.Connected ) { ShowMessage(Clomosy.AppUserDisplayName+' Bağlandı'); } Else { ShowMessage(Clomosy.AppUserDisplayName+' Bağlanamadı'); } } void JoinTimerEnabled { if(JoinTimer.Interval==1) { JoinTimer.Interval=1000; } else { PlayerMQTT.Send('Habip Bağlandı'); JoinTimer.Enabled=false; } } void ModMQTTPublishReceived; { if(ModMQTT.ReceivedAlright) { /* if(ModMQTT.ReceivedMessage=='Habip Bağlandı') { userName=SpyFallForm.AddNewProLabel(PlayersPanel, 'userName', Clomosy.AppUserDisplayName); clComponent.SetupComponent(userName,'{ "Align":"Center", "Width":150, "Height":40, "TextColor":"#323036", "TextSize":20, "TextVerticalAlign":"Center", "TextBold":"Yes", "MarginLeft":150 }'); } */ } } void JoinRoomBtnOnClick { PlayerMQTT.Channel=JoinRoomEdt.text; PlayerMQTT.Connect; JoinTimer.Enabled=true; } void setModeratorForm { SpyFallForm=TclForm.Create(Self); SpyFallForm.SetFormColor('#323036', '', clGNone); OneSpy=SpyFallForm.AddNewRadioButton(SpyFallForm, 'OneSpy', ''); OneSpy.Margins.Top=SpyFallForm.clHeight*4/10; OneSpy.Margins.Right=SpyFallForm.clWidth*9/100; OneSpy.ischecked=true; DoubleSpy=SpyFallForm.AddNewRadioButton(SpyFallForm, 'DoubleSpy', ''); DoubleSpy.Margins.Top=SpyFallForm.clHeight*4/10; DoubleSpy.Margins.Left=SpyFallForm.clWidth*23/100; OneSpyImage = SpyFallForm.AddNewProImage(SpyFallForm,'OneSpyImage'); OneSpyImage.Margins.Top=SpyFallForm.clHeight*4/10; OneSpyImage.Margins.Right=SpyFallForm.clWidth*16/100; clComponent.SetupComponent(OneSpyImage,'{ "Width":27, "Height":27, "ImgUrl":"https://i.imgur.com/hQyynu1.png", "ImgFit":"yes" }'); DoubleSpyImage = SpyFallForm.AddNewProImage(SpyFallForm,'DoubleSpyImage'); DoubleSpyImage.Margins.Top=SpyFallForm.clHeight*4/10; DoubleSpyImage.Margins.Left=SpyFallForm.clWidth*20/100; clComponent.SetupComponent(DoubleSpyImage,'{ "Width":50, "Height":50, "ImgUrl":"https://i.imgur.com/qchaHr2.png", "ImgFit":"yes" }'); GameTimeCombo=SpyFallForm.AddNewComboBox(SpyFallForm, 'GameTimeCombo'); GameTimeCombo.Align=alCenter; GameTimeCombo.Margins.Top=SpyFallForm.clHeight*25/100; GameTimeCombo.AddItem('6:00','01'); GameTimeCombo.AddItem('7:00','02'); GameTimeCombo.AddItem('8:00','03'); GameTimeCombo.AddItem('9:00','04'); GameTimeCombo.AddItem('10:00','05'); PlayersPanel=SpyFallForm.AddNewProPanel(SpyFallForm, 'PlayersPanel'); PlayersPanel.margins.bottom=SpyFallForm.clHeight*4/10; clComponent.SetupComponent(PlayersPanel,'{ "Width":370, "Height":350, "RoundHeight":10, "RoundWidth":10, "BorderWidth":5, "BorderColor":"#FFFFFF", "BackgroundColor":"#323036" }');
TestHorz = SpyFallForm.AddNewHorzScrollBox(PlayersPanel,'TestHorz'); roomIDStr=Clomosy.AppUserGUID; RoomId=SpyFallForm.AddNewProLabel(SpyFallForm, 'RoomId', 'Oda ID: '+roomIDStr); RoomId.Margins.Top=SpyFallForm.clHeight*5/10; clComponent.SetupComponent(RoomId,'{ "Width":200, "Height":40, "TextColor":"#DAC0A3", "TextSize":20, "TextVerticalAlign":"Center", "TextBold":"Yes" }'); CopyBtn=SpyFallForm.AddNewProButton(SpyFallForm, 'CopyBtn', ''); CopyBtn.Margins.Top=SpyFallForm.clHeight*5/10; CopyBtn.Margins.Left=RoomId.Width; clComponent.SetupComponent(CopyBtn,'{ "Width":20, "Height":20, "ImgUrl":"https://i.imgur.com/DU8Bb0p.png", "BackgroundColor":"#DAC0A3", "ImgFit":"yes" }'); ModMQTT = SpyFallForm.AddNewMQTTConnection(PlayersPanel,'ModMQTT'); SpyFallForm.AddNewEvent(ModMQTT,tbeOnMQTTPublishReceived,'ModMQTTPublishReceived'); ModMQTT.Channel=Clomosy.AppUserGUID; ModMQTT.Connect; SpyFallForm.Run; } void setPlayerForm { SpyFallForm=TclForm.Create(Self); SpyFallForm.SetFormColor('#323036', '', clGNone); JoinRoomBtn=SpyFallForm.AddNewProButton(SpyFallForm, 'JoinRoomBtn', 'Odaya Katıl'); JoinRoomBtn.Height=50; JoinRoomBtn.Width=150; JoinRoomBtn.Margins.Top=SpyFallForm.clHeight*4/10 clComponent.SetupComponent(JoinRoomBtn,'{ "Width":150, "Height":50, "RoundHeight":10, "RoundWidth":10, "BorderColor":"#FFFFFF", "BorderWidth":2, "FontColor":"#FFFFFF", "BackgroundColor":"#DAC0A3" }'); JoinRoomEdt=SpyFallForm.AddNewProEdit(SpyFallForm, 'JoinRoomEdt', 'Oda ID giriniz...'); JoinRoomEdt.Margins.Top=SpyFallForm.clHeight*2/10 clComponent.SetupComponent(JoinRoomEdt,'{ "Width":180, "Height":30, "RoundHeight":10, "RoundWidth":2, "BorderColor":"#FFFFFF", "BorderWidth":2 }'); panelPlayer=SpyFallForm.AddNewProPanel(SpyFallForm, 'panelPlayer'); panelPlayer.margins.bottom=SpyFallForm.clHeight*4/10; clComponent.SetupComponent(panelPlayer,'{ "Width":370, "Height":50, "RoundHeight":10, "RoundWidth":10, "BorderWidth":5, "BorderColor":"#FFFFFF", "BackgroundColor":"#DAC0A3" }'); userName=SpyFallForm.AddNewProLabel(panelPlayer, 'userName', Clomosy.AppUserDisplayName); clComponent.SetupComponent(userName,'{ "Align":"Center", "Width":150, "Height":40, "TextColor":"#323036", "TextSize":20, "TextVerticalAlign":"Center", "TextBold":"Yes", "MarginLeft":150 }'); playerStatusImage=SpyFallForm.AddNewProImage(panelPlayer, 'playerStatusImage'); clComponent.SetupComponent(playerStatusImage,'{ "Align":"Right", "Width":27, "Height":27, "ImgUrl":"https://i.imgur.com/xAERIXD.png", "ImgFit":"yes", "MarginRight":50 }'); PlayerMQTT=SpyFallForm.AddNewMQTTConnection(SpyFallForm,'PlayerMQTT'); SpyFallForm.AddNewEvent(PlayerMQTT,tbeOnMQTTStatusChanged,'PlayerMQTTStatusChanged'); JoinRoomBtn.OnClick='JoinRoomBtnOnClick'; JoinTimer=SpyFallForm.AddNewTimer(SpyFallForm,'JoinTimer',1); JoinTimer.OnTimer='JoinTimerEnabled'; SpyFallForm.Run; }
{ if(Clomosy.AppUserProfile == 1) { setModeratorForm; } else { setPlayerForm; } }
|