-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChecklist.cs
More file actions
85 lines (72 loc) · 2.18 KB
/
Copy pathChecklist.cs
File metadata and controls
85 lines (72 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
using Rage;
using System;
using System.Collections.Generic;
namespace SSStuartCallouts
{
internal class CalloutTask
{
private readonly string _name;
private bool _completed;
private readonly bool _tracked;
internal CalloutTask(string name, bool isTracked)
{
_name = name;
_completed = false;
_tracked = isTracked;
}
internal void UpdateStatus(bool completed)
{
_completed = completed;
}
internal new string ToString()
{
return (_tracked ? (_completed ? "~g~~BLIP_COMPLETED~" : "~BLIP_DARTS~") : "~BLIP_LEVEL~") + $" {_name}~w~~s~";
}
}
public class Checklist
{
private bool active;
private List<CalloutTask> tasks;
private uint displayTimeout;
public Checklist(bool activate = false)
{
active = activate;
tasks = new List<CalloutTask>();
displayTimeout = 0;
}
public int AddTask(string name, bool isTracked = true)
{
CalloutTask task = new CalloutTask(name, isTracked);
tasks.Add(task);
return tasks.IndexOf(task);
}
public void Enable()
{
active = true;
}
public void Disable()
{
active = false;
}
public void UpdateTaskStatus(int taskHandle, bool completed)
{
tasks[taskHandle].UpdateStatus(completed);
Display(true);
}
public void Display(bool force = false)
{
if (force || (active && tasks.Count > 0 && displayTimeout + 10000 < Game.GameTime && !Game.LocalPlayer.Character.IsInAnyVehicle(false)))
Game.DisplayHelp(this.ToString());
}
public new string ToString()
{
displayTimeout = Game.GameTime;
List<string> tasksList = new List<string>();
foreach (CalloutTask task in tasks)
{
tasksList.Add(task.ToString());
}
return String.Join("~n~", tasksList) + "~n~Press ~b~End~w~ to end the callout.";
}
}
}