예제 #1
0
    def __init__(self, debug_ui):
        """
        @param debug_ui: The parent DebugUI
        @type debug_ui: DebugUI
        """
        DirectObject.__init__(self)
        Notifier.__init__(self, "ui-games-list")
        List.__init__(self,
                      debug_ui.messager.games,
                      10, (-1.1, 0.6),
                      command=self.game_clicked)

        self.debug_ui = debug_ui

        self.btn_title = DirectButton(scale=self.scale,
                                      text="Games",
                                      pos=(-1.1, 1, .8),
                                      frameSize=self.frame_size,
                                      command=self.debug_ui.switch_list,
                                      extraArgs=[1],
                                      state=DGG.DISABLED,
                                      relief=DGG.SUNKEN)

        self.accept("arrow_right", self.next_page)
        self.accept("arrow_left", self.previous_page)

        self.notify.info("[__init__] Created GamesList")
예제 #2
0
    def __init__(self, debug_ui):
        Notifier.__init__(self, "ui-single-player")

        self.debug_ui = debug_ui

        taskMgr.doMethodLater(1, self.update_info, "UpdateSinglePlayerInfo")

        self.pid = None

        self.txts = []
        self.btns = []

        # texts
        self.txt_pid = OnscreenText(text="", pos=(1, .8), scale=0.1, fg=(1, 1, 1, 1))
        self.txt_gid = OnscreenText(text="", pos=(1, .7), scale=0.1, fg=(1, 1, 1, 1))

        # texts append
        self.txts.append(self.txt_pid)
        self.txts.append(self.txt_gid)

        # buttons
        self.btn_gid = None

        # buttons append
        self.btns.append(self.btn_gid)

        self.notify.info("[__init__] Created SinglePlayer")
예제 #3
0
    def __init__(self, gid, msgr, open_to_public=1):
        Notifier.__init__(self, "game")

        self.gid = gid
        self.msgr = msgr
        self.open = open_to_public
        self.started = False
        self.day = True
        self.day_count = 0
        self.red_room = 0
        self.killer = None
        self.players = []

        self.notify.debug(f"[__init__] Created game {gid}")
예제 #4
0
    def __init__(self, messager):
        DirectObject.__init__(self)
        Notifier.__init__(self, "ui")

        self.messager = messager
        self.games_list = GamesList(self)
        self.players_all = PlayersList(self)

        self.single_game = SingleGame(messager)
        self.single_player = SinglePlayer(self)

        # True for game, False for player
        self.single_game_or_player = True

        self.notify.info("[__init__] Created DebugUI")
예제 #5
0
    def __init__(self):
        Notifier.__init__(self, "msgr")

        # dicts
        self.active_connections = {}
        self.games = {}

        port_address = SERVER_PORT
        backlog = 1000
        tcp_socket = self.cManager.openTCPServerRendezvous(
            port_address, backlog)
        self.cListener.addConnection(tcp_socket)

        self.debug_ui = DebugUI(self)

        self.notify.info("[__init__] Created Messager")
예제 #6
0
    def __init__(self, level_holder):
        DirectObject.__init__(self)
        Entry.__init__(self,
                       "", (-1.25, 1, -.9),
                       self.entered_command,
                       focus=True,
                       sort_order=1500)
        Notifier.__init__(self, "console")

        self.level_holder = level_holder

        self.accept("arrow_up", self.move_command, extraArgs=[1])
        self.accept("arrow_down", self.move_command, extraArgs=[0])

        self.logs = []
        self.archivable = []
        self.pos = -1
예제 #7
0
    def __init__(self, messager):
        Notifier.__init__(self, "ui-single-game")

        self.messager = messager

        taskMgr.doMethodLater(1, self.update_info, "UpdateSingleGameInfo")

        self.gid = None
        self.txts = []

        self.txt_gid = OnscreenText(text="", pos=(1, .8), scale=0.1, fg=(1, 1, 1, 1))
        self.txt_day = OnscreenText(text="", pos=(1, .7), scale=0.08, fg=(1, 1, 1, 1))
        self.txt_red_room = OnscreenText(text="", pos=(1, .6), scale=0.08, fg=(0.68, 0.12, 0.12, 1))

        self.txts.append(self.txt_gid)
        self.txts.append(self.txt_day)
        self.txts.append(self.txt_red_room)

        self.notify.info("[__init__] Created SingleGame")
예제 #8
0
    def __init__(self, reason):
        Notifier.__init__(self, "alert")
        VirtualFileSystem.getGlobalPtr().mount(Filename("mf/alert.mf"), ".",
                                               VirtualFileSystem.MFReadOnly)
        ok = loader.loadModel("alert.egg")

        if reason not in LOCAL_EN:
            reason = GENERAL

        self.reason = reason

        self.bg_frame = DirectFrame(frameColor=(0, 0, 0, 0),
                                    frameSize=(-1, 1, -1, 1),
                                    suppressMouse=1,
                                    state=DGG.NORMAL,
                                    sortOrder=1000)
        self.frame = DirectFrame(frameSize=(1, 1, 1, 1),
                                 image=ok.find('**/alert'),
                                 image_scale=(1, 0, 0.6),
                                 state=DGG.NORMAL,
                                 parent=self.bg_frame)
        self.text = OnscreenText(text=LOCAL_EN[reason],
                                 fg=(1, 1, 1, 1),
                                 pos=(0, 0.15, 0),
                                 align=TextNode.ACenter,
                                 wordwrap=13,
                                 parent=self.frame)
        self.button = DirectButton(geom=(ok.find('**/ok-ready'),
                                         ok.find('**/ok-click'),
                                         ok.find('**/ok-hover'),
                                         ok.find('**/ok-click')),
                                   relief=None,
                                   geom_scale=(0.3, 0, 0.15),
                                   geom_pos=(0, 0, -0.175),
                                   pressEffect=0,
                                   command=self.destroy,
                                   parent=self.frame)

        self.notify.debug(
            f"[__init__] Created Alert with reason {self.reason}")

        loader.unloadModel(ok)
예제 #9
0
    def __init__(self, debug_ui):
        """
        @param debug_ui: The parent DebugUI
        @type debug_ui: DebugUI
        """
        DirectObject.__init__(self)
        List.__init__(self, debug_ui.messager.active_connections, 10, (-1.1, 0.6), active=False,
                      command=debug_ui.change_pid)
        Notifier.__init__(self, "ui-players-list")

        self.debug_ui = debug_ui

        self.btn_title = DirectButton(scale=self.scale, text="Players", pos=(-.65, 1, .8),
                                      frameSize=self.frame_size,
                                      command=self.debug_ui.switch_list, extraArgs=[2])

        self.accept("arrow_right", self.next_page)
        self.accept("arrow_left", self.previous_page)

        self.notify.info("[__init__] Created a PlayersList")
예제 #10
0
 def __init__(self, local_id):
     Player.__init__(self, local_id, ai=True)
     Notifier.__init__(self, "ai")
     self.random_name()