当前位置: 首页>>代码示例>>Python>>正文


Python View.input_player_name方法代码示例

本文整理汇总了Python中view.View.input_player_name方法的典型用法代码示例。如果您正苦于以下问题:Python View.input_player_name方法的具体用法?Python View.input_player_name怎么用?Python View.input_player_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在view.View的用法示例。


在下文中一共展示了View.input_player_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from view import View [as 别名]
# 或者: from view.View import input_player_name [as 别名]
class Game:
	def __init__(self):
		self.adventure.index = 0
		self.adventure = []
		self.player = None
		self.view= View()

		def begin(self):
			self.player = self.view.input_player_name()

		def create_player(self):
			name = self.view.input_player_name()
			job = self.view.input_player_job()
			return Player(name, job)

		def play(self):
			self.view.introduction_message()
			while self.adventure_index<len(self.adventure):
				if self.adventure[self.adventure_index].start(self.player):
					self.mission_index += 1
					self.view.passed_adventure_message()
				else:
					self.view.failed_mission_message()
					break

				def load_adventure(self, adventure):
					self.adventure = passed_adventure_messageself.adventure_index = 0
开发者ID:hrgunn,项目名称:MLH,代码行数:29,代码来源:new_cont.py

示例2: __init__

# 需要导入模块: from view import View [as 别名]
# 或者: from view.View import input_player_name [as 别名]
class Game:
    def __init__(self):
        self.mission_index = 0
        self.missions = []
        self.player = None
        self.view = View()

    def start(self):
        self.player = self.create_player()

    def create_player(self):
        name = self.view.input_player_name()
        race = self.view.input_player_race()
        return Player(name, race)

    def play(self):
        self.view.introduction_message()
        while self.mission_index < len(self.missions):
            if self.missions[self.mission_index].start(self.player):
                self.mission_index += 1
                self.view.passed_mission_message()
            else:
                self.view.failed_mission_message()
                break

    def load_missions(self, missions):
        self.missions = missions
        self.mission_index = 0
开发者ID:hrgunn,项目名称:MLH,代码行数:30,代码来源:controller.py


注:本文中的view.View.input_player_name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。