示例#1
0
    def __init__(self):
        self.bg = pygame.sprite.Sprite()
        Scene.__init__(self)
        self.sprites = pygame.sprite.Group()
        self.char_info_font = pygame.font.Font('data/AtariRevue.ttf', int(self.size[0] / 38.4))
        self.login, self.password, self.login_button, self.status = None, None, None, None

        self.first_char_is_exist = False
        self.first_char_play_button, self.first_char_delete_button, self.first_char_create_button = None, None, None
        self.first_char_name_label, self.first_char_class_label, self.first_char_rank_label,\
            self.first_char_blacklist_label, self.first_char_money_label = None, None, None, None, None
        self.first_char_name, self.first_char_class, self.first_char_money = None, None, None

        self.second_char_is_exist = False
        self.second_char_play_button, self.second_char_delete_button, self.second_char_create_button = None, None, None
        self.second_char_name_label, self.second_char_class_label, self.second_char_rank_label, \
            self.second_char_blacklist_label, self.second_char_money_label = None, None, None, None, None
        self.second_char_name, self.second_char_class, self.second_char_money = None, None, None

        self.third_char_is_exist = False
        self.third_char_play_button, self.third_char_delete_button, self.third_char_create_button = None, None, None
        self.third_char_name_label, self.third_char_class_label, self.third_char_rank_label, \
            self.third_char_blacklist_label, self.third_char_money_label = None, None, None, None, None
        self.third_char_name, self.third_char_class, self.third_char_money = None, None, None
        self.init_ui()
示例#2
0
    def __init__(self):
        Scene.__init__(self)
        self.data = AppData()
        self.data["account"]["status"] = ""
        self.interface = None
        self.map_manager = MapManager()
        self.char = None
        self.audio = AudioManager()
        self.audio.add_track("data/music/iraq.mp3")

        @self.api.on("get_char_info")
        def char_info(data):
            if data["status"] == "ok":
                self.account["char"] = {**self.account["char"], **data["char"]}
            else:
                print("Network error")

        @self.api.on("find")
        @self.check
        def found(data):
            if data["status"] == "ok":
                self.account["battle_step"] = data["step"]
                self.account["battle_enemy"] = data["enemy"]
                self.account["battle_char"] = data["player"]
                self.account["battle_skills"] = data["skills"]
                self.account["battle_status"] = ""
                self.scene_manager.change("Battle",
                                          self.scene_manager.dumps["Battle"])
            elif data["desc"] == "Not enough money":
                self.account[
                    "status"] = "Не достаточно денег, чтобы начать бой (мин.: 10 руб.)"
            else:
                print("Network error")

        self.start()
示例#3
0
    def __init__(self):
        self.bg = pygame.sprite.Sprite()
        Scene.__init__(self)
        self.sprites = pygame.sprite.Group()

        self.login, self.password, self.login_button, self.status = None, None, None, None
        self.init_ui()
示例#4
0
    def __init__(self):
        self.bg = pygame.sprite.Sprite()
        Scene.__init__(self)
        self.sprites = pygame.sprite.Group()

        self.login, self.password, self.login_button, self.status = None, None, None, None
        self.init_ui()

        @self.api.on("login")
        @self.check
        def login(data):
            nonlocal self
            if data["status"] == "ok":
                self.account["login"] = self.login.text
                self.account["password"] = self.password.text
                self.account["chars"] = list(
                    map(self.api.char_data_convert, data["chars"]))

                self.scene_manager.change("MainMenu", MainMenuScene)
            else:
                self.set_result("Ошибка: Неправильный логин или пароль")
示例#5
0
    def __init__(self):
        self.bg = pygame.sprite.Sprite()
        Scene.__init__(self)
        self.sprites = pygame.sprite.Group()

        self.quit_button, self.back_button = None, None
        self.font = self.font = pygame.font.Font('data/AtariRevue.ttf', 26)
        self.logined_account, self.chosen_class = None, None
        self.status = None
        self.init_ui()

        @self.api.on("create_char")
        @self.check
        def create_char(data):
            nonlocal self
            if data["status"] == "ok":
                self.account["chars"] = list(map(self.api.char_data_convert, data["chars"]))
                self.account["chosen_char_id"] = None
                self.scene_manager.change("CharsScene", self.scene_manager.last)
            else:
                self.set_result("Имя занято")
示例#6
0
    def __init__(self):
        self.bg = pygame.sprite.Sprite()
        Scene.__init__(self)
        self.sprites = pygame.sprite.Group()

        self.login, self.password, self.status = None, None, None
        self.register_button, self.quit_button, self.back_button = None, None, None
        self.init_ui()

        @self.api.on("register")
        @self.check
        def register(data):
            nonlocal self
            if data["status"] == "ok":
                self.account["login"] = self.login.text
                self.account["password"] = self.password.text
                self.account["chars"] = []
                self.api.login(self.account["login"], self.account["password"])
                self.scene_manager.change("MainMenu",
                                          MainMenuScene,
                                          make_dump=True)
            else:
                self.set_result("Ошибка: Логин занят")
示例#7
0
    def __init__(self):
        self.bg = pygame.sprite.Sprite()
        self.opponent = pygame.sprite.Sprite()
        self.cover = pygame.sprite.Sprite()
        Scene.__init__(self)
        self.sprites = pygame.sprite.Group()

        self.status = None

        self.char_name_label, self.char_hp_letters_label, self.char_hp_status_label = None, None, None
        self.opponent_name_label, self.opponent_hp_letters_label, self.opponent_hp_status_label = None, None, None
        self.first_action, self.second_action, self.third_action, self.leave_button = None, None, None, None
        self.status_label = None
        self.status_label_advanced = None

        self.name_font = pygame.font.Font('data/AtariRevue.ttf',
                                          int(self.size[0] / 32))
        self.hp_letters_font = pygame.font.Font('data/AtariRevue.ttf',
                                                int(self.size[0] / 22))
        self.opponent_name_font = pygame.font.Font('data/AtariRevue.ttf',
                                                   int(self.size[0] / 26))
        self.skills = self.account["battle_skills"]
        self.opponent_name = self.account["battle_enemy"]["name"]
        self.init_ui()

        @self.api.on("result")
        @self.check
        def result(data):
            nonlocal self
            if data["status"] == "ok":
                self.account["rank"] = data["rank"]
                self.scene_manager.change("Game",
                                          self.scene_manager.dumps["Game"])

        @self.api.on("battle")
        @self.check
        def battle(data):
            nonlocal self
            if data["status"] == "ok":
                self.account["battle_step"] = data["step"]
                self.account["battle_char"] = {
                    **self.account["battle_char"],
                    **data["player"]
                }
                self.account["battle_enemy"] = {
                    **self.account["battle_enemy"],
                    **data["enemy"]
                }
                self.data["draw"]()

        @self.api.on("action")
        @self.check
        def action(data):
            nonlocal self
            if data["status"] == "ok":
                self.account["battle_step"] = ""
            else:
                if data["desc"] == "data":
                    self.account["battle_step"] = ""
                if data["desc"] == "Not enough power":
                    self.account["battle_status"] = "Не достаточно силы"
                elif data["desc"] == "Not your step":
                    self.account["battle_status"] = "Не ваш ход"