コード例 #1
0
ファイル: outings.py プロジェクト: IlyaFaer/ForwardOnlyGame
    def hide_outing(self):
        """Hide all the outings gui."""
        self._upcome_text.hide()
        self._upcome_ico.hide()

        if self.is_shown:
            self._assignees.clear()

            self._list.hide()
            self.is_shown = False
            clear_wids(self._outing_widgets)
コード例 #2
0
ファイル: __init__.py プロジェクト: IlyaFaer/ForwardOnlyGame
    def _check_can_save(self, task):
        """Check if the game can be saved right now.

        If the game can't be saved, the cause will
        be shown under the "Save game" button.
        """
        if base.world.is_on_et:  # noqa: F821
            cause = base.labels.MAIN_MENU[16]  # noqa: F821
        elif base.world.is_in_city:  # noqa: F821
            cause = base.labels.MAIN_MENU[17]  # noqa: F821
        elif base.world.is_near_fork:  # noqa: F821
            cause = base.labels.MAIN_MENU[18]  # noqa: F821
        elif base.train.ctrl.critical_damage:  # noqa: F821
            cause = base.labels.MAIN_MENU[19]  # noqa: F821
        elif base.current_block.id < 4:  # noqa: F821
            cause = base.labels.MAIN_MENU[20]  # noqa: F821
        else:
            cause = None

        if cause:
            if self._save_blocked_lab is None:
                self._save_blocked_lab = DirectLabel(
                    parent=self._main_fr,
                    pos=(-1.12, 0, 0.26),
                    frameColor=(0, 0, 0, 0),
                    text_scale=0.026,
                    text_fg=SILVER_COL,
                    text=cause,
                    text_font=base.main_font,  # noqa: F821
                    text_align=TextNode.ALeft,
                )
            self._save_blocked_lab["text"] = cause
            self._save_but["text_fg"] = SILVER_COL
            self._save_but["command"] = None
            clear_wids(self.save_wids)
        else:
            self._save_but["text_fg"] = RUST_COL
            self._save_but["command"] = self._show_slots
            if self._save_blocked_lab is not None:
                self._save_blocked_lab.destroy()
                self._save_blocked_lab = None

        return task.again
コード例 #3
0
    def show(self):
        """Show/hide railways scheme GUI."""
        if (self.is_shown or base.world.outings_mgr.gui_is_shown  # noqa: F821
                or base.traits_gui.is_shown  # noqa: F821
            ):
            self._close_snd.play()
            self._list.hide()
            taskMgr.remove("update_scheme_arrow")  # noqa: F821

            clear_wids(self._temp_wids)
        else:
            if base.world.is_on_et:  # noqa: F821
                return

            self._open_snd.play()
            taskMgr.doMethodLater(  # noqa: F821
                0.2, self._update_arrow, "update_scheme_arrow")
            self._fill_scheme()
            self._list.show()
            base.char_gui.clear_char_info(True)  # noqa: F821

        self.is_shown = not self.is_shown
コード例 #4
0
ファイル: main.py プロジェクト: IlyaFaer/ForwardOnlyGame
    def save_game(self, num):
        """Save the current game description into a file.

        Args:
            num (int): The save slot number.
        """
        clear_wids(self.main_menu.save_wids)
        self.world.save_map(num)

        save = shelve.open("saves/save{}".format(num))

        save["save_time"] = time.strftime("%a, %d %b %Y %H:%M",
                                          time.localtime())
        save["cur_blocks"] = self.world.current_blocks
        save["last_angle"] = self.world.last_cleared_block_angle
        save["enemy_score"] = self.world.enemy.score
        save["disease_threshold"] = self.world.disease_threshold
        save["stench_step"] = self.world.stench_step
        save["heads"] = self.heads

        save["train"] = self.train.description
        save["dollars"] = self.dollars
        save["medicine_boxes"] = self.resource("medicine_boxes")
        save["smoke_filters"] = self.resource("smoke_filters")
        save["stimulators"] = self.resource("stimulators")
        save["cohesion"] = self.team.current_cohesion
        save["day_part"] = {
            "name": self.world.sun.day_part,
            "time": self.world.sun.day_part_time,
        }
        save["team"] = self.team.description
        save["chapter"] = self.scenario.current_chapter
        save["city_visit_num"] = self.world.city_gui.visit_num
        save["winned"] = self.journal.winned
        save["helped_children"] = self.helped_children
        save["decisions"] = self.decisions

        save.close()
コード例 #5
0
ファイル: __init__.py プロジェクト: IlyaFaer/ForwardOnlyGame
    def hide(self):
        """Hide the main menu."""
        self._main_fr.hide()
        clear_wids(self.save_wids)
        clear_wids(self.conf_wids)
        clear_wids(self.cred_wids)

        if self._load_screen is not None:
            self._load_screen.destroy()
            self._load_screen = None

        base.accept("escape", self.show)  # noqa: F821
        taskMgr.remove("check_can_save")  # noqa: F821
コード例 #6
0
ファイル: character.py プロジェクト: IlyaFaer/ForwardOnlyGame
    def _show_char_desc(self):
        """Show detailed character description.

        Includes description of every character's
        trait and their current status.
        """
        if self._char_desc_shown:
            self._fr["frameSize"] = (-0.31, 0.31, -0.1, 0.115)
            clear_wids(self._char_desc_wids)
            self._status_lab = None
        else:
            shift = 0.7
            self._fr["frameSize"] = (-0.31, 0.31, -0.1, shift)
            shift -= 0.06
            self._char_desc_wids.append(
                DirectLabel(
                    parent=self._fr,
                    # Traits
                    text=base.labels.CHARACTERS[5],  # noqa: F821,
                    text_font=base.main_font,  # noqa: F821,
                    frameSize=(0.1, 0.1, 0.1, 0.1),
                    text_scale=0.03,
                    text_fg=RUST_COL,
                    pos=(-0.225, 0, shift),
                )
            )
            if self.char.id in base.team.chars.keys():  # noqa: F821
                traits_but = DirectButton(
                    parent=self._fr,
                    text="",
                    frameSize=(-0.025, 0.025, -0.025, 0.025),
                    frameTexture=GUI_PIC + "like.png",
                    relief="flat",
                    pos=(0.265, 0, shift + 0.013),
                    command=base.traits_gui.show,  # noqa: F821
                )
                traits_but.bind(
                    DGG.ENTER, self._highlight_traits_but, extraArgs=[traits_but]
                )
                traits_but.bind(
                    DGG.EXIT, self._dehighlight_traits_but, extraArgs=[traits_but]
                )

                self._char_desc_wids.append(traits_but)

            shift = self._fill_traits(shift)

            self._status_lab = DirectLabel(  # Status
                parent=self._fr,
                # Status
                text=base.labels.CHARACTERS[4],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.03,
                text_fg=RUST_COL,
                pos=(-0.221, 0, shift),
            )
            self._char_desc_wids.append(self._status_lab)
            self._fill_status(shift)

        self._char_desc_shown = not self._char_desc_shown
コード例 #7
0
ファイル: resources.py プロジェクト: IlyaFaer/ForwardOnlyGame
    def _show_expendable_resources(self):
        """Show/hide expendable resources description."""
        if self._res_desc_shown:
            self._res_frame["frameSize"] = (-0.37, 0.37, -0.03, 0.028)

            clear_wids(self._res_desc_wids)
            self._res_desc_shown = False
            return

        self._res_desc_shown = True
        self._res_frame["frameSize"] = (-0.37, 0.37, -0.51, 0.028)
        self._res_desc_wids.append(
            DirectLabel(
                parent=self._res_frame,
                text=base.labels.RESOURCES[0],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.033,
                text_fg=SILVER_COL,
                pos=(0, 0, -0.08),
            )
        )
        self._res_desc_wids.append(
            DirectButton(
                parent=self._res_frame,
                frameSize=(-0.03, 0.03, -0.03, 0.03),
                frameTexture=GUI_PIC + "medicine.png",
                pos=(-0.29, 0, -0.15),
                relief="flat",
            )
        )
        self._res_desc_wids.append(
            DirectLabel(
                parent=self._res_frame,
                text=base.labels.RESOURCES[1],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.03,
                text_align=TextNode.ALeft,
                text_fg=SILVER_COL,
                pos=(-0.235, 0, -0.137),
            )
        )
        self._res_desc_wids.append(
            DirectLabel(
                parent=self._res_frame,
                text=base.labels.RESOURCES[2],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.029,
                text_align=TextNode.ALeft,
                text_fg=SILVER_COL,
                pos=(-0.235, 0, -0.175),
            )
        )
        self._res_desc_wids.append(
            DirectButton(
                parent=self._res_frame,
                frameSize=(-0.03, 0.03, -0.03, 0.03),
                frameTexture=GUI_PIC + "smoke_filter.png",
                pos=(-0.29, 0, -0.24),
                relief="flat",
            )
        )
        self._res_desc_wids.append(
            DirectLabel(
                parent=self._res_frame,
                text=base.labels.RESOURCES[3],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.03,
                text_align=TextNode.ALeft,
                text_fg=SILVER_COL,
                pos=(-0.235, 0, -0.233),
            )
        )
        self._res_desc_wids.append(
            DirectLabel(
                parent=self._res_frame,
                text=base.labels.RESOURCES[4],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.029,
                text_align=TextNode.ALeft,
                text_fg=SILVER_COL,
                pos=(-0.235, 0, -0.27),
            )
        )
        self._res_desc_wids.append(
            DirectButton(
                parent=self._res_frame,
                frameSize=(-0.018, 0.018, -0.028, 0.028),
                frameTexture=GUI_PIC + "stimulator.png",
                pos=(-0.29, 0, -0.339),
                relief="flat",
            )
        )
        self._res_desc_wids.append(
            DirectLabel(
                parent=self._res_frame,
                text=base.labels.RESOURCES[5],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.03,
                text_align=TextNode.ALeft,
                text_fg=SILVER_COL,
                pos=(-0.235, 0, -0.327),
            )
        )
        self._res_desc_wids.append(
            DirectLabel(
                parent=self._res_frame,
                text=base.labels.RESOURCES[6],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.029,
                text_align=TextNode.ALeft,
                text_fg=SILVER_COL,
                pos=(-0.235, 0, -0.365),
            )
        )
        self._res_desc_wids.append(
            DirectButton(
                parent=self._res_frame,
                frameSize=(-0.03, 0.03, -0.03, 0.03),
                frameTexture=GUI_PIC + "places_of_interest.png",
                pos=(-0.29, 0, -0.438),
                relief="flat",
            )
        )
        self._res_desc_wids.append(
            DirectLabel(
                parent=self._res_frame,
                text=base.labels.RESOURCES[8],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.03,
                text_align=TextNode.ALeft,
                text_fg=SILVER_COL,
                pos=(-0.235, 0, -0.426),
            )
        )
        self._res_desc_wids.append(
            DirectLabel(
                parent=self._res_frame,
                text=base.labels.RESOURCES[9],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.029,
                text_align=TextNode.ALeft,
                text_fg=SILVER_COL,
                pos=(-0.235, 0, -0.464),
            )
        )
コード例 #8
0
ファイル: resources.py プロジェクト: IlyaFaer/ForwardOnlyGame
    def _show_cohesion_abilities(self):
        """Show/hide cohesion abilities description."""
        if self._coh_desc_shown:
            self._coh_frame["frameSize"] = (-0.55, 0.55, -0.05, 0.05)

            clear_wids(self._coh_desc_wids)
            self._coh_desc_shown = False
            return

        self._coh_desc_shown = True
        self._coh_frame["frameSize"] = (-0.55, 0.55, -0.61, 0.05)
        self._coh_desc_wids.append(
            DirectLabel(
                parent=self._coh_frame,
                text=base.labels.COHESION[0],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.033,
                text_fg=SILVER_COL,
                pos=(0, 0, -0.08),
            )
        )
        self._coh_desc_wids.append(
            DirectButton(
                parent=self._coh_frame,
                frameSize=(-0.035, 0.035, -0.035, 0.035),
                frameTexture=GUI_PIC + "recall.png",
                pos=(-0.45, 0, -0.13),
                relief="flat",
            )
        )

        x_coor = -0.39
        self._coh_desc_wids.append(
            DirectLabel(
                parent=self._coh_frame,
                text=base.labels.COHESION[1],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                text_align=TextNode.ALeft,
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.029,
                text_fg=SILVER_COL,
                pos=(x_coor, 0, -0.117),
            )
        )
        self._coh_desc_wids.append(
            DirectLabel(
                parent=self._coh_frame,
                text=base.labels.COHESION[2],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                text_align=TextNode.ALeft,
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.028,
                text_fg=SILVER_COL,
                pos=(x_coor, 0, -0.155),
            )
        )
        self._coh_desc_wids.append(
            DirectButton(
                parent=self._coh_frame,
                frameSize=(-0.045, 0.045, -0.045, 0.045),
                frameTexture=GUI_PIC + "cover.png",
                pos=(-0.45, 0, -0.22),
                relief="flat",
            )
        )
        self._coh_desc_wids.append(
            DirectLabel(
                parent=self._coh_frame,
                text=base.labels.COHESION[3],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                text_align=TextNode.ALeft,
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.029,
                text_fg=SILVER_COL,
                pos=(x_coor, 0, -0.217),
            )
        )
        self._coh_desc_wids.append(
            DirectLabel(
                parent=self._coh_frame,
                text=base.labels.COHESION[4],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                text_align=TextNode.ALeft,
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.028,
                text_fg=SILVER_COL,
                pos=(x_coor, 0, -0.255),
            )
        )
        self._coh_desc_wids.append(
            DirectButton(
                parent=self._coh_frame,
                frameSize=(-0.035, 0.035, -0.035, 0.035),
                frameTexture=GUI_PIC + "heal.png",
                pos=(-0.45, 0, -0.33),
                relief="flat",
            )
        )
        self._coh_desc_wids.append(
            DirectLabel(
                parent=self._coh_frame,
                text=base.labels.COHESION[5],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                text_align=TextNode.ALeft,
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.029,
                text_fg=SILVER_COL,
                pos=(x_coor, 0, -0.317),
            )
        )
        self._coh_desc_wids.append(
            DirectLabel(
                parent=self._coh_frame,
                text=base.labels.COHESION[6],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                text_align=TextNode.ALeft,
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.028,
                text_fg=SILVER_COL,
                pos=(x_coor, 0, -0.355),
            )
        )
        self._coh_desc_wids.append(
            DirectButton(
                parent=self._coh_frame,
                frameSize=(-0.045, 0.045, -0.045, 0.045),
                frameTexture=GUI_PIC + "rage.png",
                pos=(-0.45, 0, -0.43),
                relief="flat",
            )
        )
        self._coh_desc_wids.append(
            DirectLabel(
                parent=self._coh_frame,
                text=base.labels.COHESION[7],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                text_align=TextNode.ALeft,
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.029,
                text_fg=SILVER_COL,
                pos=(x_coor, 0, -0.417),
            )
        )
        self._coh_desc_wids.append(
            DirectLabel(
                parent=self._coh_frame,
                text=base.labels.COHESION[8],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                text_align=TextNode.ALeft,
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.028,
                text_fg=SILVER_COL,
                pos=(x_coor, 0, -0.455),
            )
        )
        self._coh_desc_wids.append(
            DirectButton(
                parent=self._coh_frame,
                frameSize=(-0.043, 0.043, -0.043, 0.043),
                frameTexture=GUI_PIC + "heart.png",
                pos=(-0.45, 0, -0.53),
                relief="flat",
            )
        )
        self._coh_desc_wids.append(
            DirectLabel(
                parent=self._coh_frame,
                text=base.labels.COHESION[9],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                text_align=TextNode.ALeft,
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.029,
                text_fg=SILVER_COL,
                pos=(x_coor, 0, -0.517),
            )
        )
        self._coh_desc_wids.append(
            DirectLabel(
                parent=self._coh_frame,
                text=base.labels.COHESION[10],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                text_align=TextNode.ALeft,
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.028,
                text_fg=SILVER_COL,
                pos=(x_coor, 0, -0.555),
            )
        )
コード例 #9
0
    def _show_party(self, shift):
        """Show units management tab.

        Args:
            shift (float): Z-coordinate.
        """
        clear_wids(self._temp_wids)

        self._party_but["text_fg"] = SILVER_COL
        self._train_but["text_fg"] = RUST_COL

        shift -= 0.07
        # the crew GUI
        self._temp_wids.append(
            DirectLabel(  # Crew
                parent=self._fr,
                text=base.labels.CITY[9],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                text_align=TextNode.ALeft,
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.035,
                text_fg=RUST_COL,
                pos=(-0.3, 0, shift),
            ))

        self._char_chooser = CharacterChooser()
        self._char_chooser.prepare(
            self._fr,
            (0, 0, 0.45),
            base.team.chars  # noqa: F821
        )
        self._temp_wids.append(self._char_chooser)

        shift -= 0.14
        self._temp_wids.append(
            DirectLabel(  # Health
                parent=self._fr,
                frameColor=(0, 0, 0, 0.3),
                text_fg=SILVER_COL,
                text=base.labels.CHARACTERS[2],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                text_scale=0.03,
                pos=(-0.2, 0, shift),
            ))
        self._temp_wids.append(
            DirectButton(
                parent=self._fr,
                pos=(-0.05, 0, shift + 0.02),
                text_fg=SILVER_COL,
                text="+10\n10$",
                scale=(0.075, 0, 0.075),
                relief=None,
                text_scale=0.45,
                command=self._heal,
                extraArgs=[10],
            ))
        self._temp_wids.append(
            DirectButton(
                parent=self._fr,
                pos=(0.07, 0, shift + 0.02),
                text_fg=SILVER_COL,
                text="+50\n50$",
                scale=(0.075, 0, 0.075),
                relief=None,
                text_scale=0.45,
                command=self._heal,
                extraArgs=[50],
            ))
        shift -= 0.1
        self._temp_wids.append(
            DirectLabel(  # Energy
                parent=self._fr,
                frameColor=(0, 0, 0, 0.3),
                text_fg=SILVER_COL,
                text=base.labels.CHARACTERS[3],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                text_scale=0.03,
                pos=(-0.2, 0, shift),
            ))
        self._temp_wids.append(
            DirectButton(
                parent=self._fr,
                pos=(-0.05, 0, shift + 0.02),
                text_fg=SILVER_COL,
                text="+10\n5$",
                scale=(0.075, 0, 0.075),
                relief=None,
                text_scale=0.45,
                command=self._rest,
                extraArgs=[10],
            ))
        self._temp_wids.append(
            DirectButton(
                parent=self._fr,
                pos=(0.07, 0, shift + 0.02),
                text_fg=SILVER_COL,
                text="+50\n25$",
                scale=(0.075, 0, 0.075),
                relief=None,
                text_scale=0.45,
                command=self._rest,
                extraArgs=[50],
            ))
        shift -= 0.08
        self._temp_wids.append(
            DirectButton(  # Leave unit
                parent=self._fr,
                pos=(0.2, 0, shift),
                text_fg=SILVER_COL,
                text=base.labels.CITY[12],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                scale=(0.075, 0, 0.075),
                relief=None,
                text_scale=0.45,
                command=self._send_away,
            ))
        shift -= 0.08
        # recruits gui
        self._temp_wids.append(
            DirectLabel(  # Recruits
                parent=self._fr,
                text=base.labels.CITY[10],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                text_align=TextNode.ALeft,
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.035,
                text_fg=RUST_COL,
                pos=(-0.3, 0, shift),
            ))

        shift -= 0.13
        hire_but = DirectButton(  # Hire unit
            parent=self._fr,
            pos=(0.2, 0, shift),
            text_fg=SILVER_COL,
            text=base.labels.CITY[13],  # noqa: F821
            text_font=base.main_font,  # noqa: F821
            scale=(0.075, 0, 0.075),
            relief=None,
            text_scale=0.45,
            command=self._hire,
        )
        self._temp_wids.append(hire_but)

        self._recruit_chooser = RecruitChooser(hire_but)
        self._recruit_chooser.prepare(self._fr, (0, 0, 0.05), self._recruits)
        self._temp_wids.append(self._recruit_chooser)

        shift -= 0.08
        # expendable resources
        self._temp_wids.append(
            DirectLabel(  # Resources
                parent=self._fr,
                text=base.labels.CITY[11],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                text_align=TextNode.ALeft,
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.035,
                text_fg=RUST_COL,
                pos=(-0.3, 0, shift),
            ))
        shift -= 0.12
        buy_res_but = DirectButton(  # Buy
            parent=self._fr,
            pos=(0.08, 0, shift),
            text_fg=SILVER_COL,
            text=base.labels.CITY[15],  # noqa: F821
            text_font=base.main_font,  # noqa: F821
            scale=(0.075, 0, 0.075),
            relief=None,
            text_scale=0.45,
            command=self._buy_supply,
        )
        self._temp_wids.append(buy_res_but)

        sell_res_but = DirectButton(  # Sell
            parent=self._fr,
            pos=(-0.08, 0, shift),
            text_fg=SILVER_COL,
            text=base.labels.CITY[14],  # noqa: F821
            text_font=base.main_font,  # noqa: F821
            scale=(0.075, 0, 0.075),
            relief=None,
            text_scale=0.45,
            command=self._sell_supply,
        )
        self._temp_wids.append(sell_res_but)

        self._res_chooser = ResourceChooser(buy_res_but, sell_res_but)
        self._res_chooser.prepare(
            self._fr,
            (0, 0, -0.165),
            {
                base.labels.RESOURCES[1]: "medicine_boxes",  # noqa: F821
                base.labels.RESOURCES[5]: "stimulators",  # noqa: F821
                base.labels.RESOURCES[3]: "smoke_filters",  # noqa: F821
            },
        )
        self._temp_wids.append(self._res_chooser)
コード例 #10
0
    def _show_train(self, z_coor):
        """Show the locomotive management GUI tab.

        Args:
            z_coor (float): Z-coordinate for widgets.
        """
        clear_wids(self._temp_wids)

        self._party_but["text_fg"] = RUST_COL
        self._train_but["text_fg"] = SILVER_COL

        z_coor -= 0.07
        self._temp_wids.append(
            DirectLabel(  # Locomotive
                parent=self._fr,
                text=base.labels.CITY[5],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.035,
                text_align=TextNode.ALeft,
                text_fg=RUST_COL,
                pos=(-0.3, 0, z_coor),
            ))
        z_coor -= 0.08
        self._temp_wids.append(
            DirectLabel(  # Repair
                parent=self._fr,
                frameColor=(0, 0, 0, 0.3),
                text_fg=SILVER_COL,
                text=base.labels.CITY[6],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                text_align=TextNode.ALeft,
                text_scale=0.03,
                pos=(-0.25, 0, z_coor),
            ))
        self._temp_wids.append(
            DirectButton(
                parent=self._fr,
                pos=(-0.05, 0, z_coor + 0.015),
                text_fg=SILVER_COL,
                text="+50\n10$",
                scale=(0.075, 0, 0.075),
                relief=None,
                text_scale=0.45,
                command=self._repair,
                extraArgs=[50],
            ))
        self._temp_wids.append(
            DirectButton(
                parent=self._fr,
                pos=(0.07, 0, z_coor + 0.015),
                text_fg=SILVER_COL,
                text="+200\n40$",
                scale=(0.075, 0, 0.075),
                relief=None,
                text_scale=0.45,
                command=self._repair,
                extraArgs=[200],
            ))

        z_coor -= 0.09
        self._temp_wids.append(
            DirectLabel(  # Upgrade
                parent=self._fr,
                text=base.labels.CITY[7],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                text_align=TextNode.ALeft,
                frameSize=(0.1, 0.1, 0.1, 0.1),
                text_scale=0.035,
                text_fg=RUST_COL,
                pos=(-0.3, 0, z_coor),
            ))
        up_desc = DirectLabel(
            parent=self._fr,
            text="",
            text_font=base.main_font,  # noqa: F821
            frameSize=(0.1, 0.1, 0.1, 0.1),
            text_scale=0.03,
            text_fg=SILVER_COL,
            pos=(-0.1, 0, z_coor - 0.14),
        )
        self._temp_wids.append(up_desc)

        up_cost = DirectLabel(
            parent=self._fr,
            text="",
            frameSize=(0.1, 0.1, 0.1, 0.1),
            text_scale=0.035,
            text_fg=SILVER_COL,
            pos=(0.23, 0, z_coor - 0.17),
        )
        self._temp_wids.append(up_cost)

        but = DirectButton(  # Purchase
            parent=self._fr,
            pos=(0.2, 0, z_coor - 0.3),
            text_fg=RUST_COL,
            text=base.labels.CITY[8],  # noqa: F821
            text_font=base.main_font,  # noqa: F821
            relief=None,
            text_scale=0.035,
            command=self._purchase_upgrade,
        )
        self._temp_wids.append(but)
        base.main_menu.bind_button(but)  # noqa: F821

        z_coor -= 0.05
        self._up_chooser = UpgradeChooser(up_desc, up_cost)
        self._up_chooser.prepare(
            self._fr,
            (0, 0, z_coor),
            base.train.possible_upgrades(self.visit_num),  # noqa: F821
        )
        self._temp_wids.append(self._up_chooser)
コード例 #11
0
ファイル: __init__.py プロジェクト: IlyaFaer/ForwardOnlyGame
    def _show_slots(self, for_loading=False):
        """Show save slots GUI.

        Args:
            for_loading (bool):
                Optional. True if slots must be shown for loading.
        """
        if self.save_wids:
            return

        clear_wids(self.tactics_wids)
        clear_wids(self.conf_wids)
        clear_wids(self.cred_wids)

        if for_loading:
            is_active = True
            command = self._load_game
        else:
            is_active = not (base.train.ctrl.critical_damage  # noqa: F821
                             or base.world.is_in_city  # noqa: F821
                             or base.world.is_on_et  # noqa: F821
                             or base.current_block.id < 4  # noqa: F821
                             or base.world.is_near_fork  # noqa: F821
                             )
            command = base.save_game  # noqa: F821

        saves = self._read_saves()

        z_shift = 0.5
        x_shift = -0.2
        for num in range(1, 4):
            but = DirectButton(
                parent=self._main_fr,
                text="Slot {}".format(str(num)),
                pos=(x_shift - 0.103, 0, z_shift),
                text_scale=0.04,
                text_fg=RUST_COL,
                relief=None,
                command=command if is_active else None,
                extraArgs=[num],
                clickSound=self.click_snd,
            )
            self.bind_button(but)
            self.save_wids.append(but)

            self.save_wids.append(
                DirectLabel(
                    parent=self._main_fr,
                    pos=(x_shift, 0, z_shift - 0.05),
                    text_scale=0.03,
                    text_fg=SILVER_COL,
                    frameColor=(0, 0, 0, 0),
                    text=saves[num - 1].get("save_time", "-"),
                ))
            self.save_wids.append(
                DirectLabel(
                    parent=self._main_fr,
                    pos=(x_shift - 0.1, 0, z_shift - 0.1),
                    text_scale=0.03,
                    text_fg=SILVER_COL,
                    frameColor=(0, 0, 0, 0),
                    text=(str(saves[num - 1].get("miles") or "- ")) + " mi",
                ))
            self.save_wids.append(
                DirectLabel(
                    parent=self._main_fr,
                    pos=(x_shift + 0.35, 0, z_shift - 0.1),
                    text_scale=0.03,
                    text_fg=SILVER_COL,
                    frameColor=(0, 0, 0, 0),
                    text="{0} soldiers, {1} raiders, {2} anarchists".format(
                        *saves[num - 1].get("chars", ("-", "-", "-"))),
                ))
            z_shift -= 0.2
コード例 #12
0
ファイル: __init__.py プロジェクト: IlyaFaer/ForwardOnlyGame
    def _show_conf(self):
        """Show game configurations GUI."""
        clear_wids(self.save_wids)
        clear_wids(self.tactics_wids)
        clear_wids(self.cred_wids)

        self.conf_wids.append(
            DirectLabel(  # Resolution:
                parent=self._main_fr,
                text=base.labels.MAIN_MENU[22],  # noqa: F821,
                text_fg=RUST_COL,
                text_scale=0.04,
                text_font=base.main_font,  # noqa: F821
                pos=(-0.3, 0, 0.5),
                frameColor=(0, 0, 0, 0),
            ))

        if base.game_config.resolution in RESOLUTIONS:  # noqa: F821
            res_ind = RESOLUTIONS.index(
                base.game_config.resolution)  # noqa: F821
        else:
            res_ind = len(RESOLUTIONS)
            RESOLUTIONS.append(base.game_config.resolution)  # noqa: F821

        res_chooser = ListChooser()
        res_chooser.prepare(self._main_fr, (0.1, 0, 0.51), RESOLUTIONS,
                            res_ind)
        self.conf_wids.append(res_chooser)

        self.conf_wids.append(
            DirectLabel(  # Tutorial:
                parent=self._main_fr,
                text=base.labels.MAIN_MENU[23],  # noqa: F821,
                text_fg=RUST_COL,
                text_scale=0.04,
                text_font=base.main_font,  # noqa: F821
                pos=(-0.3, 0, 0.4),
                frameColor=(0, 0, 0, 0),
            ))
        tutorial_check = DirectCheckButton(
            parent=self._main_fr,
            indicatorValue=base.game_config.tutorial_enabled,  # noqa: F821
            clickSound=self.click_snd,
            scale=0.02,
            pos=(0.12, 0, 0.41),
            boxBorder=0,
            boxImage=(GUI_PIC + "no_check.png", GUI_PIC + "check.png", None),
            boxRelief=None,
            relief="flat",
            frameColor=RUST_COL,
        )
        tutorial_check.setTransparency(TransparencyAttrib.MAlpha)
        self.conf_wids.append(tutorial_check)

        self.conf_wids.append(
            DirectLabel(  # Language
                parent=self._main_fr,
                text=base.labels.MAIN_MENU[24],  # noqa: F821,
                text_fg=RUST_COL,
                text_scale=0.04,
                text_font=base.main_font,  # noqa: F821
                pos=(-0.3, 0, 0.3),
                frameColor=(0, 0, 0, 0),
            ))

        lang_chooser = ListChooser()
        lang_chooser.prepare(
            self._main_fr,
            (0.1, 0, 0.31),
            LANGUAGES,
            LANGUAGES.index(base.game_config.language),  # noqa: F821,
        )
        self.conf_wids.append(lang_chooser)

        self.conf_wids.append(
            DirectLabel(  # Framerate limit
                parent=self._main_fr,
                text=base.labels.MAIN_MENU[29],  # noqa: F821,
                text_fg=RUST_COL,
                text_scale=0.04,
                text_font=base.main_font,  # noqa: F821
                pos=(-0.3, 0, 0.21),
                frameColor=(0, 0, 0, 0),
            ))

        fps_chooser = ListChooser()
        fps_chooser.prepare(
            self._main_fr,
            (0.1, 0, 0.22),
            FPS,
            FPS.index(str(base.game_config.fps_limit)),  # noqa: F821
        )
        self.conf_wids.append(fps_chooser)

        self.conf_wids.append(
            DirectLabel(  # FPS meter:
                parent=self._main_fr,
                text=base.labels.MAIN_MENU[36],  # noqa: F821,
                text_fg=RUST_COL,
                text_scale=0.04,
                text_font=base.main_font,  # noqa: F821
                pos=(-0.3, 0, 0.11),
                frameColor=(0, 0, 0, 0),
            ))

        fps_meter = DirectCheckButton(
            parent=self._main_fr,
            indicatorValue=base.game_config.fps_meter,  # noqa: F821
            clickSound=self.click_snd,
            scale=0.02,
            pos=(0.12, 0, 0.12),
            boxBorder=0,
            boxImage=(GUI_PIC + "no_check.png", GUI_PIC + "check.png", None),
            boxRelief=None,
            relief="flat",
            frameColor=RUST_COL,
        )
        fps_meter.setTransparency(TransparencyAttrib.MAlpha)
        self.conf_wids.append(fps_meter)

        self.conf_wids.append(
            DirectLabel(  # Multi threading:
                parent=self._main_fr,
                text=base.labels.MAIN_MENU[37],  # noqa: F821,
                text_fg=RUST_COL,
                text_scale=0.04,
                text_font=base.main_font,  # noqa: F821
                pos=(-0.3, 0, 0.01),
                frameColor=(0, 0, 0, 0),
            ))

        multi_threading = DirectCheckButton(
            parent=self._main_fr,
            indicatorValue=base.game_config.multi_threading,  # noqa: F821
            clickSound=self.click_snd,
            scale=0.02,
            pos=(0.12, 0, 0.02),
            boxBorder=0,
            boxImage=(GUI_PIC + "no_check.png", GUI_PIC + "check.png", None),
            boxRelief=None,
            relief="flat",
            frameColor=RUST_COL,
        )
        multi_threading.setTransparency(TransparencyAttrib.MAlpha)
        self.conf_wids.append(multi_threading)

        self.conf_wids.append(
            DirectLabel(  # Multi threading:
                parent=self._main_fr,
                text=base.labels.MAIN_MENU[38],  # noqa: F821,
                text_fg=SILVER_COL,
                text_scale=0.025,
                text_font=base.main_font,  # noqa: F821
                pos=(-0.3, 0, -0.03),
                frameColor=(0, 0, 0, 0),
            ))

        but = DirectButton(  # Save and restart
            parent=self._main_fr,
            text_scale=0.045,
            text_fg=RUST_COL,
            text=base.labels.MAIN_MENU[25],  # noqa: F821,
            text_font=base.main_font,  # noqa: F821
            relief=None,
            command=self._save_conf_and_restart,
            extraArgs=[
                res_chooser,
                tutorial_check,
                lang_chooser,
                fps_chooser,
                fps_meter,
                multi_threading,
            ],
            pos=(0.1, 0, -0.2),
            clickSound=self.click_snd,
        )
        self.bind_button(but)
        self.conf_wids.append(but)
コード例 #13
0
ファイル: __init__.py プロジェクト: IlyaFaer/ForwardOnlyGame
 def _clear_temp_wids(self, task):
     """Destroy widgets from the first game screen."""
     clear_wids(self.tactics_wids)
     self._alpha_disclaimer.destroy()
     return task.done
コード例 #14
0
ファイル: __init__.py プロジェクト: IlyaFaer/ForwardOnlyGame
    def _choose_tactics(self):
        """Choose initial tactics before new game start."""
        if self.tactics_wids:
            return

        clear_wids(self.save_wids)
        clear_wids(self.conf_wids)
        clear_wids(self.cred_wids)

        self.tactics_wids.append(
            DirectLabel(  # Choose your crew
                parent=self._main_fr,
                text=base.labels.MAIN_MENU[5],  # noqa: F821
                text_fg=RUST_COL,
                text_scale=0.04,
                text_font=base.main_font,  # noqa: F821
                frameColor=(0, 0, 0, 0),
                pos=(0.7, 0, 0.75),
            ))
        # an image with a crew representer
        self._crew_preview = DirectFrame(
            parent=self._main_fr,
            frameSize=(-0.61, 0.61, -0.35, 0.35),
            pos=(0.7, 0, 0.3),
        )
        self._crew_preview.setTransparency(TransparencyAttrib.MAlpha)
        self.tactics_wids.append(self._crew_preview)

        but_params = {
            "parent": self._main_fr,
            "text_scale": 0.035,
            "text_fg": RUST_COL,
            "text_font": base.main_font,  # noqa: F821
            "relief": None,
            "clickSound": self.click_snd,
            "command": self._show_crew,
        }
        self._crew_buts = {
            "soldiers":
            DirectButton(
                text=base.labels.MAIN_MENU[6],  # noqa: F821
                extraArgs=["soldiers"],
                pos=(0.5, 0, -0.15),
                **but_params,
            ),
            "raiders":
            DirectButton(
                text=base.labels.MAIN_MENU[7],  # noqa: F821
                extraArgs=["raiders"],
                pos=(0.7, 0, -0.15),
                **but_params,
            ),
            "anarchists":
            DirectButton(
                text=base.labels.MAIN_MENU[8],  # noqa: F821
                extraArgs=["anarchists"],
                pos=(0.925, 0, -0.15),
                **but_params,
            ),
        }
        self.tactics_wids += self._crew_buts.values()

        for but in self._crew_buts.values():
            self.bind_button(but)

        self._team_description = DirectLabel(  # Crew description
            parent=self._main_fr,
            text=base.labels.MAIN_MENU[9],  # noqa: F821
            text_fg=SILVER_COL,
            text_scale=0.03,
            text_font=base.main_font,  # noqa: F821
            frameColor=(0, 0, 0, 0),
            pos=(0.7, 0, -0.26),
        )
        self.tactics_wids.append(self._team_description)

        start_but = DirectButton(  # Start
            parent=self._main_fr,
            text_scale=0.045,
            text_fg=RUST_COL,
            text=base.labels.MAIN_MENU[10],  # noqa: F821
            text_font=base.main_font,  # noqa: F821
            relief=None,
            command=self._start_new_game,
            pos=(0.7, 0, -0.5),
            clickSound=self.click_snd,
        )
        self.bind_button(start_but)
        self.tactics_wids.append(start_but)

        self._show_crew("soldiers")
コード例 #15
0
ファイル: outings.py プロジェクト: IlyaFaer/ForwardOnlyGame
    def show_result(
        self,
        desc,
        score,
        cond_score,
        class_score,
        cohesion_score,
        day_part_score,
        selected_effect,
        recruit_effect,
        cohesion_inc,
    ):
        """Show outing results GUI.

        Args:
            desc (str): Result description.
            score (int): Total outing score.
            cond_score (float): Score from characters condition.
            class_score (int): Score from characters classes.
            cohesion_score (float): Characters cohesion score.
            day_part_score (int): Day part bonus and special skills score.
            selected_effect (dict): Effect which requires to choose a target.
            recruit_effect (int): Cost of a possible recruit.
            cohesion_inc (float): Cohesion increase value.
        """
        clear_wids(self._outing_widgets)

        self._desc["text"] = desc

        self._outing_widgets.append(
            DirectLabel(  # Outing score:
                parent=self._list,
                text=base.labels.OUTINGS_GUI[4],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                frameSize=(0.6, 0.6, 0.6, 0.6),
                text_scale=0.042,
            ))
        bars = []
        shift = -0.07
        for name, maximum, col, value in (
            (  # Character classes fit:
                base.labels.OUTINGS_GUI[5],  # noqa: F821
                40,
                (0.36, 0.6, 0.42, 1),
                class_score,
            ),
            (  # Characters condition:
                base.labels.OUTINGS_GUI[6],  # noqa: F821
                25,
                (0.65, 0.2, 0.2, 1),
                cond_score,
            ),
            (  # Characters cohesion:
                base.labels.OUTINGS_GUI[7],  # noqa: F821
                25,
                SILVER_COL,
                cohesion_score,
            ),
            (  # Day part:
                base.labels.OUTINGS_GUI[8],  # noqa: F821
                10,
                (0.42, 0.42, 0.8, 1),
                day_part_score,
            ),
        ):
            self._outing_widgets.append(
                DirectLabel(
                    parent=self._list,
                    text=name,
                    text_font=base.main_font,  # noqa: F821
                    frameSize=(0.6, 0.6, 0.6, 0.6),
                    text_scale=0.035,
                    pos=(-0.08, 0, shift),
                ))
            shift -= 0.04
            bar = DirectWaitBar(
                parent=self._list,
                frameSize=(-0.17, 0.17, -0.005, 0.005),
                frameColor=(0.3, 0.3, 0.3, 0.5),
                value=0,
                range=maximum,
                barColor=col,
                pos=(0, 0, shift),
            )
            bars.append((bar, value, maximum))
            self._outing_widgets.append(bar)

            shift -= 0.08

        taskMgr.doMethodLater(  # noqa: F821
            0.035,
            self._animate_bars,
            "animate_outing_bars",
            extraArgs=[
                bars, score, selected_effect, recruit_effect, cohesion_inc
            ],
            appendTask=True,
        )
コード例 #16
0
ファイル: main.py プロジェクト: IlyaFaer/ForwardOnlyGame
    def load_game(self, num):
        """Load the previously saved game.

        Args:
            num (int): The save slot number.
        """
        clear_wids(self.main_menu.save_wids)
        save = shelve.open("saves/save{}".format(num))

        self.train = Train(save["train"])

        self.camera_ctrl = CameraController()
        self.camera_ctrl.set_controls(self.train)

        self.team = Crew()
        self.res_gui = ResourcesGUI()

        self.journal = Journal(save["winned"])
        self.common_ctrl = CommonController(self.train.parts, self.team.chars)

        # build game world
        self.world = World(save["day_part"])
        self.world.load_location(
            num,
            save["enemy_score"],
            save["disease_threshold"],
            save["stench_step"],
        )
        self.world.city_gui.visit_num = save["city_visit_num"]

        self.current_block = self.world.load_blocks(save["cur_blocks"],
                                                    save["last_angle"])
        self.common_ctrl.set_controls()

        self.train.load_upgrades(save["train"]["upgrades"])
        self.char_gui = CharacterGUI()
        self.team.load(save["team"], self.train.parts, save["cohesion"])

        self.doMethodLater(3,
                           self.start_game,
                           "start_game",
                           extraArgs=[None, True])
        self.doMethodLater(
            3.15,
            self.train.ctrl.load_speed,
            "load_speed",
            extraArgs=[save["train"]["speed"]],
        )
        self.dollars = save["dollars"]
        self._heads = save["heads"]
        self.plus_resource("medicine_boxes", save["medicine_boxes"])
        self.plus_resource("smoke_filters", save["smoke_filters"])
        self.plus_resource("stimulators", save["stimulators"])
        self.helped_children = save["helped_children"]
        self.decisions = save["decisions"]

        self.res_gui.update_resource("places_of_interest",
                                     str(save["chapter"] + 1) + "/10")

        self.scenario = Scenario(save["chapter"])
        for num in range(save["chapter"] + 1):
            self.journal.add_page(num)

        save.close()
        self.main_menu.hide_loading_msg()
コード例 #17
0
ファイル: __init__.py プロジェクト: IlyaFaer/ForwardOnlyGame
    def _show_credits(self):
        """Show the game credits."""
        clear_wids(self.save_wids)
        clear_wids(self.conf_wids)
        clear_wids(self.tactics_wids)

        center = 0.25

        self.cred_wids.append(
            DirectLabel(
                parent=self._main_fr,
                pos=(center, 0, 0.6),
                text_scale=0.04,
                text_fg=SILVER_COL,
                text_font=base.main_font,  # noqa: F821
                frameColor=(0, 0, 0, 0),
                text=base.labels.MAIN_MENU[31],  # noqa: F821
            ))
        self.cred_wids.append(
            DirectLabel(  # Project source code
                parent=self._main_fr,
                pos=(center, 0, 0.5),
                text_scale=0.04,
                text_fg=SILVER_COL,
                text_font=base.main_font,  # noqa: F821
                frameColor=(0, 0, 0, 0),
                text=base.labels.MAIN_MENU[32],  # noqa: F821
            ))
        self.cred_wids.append(
            DirectButton(
                parent=self._main_fr,
                pos=(center, 0, 0.45),
                frameColor=(0, 0, 0, 0),
                text_scale=0.04,
                text_fg=RUST_COL,
                text="github.com/IlyaFaer/ForwardOnlyGame",
                text_font=base.main_font,  # noqa: F821
                relief=None,
                command=webbrowser.open,
                extraArgs=["https://github.com/IlyaFaer/ForwardOnlyGame"],
                clickSound=self.click_snd,
            ))
        self.cred_wids.append(
            DirectLabel(  # Subscribe
                parent=self._main_fr,
                pos=(center, 0, 0.35),
                text_scale=0.04,
                text_fg=SILVER_COL,
                text_font=base.main_font,  # noqa: F821
                frameColor=(0, 0, 0, 0),
                text=base.labels.MAIN_MENU[33],  # noqa: F821
            ))
        self.cred_wids.append(
            DirectButton(
                parent=self._main_fr,
                pos=(0.11, 0, 0.29),
                frameTexture="credits/youtube.png",
                frameSize=(-0.056, 0.056, -0.029, 0.029),
                relief="flat",
                command=webbrowser.open,
                extraArgs=[
                    "https://www.youtube.com/channel/UCKmtk9K6VkcQdOMiE7H-W9w"
                ],
                clickSound=self.click_snd,
            ))
        self.cred_wids.append(
            DirectButton(
                parent=self._main_fr,
                pos=(center, 0, 0.29),
                frameTexture="credits/indie_db.png",
                frameSize=(-0.058, 0.058, -0.029, 0.029),
                relief="flat",
                command=webbrowser.open,
                extraArgs=["https://www.indiedb.com/games/forward-only"],
                clickSound=self.click_snd,
            ))
        but = DirectButton(
            parent=self._main_fr,
            pos=(0.38, 0, 0.29),
            frameTexture="credits/discord.png",
            frameSize=(-0.045, 0.045, -0.045, 0.045),
            relief="flat",
            command=webbrowser.open,
            extraArgs=["https://discord.gg/8UgFJAWsFx"],
            clickSound=self.click_snd,
        )
        but.setTransparency(TransparencyAttrib.MAlpha)
        self.cred_wids.append(but)
        self.cred_wids.append(
            DirectLabel(  # Stack
                parent=self._main_fr,
                pos=(center, 0, 0.18),
                text_scale=0.04,
                text_fg=SILVER_COL,
                text_font=base.main_font,  # noqa: F821
                frameColor=(0, 0, 0, 0),
                text=base.labels.MAIN_MENU[34],  # noqa: F821
            ))
        but = DirectButton(
            parent=self._main_fr,
            pos=(0.05, 0, 0.11),
            frameTexture="credits/python.png",
            frameSize=(-0.05, 0.05, -0.05, 0.05),
            relief="flat",
            command=webbrowser.open,
            extraArgs=["https://www.python.org/"],
            clickSound=self.click_snd,
        )
        but.setTransparency(TransparencyAttrib.MAlpha)
        self.cred_wids.append(but)

        but = DirectButton(
            parent=self._main_fr,
            pos=(0.185, 0, 0.11),
            frameTexture="credits/panda3d.png",
            frameSize=(-0.05, 0.05, -0.05, 0.05),
            relief="flat",
            command=webbrowser.open,
            extraArgs=["https://www.panda3d.org/"],
            clickSound=self.click_snd,
        )
        but.setTransparency(TransparencyAttrib.MAlpha)
        self.cred_wids.append(but)

        but = DirectButton(
            parent=self._main_fr,
            pos=(0.315, 0, 0.11),
            frameTexture="credits/blender.png",
            frameSize=(-0.05, 0.05, -0.05, 0.05),
            relief="flat",
            command=webbrowser.open,
            extraArgs=["https://www.blender.org/"],
            clickSound=self.click_snd,
        )
        but.setTransparency(TransparencyAttrib.MAlpha)
        self.cred_wids.append(but)

        but = DirectButton(
            parent=self._main_fr,
            pos=(0.45, 0, 0.11),
            frameTexture="credits/make_human.png",
            frameSize=(-0.05, 0.05, -0.05, 0.05),
            relief="flat",
            command=webbrowser.open,
            extraArgs=["http://www.makehumancommunity.org/"],
            clickSound=self.click_snd,
        )
        but.setTransparency(TransparencyAttrib.MAlpha)
        self.cred_wids.append(but)

        self.cred_wids.append(
            DirectLabel(  # Tools
                parent=self._main_fr,
                pos=(center, 0, -0.02),
                text_scale=0.04,
                text_fg=SILVER_COL,
                text_font=base.main_font,  # noqa: F821
                frameColor=(0, 0, 0, 0),
                text=base.labels.MAIN_MENU[35],  # noqa: F821
            ))
        but = DirectButton(
            parent=self._main_fr,
            pos=(center - 0.12, 0, -0.09),
            frameTexture="credits/free_sound.png",
            frameSize=(-0.057, 0.057, -0.029, 0.029),
            relief="flat",
            command=webbrowser.open,
            extraArgs=["https://freesound.org/"],
            clickSound=self.click_snd,
        )
        but.setTransparency(TransparencyAttrib.MAlpha)
        self.cred_wids.append(but)

        but = DirectButton(
            parent=self._main_fr,
            pos=(center, 0, -0.09),
            frameTexture="credits/photopea.png",
            frameSize=(-0.03, 0.03, -0.03, 0.03),
            relief="flat",
            command=webbrowser.open,
            extraArgs=["https://www.photopea.com/"],
            clickSound=self.click_snd,
        )
        but.setTransparency(TransparencyAttrib.MAlpha)
        self.cred_wids.append(but)

        but = DirectButton(
            parent=self._main_fr,
            pos=(center + 0.09, 0, -0.09),
            frameTexture="credits/online_convert.png",
            frameSize=(-0.03, 0.03, -0.03, 0.03),
            relief="flat",
            command=webbrowser.open,
            extraArgs=["https://audio.online-convert.com/"],
            clickSound=self.click_snd,
        )
        but.setTransparency(TransparencyAttrib.MAlpha)
        self.cred_wids.append(but)

        self.cred_wids.append(
            DirectLabel(  # Music
                parent=self._main_fr,
                pos=(center, 0, -0.24),
                text_scale=0.042,
                text_fg=SILVER_COL,
                text_font=base.main_font,  # noqa: F821
                frameColor=(0, 0, 0, 0),
                text=base.labels.MAIN_MENU[39],  # noqa: F821
            ))
        but = DirectButton(
            parent=self._main_fr,
            pos=(-0.15, 0, -0.45),
            frameTexture="credits/among_madness_logo.png",
            frameSize=(-0.15, 0.15, -0.15, 0.15),
            relief="flat",
            command=webbrowser.open,
            extraArgs=[
                "https://open.spotify.com/artist/3uy4tvaLvBAsKdV52Kc2TI"
            ],
            clickSound=self.click_snd,
        )
        but.setTransparency(TransparencyAttrib.MAlpha)
        self.cred_wids.append(but)

        self.cred_wids.append(
            DirectLabel(
                parent=self._main_fr,
                pos=(-0.15, 0, -0.65),
                text_scale=0.033,
                text_fg=SILVER_COL,
                text_font=base.main_font,  # noqa: F821
                frameColor=(0, 0, 0, 0),
                text="Among Madness",
            ))

        but = DirectButton(
            parent=self._main_fr,
            pos=(0.25, 0, -0.45),
            frameTexture="credits/qualia_logo.png",
            frameSize=(-0.15, 0.15, -0.15, 0.15),
            relief="flat",
            command=webbrowser.open,
            extraArgs=["https://kvalia.net/"],
            clickSound=self.click_snd,
        )
        but.setTransparency(TransparencyAttrib.MAlpha)
        self.cred_wids.append(but)

        self.cred_wids.append(
            DirectLabel(
                parent=self._main_fr,
                pos=(0.25, 0, -0.65),
                text_scale=0.033,
                text_fg=SILVER_COL,
                text_font=base.main_font,  # noqa: F821
                frameColor=(0, 0, 0, 0),
                text="Квалиа",
            ))

        but = DirectButton(
            parent=self._main_fr,
            pos=(0.65, 0, -0.45),
            frameTexture="credits/moloken_logo.png",
            frameSize=(-0.15, 0.15, -0.15, 0.15),
            relief="flat",
            command=webbrowser.open,
            extraArgs=[
                "https://open.spotify.com/artist/3LZzdqKCEcBwhh6vd6y6Q5"
            ],
            clickSound=self.click_snd,
        )
        but.setTransparency(TransparencyAttrib.MAlpha)
        self.cred_wids.append(but)

        self.cred_wids.append(
            DirectLabel(
                parent=self._main_fr,
                pos=(0.65, 0, -0.65),
                text_scale=0.033,
                text_fg=SILVER_COL,
                text_font=base.main_font,  # noqa: F821
                frameColor=(0, 0, 0, 0),
                text="Moloken",
            ))
コード例 #18
0
ファイル: outings.py プロジェクト: IlyaFaer/ForwardOnlyGame
    def _finish_outing(self, selected_effect, recruit_effect):
        """Show effect selector if needed and finish the outing.

        Args:
            selected_effect (dict):
                Effect which requires to choose a target.
            recruit_effect (int):
                Cost of a possible recruit.
        """
        clear_wids(self._outing_widgets)

        if not (selected_effect or recruit_effect):
            self.hide_outing()
            return

        if recruit_effect:
            char = base.team.generate_recruit()  # noqa: F821
            base.char_gui.show_char_info(char)  # noqa: F821

            self._outing_widgets.append(
                DirectLabel(  # You can recruit <name> for <cost>$
                    parent=self._list,
                    pos=(0, 0, 0),
                    text=base.labels.OUTINGS_GUI[12].format(  # noqa: F821
                        name=char.name, cost=recruit_effect),
                    text_font=base.main_font,  # noqa: F821
                    frameSize=(0.6, 0.6, 0.6, 0.6),
                    text_scale=0.045,
                ))
            self._outing_widgets.append(
                DirectButton(  # Recruit
                    pos=(-0.2, 0, -0.75),
                    text=base.labels.OUTINGS_GUI[10],  # noqa: F821
                    text_font=base.main_font,  # noqa: F821
                    text_fg=RUST_COL,
                    text_shadow=(0, 0, 0, 1),
                    frameColor=(0, 0, 0, 0),
                    command=self._hire_unit,
                    extraArgs=[char, recruit_effect],
                    scale=(0.05, 0, 0.05),
                    clickSound=base.main_menu.click_snd,  # noqa: F821
                ))
            self._outing_widgets.append(
                DirectButton(  # Don't recruit
                    pos=(0.2, 0, -0.75),
                    text=base.labels.OUTINGS_GUI[11],  # noqa: F821
                    text_font=base.main_font,  # noqa: F821
                    text_fg=RUST_COL,
                    text_shadow=(0, 0, 0, 1),
                    frameColor=(0, 0, 0, 0),
                    command=self._dont_hire_unit,
                    scale=(0.05, 0, 0.05),
                    clickSound=base.main_menu.click_snd,  # noqa: F821
                ))
            return

        # there are effects to select a target for
        effect_str = ""
        for key, value in selected_effect.items():
            if key == "add_trait":
                ind1, ind2 = value
                value = base.labels.TRAITS[ind1][ind2]  # noqa: F821
                effect_str = base.labels.OUTINGS_GUI[13].format(  # noqa: F821
                    trait=value,
                    desc=base.labels.TRAIT_DESC[value]  # noqa: F821
                )
            else:
                effect_str += (key + " " + ("+" if value > 0 else "-") +
                               str(value) + "\n")

        self._outing_widgets.append(
            DirectLabel(  # Select one character as a target for the effect:
                parent=self._list,
                text=base.labels.OUTINGS_GUI[14]  # noqa: F821
                + "\n{effect}".format(effect=effect_str),
                text_font=base.main_font,  # noqa: F821
                frameSize=(0.6, 0.6, 0.6, 0.6),
                text_scale=0.045,
            ))
        self._char_chooser = CharacterChooser(is_shadowed=True)
        self._char_chooser.prepare(
            self._list,
            (0, 0, -0.15),
            base.team.chars  # noqa: F821
        )
        self._outing_widgets.append(
            DirectButton(  # Done
                pos=(0, 0, -0.75),
                text=base.labels.DISTINGUISHED[6],  # noqa: F821
                text_font=base.main_font,  # noqa: F821
                text_fg=RUST_COL,
                text_shadow=(0, 0, 0, 1),
                frameColor=(0, 0, 0, 0),
                command=self._do_effect_and_finish,  # noqa: F821
                extraArgs=[selected_effect],
                scale=(0.05, 0, 0.05),
                clickSound=base.main_menu.click_snd,  # noqa: F821
            ))