10 [
Attribute(
"{1844F5647E6D772A}UI/layouts/Tasks/TaskListEntry.layout")]
11 protected ResourceName m_sTaskDescriptionWidgetResource;
14 protected ResourceName m_sTaskPrefab;
22 FactionManager factionManager =
GetGame().GetFactionManager();
26 int taskID, factionIndex;
27 taskID = task.GetTaskID();
28 factionIndex = factionManager.GetFactionIndex(faction);
30 Rpc(RPC_SetTargetFaction, taskID, factionIndex);
31 RPC_SetTargetFaction(taskID, factionIndex);
35 [
RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
36 void RPC_SetTargetFaction(
int taskID,
int factionIndex)
41 FactionManager factionManager =
GetGame().GetFactionManager();
49 task.SetTargetFaction(factionManager.GetFactionByIndex(factionIndex));
73 ResourceName GetTaskDescriptionWidgetResource()
75 return m_sTaskDescriptionWidgetResource;
79 ResourceName GetResourceName()
85 Resource GetTaskPrefab()
87 if (m_sTaskPrefab.IsEmpty())
90 return Resource.Load(m_sTaskPrefab);
94 void MoveTask(vector newPosition,
int taskID)
103 task.SetOrigin(newPosition);
108 Rpc(RPC_MoveTask, taskID, newPosition);
112 [
RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
113 void RPC_MoveTask(
int taskID, vector newPosition)
115 MoveTask(newPosition, taskID);
131 [
RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
132 void RPC_AssignTask(
int playerID,
int taskID,
float timestamp,
bool forced)
145 task.AddAssignee(assignee, timestamp);
154 void CancelTask(
int taskID)
156 Rpc(RPC_CancelTask, taskID);
157 RPC_CancelTask(taskID);
161 [
RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
162 protected void RPC_CancelTask(
int taskID)
180 int taskID = task.GetTaskID();
181 Rpc(RPC_FinishTask, taskID);
182 RPC_FinishTask(taskID);
186 [
RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
187 protected void RPC_FinishTask(
int taskID)
204 int taskID = task.GetTaskID();
205 Rpc(RPC_FailTask, taskID);
206 RPC_FailTask(taskID);
210 [
RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
211 protected void RPC_FailTask(
int taskID)
232 int taskID = task.GetTaskID();
234 Rpc(RPC_UnassignTask, taskID, executorID, reason);
235 RPC_UnassignTask(taskID, executorID, reason);
240 [
RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
241 void RPC_UnassignTask(
int taskID,
int playerID, SCR_EUnassignReason reason)
256 case SCR_EUnassignReason.ASSIGNEE_TIMEOUT:
258 case SCR_EUnassignReason.ASSIGNEE_DISCONNECT:
260 case SCR_EUnassignReason.ASSIGNEE_ABANDON:
265 case SCR_EUnassignReason.GM_REASSIGN:
273 task.RemoveAssignee(assignee, reason);
279 void SetTaskDescription(notnull
SCR_BaseTask task,
string description)
281 int taskID = task.GetTaskID();
282 RPC_SetTaskDescription(taskID, description);
283 Rpc(RPC_SetTaskDescription, taskID, description);
287 [
RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
288 void RPC_SetTaskDescription(
int taskID,
string description)
297 task.SetDescription(description);
302 void SetTaskTitle(notnull
SCR_BaseTask task,
string title)
304 int taskID = task.GetTaskID();
305 RPC_SetTaskTitle(taskID, title);
306 Rpc(RPC_SetTaskTitle, taskID, title);
310 [
RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
311 void RPC_SetTaskTitle(
int taskID,
string title)
320 task.SetTitle(title);
324 protected void RegisterContextualMenuCallbacks()
329 void OnMapOpen(MapConfiguration config)
331 RegisterContextualMenuCallbacks();
335 override void EOnInit(IEntity owner)
346 SetEventMask(EntityEvent.INIT);
347 SCR_MapEntity.GetMapInstance().GetOnMapOpen().Insert(OnMapOpen);
352 RplComponent rplComponent = RplComponent.Cast(
GetTaskManager().FindComponent(RplComponent));
356 rplComponent.InsertItem(
this);