xaxb

package
v0.0.0-...-ce26905 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Copyright 2014 loolgame Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2014 loolgame Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. fsm.go

Copyright 2014 loolgame Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

src/robot 中是猜数字游戏机器人

Copyright 2014 loolgame Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2014 mqantserver Author. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (
	VoidPeriod            = FSMState("空档期")
	IdlePeriod            = FSMState("空闲期")
	BettingPeriod         = FSMState("押注期")
	OpeningPeriod         = FSMState("开奖期")
	SettlementPeriod      = FSMState("结算期")
	VoidPeriodEvent       = FSMEvent("进入空档期")
	IdlePeriodEvent       = FSMEvent("进入空闲期")
	BettingPeriodEvent    = FSMEvent("进入押注期")
	OpeningPeriodEvent    = FSMEvent("进入开奖期")
	SettlementPeriodEvent = FSMEvent("进入结算期")
)
View Source
var Module = func() module.Module {
	this := new(xaxb)
	return this
}

Functions

func RandInt64

func RandInt64(min, max int64) int64

Types

type FSM

type FSM struct {
	// contains filtered or unexported fields
}

有限状态机

func NewFSM

func NewFSM(initState FSMState) *FSM

实例化FSM

func (*FSM) AddHandler

func (f *FSM) AddHandler(state FSMState, event FSMEvent, handler FSMHandler) *FSM

某状态添加事件处理方法

func (*FSM) Call

func (f *FSM) Call(event FSMEvent) FSMState

事件处理

type FSMEvent

type FSMEvent string // 事件

type FSMHandler

type FSMHandler func() FSMState // 处理方法,并返回新的状态

type FSMState

type FSMState string // 状态

type Table

type Table struct {
	room.BaseTableImp
	room.QueueTable
	room.UnifiedSendMessageTable
	room.TimeOutTable

	VoidPeriodHandler       FSMHandler
	IdlePeriodHandler       FSMHandler
	BettingPeriodHandler    FSMHandler
	OpeningPeriodHandler    FSMHandler
	SettlementPeriodHandler FSMHandler
	// contains filtered or unexported fields
}

func NewTable

func NewTable(module module.RPCModule, tableId int) *Table

func (*Table) AllowJoin

func (this *Table) AllowJoin() bool

func (*Table) Exit

func (self *Table) Exit(session gate.Session) error

func (*Table) GetModule

func (this *Table) GetModule() module.RPCModule

func (*Table) GetSeats

func (this *Table) GetSeats() []room.BasePlayer

func (*Table) GetViewer

func (this *Table) GetViewer() *list.List

func (*Table) InitFsm

func (this *Table) InitFsm()

func (*Table) Join

func (self *Table) Join(session gate.Session) error

* 玩家加入场景

func (*Table) NotifyAxes

func (self *Table) NotifyAxes()

* 定期刷新所有玩家的位置

func (*Table) NotifyBetting

func (self *Table) NotifyBetting()

* 通知所有玩家开始押注了

func (*Table) NotifyIdle

func (self *Table) NotifyIdle()

* 通知所有玩家进入空闲期了

func (*Table) NotifyJoin

func (self *Table) NotifyJoin(player *objects.Player)

* 通知所有玩家有新玩家加入

func (*Table) NotifyOpening

func (self *Table) NotifyOpening()

* 通知所有玩家开始开奖了

func (*Table) NotifyPause

func (self *Table) NotifyPause()

* 通知所有玩家开始游戏了

func (*Table) NotifyResume

func (self *Table) NotifyResume()

* 通知所有玩家开始游戏了

func (*Table) NotifySettlement

func (self *Table) NotifySettlement(Result int64)

* 通知所有玩家开奖结果出来了

func (*Table) NotifyStop

func (self *Table) NotifyStop()

* 通知所有玩家开始游戏了

func (*Table) OnCreate

func (this *Table) OnCreate()

func (*Table) OnDestroy

func (this *Table) OnDestroy()

func (*Table) OnNetBroken

func (self *Table) OnNetBroken(player room.BasePlayer)

* 玩家断线,游戏暂停

func (*Table) OnPause

func (this *Table) OnPause()

func (*Table) OnResume

func (this *Table) OnResume()

func (*Table) OnStart

func (this *Table) OnStart()

func (*Table) OnStop

func (this *Table) OnStop()

func (*Table) PauseGame

func (self *Table) PauseGame(session gate.Session) error

func (*Table) SitDown

func (self *Table) SitDown(session gate.Session) error

func (*Table) Stake

func (self *Table) Stake(session gate.Session, target int64) error

* 玩家押注

func (*Table) StartGame

func (self *Table) StartGame(session gate.Session) error

func (*Table) StateSwitch

func (this *Table) StateSwitch()

* 进入空闲期

func (*Table) Update

func (self *Table) Update(arge interface{})

* 牌桌主循环 定帧计算所有玩家的位置

func (*Table) VerifyAccessAuthority

func (this *Table) VerifyAccessAuthority(userId string, bigRoomId string) bool

//访问权限校验

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL