52 lines
959 B
Go
52 lines
959 B
Go
package fight
|
|
|
|
import "blazing/logic/service/fight/input"
|
|
|
|
const (
|
|
SideOur = 1
|
|
SideOpp = 2
|
|
)
|
|
|
|
type SlotView struct {
|
|
Side int
|
|
SlotIndex int
|
|
ControllerUserID uint32
|
|
Input *input.Input
|
|
}
|
|
|
|
func (f *FightC) SlotInput(side int, slotIndex int) *input.Input {
|
|
switch side {
|
|
case SideOur:
|
|
return f.selectInput(f.Our, slotIndex)
|
|
case SideOpp:
|
|
return f.selectInput(f.Opp, slotIndex)
|
|
default:
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func (f *FightC) SideSlots(side int) []SlotView {
|
|
var sideInputs []*input.Input
|
|
switch side {
|
|
case SideOur:
|
|
sideInputs = f.Our
|
|
case SideOpp:
|
|
sideInputs = f.Opp
|
|
default:
|
|
return nil
|
|
}
|
|
slots := make([]SlotView, 0, len(sideInputs))
|
|
for idx, in := range sideInputs {
|
|
if in == nil || in.Player == nil {
|
|
continue
|
|
}
|
|
slots = append(slots, SlotView{
|
|
Side: side,
|
|
SlotIndex: idx,
|
|
ControllerUserID: in.Player.GetInfo().UserID,
|
|
Input: in,
|
|
})
|
|
}
|
|
return slots
|
|
}
|