Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
W
windbot
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
windbot
Commits
bb40ca78
Commit
bb40ca78
authored
Jan 17, 2016
by
IceYGO
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Store the room position instead of comparing the username
parent
8efd8d09
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
Game/GameBehavior.cs
Game/GameBehavior.cs
+5
-8
Game/Room.cs
Game/Room.cs
+2
-0
No files found.
Game/GameBehavior.cs
View file @
bb40ca78
...
...
@@ -134,6 +134,7 @@ namespace WindBot.Game
Connection
.
Close
();
return
;
}
_room
.
Position
=
pos
;
_room
.
IsHost
=
((
type
>>
4
)
&
0xF
)
!=
0
;
_room
.
IsReady
[
pos
]
=
true
;
Connection
.
Send
(
CtosMessage
.
HsReady
);
...
...
@@ -202,7 +203,7 @@ namespace WindBot.Game
if
(!
Directory
.
Exists
(
directory
))
Directory
.
CreateDirectory
(
directory
);
string
otherName
=
_room
.
Names
[
0
]
==
Game
.
Username
?
_room
.
Names
[
1
]
:
_room
.
Names
[
0
];
string
otherName
=
_room
.
Position
==
0
?
_room
.
Names
[
1
]
:
_room
.
Names
[
0
];
string
file
=
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd.HH-mm."
)
+
otherName
+
".yrp"
;
string
fullname
=
Path
.
Combine
(
directory
,
file
);
...
...
@@ -235,11 +236,7 @@ namespace WindBot.Game
deck
=
packet
.
ReadInt16
();
extra
=
packet
.
ReadInt16
();
_duel
.
Fields
[
GetLocalPlayer
(
1
)].
Init
(
deck
,
extra
);
if
(
_room
.
Names
[
0
]
!=
Game
.
Username
&&
_room
.
Names
[
1
]
!=
Game
.
Username
)
{
Connection
.
Close
();
return
;
}
Logger
.
WriteLine
(
"Duel started: "
+
_room
.
Names
[
0
]
+
" versus "
+
_room
.
Names
[
1
]);
_ai
.
OnStart
();
}
...
...
@@ -248,7 +245,7 @@ namespace WindBot.Game
{
int
result
=
GetLocalPlayer
(
packet
.
ReadByte
());
string
otherName
=
_room
.
Names
[
0
]
==
Game
.
Username
?
_room
.
Names
[
1
]
:
_room
.
Names
[
0
];
string
otherName
=
_room
.
Position
==
0
?
_room
.
Names
[
1
]
:
_room
.
Names
[
0
];
string
textResult
=
(
result
==
2
?
"Draw"
:
result
==
0
?
"Win"
:
"Lose"
);
Logger
.
WriteLine
(
"Duel finished against "
+
otherName
+
", result: "
+
textResult
);
}
...
...
@@ -442,7 +439,7 @@ namespace WindBot.Game
foreach
(
ClientCard
card
in
cards
)
{
int
len
=
packet
.
ReadInt32
();
if
(
len
<
8
)
continue
;
if
(
len
==
4
)
continue
;
long
pos
=
packet
.
Position
;
card
.
Update
(
packet
,
_duel
);
packet
.
Position
=
pos
+
len
-
4
;
...
...
Game/Room.cs
View file @
bb40ca78
...
...
@@ -5,11 +5,13 @@
public
bool
IsHost
{
get
;
set
;
}
public
string
[]
Names
{
get
;
set
;
}
public
bool
[]
IsReady
{
get
;
set
;
}
public
int
Position
{
get
;
set
;
}
public
Room
()
{
Names
=
new
string
[
8
];
IsReady
=
new
bool
[
8
];
Position
=
-
1
;
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment