Client LuaCsForBarotrauma
UnlockPathAction.cs
1
using
Barotrauma
.
Networking
;
2
using
Microsoft.Xna.Framework;
3
using
System;
4
5
namespace
Barotrauma
6
{
10
class
UnlockPathAction
:
EventAction
11
{
12
public
UnlockPathAction
(
ScriptedEvent
parentEvent,
ContentXElement
element) : base(parentEvent, element) { }
13
14
private
bool
isFinished =
false
;
15
16
public
override
bool
IsFinished
(ref
string
goTo)
17
{
18
return
isFinished;
19
}
20
21
public
override
void
Reset
()
22
{
23
isFinished =
false
;
24
}
25
26
public
override
void
Update
(
float
deltaTime)
27
{
28
if
(isFinished) {
return
; }
29
if
(
GameMain
.
GameSession
?.
Map
?.
CurrentLocation
?.
Connections
!=
null
)
30
{
31
foreach
(
LocationConnection
connection
in
GameMain
.
GameSession
?.
Map
?.
CurrentLocation
?.
Connections
)
32
{
33
if
(!connection.
Locked
) {
continue
; }
34
connection.
Locked
=
false
;
35
#if SERVER
36
NotifyUnlock(connection);
37
#else
38
new
GUIMessageBox
(
string
.Empty, TextManager.Get(
"pathunlockedgeneric"
),
39
Array.Empty<
LocalizedString
>(), type:
GUIMessageBox
.
Type
.InGame, iconStyle:
"UnlockPathIcon"
, relativeSize:
new
Vector2(0.3f, 0.15f), minSize:
new
Point(512, 128));
40
#endif
41
}
42
}
43
44
isFinished =
true
;
45
}
46
47
public
override
string
ToDebugString
()
48
{
49
return
$
"{ToolBox.GetDebugSymbol(isFinished)} {nameof(UnlockPathAction)}"
;
50
}
51
52
#if SERVER
53
private
void
NotifyUnlock(
LocationConnection
connection)
54
{
55
foreach
(
Client
client
in
GameMain
.Server.ConnectedClients)
56
{
57
IWriteMessage
outmsg =
new
WriteOnlyMessage();
58
outmsg.
WriteByte
((
byte
)
ServerPacketHeader
.EVENTACTION);
59
outmsg.
WriteByte
((
byte
)
EventManager
.
NetworkEventType
.UNLOCKPATH);
60
outmsg.
WriteUInt16
((UInt16)
GameMain
.
GameSession
.
Map
.
Connections
.IndexOf(connection));
61
GameMain
.Server.ServerPeer.Send(outmsg, client.Connection, DeliveryMethod.Reliable);
62
}
63
}
64
#endif
65
}
66
}
Barotrauma.ContentXElement
Definition:
ContentXElement.cs:13
Barotrauma.EventAction
Definition:
EventAction.cs:9
Barotrauma.EventManager
Definition:
BarotraumaShared/SharedSource/Events/EventManager.cs:13
Barotrauma.EventManager.NetworkEventType
NetworkEventType
Definition:
BarotraumaShared/SharedSource/Events/EventManager.cs:15
Barotrauma.GUIMessageBox
Definition:
GUIMessageBox.cs:11
Barotrauma.GUIMessageBox.Type
Type
Definition:
GUIMessageBox.cs:22
Barotrauma.GameMain
Definition:
GameMain.cs:25
Barotrauma.GameMain.GameSession
static GameSession?? GameSession
Definition:
GameMain.cs:88
Barotrauma.GameSession.Map
Map?? Map
Definition:
BarotraumaShared/SharedSource/GameSession/GameSession.cs:120
Barotrauma.LocalizedString
Definition:
LocalizedString.cs:8
Barotrauma.LocationConnection
Definition:
LocationConnection.cs:8
Barotrauma.LocationConnection.Locked
bool Locked
Definition:
LocationConnection.cs:17
Barotrauma.Location.Connections
readonly List< LocationConnection > Connections
Definition:
Location.cs:57
Barotrauma.Map.CurrentLocation
Location CurrentLocation
Definition:
BarotraumaShared/SharedSource/Map/Map/Map.cs:47
Barotrauma.Map.Connections
List< LocationConnection > Connections
Definition:
BarotraumaShared/SharedSource/Map/Map/Map.cs:75
Barotrauma.Networking.Client
Definition:
LuaBarotraumaAdditions.cs:11
Barotrauma.ScriptedEvent
Definition:
ScriptedEvent.cs:9
Barotrauma.UnlockPathAction
Unlocks a "locked" pathways between locations, if there are any such paths adjacent to the current lo...
Definition:
UnlockPathAction.cs:11
Barotrauma.UnlockPathAction.IsFinished
override bool IsFinished(ref string goTo)
Has the action finished.
Definition:
UnlockPathAction.cs:16
Barotrauma.UnlockPathAction.UnlockPathAction
UnlockPathAction(ScriptedEvent parentEvent, ContentXElement element)
Definition:
UnlockPathAction.cs:12
Barotrauma.UnlockPathAction.Update
override void Update(float deltaTime)
Definition:
UnlockPathAction.cs:26
Barotrauma.UnlockPathAction.Reset
override void Reset()
Definition:
UnlockPathAction.cs:21
Barotrauma.UnlockPathAction.ToDebugString
override string ToDebugString()
Rich test to display in debugdraw
Definition:
UnlockPathAction.cs:47
Barotrauma.Networking.IWriteMessage
Definition:
IWriteMessage.cs:6
Barotrauma.Networking.IWriteMessage.WriteUInt16
void WriteUInt16(UInt16 val)
Barotrauma.Networking.IWriteMessage.WriteByte
void WriteByte(byte val)
Barotrauma.Networking
Definition:
LuaBarotraumaAdditions.cs:9
Barotrauma.Networking.ServerPacketHeader
ServerPacketHeader
Definition:
NetworkMember.cs:68
Barotrauma
Definition:
AchievementManager.cs:12
Barotrauma
BarotraumaShared
SharedSource
Events
EventActions
UnlockPathAction.cs
Generated by
1.9.1