//pid 1219 推送成就变化 func (this *AchievementStruct) Notice2CAchievementChange(type_id int32, conn *net.Conn) { //对应 if _, ok := this.Achievement_Map[type_id]; !ok { return } var infos []*protocol.AchievementInfo for _, v_buff := range this.Achievement_Map[type_id] { v := v_buff info := new(protocol.AchievementInfo) info.Id = &v.Id info.Progress = &v.Progress info.IsComplete = &v.Is_complete info.IsReward = &v.Is_reward infos = append(infos, info) } result4C := &protocol.NoticeMsg_Notice2CAchievementChange{ Infos: infos, } encObj, _ := proto.Marshal(result4C) SendPackage(*conn, 1219, encObj) }
//请求获取完成成就列表 func (this *AchievementStruct) GetAchievementResult(conn *net.Conn) { var infos []*protocol.AchievementInfo for _, v1 := range this.Achievement_Map { for _, v_buff := range v1 { v2 := v_buff info := new(protocol.AchievementInfo) info.Id = &v2.Id info.Progress = &v2.Progress info.IsComplete = &v2.Is_complete info.IsReward = &v2.Is_reward infos = append(infos, info) } } result4C := &protocol.Task_GetAchievementResult{ Infos: infos, } encObj, _ := proto.Marshal(result4C) SendPackage(*conn, 1851, encObj) }