1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
using assembly System.Windows.Forms using namespace System.Windows.Forms $global:jugador = 1 $empezar = (read-host "Quién empieza").ToLower() $form = [Form] @{ Text = 'Mi formulario' } $button = [Button] @{ Text = ' ' Location = [System.Drawing.Size]::new(10,10) size = [System.Drawing.Size]::new(100,100) BackColor = '#CCCC99' } $button.add_Click{ Write-Host $jugador if($jugador) { write-host "el uno" $global:jugador = 0 Write-Host $jugador } else { write-host "el dos" $global:jugador = 1 } if($button.text -eq " ") { $button.text = $empezar } elseif($button.text -eq "x") { $button.text = "0" } else{ $button.text = "x" } } $form.Controls.Add($button) $form.ShowDialog() |