def __init__(self, process_login):
        ScreenState.__init__(self)

        self.screen_atributes.buttons["but:Confirm"] = ButtonFsm(
            "Confirm", (0, 0, -0.5))
        self.screen_atributes.buttons["but:Back"] = ButtonFsm(
            "Back", (0, 0, -0.8))

        self.screen_atributes.text_fields["text_field:Login"] = TextFieldFsm(
            "text_field_login", (-0.5, 0, 0.5), False)
        self.screen_atributes.text_fields["text_field:Email"] = TextFieldFsm(
            "text_field_email", (-0.5, 0, 0.3), False)
        self.screen_atributes.text_fields[
            "text_field:Password"] = TextFieldFsm("text_field_password",
                                                  (-0.5, 0, 0.1), True)

        self.screen_atributes.screen_texts["scrtext:Login"] = ScreenTextFsm(
            "Login:   "******"scrtext:Email"] = ScreenTextFsm(
            "Email:", (-0.7, 0.3))
        self.screen_atributes.screen_texts["scrtext:Password"] = ScreenTextFsm(
            "Password:", (-0.7, 0.1))

        self.initialize_button_links()

        self.login_field = None
        self.email = None
        self.password_field = None

        self.process_login = process_login
예제 #2
0
    def __init__(self, render_fsm):
        ScreenState.__init__(self)
        self.button_sizes = (-3, 3, -0.4, 0.8)
        self.render_fsm_ref = render_fsm

        self.screen_atributes.screen_texts["screen_text:Title"] = ScreenTextFsm("Windows params:", (0, 0.2))

        self.screen_atributes.radio_buttons["rb:WinSize 16:9"] = RadioButtonFsm("16:9", (-0.2, 0, 0), self.confirm_command)
        self.screen_atributes.radio_buttons["rb:WinSize 4:3"] = RadioButtonFsm("4:3", (0.2, 0, 0), self.confirm_command)

        self.screen_atributes.buttons["but:Confirm"] = ButtonFsm("Confirm", (0, 0, -0.5))
        self.screen_atributes.buttons["but:Back"] = ButtonFsm("Back", (0, 0, -0.8))

        self.initialize_button_links()

        # sound bar
        self.sound_value = int(render_fsm.sound.get_volume() * 100)
        self.screen_atributes.screen_texts["screen_text:sound"] = ScreenTextFsm("Sound volume:", (0, 0.7))

        self.sound_bar = DirectScrollBar(range=(0, 100),
                                         value=self.sound_value,
                                         pageSize=3, command=self.on_sound_change)

        self.menu_music_box = DirectCheckButton(text="MenuMusic", scale=.07, command=self.update_menu_music)
        self.menu_music_box["indicatorValue"] = self.render_fsm_ref.sound.can_play(SoundTypes.MAIN)
        self.menu_music_box.setIndicatorValue()

        self.menu_music_box.setPos(0.0, 0.0, 0.3)

        self.sound_bar.setPos(0.0, 0.0, 0.5)
        self.screen_atributes.screen_texts["screen_text:sound_volume"] = ScreenTextFsm(str(self.sound_value), (0, 0.4))
    def __init__(self, process_auth_confirm, email=''):
        ScreenState.__init__(self)

        self.screen_atributes.buttons["but:Confirm"] = ButtonFsm(
            "Confirm", (0, 0, -0.5))
        self.screen_atributes.buttons["but:Back"] = ButtonFsm(
            "Back", (0, 0, -0.8))

        self.screen_atributes.text_fields["text_field:Email"] = TextFieldFsm(
            "text_field_email", (-0.5, 0, 0.5), initial_text=email)
        self.screen_atributes.text_fields[
            "text_field:AuthCode"] = TextFieldFsm("text_field_auth_code",
                                                  (-0.5, 0, 0.3))

        self.screen_atributes.screen_texts["scrtext:Email"] = ScreenTextFsm(
            "email:   ", (-0.7, 0.5))
        self.screen_atributes.screen_texts["scrtext:AuthCode"] = ScreenTextFsm(
            "auth code:", (-0.7, 0.3))

        self.initialize_button_links()

        self.email_field = None
        self.auth_code_field = None

        self.process_auth_confirm = process_auth_confirm
    def __init__(self, process_game_with_computer, process_game_with_firend,
                 process_reset_save_data_friend,
                 process_reset_save_data_computer):
        ScreenState.__init__(self)
        self.button_sizes = (-4, 4, -0.5, 1)
        self.screen_atributes.buttons["but:2Players"] = ButtonFsm(
            "With friend", (-0.5, 0, 0.4), None, None, None, (4, 1, 1), 0.15)
        self.screen_atributes.buttons["but:Computer"] = ButtonFsm(
            "With computer", (-0.5, 0, 0), None, None, None, (4, 1, 1), 0.15)

        self.screen_atributes.buttons["but:2PlayersReset"] = ButtonFsm(
            "Reset", (0.8, 0, 0.4), None, None, (-1.3, 1.4, -0.5, 1),
            (3, 1, 1), 0.15)
        self.screen_atributes.buttons["but:ComputerReset"] = ButtonFsm(
            "Reset", (0.8, 0, 0), None, None, (-1.3, 1.4, -0.5, 1), (3, 1, 1),
            0.15)

        self.screen_atributes.buttons["but:Back"] = ButtonFsm(
            "Back", (0, 0, -0.8))
        self.screen_atributes.buttons["but:Back"].scale = 0.15

        self.process_game_with_computer = process_game_with_computer
        self.process_game_with_firend = process_game_with_firend

        self.process_reset_save_data_friend = process_reset_save_data_friend
        self.process_reset_save_data_computer = process_reset_save_data_computer

        self.initialize_button_links()
예제 #5
0
 def __init__(self):
     ScreenState.__init__(self)
     self.button_sizes = (-4, 4, -0.5, 1)
     self.screen_atributes.buttons["but:Registration"] = ButtonFsm(
         "Registration", (0, 0, 0.4))
     self.screen_atributes.buttons["but:Login"] = ButtonFsm(
         "Login", (0, 0, 0))
     self.screen_atributes.buttons["but:Back"] = ButtonFsm(
         "Back", (0, 0, -0.8))
     self.initialize_button_links()
예제 #6
0
 def __init__(self, str_message, render_fsm):
     ScreenState.__init__(self)
     self.render_fsm_ref = render_fsm
     self.screen_atributes.screen_texts["scrtext:Message"] = ScreenTextFsm(
         str_message, (0, 0))
     self.screen_atributes.buttons["but:Back"] = ButtonFsm(
         "Back", (0, 0, -0.8))
     self.initialize_button_links()
    def __init__(self, process_find_player, render_fsm):
        ScreenState.__init__(self)

        self.render_fsm_ref = render_fsm
        self.screen_atributes.buttons["but:Back"] = ButtonFsm(
            "Back", (0, 0, -0.8))
        self.screen_atributes.buttons["but:Confirm"] = ButtonFsm(
            "Confirm", (0, 0, -0.5))

        self.screen_atributes.text_fields[
            "text_field:Match time"] = TextFieldFsm("text_field_match_time",
                                                    (-0.5, 0, 0.5), "")
        self.screen_atributes.text_fields[
            "text_field:Addition time"] = TextFieldFsm("text_field_add_time",
                                                       (-0.5, 0, 0.3), "")
        self.screen_atributes.text_fields[
            "text_field:Min rate"] = TextFieldFsm("text_field_min_rate",
                                                  (-0.5, 0, 0.1), "")
        self.screen_atributes.text_fields[
            "text_field:Max rate"] = TextFieldFsm("text_field_max_rate",
                                                  (-0.5, 0, -0.1), "")

        self.screen_atributes.screen_texts[
            "scrtext:Match time"] = ScreenTextFsm("Match time:          ",
                                                  (-0.85, 0.5))
        self.screen_atributes.screen_texts[
            "scrtext:Addition time"] = ScreenTextFsm("Addition time:    ",
                                                     (-0.85, 0.3))
        self.screen_atributes.screen_texts["scrtext:Min rate"] = ScreenTextFsm(
            "Min rate:              ", (-0.85, 0.1))
        self.screen_atributes.screen_texts["scrtext:Max rate"] = ScreenTextFsm(
            "Max rate:              ", (-0.85, -0.1))
        self.screen_atributes.screen_texts["scrtext:My rate"] = ScreenTextFsm(
            "Your's rate: {}".format(render_fsm.get_loacal_player_rating()),
            (-0.85, 0.8))

        self.initialize_button_links()

        self.login_field = None
        self.password_field = None

        self.process_matchmaking = process_find_player

        self.render_fsm_ref.message = "Loading..."
예제 #8
0
    def __init__(self, process_find_player, start_game_by_pairing, render_fsm):
        ScreenState.__init__(self)

        self.render_fsm_ref = render_fsm
        self.start_game_by_pairing = start_game_by_pairing
        self.screen_atributes.buttons["but:Back"] = ButtonFsm(
            "Back", (-0., 0, -0.8))
        self.screen_atributes.buttons["but:Create"] = ButtonFsm(
            "Create game", (-0., 0, -0.5))
        self.screen_atributes.buttons["but:Refresh"] = ButtonFsm(
            "Refresh", (0.3, 0, -0.1), None, None, (-1.6, 1.6, -0.3, 0.9),
            (2.1, 0.9, 0.8), 0.1)

        self.refresh_command = render_fsm.refresh_matchmaking_pairlist

        self.screen_atributes.screen_texts["scrtext:info"] = ScreenTextFsm(
            "Quick game:\nGame time (minutes), adding time (seconds)",
            (-0.85, 0.9))
        self.text_todo_later_delete = OnscreenText(
            text="Connect to:\nLogin, rate, game time, adding time",
            pos=(0.8, 0.73),
            bg=(1, 1, 1, 1))

        self.screen_atributes.buttons["but:preset1"] = ButtonFsm(
            "10, 0", (-1.25, 0, 0.6), None, None, (-1.5, 1.5, -0.3, 0.9),
            (1.8, 0.8, 0.8))
        self.screen_atributes.buttons["but:preset2"] = ButtonFsm(
            "30,0", (-0.5, 0, 0.6), None, None, (-1.5, 1.5, -0.3, 0.9),
            (1.8, 0.8, 0.8))
        self.screen_atributes.buttons["but:preset3"] = ButtonFsm(
            "5, 3", (-1.25, 0, 0.4), None, None, (-1.5, 1.5, -0.3, 0.9),
            (1.8, 0.8, 0.8))
        self.screen_atributes.buttons["but:preset4"] = ButtonFsm(
            "3, 2", (-0.5, 0, 0.4), None, None, (-1.5, 1.5, -0.3, 0.9),
            (1.8, 0.8, 0.8))
        self.screen_atributes.buttons["but:preset5"] = ButtonFsm(
            "1, 0", (-0.9, 0, 0.2), None, None, (-1.5, 1.5, -0.3, 0.9),
            (1.8, 0.8, 0.8))

        self.screen_atributes.screen_texts["scrtext:My rate"] = ScreenTextFsm(
            "Your's rate: {}".format(render_fsm.get_loacal_player_rating()),
            (-1.25, -0.2))

        self.pairs_buts = []
        self.my_scrolled_list = None
        self.initialize_button_links()

        self.pairing_list = None

        self.process_matchmaking = process_find_player

        self.render_fsm_ref.message = "Finding player..."
        self.set_pairing_list([])
예제 #9
0
    def __init__(self, process_login, render_fsm):
        ScreenState.__init__(self)

        self.screen_atributes.buttons["but:Confirm"] = ButtonFsm("Confirm", (0, 0, -0.5))
        self.screen_atributes.buttons["but:Back"] = ButtonFsm("Back", (0, 0, -0.8))

        self.screen_atributes.text_fields["text_field:Login"] = TextFieldFsm("text_field_login", (-0.7, 0, 0.7))
        self.screen_atributes.text_fields["text_field:Password"] = TextFieldFsm("text_field_password", (-0.7, 0, 0.3), True)

        self.screen_atributes.screen_texts["scrtext:Login"] = ScreenTextFsm("Login:   "******"scrtext:Password"] = ScreenTextFsm("Password:"******"Loading..."
    def __init__(self, render_fsm, new_pack):
        ScreenState.__init__(self)
        self.cur_bg_2d = None
        self.button_sizes = (-2, 2, -0.4, 0.8)
        self.render_fsm_ref = render_fsm
        self.lights = Lights(base, self.render_fsm_ref.cur_window_width, self.render_fsm_ref.cur_window_height)
        self.camera_p = Camera3D(base.camera, base.camLens, self.render_fsm_ref.cur_window_width, self.render_fsm_ref.cur_window_height)
        base.disableMouse()

        self.figure_manager = FigureMngr(new_pack, new_pack)

        self.need_camera_update = False
        render_fsm.accept("mouse2", self.middle_click)

        render_fsm.accept("mouse3", self.right_click)
        render_fsm.accept("mouse3-up", self.right_release)

        render_fsm.accept("wheel_up", self.wheel_up)
        render_fsm.accept("wheel_down", self.wheel_down)

        self.screen_atributes.buttons["but:2D/3D"] = ButtonFsm("2D/3D", (0.5, 0, 0.8), None, None, None, (1.8, 0.8, 0.8))
        self.screen_atributes.buttons["but:Prev"] = ButtonFsm("<--", (-0.5, 0, -0.5), None, None, None, (1.8, 0.8, 0.8))
        self.screen_atributes.buttons["but:Next"] = ButtonFsm("-->", (0.5, 0, -0.5), None, None, None, (1.8, 0.8, 0.8))
        self.screen_atributes.buttons["but:Confirm"] = ButtonFsm("Confirm", (0, 0, -0.8), None, None, None, (2.2, 1, 1))

        self.screen_atributes.screen_texts["scrtext:WinPack"] = ScreenTextFsm("You won new pack: " + str(new_pack), (-0.6, 0.8))

        self.initialize_button_links()

        self.dimension = Dimension._3D

        self.cur_model_num = 0
        self.cur_model_node = None
        self.models_order = ['k', 'q', 'b', 'n', 'r', 'p'
                             'K', 'Q', 'B', 'N', 'R', 'P']
        self.load_model_to_screen()
예제 #11
0
    def __init__(self, is_client_connected_to_server,
                 process_continue_online_game, on_application_exit,
                 render_fsm):
        ScreenState.__init__(self)
        self.button_sizes = (-4, 4, -0.5, 1)

        self.screen_atributes.buttons["but:Single player"] = ButtonFsm(
            "Single player", (0, 0, 0.7))
        self.screen_atributes.buttons["but:Single player"].scale = 0.15
        if is_client_connected_to_server is False:
            self.screen_atributes.buttons["but:Multiplayer"] = ButtonFsm(
                "Connect to online", (0, 0, 0.35))
            self.screen_atributes.buttons["but:Multiplayer"].scale = 0.15

        else:
            self.screen_atributes.buttons["but:Multiplayer"] = ButtonFsm(
                "Multiplayer", (0, 0, 0.35))
            self.screen_atributes.buttons["but:Multiplayer"].scale = 0.15

        self.screen_atributes.buttons["but:Select skins"] = ButtonFsm(
            "Select skins", (0, 0, 0))
        self.screen_atributes.buttons["but:Select skins"].scale = 0.15

        self.screen_atributes.buttons["but:Window settings"] = ButtonFsm(
            "Settigns", (0, 0, -0.35))
        self.screen_atributes.buttons["but:Window settings"].scale = 0.15

        self.screen_atributes.buttons["but:Exit"] = ButtonFsm(
            "Exit", (0, 0, -0.8))
        self.screen_atributes.buttons["but:Exit"].scale = 0.15

        #self.screen_atributes.buttons["but:Style"] = ButtonFsm("Style", (1.3, 0, 0.7), None, None, (-1.5, 1.5, -0.4, 0.8), (1.8, 0.8, 0.8))

        # self.process_offline_game = process_offline_game
        self.process_continue_online_game = process_continue_online_game
        self.is_client_connected_to_server = is_client_connected_to_server
        self.on_application_exit = on_application_exit
        self.render_fsm_ref = render_fsm
        self.initialize_button_links()
    def __init__(self,
                 render_fsm,
                 whiteside_pack_name,
                 blackside_pack_name,
                 side,
                 exit_link,
                 check_move_func,
                 get_cur_turn_side,
                 on_exit_func=None):
        ScreenState.__init__(self)
        self.exit_link = "fsm:MainMenu"
        self.button_sizes = (-1.5, 1.5, -0.4, 0.8)
        self.render_fsm_ref = render_fsm
        self.render_fsm_ref.taskMgr.remove('camRotTask')
        self.side = side
        self.skysphere = None
        self.objMngr = FigureMngr(blackside_pack_name, whiteside_pack_name)

        self.dimension = Dimension._3D
        self.side = Side.WHITE

        self.init_sky_sphere()
        self.squares = [None for i in range(64)]
        self.info_squares = [None for i in range(100)]
        self.cubes = [None for i in range(64)]
        self.info_cubes = [None for i in range(100)]
        self.init_nodes_to_chsess_board()
        self.init_nodes_to_board_info()
        self.init_info_panel()
        self.pawn_change_panel = None
        self.swaped_icons = None

        self.str_board = "rnbqkbnr" \
                         "pppppppp" \
                         "........" \
                         "........" \
                         "........" \
                         "........" \
                         "PPPPPPPP" \
                         "RNBQKBNR"

        self.figures = [None for i in range(64)]
        self.init_nodes_to_figures()

        self._camera_set()
        #self.camera_p = Camera(base.camera, base.camLens)
        base.disableMouse()
        # camera debug god mode
        #base.oobe()
        self.is_in_past = False

        self.lights = Lights(base, self.render_fsm_ref.cur_window_width,
                             self.render_fsm_ref.cur_window_height)

        self.screen_atributes.buttons["but:Give up"] = ButtonFsm(
            "Give up", (-1, 0, 0.87), None, None, (-1.6, 1.6, -0.3, 0.9),
            (1.8, 0.8, 0.8), 0.1)
        self.screen_atributes.buttons["but:Exit"] = ButtonFsm(
            "Exit", (-1, 0, 0.73), None, None, (-1.6, 1.6, -0.3, 0.9),
            (1.8, 0.8, 0.8), 0.1)
        self.screen_atributes.buttons["but:2D/3D"] = ButtonFsm(
            "2D/3D", (1, 0, 0.8), None, None, None, (1.8, 0.8, 0.8), 0.2)
        self.initialize_button_links()

        self.init_ray()

        render_fsm.accept("a", self.go_to_past)  # left-click grabs a piece
        render_fsm.accept("d", self.go_to_future)  # releasing places it

        render_fsm.accept("mouse1",
                          self.grab_piece)  # left-click grabs a piece
        render_fsm.accept("mouse1-up",
                          self.release_piece)  # releasing places it

        render_fsm.accept("mouse2", self.middle_click)

        self.need_camera_update = False
        render_fsm.accept("mouse3", self.right_click)
        render_fsm.accept("mouse3-up", self.right_release)

        render_fsm.accept("wheel_up", self.wheel_up)
        render_fsm.accept("wheel_down", self.wheel_down)

        self.dragging = False
        self.dragging_figure_position = None
        self.hiSq = False

        self.text_info = {}
        self.scale = 0.07
        self.on_exit_func = on_exit_func

        self.check_move_func = check_move_func
        self.get_cur_turn_side = get_cur_turn_side

        self.tap_movement_manager = TapMovementManager(render_fsm, self)
    def __init__(self,
                 render_fsm,
                 process_skin_select,
                 avail_packs=["pack0", "pack1"]):
        ScreenState.__init__(self)
        self.cur_bg_2d = None
        self.button_sizes = (-2, 2, -0.4, 0.8)
        self.render_fsm_ref = render_fsm
        self.lights = Lights(base, self.render_fsm_ref.cur_window_width,
                             self.render_fsm_ref.cur_window_height)
        self.camera_p = Camera3D(base.camera, base.camLens,
                                 self.render_fsm_ref.cur_window_width,
                                 self.render_fsm_ref.cur_window_height)
        base.disableMouse()

        self.need_camera_update = False
        render_fsm.accept("mouse2", self.middle_click)

        render_fsm.accept("mouse3", self.right_click)
        render_fsm.accept("mouse3-up", self.right_release)

        render_fsm.accept("wheel_up", self.wheel_up)
        render_fsm.accept("wheel_down", self.wheel_down)

        self.screen_atributes.buttons["but:2D/3D"] = ButtonFsm(
            "2D/3D", (0.5, 0, 0.8), None, None, None, (1.8, 0.8, 0.8))
        self.screen_atributes.buttons["but:Prev"] = ButtonFsm(
            "<--", (-0.5, 0, -0.5), None, None, None, (1.8, 0.8, 0.8))
        self.screen_atributes.buttons["but:Next"] = ButtonFsm(
            "-->", (0.5, 0, -0.5), None, None, None, (1.8, 0.8, 0.8))
        self.screen_atributes.buttons["but:Confirm"] = ButtonFsm(
            "Confirm", (0.5, 0, -0.8), None, None, None, (2.2, 1, 1))
        self.screen_atributes.buttons["but:Back"] = ButtonFsm(
            "Back", (-0.5, 0, -0.8), None, None, None, (2.2, 1, 1))

        packs_in_list = []
        for pack in avail_packs:
            packs_in_list.append(
                DirectButton(text=pack,
                             scale=0.1,
                             command=self.option_list_confirm,
                             extraArgs=[pack],
                             frameColor=((0.8, 0.8, 0.8, 0.8), (0.4, 0.4, 0.4,
                                                                0.8),
                                         (0.4, 0.4, 0.8, 0.8), (0.1, 0.1, 0.1,
                                                                0.8)),
                             frameSize=(-1.5, 1.5, -0.4, 0.8)))

        self.my_scrolled_list = DirectScrolledList(
            decButton_pos=(0.35, 0, 0.7),
            decButton_text="up",
            decButton_text_scale=0.08,
            decButton_borderWidth=(0.005, 0.005),
            incButton_pos=(0.35, 0, 0.05),
            incButton_text="down",
            incButton_text_scale=0.08,
            incButton_borderWidth=(0.005, 0.005),
            frameSize=(0.0, 0.7, 0.8, 0),
            frameColor=(0.3, 0.3, 1, 0.5),
            pos=(-1, 0, 0),
            items=packs_in_list,
            numItemsVisible=4,
            forceHeight=0.11,
            itemFrame_frameSize=(-0.2, 0.2, -0.42, 0.11),
            itemFrame_pos=(0.35, 0, 0.55),
        )

        self.initialize_button_links()

        self.dimension = Dimension._3D

        self.current_pack = avail_packs[0]
        self.cur_model_num = 0
        self.cur_model_node = None
        self.models_order = [
            'k', 'q', 'b', 'n', 'r', 'p'
            'K', 'Q', 'B', 'N', 'R', 'P'
        ]

        self.option_list_confirm("pack0")

        self.process_skin_select = process_skin_select