通关星级对应到指定的描述位置

This commit is contained in:
meixiongfeng 2023-01-07 14:46:47 +08:00
parent 367a553c15
commit 2ecebd23fd
2 changed files with 26 additions and 13 deletions

View File

@ -18,7 +18,6 @@ import (
"go_dreamfactory/sys/configure"
"go_dreamfactory/sys/db"
"go_dreamfactory/utils"
"math"
"reflect"
"strings"
"testing"
@ -72,15 +71,22 @@ func GetMonthStartEnd() (int64, int64) {
}
func Test_Main(t *testing.T) {
var l int64
var l1 int64
var i int32
var f float64
i = math.MaxInt32
l = int64(i) << 31
l1 = 1 << 31
f = float64(l)
fmt.Printf("%d,%d,%f", l, l1, f)
var star1, star2, star3 int32
var rst int32
star1 = 1 << 2
star2 = 1 << 1
star3 = 1 << 0
//rst = star1 ^ star2 ^ star3 // 三星
//rst = star1 ^ star2 // 2星
rst ^= star1
rst ^= star2
// 校验星
b1 := (rst&star1 == star1)
b2 := (rst&star2 == star2)
b3 := (rst&star3 == star3)
fmt.Printf("%d,%d,%d,%d", star1, star2, star3, rst)
fmt.Printf("%v,%v,%v,%d", b1, b2, b3, rst)
var list []int32
var list2 []int32
list = []int32{1, 2, 3, 4, 5, 6, 7, 8, 9}

View File

@ -76,16 +76,23 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
code = pb.ErrorCode_ConfigNoFound
return
}
var star1, star2, star3 int32
star1 = 1 << 2
star2 = 1 << 1
star3 = 1 << 0
for i, v := range stageConf.StarType {
if v == comm.MainStarType1 {
star += stageConf.Star[i]
//star += stageConf.Star[i]
star ^= star1
} else if v == comm.MainStarType2 {
if req.Report.Death <= stageConf.StarValue[i] {
star += stageConf.Star[i]
//star += stageConf.Star[i]
star ^= star2
}
} else if v == comm.MainStarType3 {
if req.Report.Round <= stageConf.StarValue[i] {
star += stageConf.Star[i]
//star += stageConf.Star[i]
star ^= star3
}
}
}