|
| 1 | +GraphicsWindow.Title = "Zoomの時間までを教えてあげるタイマー " |
| 2 | +oldsec=0 |
| 3 | +'tiltime_t=Clock.ElapsedMilliseconds |
| 4 | + |
| 5 | +InitForm() |
| 6 | +Controls.ButtonClicked=OnButtonClicked |
| 7 | +Timer.Tick = OntimerTick |
| 8 | +Timer.Pause() |
| 9 | + |
| 10 | +Sub InitForm |
| 11 | + GraphicsWindow.Width = 600 |
| 12 | + GraphicsWindow.Height = 650 |
| 13 | + GraphicsWindow.FontName = "Segoe UI Symbol" |
| 14 | + GraphicsWindow.CanResize= "False" |
| 15 | + GraphicsWindow.Top = 0 |
| 16 | + GraphicsWindow.Show() |
| 17 | + Timer.Interval = 1000 |
| 18 | + |
| 19 | + GraphicsWindow.FontSize = 120 |
| 20 | + Text[2] = Shapes.AddText("カウントダウンタイマー:") |
| 21 | + Shapes.Move(Text[2],1,200) |
| 22 | + |
| 23 | + GraphicsWindow.FontSize = 20 |
| 24 | + Text[1] = Shapes.AddText(Clock.Time) |
| 25 | + Shapes.Move(Text[1],0,0) |
| 26 | + |
| 27 | + button[1] = Controls.AddButton("▶",300,600) |
| 28 | + Controls.SetSize(button[1],80,50) |
| 29 | + button[2] = Controls.AddButton("◧",400,600) |
| 30 | + Controls.SetSize(button[2],80,50) |
| 31 | + button[3] = Controls.AddButton("■",500,600) |
| 32 | + Controls.SetSize(button[3],80,50) |
| 33 | + button[4] = Controls.AddButton("音(CHI)",400,0) |
| 34 | + Controls.SetSize(button[4],80,50) |
| 35 | + button[5] = Controls.AddButton("音(PRM)",500,0) |
| 36 | + Controls.SetSize(button[5],80,50) |
| 37 | + |
| 38 | + T1h = Controls.AddTextBox(0,600) |
| 39 | + Controls.SetSize(T1h,80,50) |
| 40 | + Controls.SetTextBoxText(T1h,"0") |
| 41 | + |
| 42 | + T1m = Controls.AddTextBox(90,600) |
| 43 | + Controls.SetSize(T1m,80,50) |
| 44 | + Controls.SetTextBoxText(T1m,"0") |
| 45 | + |
| 46 | + T1s = Controls.AddTextBox(180,600) |
| 47 | + Controls.SetSize(T1s,80,50) |
| 48 | + Controls.SetTextBoxText(T1s,"30") |
| 49 | +EndSub |
| 50 | + |
| 51 | +Sub OnTimerTick |
| 52 | + If tiltime_t > Clock.ElapsedMilliseconds Then |
| 53 | + sec = Clock.Second |
| 54 | + str = "TIME - " + Clock.Hour + ":" + Clock.Minute + ":" + sec + "." + Clock.Millisecond |
| 55 | + Shapes.SetText(Text[1],str) |
| 56 | + If oldsec <> sec Then |
| 57 | + If Math.Remainder( sec, 2) = 0 Then |
| 58 | + If "♪" = Controls.GetButtonCaption(button[4]) Then |
| 59 | + Sound.PlayClick() |
| 60 | + EndIf |
| 61 | + Else |
| 62 | + If "♪" = Controls.GetButtonCaption(button[5]) Then |
| 63 | + Sound.PlayChimes() |
| 64 | + EndIf |
| 65 | + EndIf |
| 66 | + |
| 67 | + nowtime_t = math.Floor((tiltime_t - Clock.ElapsedMilliseconds )/1000) |
| 68 | + m1= Math.Remainder(nowtime_t, 3600) |
| 69 | + s1= Math.Remainder(m1, 60) |
| 70 | + h2=math.Floor(nowtime_t /3600) |
| 71 | + m2=math.Floor(m1 /60) |
| 72 | + s2=s1 |
| 73 | + If h2 < 10 Then |
| 74 | + h2 = "_" + "0" + h2 |
| 75 | + EndIf |
| 76 | + If m2 < 10 Then |
| 77 | + m2 = ":" + "0" + m2 |
| 78 | + Else |
| 79 | + m2 = ":" + m2 |
| 80 | + EndIf |
| 81 | + If s2 < 10 Then |
| 82 | + s2 = ":" + "0" + s2 |
| 83 | + Else |
| 84 | + s2 = ":" + s2 |
| 85 | + EndIf |
| 86 | + |
| 87 | + str = h2 + m2 + s2 +"_" |
| 88 | + If Math.Remainder( sec, 4) = 0 Then |
| 89 | + Shapes.SetText(Text[2],str) |
| 90 | + GraphicsWindow.BackgroundColor = "black" |
| 91 | + ElseIf Math.Remainder( sec, 4) = 1 Then |
| 92 | + Shapes.SetText(Text[2],str) |
| 93 | + GraphicsWindow.BackgroundColor = "Gray" |
| 94 | + ElseIf Math.Remainder( sec, 4) = 2 Then |
| 95 | + Shapes.SetText(Text[2],str) |
| 96 | + GraphicsWindow.BackgroundColor = "black" |
| 97 | + ElseIf Math.Remainder( sec, 4) = 3 Then |
| 98 | + Shapes.SetText(Text[2],str) |
| 99 | + GraphicsWindow.BackgroundColor = "Gray" |
| 100 | + Else |
| 101 | + Shapes.SetText(Text[2],Str) |
| 102 | + EndIf |
| 103 | + oldsec=sec |
| 104 | + Else |
| 105 | + Shapes.SetText(Text[1],Str) |
| 106 | + EndIf |
| 107 | + |
| 108 | + Else |
| 109 | + Timer.Pause() |
| 110 | + GraphicsWindow.BackgroundColor = "red" |
| 111 | + Shapes.SetText(Text[2],"時間です") |
| 112 | + EndIf |
| 113 | +EndSub |
| 114 | + |
| 115 | +Sub OnButtonClicked |
| 116 | + If Controls.LastClickedButton = button[1] Then |
| 117 | + target = 3600 * Controls.GetTextBoxText(T1h) + 60 * Controls.GetTextBoxText(T1m) + Controls.GetTextBoxText(T1s) * 1 |
| 118 | + tiltime_t = clock.ElapsedMilliseconds + target * 1000 |
| 119 | + GraphicsWindow.BackgroundColor = "black" |
| 120 | + GraphicsWindow.BrushColor = "wihte" |
| 121 | + Timer.Resume() |
| 122 | + ElseIf Controls.LastClickedButton = button[2] Then |
| 123 | + Timer.Resume() |
| 124 | + ElseIf Controls.LastClickedButton = button[3] Then |
| 125 | + Timer.Pause() |
| 126 | + ElseIf Controls.LastClickedButton = button[4] Then |
| 127 | + If "♪" = Controls.GetButtonCaption(button[4]) Then |
| 128 | + Controls.SetButtonCaption(button[4], "x-1") |
| 129 | + Else |
| 130 | + Controls.SetButtonCaption(button[4], "♪") |
| 131 | + EndIf |
| 132 | + ElseIf Controls.LastClickedButton = button[5] Then |
| 133 | + If "♪" = Controls.GetButtonCaption(button[5]) Then |
| 134 | + Controls.SetButtonCaption(button[5], "x-2") |
| 135 | + Else |
| 136 | + Controls.SetButtonCaption(button[5], "♪") |
| 137 | + EndIf |
| 138 | + EndIf |
| 139 | +EndSub |
0 commit comments