예제 #1
0
    def SetupPopup(self):
        bg_image_name = 'optimization_results-popup.png'
        if constants.language == 'es':
            bg_image_name = 'optimization_finished-popup-es.png'
        self.results_background = utils.Sprite(
            constants.SPRITES_OPTIMIZATION + bg_image_name, 640, 360)

        self.popup_description = utils.Text("you are awesome!",
                                            self.subtitle_font,
                                            color=constants.PALETTE_TEXT_RED)
        self.popup_description.SetPosition(constants.VIEWPORT_CENTER_X, 380)

        self.bonus_text = utils.Text("++!",
                                     self.subtitle_font,
                                     color=constants.PALETTE_TEXT_CYAN)
        self.bonus_text.SetPosition(constants.VIEWPORT_CENTER_X, 420)

        next_news_text = "press    to edit the next news"
        if constants.language == 'es':
            next_news_text = 'presiona    para editar otra noticia'
        self.right_progress_label = utils.Text(
            next_news_text,
            self.subtitle_font,
            color=constants.PALETTE_TEXT_CYAN)
        self.right_progress_label.setAnchor(1, 0)
        self.right_progress_label.SetPosition(1200, 660)
        self.right_progress_icon = utils.Sprite(
            "assets/sprites/scenes/common/progress-button-green.png",
            745 if constants.language == 'en' else 684, 642)
        self.right_progress_icon.setAnchor(1, 0)
예제 #2
0
    def SetupLayout(self):
        utils.play_music(self.MX[(int(random.random()*10))], -1, 0.1, 0.6)
        # add da fact
        self.fact_title = utils.Text(
            '',
            self.title_font,
            color = constants.PALETTE_TITLES_DARK_BLUE
        )
        self.fact_title.setAnchor(0.5, 0)
        self.fact_title.SetPosition(constants.VIEWPORT_CENTER_X, 100)

        self.current_evt_frame = utils.Sprite(
            constants.SPRITES_EDITION + 'current-nws.png'
        )
        self.current_evt_frame.setAnchor(0.5, 0.5)
        self.current_evt_frame.SetPosition(constants.VIEWPORT_CENTER_X, 303)

        self.fact_summary = utils.Text('', self.normal_font,
            color = constants.PALETTE_TITLES_DARK_BLUE)
        self.fact_summary.setAnchor(0.5, 0)
        self.fact_summary.SetPosition(constants.VIEWPORT_CENTER_X, 463)

        # self.fact_argument = utils.Text('', self.normal_font,
        #     color = constants.PALETTE_TITLES_DARK_BLUE)
        # self.fact_argument.setAnchor(0.5, 0)
        # self.fact_argument.SetPosition(constants.VIEWPORT_CENTER_X, 496)

        # add da goal
        goal_layout = {
            'title': { 'en': 'goal', 'es': 'objetivo' },
            'width': { 'en': 115, 'es': 198 }
        }
        self.goal_title = utils.Text(
            goal_layout['title'][constants.language] + ':',
            self.subtitle_font,
            color = constants.PALLETE_BACKGROUND_BLUE
        )
        self.goal_title.setAnchor(0, 0)
        self.goal_title.SetPosition(78, 554)

        self.goal_desc = utils.Text('', self.subtitle_font, color = constants.PALLETE_BACKGROUND_BLUE)
        self.goal_desc.setAnchor(0, 0)
        self.goal_desc.SetPosition(78 + goal_layout['width'][constants.language], 554)

        # background for other news:
        self.back_news = []
        for i in range(1, 3):
            temp = utils.Sprite(
                constants.SPRITES_EDITION + 'next-nws.png'
            )
            temp.setAnchor(0.5, 0.5)
            temp.SetPosition(constants.VIEWPORT_CENTER_X+273*i, 303)
            self.back_news.append(temp)

        # add da ui
        self.SetupUI()
예제 #3
0
    def SetupLayout(self):
        self.frame = utils.Sprite(
            constants.SPRITES_OPTIMIZATION + 'optimization-frame.png',
            constants.VIEWPORT_CENTER_X, constants.VIEWPORT_CENTER_Y)

        opt_text = 'news optimization'
        if constants.language == 'es':
            opt_text = 'optimización de noticia'
        self.title = utils.Text(opt_text + ' - ' + self.minigametitle,
                                self.subtitle_font,
                                color=constants.PALETTE_TEXT_PURPLE)
        self.title.SetPosition(constants.VIEWPORT_CENTER_X, 40)

        self.timerprogress = 1.0
        self.timerBackground = utils.Sprite(
            constants.SPRITES_OPTIMIZATION + 'timer_bar-background.png', 0, 77)
        self.timerBackground.setAnchor(0, 0)
예제 #4
0
    def SetupUI(self):
        self.ui_background = utils.Sprite(constants.SPRITES_UI_BG, 0, 0)
        self.ui_background.setAnchor(0, 0)

        start_edit_layout = {
            'text': {
                'en': 'press    to start editing',
                'es': 'presiona    para empezar a editar'
            },
            'icon': {
                'en': 855,
                'es': 747
            }
        }

        self.right_progress_label = utils.Text(
            start_edit_layout['text'][constants.language],
            self.subtitle_font,
            color = constants.PALETTE_TEXT_CYAN
        )
        self.right_progress_label.setAnchor(1, 0)
        self.right_progress_label.SetPosition(1200, 660)
        self.right_progress_icon = utils.Sprite(
            "assets/sprites/scenes/common/progress-button-pink.png",
            start_edit_layout['icon'][constants.language],
            645
        )
        self.right_progress_icon.setAnchor(1, 0)

        self.left_progress_label = utils.Text(
            "press    to stop editing",
            self.subtitle_font,
            color = constants.PALETTE_TEXT_CYAN
        )
        self.left_progress_label.setAnchor(0.5, 0.5)
        self.left_progress_label.SetPosition(
            constants.VIEWPORT_PADDING_X,
            constants.VIEWPORT_HEIGHT - constants.VIEWPORT_PADDING_Y
        )
        self.left_progress_icon = utils.Sprite(
            "assets/sprites/scenes/common/progress-button-purple.png",
            148,
            675
        )
예제 #5
0
    def LoadEvent(self, event):
        self.current_event = event

        self.icon = utils.Sprite(
            constants.EVENTS + self.current_event['ico']
        )

        self.icon.setAnchor(0.5, 0.5)
        self.icon.SetPosition(constants.VIEWPORT_CENTER_X, 303)

        self.fact_title.SetText(self.current_event['hdl'][constants.language])
        self.fact_summary.SetText(self.current_event['ovw'][constants.language])
        # self.fact_argument.SetText(self.current_event['arg'][constants.language])
        self.goal_desc.SetText(self.current_event['gol'][constants.language])

        # change the default order of the material
        random.shuffle(self.current_event['material'])


        #mimo.termal_print(self.current_event['hdl'].upper())
        #### imprimir la noticia en pantalla?
예제 #6
0
    def __init__(self):
        SceneBase.__init__(self)
        mimo.reset()

        self.logo = utils.Sprite('assets/sprites/logo_MCorp.png', 1280 / 2,
                                 720 / 2)
        self.logo.opacity = 0

        self.sfx_mimo_logo = utils.get_sound(
            'assets/audio/SFX/M_OS/UI_Booth.ogg')

        self.AddTween("easeInOutSine", 2, self.logo, "opacity", 0, 255, 1)
        self.AddTrigger(1, self.sfx_mimo_logo, 'play')

        # check ring and bulbs leds
        factor = 0.1
        loops = 50
        n_leds = 20
        leds = list(range(8, 28))
        for index in range(0, n_leds * loops):
            led_i = leds[index % n_leds]
            self.AddTrigger((1.5 + index) * factor, mimo,
                            'set_material_leds_color', [
                                led_i,
                                int(random.random() * 255),
                                int(random.random() * 255),
                                int(random.random() * 255)
                            ])
            self.AddTrigger((1.5 + index + 0.9) * factor, mimo,
                            'set_material_leds_color', [led_i, 0, 0, 0])

        # check buttons and backlight buttons.
        mimo.set_buttons_enable_status(True, True)
        mimo.set_independent_lights(False, False)
        mimo.set_led_brightness(120)
        mimo.set_material_buttons_lock_status(
            [0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0])
        mimo.set_material_buttons_mode(
            [0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0])
        mimo.set_optimization_buttons_lock_status(
            [0, 0, 1, 0, 2, 0, 3, 0, 4, 0])
        mimo.set_optimization_buttons_mode([0, 0, 1, 0, 2, 0, 3, 0, 4, 0])

        # activate knobs
        mimo.set_tunners_enable_status(True)

        # create matrix sprite
        self.testSprite = AnimatedNeoSprite('assets/palomita.png')

        self.label = TextNeoSprite("people")
        self.label.y = 2

        font = pygame.font.Font("assets/fonts/VCR_OSD_MONO_1.001.ttf", 36)
        self.title = utils.Text("Hello Machinaria!", font)
        self.title.opacity = 0
        self.title.SetPosition(400, 200)
        self.AddTween("easeInOutSine", 2, self.title, "opacity", 0, 255, 1)

        # check lcd screens
        for index in range(0, 6):
            mimo.lcd_display_at(index, 'id' + str(index) + '- line 1', 1)
            mimo.lcd_display_at(index, 'id' + str(index) + '- line 2', 2)
예제 #7
0
    def __init__(self):
        # initialize state
        self.next = None
        self.time_triggers = []
        self.tweens = []
        self.dirty_rects = [(
            0,
            0,
            constants.VIEWPORT_WIDTH,
            constants.VIEWPORT_HEIGHT
        )]

        self.title_font = pygame.font.Font(
            constants.VCR_OSD_MONO,
            constants.FONT_TITLE
        )
        self.subtitle_font = pygame.font.Font(
            constants.VCR_OSD_MONO,
            constants.FONT_SUBTITLE
        )
        self.normal_font = pygame.font.Font(
            constants.VCR_OSD_MONO,
            constants.FONT_NORMAL
        )
        self.small_font = pygame.font.Font(
            constants.VCR_OSD_MONO,
            constants.FONT_SMALL
        )

        self.render_right_progress = True
        self.render_left_progress = False

        self.transition_cortain = False
        self.height_cortain = 0
        self.closing = False
        #self.AddTrigger(0.1, self, 'OpenEvent')

        self.countdown_label = utils.Text(
            "00:00",
            self.subtitle_font,
            color = constants.PALETTE_TEXT_BLACK
        )
        self.countdown_label.SetPosition(constants.VIEWPORT_CENTER_X, 28)
        self.countdown_in_red = False

        # timer popup elements
        self.timeout_popup_active = False
        self.timeoutends_move_x = 0
        self.popup_timer_background = utils.Sprite(
            constants.SPRITES+'timeout/alert-background.png',
            constants.VIEWPORT_CENTER_X,
            constants.VIEWPORT_CENTER_Y
        )
        self.popup_timer_top_bar = utils.Sprite(
            constants.SPRITES+'timeout/alert-line.png',
            640,
            197
        )
        self.popup_timer_top_bar.setAnchor(0,0.5)
        self.popup_timer_bottom_bar = utils.Sprite(
            constants.SPRITES+'timeout/alert-line.png',
            0,
            513
        )
        self.popup_timer_bottom_bar.setAnchor(0,0.5)
        self.popup_timer_icon = utils.Sprite(
            constants.SPRITES+'timeout/alert-icon.png',
            constants.VIEWPORT_CENTER_X,
            328
        )

        finish_text = 'the test will finish in one minute'
        if constants.language == 'es':
            finish_text = 'la prueba terminará en un minuto'
        self.popup_timer_description = utils.Text(
            finish_text,
            self.subtitle_font,
            color = constants.PALETTE_TEXT_RED
        )
        self.popup_timer_description.SetPosition(constants.VIEWPORT_CENTER_X, 427)
        self.timeoutends_popup_active = False

        self.popup_timerends_background = utils.Sprite(
            constants.SPRITES_COMMON + 'popup_timerends-background.png'
        )
        self.popup_timerends_background.SetPosition(
            constants.VIEWPORT_CENTER_X,
            constants.VIEWPORT_CENTER_Y
        )
        self.popup_timerends_title = utils.Text(
            'evaluation complete' if constants.language == 'en' else 'evaluación completada',
            self.subtitle_font
        )
        self.popup_timerends_title.SetPosition(constants.VIEWPORT_CENTER_X, 392)
        
        self.popup_timerends_description = utils.Text(
            'testing environment deactivated' if constants.language == 'en' else 'entorno de pruebas desactivado',
            self.subtitle_font
        )
        self.popup_timerends_description.SetPosition(
            constants.VIEWPORT_CENTER_X,
            436
        )

        # TODO: animate this texto
        self.popup_timerends_printing = utils.Text(
            "/... Don't call us, we'll call you...\\",
            self.subtitle_font
        )
        self.popup_timerends_printing.SetPosition(
            constants.VIEWPORT_CENTER_X,
            481
        )

        # TODO: get the subject ID from somewhere
        self.popup_timerends_subject = utils.Text(
            "application completed for subject",
            self.subtitle_font
        )
        self.popup_timerends_subject.SetPosition(
            constants.VIEWPORT_CENTER_X,
            567
        )

        self.popup_timerends_shudown = utils.Text(
            "shutdown m.i.m.o. and leave the booth",
            self.subtitle_font
        )
        self.popup_timerends_shudown.SetPosition(
            constants.VIEWPORT_CENTER_X,
            613
        )

        self.loading_label = utils.Text(
            "loading" if constants.language == 'en' else 'cargando',
            self.subtitle_font,
            color = constants.PALETTE_TEXT_CYAN
        )
        self.loading_label.SetPosition(constants.VIEWPORT_CENTER_X, 330)
        # -- end popup elements

        # sfx and audio

        audio_path = 'assets/audio/SFX/M_OS/'

        self.UI_BarLoad = utils.get_sound(audio_path + 'UI_BarLoad.ogg')
        self.UI_BarLoad.set_volume(1)

        self.UI_TimeAlert = utils.get_sound(audio_path + 'UI_TimeAlert.ogg')
        self.UI_TimeAlert.set_volume(1)

        self.UI_EndGame = utils.get_sound(audio_path + 'UI_EndGame.ogg')
        self.UI_EndGame.set_volume(1)
예제 #8
0
    def ShowMinigame(self, side):
        # TODO: load the specific mini-game info. based on the chosen side
        self.showing_minigame_tutorial = True
        selected_minigame = self.available_minigames[side]
        self.selected_minigame = selected_minigame["scene"]

        minigame_color = self.left_progress_label.color \
            if side == constants.MINIGAME_LEFT else self.right_progress_label.color

        self.minigame_title = utils.Text(
            'how to play?' if constants.language == 'en' else 'funcionamiento',
            self.subtitle_font,
            color = constants.PALETTE_TEXT_CYAN
        )
        self.minigame_title.setAnchor(0, 0)
        self.minigame_title.SetPosition(310, 240)

        self.minigame_optimization_sub = utils.Text(
            # 'optimization' if constants.language == 'en' else 'optimización',
            selected_minigame["title"][constants.language],
            self.subtitle_font,
            color = constants.PALETTE_TEXT_RED
        )
        self.minigame_optimization_sub.SetPosition(constants.VIEWPORT_CENTER_X, 175)

        self.minigame_icon_back = utils.Sprite(
            'assets/sprites/scenes/edition/icon_frame.png',
            110,
            240+87
        )
        self.minigame_icon_back.setAnchor(0,0.5)
        self.minigame_icon = utils.Sprite(
            'assets/minigame_icons/'+selected_minigame["icon"],
            114,
            240+87
        )
        self.minigame_icon.setAnchor(0,0.5)
        
        self.minigame_desc = utils.Text(
            selected_minigame["description"][constants.language],
            self.normal_font,
            310,
            300,
            color= constants.PALETTE_TEXT_PURPLE
        )
        self.minigame_desc.setAnchor(0,0)


        self.minigame_goal_label = utils.Text(
            'goal:' if constants.language == 'en' else 'objetivo:',
            self.subtitle_font,
            300,
            500,
            color= constants.PALETTE_TEXT_PURPLE
        )
        self.minigame_goal_label.setAnchor(1,0)
        self.minigame_goal = utils.Text(
            selected_minigame["goal"][constants.language],
            self.normal_font,
            310,
            500,
            color= constants.PALETTE_TEXT_PURPLE
        )
        self.minigame_goal.setAnchor(0,0)

        self.minigame_preview = utils.Sprite(
            'assets/minigame_icons/'+selected_minigame["preview"],
            selected_minigame["preview_x"],
            selected_minigame["preview_y"]
        )
        self.minigame_preview.frameDelay = selected_minigame["preview_rate"]
        self.minigame_preview.frameWidth = selected_minigame["preview_width"]
        self.minigame_preview.frameHeight = selected_minigame["preview_height"]
        self.minigame_preview.animationFrames = selected_minigame["preview_frames"]
        self.minigame_preview.setAnchor(0,0)

        self.percentage = 0

        start_label = {
            'title': {
                'en': 'press    to start',
                'es': 'presiona    para empezar'
            },
            'pos': {
                'en': 907,
                'es': 968 - 60
            }
        }
        self.right_progress_label.SetColor(minigame_color)
        self.right_progress_label.SetText(start_label['title'][constants.language])
        self.right_progress_icon.SetPosition(
            start_label['pos'][constants.language],
            675
        )

        self.render_left_progress = False

        mimo.set_material_buttons_active_status([6,1, 7,0])
예제 #9
0
    def __init__(self):
        SceneBase.__init__(self)

        # initialize state
        self.image_positions = [
            { 'x': 400, 'y': 500 },
            { 'x': 400 + 340, 'y': 500 },
            { 'x': 400 + (340 * 2), 'y': 500 },
            { 'x': 400 + (340 * 3), 'y': 500 }
        ]
        self.sequence = [-1, -1, -1, -1]
        self.material = [False, False, False, False, False, False]
        self.busy_slots = 0
        self.popupActive = False
        self.can_optimize = False
        self.showing_minigame_tutorial = False
        self.selected_minigame = ""
        self.impact = 0
        self.mtl_switcher = {
            0: self.hook,
            1: self.plot,
            2: self.plot,
            3: self.conclusion
        }
        self.available_minigames = []
        self.no_facts = False

        # Cargar el arreglo de direcciones pa' la musique
        self.MX = []
        self.MX.append('assets/audio/MX/DirtySoil.ogg')
        self.MX.append('assets/audio/MX/DystopianBallad.ogg')
        self.MX.append('assets/audio/MX/LazyBartender.ogg')
        self.MX.append('assets/audio/MX/LostInParadise.ogg')
        self.MX.append('assets/audio/MX/PapayaJuice.ogg')
        self.MX.append('assets/audio/MX/RetroDance.ogg')
        self.MX.append('assets/audio/MX/SunnyBeach.ogg')
        self.MX.append('assets/audio/MX/TimeTraveler.ogg')
        self.MX.append('assets/audio/MX/WeirdJungle.ogg')
        self.MX.append('assets/audio/MX/WhereAreYou.ogg')

        # Cargar arreglos de SFX
        audio_path = 'assets/audio/SFX/M_OS/'

        self.UI_MatSel = []
        self.UI_MatSel.append(utils.get_sound(audio_path + 'UI_MatSel_01.ogg'))
        self.UI_MatSel.append(utils.get_sound(audio_path + 'UI_MatSel_02.ogg'))
        self.UI_MatSel.append(utils.get_sound(audio_path + 'UI_MatSel_03.ogg'))
        self.UI_MatSel.append(utils.get_sound(audio_path + 'UI_MatSel_04.ogg'))

        self.UI_EndGame = utils.get_sound(audio_path + 'UI_EndGame.ogg')
        self.UI_EndGame.set_volume(1)

        self.UI_SwitchScene = utils.get_sound('assets/audio/SFX/Scanning/MG1_ObjSort.ogg')

        # Preparar la máquina para la destrucción
        self.SetupMimo()

        # ─────────────────────────────────────────────────────────────────────┐
        # obtener el hecho o ir a la pantalla de resultados
        if constants.currento_evento == len(news):
            self.no_facts = True
            self.AddTrigger(0.16, self, 'SwitchToScene', "Results")
            constants.currento_evento = 0

        self.current_event = news[constants.currento_evento]
        self.current_frame = '???'

        constants.currento_evento += 1

        # obtener el material del hecho
        self.event_mtl = self.current_event['material']
        # ─────────────────────────────────────────────────────────────────────┘

        # setup the layout for the scene
        self.SetupLayout()

        self.images = []
        self.details = []
        for mtl in self.event_mtl:
            mtl_dtl = utils.Text(
                mtl['detail'][constants.language],
                self.normal_font,
                color = constants.PALETTE_TEXT_CYAN
            )
            mtl_dtl.setAnchor(0, 0)
            mtl_img = utils.Sprite(constants.MATERIAL + mtl['img'])
            mtl_img.SetOpacity(64)

            self.images.append(mtl_img)
            self.details.append(mtl_dtl)

        material_indexes = [0, 1, 2, 4, 5, 6]
        index = 0
        # set buttons to switch mode
        for material in self.current_event['material']:
            line1_text = utils.align_text(material['label'][constants.language][0], index < 3, 16, ' ')
            line2_text = utils.align_text(material['label'][constants.language][1], index < 3, 16, ' ')
            
            mimo.set_material_buttons_light([index] + material['color'])
            #mimo.set_material_leds_color([material_indexes[index]] + material['color'])
            
            mimo.lcd_display_at(index, line1_text, 1)
            mimo.lcd_display_at(index, line2_text, 2)

            index += 1
예제 #10
0
    def SetupPopupLayout(self):
        self.available_minigames = get_next_pair()
        self.popup_background = utils.Sprite(
            constants.SPRITES_EDITION + 'minigames-popup.png',
            constants.VIEWPORT_CENTER_X,
            351
        )

        self.popup_title = utils.Text(
            self.current_event['hdl'][constants.language],
            self.subtitle_font,
            color = constants.PALETTE_TEXT_CYAN
        )
        self.popup_title.setAnchor(0.5, 0)
        self.popup_title.SetPosition(constants.VIEWPORT_CENTER_X, 100)

        self.popup_framing = utils.Text(
            # self.current_frame, # por si se quiere mostrar el framing generado
            'Selecciona una de las siguientes mejoras para optimizar el impacto que tendrá la noticia',
            self.normal_font,
            color= constants.PALETTE_TEXT_PURPLE
        )
        self.popup_framing.setAnchor(0, 0)
        self.popup_framing.SetPosition(
            constants.POPUP_X + 50,
            185
        )

        minigame_data_a = self.available_minigames[0]
        minigame_data_b = self.available_minigames[1]

        # minigame 1
        self.icon_back_a= utils.Sprite(
            'assets/sprites/scenes/edition/icon_frame.png',
            336,
            360
        )
        self.icon_minigame_a = utils.Sprite(
            'assets/minigame_icons/'+minigame_data_a["icon"],
            336,
            360
        )
        self.title_minigame_a = utils.Text(
            minigame_data_a["title"][constants.language],
            self.subtitle_font,
            336,
            480,
            color= constants.PALETTE_TEXT_CYAN
        )
        self.description_minigame_a = utils.Text(
            minigame_data_a["pitch"][constants.language],
            self.normal_font,
            111,
            500,
            color= constants.PALETTE_TEXT_PURPLE
        )
        self.description_minigame_a.setAnchor(0,0)

        # minigame 2
        self.icon_back_b= utils.Sprite(
            'assets/sprites/scenes/edition/icon_frame.png',
            937,
            360
        )
        self.icon_minigame_b = utils.Sprite(
            'assets/minigame_icons/'+minigame_data_b["icon"],
            937,
            360
        )
        self.title_minigame_b = utils.Text(
            minigame_data_b["title"][constants.language],
            self.subtitle_font,
            937,
            480,
            color= constants.PALETTE_TEXT_CYAN
        )

        self.description_minigame_b = utils.Text(
            minigame_data_b["pitch"][constants.language],
            self.normal_font,
            712,
            500,
            color= constants.PALETTE_TEXT_PURPLE
        )
        self.description_minigame_b.setAnchor(0,0)
예제 #11
0
    def SetupLayout(self):
        # Poner a sonar una rola
        utils.play_music(self.MX[(int(random() * 10))], -1, 0.1, 0.6)

        # El marco para la información
        self.info_frame = utils.Sprite(
            constants.SPRITES_EDITION + 'current_news-frame.png',
            constants.VIEWPORT_CENTER_X,
            182
        )

        # El icono del hecho
        self.icon = utils.Sprite(
            constants.EVENTS + self.current_event['ico']
        )
        # self.icon.Scale([0.75, 0.75])
        self.icon.SetPosition(146, 183)

        # El título del hecho y el objetivo a alcanzar con la noticia
        self.fact_title = utils.Text(
            ('fact' if constants.language == 'en' else 'hecho') +
                ': ' + self.current_event['ovw'][constants.language] +
                '\n\n' +
                ('goal' if constants.language == 'en' else 'objetivo') +
                ': ' + self.current_event['gol'][constants.language],
            self.normal_font,
            color = constants.PALETTE_TEXT_PURPLE
        )
        self.fact_title.setAnchor(0, 0)
        self.fact_title.SetPosition(274, 84)

        # TODO: reemplazar esto por un número o una barra que muestre el impacto que está generando la edición
        # El sesgo generado
        self.default_framing = 'no opinion bias set yet. select material to start framing the news.'
        if constants.language == 'es':
            self.default_framing = 'seleccione material para generar una opinión'
        self.news_framing = utils.Text(
            self.default_framing,
            self.normal_font,
            color = constants.PALETTE_TEXT_RED
        )
        self.news_framing.setAnchor(0, 0)
        self.news_framing.SetPosition(274, 218)

        # El fondo para la trama
        self.timeline_back = utils.Sprite(
            constants.SPRITES_EDITION + 'storyline-background.png',
            constants.VIEWPORT_CENTER_X,
            606
        )

        self.mtl_slots_frames = [
            utils.Sprite(constants.SPRITES_EDITION + 'mtl_slot.png', 170, 440),
            utils.Sprite(constants.SPRITES_EDITION + 'mtl_slot.png', 483, 440),
            utils.Sprite(constants.SPRITES_EDITION + 'mtl_slot.png', 797, 440),
            utils.Sprite(constants.SPRITES_EDITION + 'mtl_slot.png', 1110, 440)
        ]

        story_layout = {
            '1': {
                'en': ['hook', 170],
                'es': ['gancho', 170]
            },
            '2': {
                'en': ['plot', constants.VIEWPORT_CENTER_X],
                'es': ['argumento', constants.VIEWPORT_CENTER_X]
            },
            '3': {
                'en': ['conclusion', 1110],
                'es': ['conclusión', 1110]
            }
        }
        self.news_hook = utils.Text(
            story_layout['1'][constants.language][0],
            self.subtitle_font,
            color = constants.PALETTE_TEXT_BLACK
        )   
        self.news_hook.SetPosition(story_layout['1'][constants.language][1], 605)

        self.news_conflict = utils.Text(
            story_layout['2'][constants.language][0],
            self.subtitle_font,
            color = constants.PALETTE_TEXT_BLACK
        )
        self.news_conflict.SetPosition(story_layout['2'][constants.language][1], 605)

        self.news_conclusion = utils.Text(
            story_layout['3'][constants.language][0],
            self.subtitle_font,
            color = constants.PALETTE_TEXT_BLACK
        )
        self.news_conclusion.SetPosition(story_layout['3'][constants.language][1], 605)

        # ???
        self.popupLabel = utils.Text('popup', self.subtitle_font)
        self.popupLabel.setAnchor(0.5, 0)
        self.popupLabel.SetPosition(640, 120)

        # add da ui
        finish_edition_layout = {
            'text': {
                'en': 'press    to finish edition',
                'es': 'presiona    para terminar de editar'
            },
            'icon': {
                'en': 853,
                'es': 704
            }
        }
        self.SetupUI()
        self.render_right_progress = False
        self.right_progress_label.SetText(finish_edition_layout['text'][constants.language])
        self.right_progress_icon.SetPosition(
            finish_edition_layout['icon'][constants.language],
            645
        )
예제 #12
0
    def __init__(self):
        self.minigametitle = 'scanner.opt'
        OptimizationScene.__init__(self)
        
        self.coldown = 0
        
        self.index = 8
        self.line_color = 0xfff
        self.playing = False
        self.direction = 1
        self.mode = 1
        self.speed = 0.02
        self.level = 0
        self.displayed_figure_index = -1
        self.fails = 0
        self.detected_contact = False
        self.countdown = 45000
        self.current_time = 45000
        self.countdown_shadow = 0
        self.guess_mode = 2
        self.guess_direction = 1
        self.guess_color = False
        
        self.colors = [
            [0x00, 0x5f, 0xff], #blue 
            [0x27, 0xff, 0x93], #green
            [0xf7, 0x5a, 0xff], #pink
            [0x8b, 0x27, 0xff], #purple
            [0xea, 0xe1, 0xf3]  #white
        ]
        led_lights = []
        index = 0
        for color in self.colors:
            led_lights += [index] + color
            index += 1
        mimo.set_optimization_leds_color(led_lights)

        self.radar_matrix = [
            [0,0,0,0,0,0,0,0],
            [0,0,0,0,0,0,0,0],
            [0,0,0,0,0,0,0,0],
            [0,0,0,0,0,0,0,0],
            [0,0,0,0,0,0,0,0],
            [0,0,0,0,0,0,0,0],
            [0,0,0,0,0,0,0,0],
            [0,0,0,0,0,0,0,0]
        ]

        # load assets
        self.piece_sprites = []
        self.piece_sprites.append(utils.Sprite(constants.SPRITES_SCANNING + 'piece_blue.png', 0, 0))
        self.piece_sprites.append(utils.Sprite(constants.SPRITES_SCANNING + 'piece_green.png', 0, 0))
        self.piece_sprites.append(utils.Sprite(constants.SPRITES_SCANNING + 'piece_pink.png', 0, 0))
        self.piece_sprites.append(utils.Sprite(constants.SPRITES_SCANNING + 'piece_purple.png', 0, 0))
        self.piece_sprites.append(utils.Sprite(constants.SPRITES_SCANNING + 'piece_white.png', 0, 0))
        index = 0

        self.progress = utils.Text(
            'Nivel 1',
            self.normal_font,
            color = constants.PALETTE_TEXT_CYAN
        )
        self.progress.SetPosition(640, 160)

        # sfx and audio
        audio_path = 'assets/audio/SFX/Scanning/'
        self.MG1_ObjSort = utils.get_sound(audio_path + 'MG1_ObjSort.ogg')
        self.MG1_ObjSort.set_volume(0.6)

        audio_path = 'assets/audio/SFX/Scanning/'
        self.MG1_Sweep = utils.get_sound(audio_path + 'MG1_Sweep.ogg')
        self.MG1_Sweep.set_volume(1.0)

        audio_path = 'assets/audio/SFX/Scanning/'
        self.MG1_Success = utils.get_sound(audio_path + 'MG1_Success.ogg')
        self.MG1_Success.set_volume(1)

        audio_path = 'assets/audio/SFX/Scanning/'
        self.MG1_Failed = utils.get_sound(audio_path + 'MG1_Failed.ogg')
        self.MG1_Failed.set_volume(1)

        self.NextFigure()
예제 #13
0
    def __init__(self):
        SceneBase.__init__(self)

        mimo.set_led_brightness(50)

        self.mimo_blueprint = utils.Sprite('assets/sprites/mimo_blueprint.png',
                                           640, 265)
        self.mimo_blueprint.opacity = 0

        self.printer01 = utils.Sprite('assets/sprites/printer-01.png', 380,
                                      181)
        self.printer02 = utils.Sprite('assets/sprites/printer-02.png', 380,
                                      181)
        self.printer03 = utils.Sprite('assets/sprites/printer-03.png', 380,
                                      181)
        self.printer01.opacity = 0
        self.printer02.opacity = 0
        self.printer03.opacity = 0
        self.printer01.setAnchor(0.5, 1)
        self.printer02.setAnchor(0.5, 1)
        self.printer03.setAnchor(0.5, 1)

        self.materialL1 = utils.Sprite('assets/sprites/mtlL1.png', 301, 292)
        self.materialL2 = utils.Sprite('assets/sprites/mtlL2.png', 301, 365)
        self.materialL3 = utils.Sprite('assets/sprites/mtlL3.png', 301, 443)
        self.materialR1 = utils.Sprite('assets/sprites/mtlR1.png', 979, 292)
        self.materialR2 = utils.Sprite('assets/sprites/mtlR2.png', 979, 365)
        self.materialR3 = utils.Sprite('assets/sprites/mtlR3.png', 979, 443)
        self.materialL1.opacity = 0
        self.materialL2.opacity = 0
        self.materialL3.opacity = 0
        self.materialR1.opacity = 0
        self.materialR2.opacity = 0
        self.materialR3.opacity = 0

        self.opt_knobs = utils.Sprite('assets/sprites/opt_knobs.png', 640, 325)
        self.opt_buttons = utils.Sprite('assets/sprites/opt_buttons.png', 640,
                                        447)
        self.opt_knobs.opacity = 0
        self.opt_buttons.opacity = 0

        self.sfx_tut_st = utils.get_sound('assets/audio/SFX/SFX_Tut_St.ogg')
        self.sfx_tut_print = utils.get_sound(
            'assets/audio/SFX/SFX_Tut_Print.ogg')
        self.sfx_tut_mat = utils.get_sound('assets/audio/SFX/SFX_Tut_Mat.ogg')
        self.sfx_tut_opt = utils.get_sound('assets/audio/SFX/SFX_Tut_Opt.ogg')
        self.sfx_tut_end = utils.get_sound('assets/audio/SFX/SFX_Tut_End.ogg')

        titlefont = pygame.font.Font("assets/fonts/VCR_OSD_MONO_1.001.ttf", 44)
        self.title = utils.Text("", titlefont)
        self.title.SetPosition(1280 / 2, 546)

        subtitlefont = pygame.font.Font("assets/fonts/VCR_OSD_MONO_1.001.ttf",
                                        32)
        self.subtitle = utils.Text("", subtitlefont)
        self.subtitle.SetPosition(1280 / 2, 610)

        # second 0
        second = 0
        self.AddTween("easeOutCubic", 2, self.mimo_blueprint, "opacity", 0,
                      255, second)
        # second 2
        second = 2
        self.AddTrigger(second, self.sfx_tut_st, 'play')
        self.AddTrigger(second, self.title, 'SetText',
                        '-- M.I.M.O. VERIFICATION PROCESS --')

        # second 4
        second = 4
        self.AddTween("easeOutCubic", 0.5, self.mimo_blueprint, "opacity", 255,
                      64, second)
        self.AddTween("easeOutCubic", 1, self.printer01, "opacity", 0, 255,
                      second)

        # second 5
        second = 5.5
        self.AddTrigger(second, self.sfx_tut_print, 'play')
        self.AddTrigger(second, self.printer01, 'SetOpacity', 0)
        self.AddTrigger(second, self.printer02, 'SetOpacity', 255)
        self.AddTrigger(second, self.title, 'SetText', 'VERIFYING PRINTER')
        self.AddTrigger(
            second, self.subtitle, 'SetText',
            'READ EACH INCOMING EVENT AND USE THE MATERIAL\nATTACHED TO IT TO TRANSFORM IT INTO THE NEWS'
        )
        second = 6
        self.AddTrigger(second, self.printer02, 'SetOpacity', 0)
        self.AddTrigger(second, self.printer03, 'SetOpacity', 255)
        second = 6.5
        self.AddTrigger(second, self.printer03, 'SetOpacity', 0)
        self.AddTrigger(second, self.printer01, 'SetOpacity', 255)
        second = 7
        self.AddTrigger(second, self.printer01, 'SetOpacity', 0)
        self.AddTrigger(second, self.printer02, 'SetOpacity', 255)
        second = 7.5
        self.AddTrigger(second, self.printer02, 'SetOpacity', 0)
        self.AddTrigger(second, self.printer03, 'SetOpacity', 255)
        second = 8
        self.AddTrigger(second, self.printer03, 'SetOpacity', 0)
        self.AddTrigger(second, self.printer01, 'SetOpacity', 255)
        second = 8.5
        self.AddTrigger(second, self.printer01, 'SetOpacity', 0)
        self.AddTrigger(second, self.printer02, 'SetOpacity', 255)
        second = 9
        self.AddTrigger(second, self.printer02, 'SetOpacity', 0)
        self.AddTrigger(second, self.printer03, 'SetOpacity', 255)
        self.AddTrigger(second, mimo, 'termal_print',
                        "System check\nveryfing printer")

        second = 10.5
        self.AddTrigger(second, self.printer03, 'SetOpacity', 0)
        self.AddTrigger(second, self.sfx_tut_mat, 'play')
        self.AddTrigger(second, self.title, 'SetText',
                        'VERIFYING MATERIAL PANEL')
        self.AddTrigger(
            second, self.subtitle, 'SetText',
            'PRESS EACH BUTTON TO SELECT THE MATERIAL\nYOU WANT TO USE TO EVOKE AN EMOTION IN THE CURRENT NEWS'
        )

        self.AddTween('easeOutCubic', 0.5, self.materialL1, "opacity", 0, 255,
                      second)
        self.AddTrigger(10.7, mimo, 'set_material_leds_color', [0, 255, 0, 0])
        second = 11.5
        self.AddTween('easeOutCubic', 0.5, self.materialL2, "opacity", 0, 255,
                      second)
        self.AddTrigger(11.7, mimo, 'set_material_leds_color',
                        [1, 255, 255, 255])
        second = 12.5
        self.AddTween('easeOutCubic', 0.5, self.materialL3, "opacity", 0, 255,
                      second)
        self.AddTrigger(12.7, mimo, 'set_material_leds_color', [2, 0, 255, 0])
        second = 13.5
        self.AddTween('easeOutCubic', 0.5, self.materialR1, "opacity", 0, 255,
                      second)
        self.AddTrigger(13.7, mimo, 'set_material_leds_color',
                        [7, 255, 255, 0])
        second = 14.5
        self.AddTween('easeOutCubic', 0.5, self.materialR2, "opacity", 0, 255,
                      second)
        self.AddTrigger(14.7, mimo, 'set_material_leds_color',
                        [6, 0, 255, 255])
        second = 15.5
        self.AddTween('easeOutCubic', 0.5, self.materialR3, "opacity", 0, 255,
                      second)
        self.AddTrigger(15.7, mimo, 'set_material_leds_color',
                        [5, 255, 0, 255])

        second = 16.5
        self.AddTween('easeOutCubic', 0.5, self.materialL1, "opacity", 255, 0,
                      second)
        self.AddTween('easeOutCubic', 0.5, self.materialL2, "opacity", 255, 0,
                      second)
        self.AddTween('easeOutCubic', 0.5, self.materialL3, "opacity", 255, 0,
                      second)
        self.AddTween('easeOutCubic', 0.5, self.materialR1, "opacity", 255, 0,
                      second)
        self.AddTween('easeOutCubic', 0.5, self.materialR2, "opacity", 255, 0,
                      second)
        self.AddTween('easeOutCubic', 0.5, self.materialR3, "opacity", 255, 0,
                      second)
        self.AddTrigger(17, mimo, 'set_material_leds_color', [
            0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 7, 0, 0, 0, 6, 0, 0, 0, 5, 0,
            0, 0
        ])

        second = 18
        self.AddTrigger(second, self.sfx_tut_opt, 'play')
        self.AddTrigger(second, self.title, 'SetText',
                        'VERIFYING OPTIMIZATION PANEL')
        self.AddTrigger(
            second, self.subtitle, 'SetText',
            'USE THE KNOBS AND BUTTONS TO IMPROVE THE IMPACT\nOF THE EVOKED EMOTION'
        )
        self.AddTween('easeOutCubic', 4, self.opt_knobs, "opacity", 0, 255,
                      second)
        self.AddTween('easeOutCubic', 5, self.opt_buttons, "opacity", 0, 255,
                      second)

        second = 24
        self.AddTrigger(second, self.sfx_tut_end, 'play')
        self.AddTrigger(second, self.title, 'SetText',
                        '-- M.I.M.O. VERIFICATION COMPLETE --')
        self.AddTrigger(
            second, self.subtitle, 'SetText',
            'ALL SYSTEMS WORKING.\nWELCOME!\nYOU CAN START MANUFACTURING THE NEWS.'
        )
예제 #14
0
    def __init__(self):
        SceneBase.__init__(self)
        mimo.reset()

        self.logo = utils.Sprite('assets/sprites/logo_MCorp.png', 1280 / 2,
                                 720 / 2)
        self.logo.opacity = 0

        self.sfx_mimo_logo = utils.get_sound('assets/audio/SFX/MimoLogo.ogg')

        self.AddTween("easeInOutSine", 2, self.logo, "opacity", 0, 255, 1)
        self.AddTrigger(1, self.sfx_mimo_logo, 'play')

        #self.comm.opt.set_led_brightness(50)
        #mimo.set_led_brightness(250)
        #self.comm.opt.lock_buttons([3, 0, 4, 0])
        #mimo.set_optimization_leds_color([0, 255, 0, 0])
        #mimo.set_optimization_leds_color([1, 0, 255, 0])
        #mimo.set_optimization_leds_color([2, 0, 0, 255])
        #mimo.set_optimization_leds_color([3, 255, 0, 0])
        #mimo.set_optimization_leds_color([4, 255, 255, 255])
        #mimo.set_independent_lights(False, True)
        #mimo.set_independent_lights(True, True)
        #mimo.set_buttons_enable_status(True, True)
        #mimo.set_optimization_buttons_lock_status([0,0,1,0,2,0,3,0,4,0])
        #mimo.set_material_buttons_lock_status([0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0])
        #mimo.set_tunners_enable_status(False)
        #mimo.set_optimization_leds_color([2, 255,0,255])
        #mimo.set_optimization_leds_color([5, 255,0,255])
        #mimo.set_optimization_leds_color([19, 255,0,255])
        #mimo.set_optimization_leds_color([27, 255,0,0])
        #mimo.set_optimization_leds_color([28, 255,255])
        #mimo.set_optimization_leds_color([29, 255,0,255])
        #mimo.set_optimization_leds_color([30, 255,0,255])
        factor = 0.05
        loops = 100
        n_leds = 64 + 5
        #for index in range(0, n_leds*loops):
        #    self.AddTrigger((1+index)*factor, mimo, 'set_optimization_leds_color', [index%n_leds, int(random.random()*255), int(random.random()*255), int(random.random()*255)])
        #    self.AddTrigger((1+index+0.9)*factor, mimo, 'set_optimization_leds_color', [index%n_leds, 0, 0, 0])

        n_leds = 64
        leds = list(range(0, 64))
        #for index in range(0, n_leds*loops):
        #    led_i = leds[index%n_leds] + 5
        #    self.AddTrigger((1.5+index)*factor, mimo, 'set_optimization_leds_color', [led_i, int(random.random()*255), int(random.random()*255), int(random.random()*255)])
        #    self.AddTrigger((1.5+index+0.9)*factor, mimo, 'set_optimization_leds_color', [led_i, 0, 0, 0])
        #self.comm.opt.activate_buttons(True)
        mimo.set_buttons_enable_status(True, True)
        mimo.set_independent_lights(False, False)
        mimo.set_led_brightness(250)
        mimo.set_material_buttons_lock_status(
            [0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0])
        mimo.set_material_buttons_mode(
            [0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0])
        mimo.set_optimization_buttons_lock_status(
            [0, 0, 1, 0, 2, 0, 3, 0, 4, 0])
        mimo.set_optimization_buttons_mode([0, 0, 1, 0, 2, 0, 3, 0, 4, 0])
        #self.comm.opt.activate_tunners(False)
        #mimo.set_tunners_enable_status(False)
        #self.comm.opt.set_independent_lights(False)
        #self.comm.opt.clean_matrix()
        #graphics.clear()

        #self.AddTrigger(0, self.comm.mat, 'set_led_light', [1, 125, 125, 0, 1, 255, 255, 0])
        #self.AddTrigger(1, mimo, 'set_material_leds_color', [0, 125, 125, 0, 1, 255, 255, 0])
        #self.AddTrigger(2, self.comm.mat, 'set_led_light', [7, 0, 255, 0])
        #self.AddTrigger(2, mimo, 'set_material_leds_color', [7, 0, 255, 0])
        #self.AddTrigger(3, self.comm.opt, 'set_led_light', [0, 255, 0, 0])
        # debe prender el led del boton de  optimizacion 0
        #self.AddTrigger(3, mimo, 'set_optimization_leds_color', [10, 255, 0, 0])

        mimo.set_tunners_enable_status(True)
        #self.testSprite = AnimatedNeoSprite('assets/tilesprite.png')
        self.testSprite = AnimatedNeoSprite('assets/palomita.png')
        #self.testSprite.setFrameRate(8)
        #self.testSprite.playing = True
        self.label = TextNeoSprite("people")
        #
        self.label.y = 2
        #
        font = pygame.font.Font("assets/fonts/VCR_OSD_MONO_1.001.ttf", 36)
        self.title = utils.Text("Hello Machinaria!", font)
        self.title.opacity = 0
        self.title.SetPosition(400, 200)
        self.AddTween("easeInOutSine", 2, self.title, "opacity", 0, 255, 1)
예제 #15
0
    def __init__(self):
        self.minigametitle = 'focus.opt'
        OptimizationScene.__init__(self)

        self.pieces = []
        self.rendering_order = [0,1,2,3,4]
        self.render_background = True
        self.customRotation = 0
        self.correct_pieces = 0
        self.current_time = 20000

        # Agregar las cosas pa' renderizar en la pantalla
        self.background = utils.Sprite(
            constants.SPRITES_FOCUS + 'focus-background.png', 
            1280/2,
            720/2
        )
        self.pieces.append(
            utils.Sprite(constants.SPRITES_FOCUS + 'focus-pieceA.png', 418, 336)
        )
        self.pieces.append(
            utils.Sprite(constants.SPRITES_FOCUS + 'focus-pieceB.png', 640, 331)
        )
        self.pieces.append(
            utils.Sprite(constants.SPRITES_FOCUS + 'focus-pieceC.png', 859, 336)
        )
        self.pieces.append(
            utils.Sprite(constants.SPRITES_FOCUS + 'focus-pieceD.png', 533, 447)
        )
        self.pieces.append(
            utils.Sprite(constants.SPRITES_FOCUS + 'focus-pieceE.png', 747, 447)
        )

        self.progress = utils.Text(
            '0 de 5',
            self.normal_font,
            color = constants.PALETTE_TEXT_CYAN
        )
        self.progress.SetPosition(640, 160)

        for piece in self.pieces:
            rotation = int(random()*4)
            if rotation == 0:
                rotation += 1
            piece.Rotate(rotation*90)
            if rotation == 0:
                self.correct_pieces += 1

        self.locked_pieces = [False, False, False, False, False]

        # sfx and audio
        audio_path = 'assets/audio/SFX/Focus/'
        self.MG2_Turn = utils.get_sound(audio_path + 'MG2_Turn.ogg')
        self.MG2_Turn.set_volume(0.4)

        self.MG2_Pos = []
        self.MG2_Pos.append(utils.get_sound(audio_path + 'MG2_Pos_01.ogg'))
        self.MG2_Pos.append(utils.get_sound(audio_path + 'MG2_Pos_02.ogg'))
        self.MG2_Pos.append(utils.get_sound(audio_path + 'MG2_Pos_03.ogg'))
        self.MG2_Pos.append(utils.get_sound(audio_path + 'MG2_Pos_04.ogg'))
        self.MG2_Pos.append(utils.get_sound(audio_path + 'MG2_Pos_05.ogg'))

        self.sfx_pieces = []
        self.sfx_pieces.append(utils.get_sound(audio_path + 'MG2_SFX_A.ogg'))
        self.sfx_pieces.append(utils.get_sound(audio_path + 'MG2_SFX_B.ogg'))
        self.sfx_pieces.append(utils.get_sound(audio_path + 'MG2_SFX_C.ogg'))
        self.sfx_pieces.append(utils.get_sound(audio_path + 'MG2_SFX_D.ogg'))
        self.sfx_pieces.append(utils.get_sound(audio_path + 'MG2_SFX_E.ogg'))

        for sfx in self.sfx_pieces:
            sfx.set_volume(0.1)
            sfx.play(-1)

        self.UI_OptWin = utils.get_sound('assets/audio/SFX/M_OS/UI_OptWin.ogg')
        self.UI_OptWin.set_volume(0.5)

        self.UI_OptFail = utils.get_sound('assets/audio/SFX/M_OS/UI_OptFail.ogg')
        self.UI_OptFail.set_volume(1)

        # base loop
        utils.play_music(audio_path + 'MG2_BasicLoop.ogg', -1, 0.1)