def __init__(self): gobject.GObject.__init__(self) self._audio = False self._ip = get_ip() self._res = False self._escenario = False self._win = False self._real_win = False self._client = False self._estado = False self._jugador = False self._disparo = False self._disparos_activos = True self._data_game_players = {} self._contador = 0 self._jugadores = pygame.sprite.RenderUpdates() self._balas = pygame.sprite.RenderUpdates() self._mybalas = pygame.sprite.RenderUpdates() self._explosiones = pygame.sprite.RenderUpdates() self._default_retorno = {"ingame": True} # Variables para control de latencia self._while = False self._latencias = [] self._time = False self._promedio = 0.0 self._max_lat_server = 0.0 self._pausa = 0.0 print "Nuevo Juego Creado:", platform.platform()
def __init__(self, _dict, client): GObject.Object.__init__(self) self.GAME = {} self.GAME['mapa'] = str(_dict['mapa'].strip()) self.sound_disparo = False self.sound_juego = False self.sound_explosion = False self.ip = get_ip() self.JUGADORES = {} self.JUGADORES[self.ip] = get_model() self.JUGADORES[self.ip]['nick'] = str(_dict['nick'].strip()) self.JUGADORES[self.ip]['tanque'] = str(_dict['tanque'].strip()) self.BALAS = {} self.client = client self.resolucionreal = RESOLUCION_INICIAL self.escenario = False self.ventana = False self.reloj = False self.estado = False self.jugador = False self.bala = False self.disparo = False self.jugadores = pygame.sprite.RenderUpdates() self.balas = pygame.sprite.RenderUpdates() self.explosiones = pygame.sprite.RenderUpdates()
def __descargar(self): if get_ip(): get_streaming_default() else: print "No estás conectado a Internet" self.destroy()
def __descargar(self): if self.force: if get_ip(): download_streamings() else: print "No estás conectado a Internet" else: set_listas_default() self.destroy() return False
def config_show(self, tipo): """ Muestra u oculta los widgets de configuración. """ if tipo: if self.box_config.get_visible(): self.box_config.hide() else: self.box_config.show() else: self.box_config.hide() return video_widgets = [ self.camara_setting, self.video_out_setting, self.balance_config_widget, self.widget_efectos ] foto_widgets = [ self.camara_setting, #self.video_out_setting, self.rafagas_setting, self.balance_config_widget, self.widget_efectos ] jamedia_widgets = [ #self.camara_setting, #self.video_out_setting, #self.rafagas_setting, #self.balance_config_widget, #self.widget_efectos, self.playerlist, self.player_control ] jamediaimagenes_widgets = [ #self.camara_setting, #self.video_out_setting, #self.rafagas_setting, #self.balance_config_widget, #self.widget_efectos, self.playerlist, #self.player_control, ] map(ocultar, video_widgets) map(ocultar, foto_widgets) map(ocultar, jamedia_widgets) map(ocultar, jamediaimagenes_widgets) if tipo == "camara": map(mostrar, video_widgets) self.camara_setting.label_ip.set_text(get_ip()) elif tipo == "foto": map(mostrar, foto_widgets) self.camara_setting.label_ip.set_text(get_ip()) elif tipo == "jamedia": map(mostrar, jamedia_widgets) elif tipo == "jamediaimagenes": map(mostrar, jamediaimagenes_widgets) else: print self.config_show, "Falta definir:", tipo if self.jamediawebcam: self.__update_balance_toolbars(self.jamediawebcam.get_config()) self.emit("cancel-toolbars")
def config_show(self, tipo): """ Muestra u oculta los widgets de configuración. """ if tipo: if self.box_config.get_visible(): self.box_config.hide() else: self.box_config.show() else: self.box_config.hide() return video_widgets = [ self.camara_setting, self.video_out_setting, self.balance_config_widget, self.widget_efectos] foto_widgets = [ self.camara_setting, #self.video_out_setting, self.rafagas_setting, self.balance_config_widget, self.widget_efectos] jamedia_widgets = [ #self.camara_setting, #self.video_out_setting, #self.rafagas_setting, #self.balance_config_widget, #self.widget_efectos, self.playerlist, self.player_control] jamediaimagenes_widgets = [ #self.camara_setting, #self.video_out_setting, #self.rafagas_setting, #self.balance_config_widget, #self.widget_efectos, self.playerlist, #self.player_control, ] map(ocultar, video_widgets) map(ocultar, foto_widgets) map(ocultar, jamedia_widgets) map(ocultar, jamediaimagenes_widgets) if tipo == "camara": map(mostrar, video_widgets) self.camara_setting.label_ip.set_text(get_ip()) elif tipo == "foto": map(mostrar, foto_widgets) self.camara_setting.label_ip.set_text(get_ip()) elif tipo == "jamedia": map(mostrar, jamedia_widgets) elif tipo == "jamediaimagenes": map(mostrar, jamediaimagenes_widgets) else: print self.config_show, "Falta definir:", tipo if self.jamediawebcam: self.__update_balance_toolbars(self.jamediawebcam.get_config()) self.emit("cancel-toolbars")
def __check_ip(self): valor = get_ip() self.izquierda.set_ip(valor) self.derecha.set_ip(valor) return True
def setup_init(self, _dict): ip = get_ip() server = str(_dict['server']) tanque = str(_dict['tanque']) self.derecha.set_data(ip, server, tanque) self.drawing.setup_init(_dict)
def __init__(self): gtk.EventBox.__init__(self) self.set_property("visible-window", False) self.game_dict = { 'server': get_ip(), 'nick': '', 'mapa': "", 'tanque': "", 'enemigos': 2, 'vidas': 5, } self.set_border_width(10) self.mapaview = gtk.Image() self.tanqueview = gtk.Image() self.oponentes = OponentesSelectBox() tabla = gtk.Table(columns=4, rows=9, homogeneous=True) self.framemapa = FrameMapa() tabla.attach_defaults(self.framemapa, 0, 1, 0, 4) self.frametanque = FrameTanque() tabla.attach_defaults(self.frametanque, 0, 1, 4, 8) event = gtk.EventBox() event.set_border_width(10) event.set_property("visible-window", False) event.add(self.mapaview) tabla.attach_defaults(event, 1, 4, 0, 4) tabla.attach_defaults(self.tanqueview, 1, 2, 6, 7) self.framenick = FrameNick() tabla.attach_defaults(self.framenick, 2, 3, 5, 8) event = gtk.EventBox() event.set_property("visible-window", False) event.set_border_width(4) event.add(self.oponentes) tabla.attach_defaults(event, 3, 4, 5, 8) button = gtk.Button("Cancelar") set_font(button.get_children()[0], "subtitulo1", typewidget="Label") tabla.attach_defaults(button, 0, 1, 8, 9) button.connect("clicked", self.__accion, "salir") self.jugar = gtk.Button("Crear") set_font(self.jugar.get_children()[0], "subtitulo1", typewidget="Label") self.jugar.set_sensitive(False) self.jugar.connect("clicked", self.__accion, "run") tabla.attach_defaults(self.jugar, 3, 4, 8, 9) self.add(tabla) self.connect("realize", self.__do_realize) self.framemapa.lista.connect( "nueva-seleccion", self.__seleccion_mapa) self.frametanque.lista.connect( "nueva-seleccion", self.__seleccion_tanque) self.oponentes.connect("valor", self.__seleccion_oponentes) self.framenick.nick.connect("changed", self.__change_nick) self.show_all()