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
List
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
alstroemeria-silentlove
windbot
Commits
9e0baa79
Commit
9e0baa79
authored
Jul 27, 2016
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
speed up some operations
parent
09b9678c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
2 deletions
+19
-2
Game/GameBehavior.cs
Game/GameBehavior.cs
+13
-0
Game/GameClient.cs
Game/GameClient.cs
+4
-0
Program.cs
Program.cs
+2
-2
No files found.
Game/GameBehavior.cs
View file @
9e0baa79
...
...
@@ -289,6 +289,7 @@ namespace WindBot.Game
private
void
OnNewTurn
(
BinaryReader
packet
)
{
Game
.
nextTickDelay
=
1
;
_duel
.
Turn
++;
_duel
.
Player
=
GetLocalPlayer
(
packet
.
ReadByte
());
_ai
.
OnNewTurn
();
...
...
@@ -296,12 +297,14 @@ namespace WindBot.Game
private
void
OnNewPhase
(
BinaryReader
packet
)
{
Game
.
nextTickDelay
=
1
;
_duel
.
Phase
=
(
DuelPhase
)
packet
.
ReadInt16
();
_ai
.
OnNewPhase
();
}
private
void
OnDamage
(
BinaryReader
packet
)
{
Game
.
nextTickDelay
=
1
;
int
player
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
final
=
_duel
.
LifePoints
[
player
]
-
packet
.
ReadInt32
();
if
(
final
<
0
)
final
=
0
;
...
...
@@ -310,12 +313,14 @@ namespace WindBot.Game
private
void
OnRecover
(
BinaryReader
packet
)
{
Game
.
nextTickDelay
=
1
;
int
player
=
GetLocalPlayer
(
packet
.
ReadByte
());
_duel
.
LifePoints
[
player
]
+=
packet
.
ReadInt32
();
}
private
void
OnLpUpdate
(
BinaryReader
packet
)
{
Game
.
nextTickDelay
=
1
;
int
player
=
GetLocalPlayer
(
packet
.
ReadByte
());
_duel
.
LifePoints
[
player
]
=
packet
.
ReadInt32
();
}
...
...
@@ -366,6 +371,7 @@ namespace WindBot.Game
private
void
OnAttack
(
BinaryReader
packet
)
{
Game
.
nextTickDelay
=
1
;
int
ca
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
la
=
packet
.
ReadByte
();
int
sa
=
packet
.
ReadByte
();
...
...
@@ -410,18 +416,21 @@ namespace WindBot.Game
private
void
OnChainEnd
(
BinaryReader
packet
)
{
Game
.
nextTickDelay
=
1
;
_ai
.
OnChainEnd
();
//_duel.ChainTargets.Clear();
}
private
void
OnChainSorting
(
BinaryReader
packet
)
{
Game
.
nextTickDelay
=
1
;
BinaryWriter
writer
=
GamePacketFactory
.
Create
(
CtosMessage
.
Response
);
Connection
.
Send
(
CtosMessage
.
Response
,
-
1
);
}
private
void
OnUpdateCard
(
BinaryReader
packet
)
{
Game
.
nextTickDelay
=
1
;
int
player
=
GetLocalPlayer
(
packet
.
ReadByte
());
int
loc
=
packet
.
ReadByte
();
int
seq
=
packet
.
ReadByte
();
...
...
@@ -436,6 +445,7 @@ namespace WindBot.Game
private
void
OnUpdateData
(
BinaryReader
packet
)
{
Game
.
nextTickDelay
=
1
;
int
player
=
GetLocalPlayer
(
packet
.
ReadByte
());
CardLocation
loc
=
(
CardLocation
)
packet
.
ReadByte
();
...
...
@@ -603,6 +613,7 @@ namespace WindBot.Game
private
void
OnSelectChain
(
BinaryReader
packet
)
{
Game
.
nextTickDelay
=
1
;
packet
.
ReadByte
();
// player
int
count
=
packet
.
ReadByte
();
packet
.
ReadByte
();
// specount
...
...
@@ -775,6 +786,7 @@ namespace WindBot.Game
private
void
OnSelectPlace
(
BinaryReader
packet
)
{
Game
.
nextTickDelay
=
1
;
packet
.
ReadByte
();
// player
packet
.
ReadByte
();
// min
int
field
=
~
packet
.
ReadInt32
();
...
...
@@ -844,6 +856,7 @@ namespace WindBot.Game
private
void
OnSelectPosition
(
BinaryReader
packet
)
{
Game
.
nextTickDelay
=
1
;
packet
.
ReadByte
();
// player
int
cardId
=
packet
.
ReadInt32
();
int
pos
=
packet
.
ReadByte
();
...
...
Game/GameClient.cs
View file @
9e0baa79
...
...
@@ -14,6 +14,9 @@ namespace WindBot.Game
public
string
Deck
;
public
string
Dialog
;
public
int
TickDelay
=
30
;
public
int
nextTickDelay
=
1
;
private
string
_serverHost
;
private
int
_serverPort
;
private
short
_proVersion
;
...
...
@@ -60,6 +63,7 @@ namespace WindBot.Game
public
void
Tick
()
{
nextTickDelay
=
TickDelay
;
Connection
.
Update
();
}
...
...
Program.cs
View file @
9e0baa79
...
...
@@ -124,7 +124,7 @@ namespace WindBot
while
(
client
.
Connection
.
IsConnected
)
{
client
.
Tick
();
Thread
.
Sleep
(
30
);
Thread
.
Sleep
(
client
.
nextTickDelay
);
}
}
...
...
@@ -207,7 +207,7 @@ namespace WindBot
try
{
client
.
Tick
();
Thread
.
Sleep
(
30
);
Thread
.
Sleep
(
client
.
nextTickDelay
);
}
catch
(
Exception
ex
)
{
...
...
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