Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
f14bfa7567
@ -428,12 +428,12 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
|
|||||||
this.AiOperator()
|
this.AiOperator()
|
||||||
}
|
}
|
||||||
case "ready":
|
case "ready":
|
||||||
var bStartGame bool // 可以开始游戏
|
var bStartGame bool // 可以开始游戏
|
||||||
|
this.NexPower = this.player1.Userinfo.Uid
|
||||||
|
this.curPower = this.player1.Userinfo.Uid
|
||||||
|
this.player1.Ps = MaxPs
|
||||||
|
this.player2.Ps = 0
|
||||||
if len(this.szSession) == 1 { // AI对战的话直接开始游戏
|
if len(this.szSession) == 1 { // AI对战的话直接开始游戏
|
||||||
this.NexPower = this.player1.Userinfo.Uid
|
|
||||||
this.curPower = this.player1.Userinfo.Uid
|
|
||||||
this.player1.Ps = MaxPs
|
|
||||||
this.player2.Ps = 0
|
|
||||||
bStartGame = true
|
bStartGame = true
|
||||||
} else {
|
} else {
|
||||||
if this.player1.Userinfo.Uid == session.GetUserId() {
|
if this.player1.Userinfo.Uid == session.GetUserId() {
|
||||||
|
@ -620,13 +620,13 @@ func (this *MapData) CheckInitPlat() {
|
|||||||
|
|
||||||
func (this *MapData) SetMap() {
|
func (this *MapData) SetMap() {
|
||||||
sz2 := []int32{
|
sz2 := []int32{
|
||||||
5, 5, 4, 1, 1, 2, 5,
|
3, 3, 2, 2, 1, 3, 1,
|
||||||
3, 6, 3, 4, 6, 2, 1,
|
5, 1, 2, 3, 1, 2, 2,
|
||||||
3, 5, 6, 3, 1, 6, 1,
|
3, 4, 3, 5, 6, 1, 6,
|
||||||
1, 2, 6, 5, 4, 1, 3,
|
1, 4, 6, 4, 2, 3, 6,
|
||||||
4, 4, 3, 5, 4, 6, 4,
|
1, 5, 6, 5, 6, 1, 4,
|
||||||
5, 6, 1, 4, 3, 3, 6,
|
5, 3, 4, 1, 4, 3, 3,
|
||||||
5, 3, 5, 3, 6, 1, 5,
|
3, 3, 5, 1, 1, 2, 5,
|
||||||
// 1, 4, 2, 5, 4, 5, 2,
|
// 1, 4, 2, 5, 4, 5, 2,
|
||||||
// 3, 2, 3, 5, 2, 1, 4,
|
// 3, 2, 3, 5, 2, 1, 4,
|
||||||
// 2, 5, 5, 4, 5, 4, 1,
|
// 2, 5, 5, 4, 5, 4, 1,
|
||||||
@ -655,15 +655,15 @@ func (this *MapData) CheckAndRefreshPlat() (bEliminate bool) {
|
|||||||
if v.Color == 0 {
|
if v.Color == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
x := int32(k % Height) // x
|
x := int32(k % Height)
|
||||||
y := int32(k / Height) // y
|
y := int32(k / Height)
|
||||||
if x+2 < Height { // 上
|
if x+2 < Height { // 上
|
||||||
k1 := this.Plat[k].Color
|
k1 := this.Plat[k].Color
|
||||||
k2 := this.Plat[k+1].Color
|
k2 := this.Plat[k+1].Color
|
||||||
if k1 == k2 { // 校验k3 左边和右边
|
if k1 == k2 { // 校验k3 左边和右边
|
||||||
if true {
|
if true {
|
||||||
pos := k + 2
|
pos := k + 2
|
||||||
if pos/Width-1 >= 0 { // 右
|
if pos/Width-1 >= 0 { // 左
|
||||||
p := this.Plat[pos-Width].Color
|
p := this.Plat[pos-Width].Color
|
||||||
if p == k1 {
|
if p == k1 {
|
||||||
bEliminate = true
|
bEliminate = true
|
||||||
@ -687,23 +687,25 @@ func (this *MapData) CheckAndRefreshPlat() (bEliminate bool) {
|
|||||||
}
|
}
|
||||||
// xia
|
// xia
|
||||||
pos := k - 1
|
pos := k - 1
|
||||||
if pos%Height > 0 { // 左右
|
if x > 0 {
|
||||||
if pos/Width-1 >= 0 { //左
|
if pos%Height > 0 { // 左右
|
||||||
p := this.Plat[pos-Width].Color
|
if pos/Width-1 >= 0 { //左
|
||||||
if p == k1 {
|
p := this.Plat[pos-Width].Color
|
||||||
bEliminate = true
|
if p == k1 {
|
||||||
return
|
bEliminate = true
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if pos/Width+1 < Width { // 右
|
||||||
if pos/Width+1 < Width { // 右
|
p := this.Plat[pos+Width].Color
|
||||||
p := this.Plat[pos+Width].Color
|
if p == k1 {
|
||||||
if p == k1 {
|
bEliminate = true
|
||||||
bEliminate = true
|
return
|
||||||
return
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if pos%Height-1 >= 0 {
|
if x > 1 {
|
||||||
p := this.Plat[pos-1].Color
|
p := this.Plat[pos-1].Color
|
||||||
if p == k1 {
|
if p == k1 {
|
||||||
bEliminate = true
|
bEliminate = true
|
||||||
@ -772,61 +774,66 @@ func (this *MapData) CheckAndRefreshPlat() (bEliminate bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for index := Width - 1; index >= 0; index-- {
|
for k, v := range this.Plat {
|
||||||
for j := 0; j < Height; j++ {
|
if v.Color == 0 {
|
||||||
k := index + j*7
|
continue
|
||||||
if j+3 < Width {
|
}
|
||||||
k1 := this.Plat[k].Color
|
// x := int32(k % Height) // x
|
||||||
k2 := this.Plat[k+2*Width].Color
|
y := int32(k / Height) // y
|
||||||
pos := index + (j+1)*7
|
|
||||||
if k1 == k2 {
|
if y+2 < Width {
|
||||||
// 上
|
k1 := this.Plat[k].Color
|
||||||
if pos%Height+1 < Height {
|
k2 := this.Plat[k+2*Width].Color
|
||||||
p := this.Plat[pos+1].Color
|
pos := k + Width
|
||||||
if p == k1 {
|
if k1 == k2 {
|
||||||
bEliminate = true
|
// 上
|
||||||
return
|
if pos%Height+1 < Height {
|
||||||
}
|
p := this.Plat[pos+1].Color
|
||||||
|
if p == k1 {
|
||||||
|
bEliminate = true
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if pos%Height-1 >= 0 {
|
}
|
||||||
p := this.Plat[pos-1].Color
|
if pos%Height-1 >= 0 {
|
||||||
if p == k1 {
|
p := this.Plat[pos-1].Color
|
||||||
bEliminate = true
|
if p == k1 {
|
||||||
return
|
bEliminate = true
|
||||||
}
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 上下检测中间元素左右互换
|
// 上下检测中间元素左右互换
|
||||||
for i := 0; i < Height; i++ {
|
for k, v := range this.Plat {
|
||||||
for j := 0; j < Height; j++ {
|
if v.Color == 0 {
|
||||||
k := j + i*7
|
continue
|
||||||
if k%Height+3 < Height {
|
}
|
||||||
k1 := this.Plat[k].Color
|
|
||||||
k2 := this.Plat[k+2].Color
|
if k%Height+2 < Height {
|
||||||
pos := k + 1
|
k1 := this.Plat[k].Color
|
||||||
if k1 == k2 {
|
k2 := this.Plat[k+2].Color
|
||||||
if pos/Height+1 < Width { // 右
|
pos := k + 1
|
||||||
p := this.Plat[pos+Width].Color
|
if k1 == k2 {
|
||||||
if p == k1 {
|
if pos/Height+1 < Width { // 右
|
||||||
bEliminate = true
|
p := this.Plat[pos+Width].Color
|
||||||
return
|
if p == k1 {
|
||||||
}
|
bEliminate = true
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if pos/Height-1 >= 0 { // 右
|
}
|
||||||
p := this.Plat[pos-Width].Color
|
if pos/Height-1 >= 0 { // 右
|
||||||
if p == k1 {
|
p := this.Plat[pos-Width].Color
|
||||||
bEliminate = true
|
if p == k1 {
|
||||||
return
|
bEliminate = true
|
||||||
}
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !bEliminate {
|
if !bEliminate {
|
||||||
|
fmt.Printf("=====地图数据不能交换===========\n")
|
||||||
this.Debugf()
|
this.Debugf()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -905,5 +912,5 @@ func (this *MapData) RedsetPlatData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.SetIndelibilityPlat()
|
this.SetIndelibilityPlat()
|
||||||
this.Debugf()
|
//this.Debugf()
|
||||||
}
|
}
|
||||||
|
@ -84,9 +84,10 @@ func Test_Main(t *testing.T) {
|
|||||||
}()
|
}()
|
||||||
m := new(entertainment.MapData)
|
m := new(entertainment.MapData)
|
||||||
m.InitMap(nil)
|
m.InitMap(nil)
|
||||||
|
|
||||||
|
//m.SkillUp(24, 1, 3, 7, true)
|
||||||
|
m.SetMap()
|
||||||
m.Debugf()
|
m.Debugf()
|
||||||
m.SkillUp(24, 1, 3, 7, true)
|
|
||||||
// m.SetMap()
|
|
||||||
b := m.CheckAndRefreshPlat()
|
b := m.CheckAndRefreshPlat()
|
||||||
fmt.Printf("xxxx%v", b)
|
fmt.Printf("xxxx%v", b)
|
||||||
m.RedsetPlatData()
|
m.RedsetPlatData()
|
||||||
|
Loading…
Reference in New Issue
Block a user