feat(Go-Tool):
2020/12/31:新增项目案例(角色技能树)
2020/12/31: 修改diliver包结构
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* @Author : huangzj
|
||||
* @Time : 2020/12/29 14:49
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
package dbOperation
|
||||
|
||||
import (
|
||||
"Go-Tool/ProgressTest/SkillTopology/model"
|
||||
)
|
||||
|
||||
type CounsellorSrv struct {
|
||||
}
|
||||
|
||||
func NewCounsellorSrv() *CounsellorSrv {
|
||||
return &CounsellorSrv{}
|
||||
}
|
||||
|
||||
//通过模拟的Id来获取对应的技能
|
||||
func (*CounsellorSrv) GetCounsellorSkill(counsellorId int) *model.Counsellor {
|
||||
skillPoint := NewSkillPointSrv()
|
||||
return &model.Counsellor{
|
||||
Id: model.CounsellorId,
|
||||
Name: "测试的大臣",
|
||||
Skill: skillPoint.GetAllSkillByCounsellorId(model.CounsellorId),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* @Author : huangzj
|
||||
* @Time : 2020/12/29 14:48
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
package dbOperation
|
||||
|
||||
import (
|
||||
"Go-Tool/ProgressTest/SkillTopology/model"
|
||||
"Go-Tool/util/file"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
type SkillPointSrv struct {
|
||||
//.... 需要的所有属性
|
||||
}
|
||||
|
||||
func NewSkillPointSrv() *SkillPointSrv {
|
||||
return &SkillPointSrv{}
|
||||
}
|
||||
|
||||
func (*SkillPointSrv) RacePoint() {
|
||||
|
||||
}
|
||||
|
||||
type tmp struct {
|
||||
Skills []*model.Skill
|
||||
}
|
||||
|
||||
//模拟数据,未激活的技能(Level = 0 )技能设置为:6、7、8、10、12,其他为激活的技能,没有等级的技能在数据库不体现
|
||||
func (*SkillPointSrv) GetAllSkillByCounsellorId(counsellorId int) []*model.Skill {
|
||||
var tmp tmp
|
||||
content, _ := file.ReadJsonFile("F://Go_BySelf//src//Go-Tool//ProgressTest//SkillTopology//skill.json")
|
||||
_ = json.Unmarshal([]byte(content), &tmp)
|
||||
|
||||
return tmp.Skills
|
||||
}
|
||||
Reference in New Issue
Block a user