Skip to content

关于baseAppData和globalData数据

ilvxna edited this page Aug 8, 2018 · 1 revision

: 如果baseAppData和globalData数据我存入了一个相对复杂的字典结构请问会在其他的BaseApp都能读取到么?同问globalData也可以在多个cellapp等里读到么?简单的结构我知道是可以的。比如这样的结构:

def initLotteryGlobalData():
        _LotteryData = "scripts/data/GameData/Lottery.xml"
        LotteryRes = KBEngine.getResFullPath(_LotteryData)                        
        tree = etree.parse(LotteryRes) 
        root = tree.getroot()

        for childTemp in root:
                _Lottery = {}
                _Lottery["nameTxt"]            = childTemp[0].text
                _Lottery["once"]               = int(childTemp[1].text)
                _Lottery["tens"]               = int(childTemp[2].text)
                _Lottery["Green"]              = int(childTemp[3].text)
                _Lottery["Blue"]               = int(childTemp[4].text)
                _Lottery["Purple"]             = int(childTemp[5].text)
                _Lottery["Time"]               = int(childTemp[6].text)
                
                KBEngine.baseAppData[childTemp.attrib['name']] = _Lottery

不管多复杂都可以读到。

Clone this wiki locally