示例#1
0
文件: webs.go 项目: Alexis211/ajstk
func LoadWebFiles() {
	log.Printf("Loading web server templates...")
	util.LoadJSONFile(config.Conf.WebFolder+"/info.json", &Info)
	messages = Info.Messages
	for _, page := range Info.ExtraPages {
		tpl[page] = nil
	}

	for name, _ := range tpl {
		log.Printf("Loading template : %v...", name)
		tpl[name] = loadExtendedTemplate(config.Conf.WebFolder+"/tpl", name)
	}
}
示例#2
0
文件: data.go 项目: Alexis211/ajstk
func loadLevel(level string) *Level {
	log.Printf("Loading level : %v...", level)
	ret := &Level{Id: level, LessonsMap: make(map[string]*Lesson)}

	util.LoadJSONFile(config.Conf.ContentsFolder+"/"+level+"/info.json", &ret.Info)

	ret.Lessons = make([]*Lesson, len(ret.Info.Lessons))
	for id, name := range ret.Info.Lessons {
		ret.Lessons[id] = loadLesson(level, name, ret)
		ret.LessonsMap[name] = ret.Lessons[id]
	}
	return ret
}
示例#3
0
文件: data.go 项目: Alexis211/ajstk
func LoadData() (DataInfo, []*Level, map[string]*Level) {
	var info DataInfo
	var levels []*Level
	var levelsMap = make(map[string]*Level)

	util.LoadJSONFile(config.Conf.ContentsFolder+"/info.json", &info)

	levels = make([]*Level, len(info.Levels))
	for id, name := range info.Levels {
		levels[id] = loadLevel(name)
		levelsMap[name] = levels[id]
	}
	return info, levels, levelsMap
}
示例#4
0
文件: data.go 项目: Alexis211/ajstk
func loadLesson(level, lesson string, lp *Level) *Lesson {
	log.Printf("Loading lesson : %v / %v...", level, lesson)
	ret := &Lesson{Level: lp, Id: lesson, ChunksMap: make(map[string]*Chunk)}

	util.LoadJSONFile(config.Conf.ContentsFolder+"/"+level+"/"+lesson+"/info.json", &ret.Info)

	ret.Chunks = make([]*Chunk, len(ret.Info.Chunks))
	for id, name := range ret.Info.Chunks {
		ret.Chunks[id] = loadChunk(level, lesson, name, ret)
		ret.ChunksMap[name] = ret.Chunks[id]
		ret.Chunks[id].Id = name
		ret.Chunks[id].Level = lp
	}
	return ret
}
示例#5
0
文件: config.go 项目: Alexis211/ajstk
func LoadConfig(file string) {
	log.Printf("Loading config file...")
	util.LoadJSONFile(file, &Conf)
}