1 | using System; |
---|
2 | using System.Collections.Generic; |
---|
3 | using System.Linq; |
---|
4 | using System.Text; |
---|
5 | |
---|
6 | namespace My_Warfare_2_Server |
---|
7 | { |
---|
8 | /// <summary> |
---|
9 | /// Yhteyden muodostamisyritys clientiltä serverille. |
---|
10 | /// </summary> |
---|
11 | [Serializable] |
---|
12 | public class Connect |
---|
13 | { |
---|
14 | /// <summary> |
---|
15 | /// Pelaajan nimi. |
---|
16 | /// </summary> |
---|
17 | public string PlayerName { get; set; } |
---|
18 | |
---|
19 | /// <summary> |
---|
20 | /// Pelaajan antama salasana. |
---|
21 | /// </summary> |
---|
22 | public string Password { get; set; } |
---|
23 | |
---|
24 | /// <summary> |
---|
25 | /// Luodaan Connect-paketti. |
---|
26 | /// </summary> |
---|
27 | /// <param name="name">Pelaajan nimi.</param> |
---|
28 | /// <param name="password">Pelaajan antama salasana.</param> |
---|
29 | public Connect(string name, string password) |
---|
30 | { |
---|
31 | this.PlayerName = name; |
---|
32 | this.Password = password; |
---|
33 | } |
---|
34 | } |
---|
35 | |
---|
36 | /// <summary> |
---|
37 | /// Yhteyden katkaisu syystä tai toisesta. |
---|
38 | /// </summary> |
---|
39 | [Serializable] |
---|
40 | public class Disconnect |
---|
41 | { |
---|
42 | /// <summary> |
---|
43 | /// Syy yhteyden katkaisuun. |
---|
44 | /// </summary> |
---|
45 | public string Reason { get; set; } |
---|
46 | |
---|
47 | public Disconnect(string reason) |
---|
48 | { |
---|
49 | this.Reason = reason; |
---|
50 | } |
---|
51 | } |
---|
52 | |
---|
53 | /// <summary> |
---|
54 | /// Yhteyden muodostuksen hyväksyminen. |
---|
55 | /// </summary> |
---|
56 | [Serializable] |
---|
57 | public class AcceptConnect |
---|
58 | { |
---|
59 | /// <summary> |
---|
60 | /// Tällä hetkellä pelissä olevat pelaajat. |
---|
61 | /// </summary> |
---|
62 | public List<Player> ConnectedPlayers { get; set; } |
---|
63 | |
---|
64 | /// <summary> |
---|
65 | /// Mikä ID paketin kohteelle tulee. |
---|
66 | /// </summary> |
---|
67 | public int ID { get; set; } |
---|
68 | |
---|
69 | /// <summary> |
---|
70 | /// Pelityyppi. |
---|
71 | /// </summary> |
---|
72 | public int GameMode { get; set; } |
---|
73 | |
---|
74 | public AcceptConnect(List<Player> connectedPlayers, int ID, int gameMode) |
---|
75 | { |
---|
76 | this.ConnectedPlayers = connectedPlayers; |
---|
77 | this.ID = ID; |
---|
78 | this.GameMode = gameMode; |
---|
79 | } |
---|
80 | } |
---|
81 | |
---|
82 | /// <summary> |
---|
83 | /// Chattiviesti. |
---|
84 | /// </summary> |
---|
85 | [Serializable] |
---|
86 | public class ChatMessage |
---|
87 | { |
---|
88 | /// <summary> |
---|
89 | /// Viesti. |
---|
90 | /// </summary> |
---|
91 | public String Message { get; set; } |
---|
92 | |
---|
93 | public ChatMessage(string message) |
---|
94 | { |
---|
95 | this.Message = message; |
---|
96 | } |
---|
97 | } |
---|
98 | |
---|
99 | /// <summary> |
---|
100 | /// Pelaajan tilan muutos. |
---|
101 | /// </summary> |
---|
102 | [Serializable] |
---|
103 | public class PlayerUpdate |
---|
104 | { |
---|
105 | /// <summary> |
---|
106 | /// Päivitetyn pelaajan ID. |
---|
107 | /// </summary> |
---|
108 | public int UpdatedPlayerID { get; set; } |
---|
109 | |
---|
110 | /// <summary> |
---|
111 | /// Päivitetyn pelaajan data. |
---|
112 | /// </summary> |
---|
113 | public Player UpdatedPlayerData { get; set; } |
---|
114 | |
---|
115 | public PlayerUpdate(int updatedPlayerID, Player updatedPlayerData) |
---|
116 | { |
---|
117 | this.UpdatedPlayerID = updatedPlayerID; |
---|
118 | this.UpdatedPlayerData = updatedPlayerData; |
---|
119 | } |
---|
120 | } |
---|
121 | } |
---|