def createSpawnPointDatas(self): """ """ res = r"scripts\data\spawnpoints\%s_spawnpoints.xml" % (self.spaceResName.replace("\\", "/").split("/")[-1]) if(len(self.spaceResName) == 0 or not KBEngine.hasRes(res)): return res = KBEngine.getResFullPath(res) tree = etree.parse(res) root = tree.getroot() DEBUG_MSG("Space::createSpawnPointDatas: %s" % (res)) for child in root: positionNode = child[0][0] directionNode = child[0][1] scaleNode = child[0][2] scale = int(((float(scaleNode[0].text) + float(scaleNode[1].text) + float(scaleNode[2].text)) / 3.0) * 10) position = (float(positionNode[0].text), float(positionNode[1].text), float(positionNode[2].text)) direction = [float(directionNode[0].text) / 360 * (math.pi * 2), float(directionNode[1].text) / 360 * (math.pi * 2), float(directionNode[2].text) / 360 * (math.pi * 2)] if direction[0] - math.pi > 0.0: direction[0] -= math.pi * 2 if direction[1] - math.pi > 0.0: direction[1] -= math.pi * 2 if direction[2] - math.pi > 0.0: direction[2] -= math.pi * 2 self.tmpCreateEntityDatas.append([int(child.attrib['name']), \ position, \ direction, \ scale, \ ])
def createSpawnPointDatas(self): """ """ res = r"scripts\data\spawnpoints\%s_spawnpoints.xml" % self.spaceResName if (len(self.spaceResName) == 0 or not KBEngine.hasRes(res)): return res = KBEngine.getResFullPath(res) tree = etree.parse(res) root = tree.getroot() DEBUG_MSG("Space::createSpawnPointDatas: %s" % (res)) for child in root: position = child[0][0] direction = child[0][1] scaleNode = child[0][2] scale = int(((float(scaleNode[0].text) + float(scaleNode[1].text) + float(scaleNode[2].text)) / 3.0) * 10) self.tmpCreateEntityDatas.append([int(child.attrib['name']), \ (float(position[0].text), float(position[1].text), float(position[2].text)), \ (float(direction[0].text) * ((math.pi * 2) / 360), float(direction[1].text) * ((math.pi * 2) / 360), float(direction[2].text) * ((math.pi * 2) / 360)), \ scale, \ ])
def createSpawnPointDatas(self): """ """ res = r"scripts\data\spawnpoints\%s_spawnpoints.xml" % self.spaceResName if(len(self.spaceResName) == 0 or not KBEngine.hasRes(res)): return res = KBEngine.getResFullPath(res) tree = etree.parse(res) root = tree.getroot() DEBUG_MSG("Space::createSpawnPointDatas: %s" % (res)) for child in root: position = child[0][0] direction = child[0][1] scaleNode = child[0][2] scale = int(((float(scaleNode[0].text) + float(scaleNode[1].text) + float(scaleNode[2].text)) / 3.0) * 10) self.tmpCreateEntityDatas.append([int(child.attrib['name']), \ (float(position[0].text), float(position[1].text), float(position[2].text)), \ (float(direction[0].text) * ((math.pi * 2) / 360), float(direction[1].text) * ((math.pi * 2) / 360), float(direction[2].text) * ((math.pi * 2) / 360)), \ scale, \ ])
def __init__(self, filename): super().__init__() filename = KBEngine.getResFullPath(filename) try: with codecs.open(filename, 'r', 'utf-8') as f: dom = xml.dom.minidom.parse(f) root = dom.documentElement self.recursive(self, root) except FileNotFoundError: pass
def reloadAllModule(): global g_allClasses g_allClasses = {} # base cell common user_type文件夹内的所有py全部重载 if KBEngine.component == "baseapp": sb = KBEngine.getResFullPath("base/kbemain.py") sb = sb[:-10] ll = len(sb) for s in KBEngine.listPathRes("base", "py"): s = s[ll:-3] s = s.replace('/', '.') mo = importlib.import_module(s) _reloadModule(mo) elif KBEngine.component == "cellapp": sb = KBEngine.getResFullPath("cell/kbemain.py") sb = sb[:-10] ll = len(sb) for s in KBEngine.listPathRes("cell", "py"): s = s[ll:-3] s = s.replace('/', '.') mo = importlib.import_module(s) _reloadModule(mo) # reload common sb = KBEngine.getResFullPath("common/KBEDebug.py") sb = sb[:-11] ll = len(sb) for s in KBEngine.listPathRes("common", "py"): s = s[ll:-3] s = s.replace('/', '.') mo = importlib.import_module(s) _reloadModule(mo) # reload userType sb = KBEngine.getResFullPath("user_type/UserType.py") sb = sb[:-11] ll = len(sb) for s in KBEngine.listPathRes("user_type", "py"): s = s[ll:-3] s = s.replace('/', '.') mo = importlib.import_module(s) _reloadModule(mo) _reloadAllObjects()