document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. \' Gambas class file
  2.  
  3. Private PorteroDeEstados As New Caretaker \'undo y redo
  4.  
  5. Public Sub _new()
  6.  
  7. End
  8.  
  9. Public Sub Form_Show()
  10.  
  11.   \'guardaEstadoDelMarcador: guarda el estado actual....
  12.   guardaEstado()
  13.  
  14.   Me.Center()
  15.  
  16. End
  17.  
  18. Public Sub buttonMarcador1_Click()
  19.  
  20.   Dim nombre As String
  21.   Dim hora As String
  22.  
  23.   nombre = InputBox("Nombre del jugador:")
  24.   hora = InputBox("Minuto del gol (0-90):")
  25.   ListBoxEquipo1.Add(nombre & " ( " & hora & "\' )")
  26.   If RadioButton1.Value = True Then
  27.     LCDLabel1Equipo1.value += 1
  28.   Else
  29.     LCDLabel2Equipo1.value += 1
  30.   Endif
  31.   LCDLabelFinEquipo1.value += 1
  32.  
  33.   \'guardaEstadoDelMarcador: guarda el estado actual....
  34.   guardaEstado()
  35.  
  36.   \'borrar lista de rehacer
  37.   PorteroDeEstados.BorrarEstadosRedo()
  38.  
  39. End
  40.  
  41. Public Sub buttonMarcador2_Click()
  42.  
  43.   Dim nombre As String
  44.   Dim hora As String
  45.  
  46.   nombre = InputBox("Nombre del jugador:")
  47.   hora = InputBox("Minuto del gol (0-90):")
  48.   ListBoxEquipo2.Add(nombre & " ( " & hora & "\' )")
  49.   If RadioButton1.Value = True Then
  50.     LCDLabel1Equipo2.value += 1
  51.    
  52.   Else
  53.     LCDLabel2Equipo2.value += 1
  54.    
  55.   Endif
  56.   LCDLabelFinEquipo2.value += 1
  57.  
  58.   \'guardaEstadoDelMarcador: guarda el estado actual....
  59.   guardaEstado()
  60.  
  61.   \'borrar lista de rehacer
  62.   PorteroDeEstados.BorrarEstadosRedo()
  63.  
  64. End
  65.  
  66. \'---------------------------------------------------------------------------------------
  67. \'
  68. Public Function EstadoActual() As State
  69.  
  70.   Dim estado As New State
  71.  
  72.   estado.setjugadores1(ListBoxEquipo1)
  73.   estado.setjugadores2(ListBoxEquipo2)
  74.   estado.setmarcador(LCDLabel1Equipo1.value, LCDLabel2Equipo1.value, LCDLabelFinEquipo1.value, LCDLabel1Equipo2.value, LCDLabel2Equipo2.value, LCDLabelFinEquipo2.value)
  75.   estado.settiempo(RadioButton1.value, RadioButton2.value)
  76.  
  77.   Return estado
  78.  
  79. End
  80.  
  81. Public Sub guardaEstado()
  82.  
  83.   PorteroDeEstados.addMementoUndo(EstadoActual())
  84.  
  85. End
  86.  
  87. Public Sub UndoEstado()
  88.  
  89.   Dim s As State
  90.   Dim m As Integer[]  
  91.   Dim r As Boolean[]
  92.  
  93.   s = PorteroDeEstados.getMementoUndo()
  94.   If IsNull(S) Then
  95.     Message.Error("No hay nada que deshacer")
  96.     Return
  97.   Endif
  98.  
  99.   \'lista de jugadores que marcaron goles...
  100.   s.getjugadores1(ListBoxEquipo1)
  101.   s.getjugadores2(ListBoxEquipo2)
  102.  
  103.   m = s.getmarcador()
  104.  
  105.   \'goles
  106.   LCDLabel1Equipo1.Value = m[0]
  107.   LCDLabel2Equipo1.Value = m[1]
  108.   LCDLabelFinEquipo1.Value = m[2]
  109.   LCDLabel1Equipo2.Value = m[3]
  110.   LCDLabel2Equipo2.Value = m[4]
  111.   LCDLabelFinEquipo2.value = m[5]
  112.  
  113.   \'tiempo (1º o 2º parte)
  114.   r = s.gettiempo()
  115.  
  116.   RadioButton1.Value = r[0]
  117.   RadioButton2.Value = r[1]
  118.  
  119.   ToolButtonRehacer.enabled = True
  120.  
  121. End
  122.  
  123. Public Sub ToolButtonDeshacer_Click()
  124.  
  125.   UndoEstado() \'undo
  126.  
  127. End
  128.  
  129. Public Sub ToolButtonRehacer_Click()
  130.  
  131.   Dim s As State
  132.   Dim m As Integer[]  
  133.   Dim r As Boolean[]
  134.  
  135.   s = PorteroDeEstados.getMementoRedo()
  136.  
  137.   If IsNull(S) Then
  138.     Message.Error("No hay nada que rehacer")
  139.     Return
  140.   Endif
  141.  
  142.   \'lista de jugadores que marcaron goles...
  143.  
  144.   s.getjugadores1(ListBoxEquipo1)
  145.   s.getjugadores2(ListBoxEquipo2)
  146.  
  147.   m = s.getmarcador()
  148.  
  149.   \'goles
  150.   LCDLabel1Equipo1.Value = m[0]
  151.   LCDLabel2Equipo1.Value = m[1]
  152.   LCDLabelFinEquipo1.Value = m[2]
  153.   LCDLabel1Equipo2.Value = m[3]
  154.   LCDLabel2Equipo2.Value = m[4]
  155.   LCDLabelFinEquipo2.value = m[5]
  156.  
  157.   \'tiempo (1º o 2º parte)
  158.   r = s.gettiempo()
  159.  
  160.   RadioButton1.Value = r[0]
  161.   RadioButton2.Value = r[1]
  162.  
  163. End
');