-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMessage.swift
119 lines (95 loc) · 2.06 KB
/
Message.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//
// Message.swift
// try
//
// Created by Jiafang Jiang on 1/28/15.
// Copyright (c) 2015 Xiaoyu Chen. All rights reserved.
//
import Foundation
enum MessageType: Int {
case RandomNumber, GameReady, GameStart, FirstTrip, SecondTrip, ThirdTrip, Destination, Move, Pause, Dead, GameOver, NeutralInfo, Reborn, Exit, ChooseGameMode, ForceExitSession
}
enum GameState: Int {
case WaitingForReconcil, WaitingForStart, InGame, Done, InViewController, InLevelViewController
}
enum GameMode: Int {
case None, BattleArena, HiveMaze, PoolArena, HiveMaze2
}
struct Message {
let messageType: MessageType
}
struct MessageFirstTrip {
let message: Message
let time: NSTimeInterval
}
struct MessageSecondTrip {
let message: Message
let time: NSTimeInterval
let delta: NSTimeInterval
}
struct MessageThirdTrip {
let message: Message
let delta: NSTimeInterval
}
struct MessageRandomNumber {
let message: Message
let number: UInt32
}
struct MessageReadyToGame {
let message: Message
let playerID: UInt16
}
struct MessageGameStart {
let message: Message
let gameMode: UInt16
}
struct MessageDead {
let message: Message
let index: UInt16
let count: UInt32
}
struct MessageReborn {
let message: Message
let index: UInt16
}
struct MessageMove {
let message: Message
let x: Float
let y: Float
let dx: Float
let dy: Float
let count: UInt32
let index: UInt16
let dt: NSTimeInterval
let isSlave: Bool
}
struct MessageGameOver {
let message: Message
}
struct MessageNeutralInfo{
let message: Message
let index: UInt16
let id: UInt16
let lastCaptured: Double
}
struct MessageDestination {
let message: Message
let x: Float
let y: Float
let rotate: Float
let starX: Float
let starY: Float
}
struct MessagePause {
let message: Message
}
struct MessageExit {
let message: Message
}
struct MessageChooseGameMode {
let message: Message
let numConnectedPeers: UInt16
}
struct MessageForceExitSession {
let message: Message
}