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


Python Map.updateMap方法代码示例

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


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

示例1: __init__

# 需要导入模块: from map import Map [as 别名]
# 或者: from map.Map import updateMap [as 别名]
class Parser:
    """Check all command et execute command"""

    def __init__(self, window, winW, winH):
        self.players = []
        self.itX = []
        self.itY = []
        self.winW = winW
        self.winH = winH
        self.win = window
        self.dicts = {}
        self.action = {}
        self.pic = 0
        self.teamList = ["Team : "]
        self.threadList = {}
        self.mp = Map(window, winW, winH)
        self.perso = Player(window, self.mp)
        self.item = Items(window, self.mp)
        self.initCommands()
        self.initAction()
        self.stat = 0

    def initCommands(self):
        self.dicts["msz"] = self.Cmsz
        self.dicts["pnw"] = self.Cpnw
        self.dicts["enw"] = self.Cenw
        self.dicts["pbc"] = self.Cpbc
        self.dicts["eht"] = self.Ceht
        self.dicts["edi"] = self.Cedi
        self.dicts["ppo"] = self.Cppo
        self.dicts["plv"] = self.Cplv
        self.dicts["pfk"] = self.Cpfk
        self.dicts["pdi"] = self.Cpdi
        self.dicts["bct"] = self.Cbct
        self.dicts["pex"] = self.Cpex
        self.dicts["pin"] = self.Cpin
        self.dicts["pic"] = self.Cpic
        self.dicts["pie"] = self.Cpie
        self.dicts["pdr"] = self.Cpdr
        self.dicts["pgt"] = self.Cpgt
        self.dicts["ebo"] = self.Cebo
        self.dicts["sgt"] = self.Csgt
        self.dicts["seg"] = self.Cseg
        self.dicts["smg"] = self.Csmg
        self.dicts["tna"] = self.Ctna
        self.dicts["suc"] = self.Cunknown
        self.dicts["sbp"] = self.Cunknown

    def initAction(self):
        self.action["msz"] = self.mp.displayMap
        self.action["pnw"] = self.perso.add
        self.action["enw"] = self.perso.makeEggs
        self.action["pbc"] = self.perso.broadcast
        self.action["eht"] = self.perso.hatchEggs
        self.action["edi"] = self.perso.hatchEggs
        self.action["ppo"] = self.perso.update
        self.action["plv"] = self.perso.setLevel
        self.action["pfk"] = self.perso.shield
        self.action["pdi"] = self.perso.die
        self.action["bct"] = self.item.addItem

    def checkCommand(self, command):
        if command[0] == "BIENVENUE":
            return
        print command
        if (self.dicts[command[0]](command) == False):
            print "Invalid Command =>" + command[0]

    def updateMap(self, winW, winH):
        self.winW = winW
        self.winH = winH
        self.mp.updateMap(winW, winH, self.item, self.perso, self.players, self.teamList)

    def play_music(self, song, lop):
        try:
            if not pygame.mixer.get_init():
                pygame.mixer.init()
            pygame.mixer.music.load(song)
            pygame.mixer.music.set_volume(float(50.00)/100)
            channel = pygame.mixer.music.play(lop)
        except:
            print "Could not load music"

    def checkInt(self, valArray, size):
        i = 1
        while (i < size):
            if (valArray[i].isdigit == False):
                print "ioJAIODJOJIOJDIOJ"
                return False
            i += 1
        return True

    def run(self, id):
        self.perso.execCommand(id)

    def Cmsz(self, command):
        if (len(command) != 3 or self.checkInt(command, 3) == False):
            return False
        self.action[command[0]](int(command[1]) - 1,
                                int(command[2]) - 1)
#.........这里部分代码省略.........
开发者ID:jonquach,项目名称:zappy,代码行数:103,代码来源:parser.py


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