import ConfProxy, { ConfListProxy } from "./confProxy"
import { XlsConfig, xlsAttrAttr, xlsAudioInfo, xlsChapterInfo, xlsChapterLayout, xlsEmitterInfo, xlsGuideInfo, xlsItemKind
, xlsItemInfo, xlsKaiqiInfo, xlsLanguageLang, xlsLanguageClientText, xlsLanguageSeverHouduan, xlsLevelLevel, xlsMathInfo, xlsMergePropInfo, xlsMergeInfo
, xlsEquipInfo, xlsNameName, xlsPackageInfo, xlsPingbiciInfo, xlsTaskDesc, xlsTaskMain } from "./xlsConfig"

export default class Gamecfg {
    static attrAttr:ConfProxy<xlsAttrAttr>
    static audioInfo:ConfProxy<xlsAudioInfo>
    static chapterInfo:ConfProxy<xlsChapterInfo>
    static chapterLayoutList:ConfListProxy<xlsChapterLayout>
    static emitterInfo:ConfProxy<xlsEmitterInfo>
    static guideInfo:ConfProxy<xlsGuideInfo>
    static guideInfoList:ConfListProxy<xlsGuideInfo>
    static itemKind:ConfProxy<xlsItemKind>
    static itemInfo:ConfProxy<xlsItemInfo>
    static kaiqiInfo:ConfProxy<xlsKaiqiInfo>
    static languageLang:ConfProxy<xlsLanguageLang>
    static languageClientText:ConfProxy<xlsLanguageClientText>
    static languageSeverHouduan:ConfProxy<xlsLanguageSeverHouduan>
    static levelLevel:ConfProxy<xlsLevelLevel>
    static mathInfo:ConfProxy<xlsMathInfo>
    static mergePropInfo:ConfProxy<xlsMergePropInfo>
    static mergeInfo:ConfProxy<xlsMergeInfo>
    static equipInfo:ConfProxy<xlsEquipInfo>
    static nameName:ConfProxy<xlsNameName>
    static packageInfo:ConfProxy<xlsPackageInfo>
    static pingbiciInfo:ConfProxy<xlsPingbiciInfo>
    static taskDesc:ConfProxy<xlsTaskDesc>
    static taskMain:ConfProxy<xlsTaskMain>
    static taskMainByNextid:ConfProxy<xlsTaskMain>

    static initLoading(loadSuccess: Function) {
       try {
           new XlsConfig("loadJson",(xls: XlsConfig) => {
               Gamecfg.audioInfo = new ConfProxy("audioInfo",xls.xlsAudioInfo ,"id")
               Gamecfg.languageLang = new ConfProxy("languageLang",xls.xlsLanguageLang ,"key")
               Gamecfg.languageClientText = new ConfProxy("languageClientText",xls.xlsLanguageClientText ,"key")
               Gamecfg.mathInfo = new ConfProxy("mathInfo",xls.xlsMathInfo ,"key")
               Gamecfg.packageInfo = new ConfProxy("packageInfo",xls.xlsPackageInfo ,"id")

				loadSuccess(true)
			})
		} catch (error) {
			loadSuccess(false)
		}
	}
    static init(loadSuccess: Function, progressCallback: Function) {
       try {
           new XlsConfig("pzwj",(xls: XlsConfig) => {
               Gamecfg.attrAttr = new ConfProxy("attrAttr",xls.xlsAttrAttr ,"id")
               Gamecfg.chapterInfo = new ConfProxy("chapterInfo",xls.xlsChapterInfo ,"id")
               Gamecfg.chapterLayoutList = new ConfListProxy("chapterLayoutList",xls.xlsChapterLayout ,"infoId")
               Gamecfg.emitterInfo = new ConfProxy("emitterInfo",xls.xlsEmitterInfo ,"id")
               Gamecfg.guideInfo = new ConfProxy("guideInfo",xls.xlsGuideInfo ,"id")
               Gamecfg.guideInfoList = new ConfListProxy("guideInfoList",xls.xlsGuideInfo ,"event")
               Gamecfg.itemKind = new ConfProxy("itemKind",xls.xlsItemKind ,"kind")
               Gamecfg.itemInfo = new ConfProxy("itemInfo",xls.xlsItemInfo ,"id")
               Gamecfg.kaiqiInfo = new ConfProxy("kaiqiInfo",xls.xlsKaiqiInfo ,"id")
               Gamecfg.languageSeverHouduan = new ConfProxy("languageSeverHouduan",xls.xlsLanguageSeverHouduan ,"key")
               Gamecfg.levelLevel = new ConfProxy("levelLevel",xls.xlsLevelLevel ,"level")
               Gamecfg.mergePropInfo = new ConfProxy("mergePropInfo",xls.xlsMergePropInfo ,"id")
               Gamecfg.mergeInfo = new ConfProxy("mergeInfo",xls.xlsMergeInfo ,"id")
               Gamecfg.equipInfo = new ConfProxy("equipInfo",xls.xlsEquipInfo ,"id")
               Gamecfg.nameName = new ConfProxy("nameName",xls.xlsNameName ,"frist")
               Gamecfg.pingbiciInfo = new ConfProxy("pingbiciInfo",xls.xlsPingbiciInfo ,"id")
               Gamecfg.taskDesc = new ConfProxy("taskDesc",xls.xlsTaskDesc ,"kind")
               Gamecfg.taskMain = new ConfProxy("taskMain",xls.xlsTaskMain ,"id")
               Gamecfg.taskMainByNextid = new ConfProxy("taskMainByNextid",xls.xlsTaskMain ,"nextid")

                loadSuccess(true)
            }, progressCallback)
        } catch (error) {
            loadSuccess(false)
        }
    }
}