Ejemplo n.º 1
0
class Main(QObject):
    def __init__(self):
        super().__init__()
        self.menu_widget = MenuWidget()

        # 绑定菜单按钮点击信号
        self.menu_widget.single_clicked.connect(self.start_single_player)
        self.menu_widget.double_clicked.connect(self.start_double_player)
        self.menu_widget.network_clicked.connect(self.start_network_player)

        self.double_player = DoublePlayer()
        self.double_player.exit_clicked.connect(self.start_program)

        self.single_player = SinglePlayer()
        self.single_player.exit_clicked.connect(self.start_program)
        # self.network_player = NetworkPlayer()

    def start_program(self):
        self.menu_widget.show()
        # self.menu_widget.hide()

    def start_single_player(self):
        self.single_player.start_game()
        # 隐藏主菜单
        self.menu_widget.hide()

    def start_double_player(self):

        self.double_player.start_game()
        # 隐藏主菜单
        self.menu_widget.hide()

    def start_network_player(self):
        pass
Ejemplo n.º 2
0
    def __init__(self):
        super().__init__()
        self.menu_widget = MenuWidget()
        # 绑定菜单按钮点击信号
        self.menu_widget.single_clicked.connect(self.start_single_player)
        self.menu_widget.double_clicked.connect(self.start_double_player)
        self.menu_widget.network_clicked.connect(self.start_network_player)

        self.double_player = DoublePlayer()
        self.double_player.exit_clicked.connect(self.start_program)
        self.single_player = SinglePlayer()
Ejemplo n.º 3
0
 def double(self):
     self.game_window = DoublePlayer()
     self.game_window.backSignal.connect(self.back)
     self.game_window.show()
     self.close()
Ejemplo n.º 4
0
 def double_player(self):
     self.close()
     self.game_window = DoublePlayer()
     self.game_window.exitSignal.connect(self.game_over)  # 游戏结束
     self.game_window.backSignal.connect(self.show)  # 游戏
     self.game_window.show()