DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
MainMenuData.c
См. документацию.
2{
3 protected static ref JsonDataNewsList m_NewsData;
4 protected static ref array<ref ModInfo> m_AllMods;
6 protected static ref ScriptInvoker m_OnDLCChangeSI;
7
8 static void SubscribeDLCUpdate()
9 {
10 ContentDLC contentDLC = g_Game.GetContentDLCService();
11 if (contentDLC)
12 {
13 contentDLC.Subscribe(OnDLCChange);
14 }
15 }
16
18 {
19 ContentDLC contentDLC = g_Game.GetContentDLCService();
20 if (contentDLC)
21 {
22 contentDLC.Unsubscribe(OnDLCChange);
23 }
24 }
25
27 {
28 if (!m_NewsData)
30
31 return m_NewsData;
32 }
33
35 {
36 if (!m_NewsData)
37 return null;
38
39 if (index > m_NewsData.News.Count() - 1)
40 {
41 ErrorEx(string.Format("Requested news article for index %1 but article count is %2. Index out of bounds!", index, m_NewsData.News.Count()));
42 return null;
43 }
44
45 return m_NewsData.News[index];
46 }
47
48 static void LoadMods()
49 {
50 if (!m_NewsData)
52
53 if (!m_AllMods)
55 else
56 m_AllMods.Clear();
57
58 g_Game.GetModInfos(m_AllMods);
59
60 int modsCount = m_AllMods.Count();
61 if (modsCount > 0)
62 {
63 m_AllMods.Remove(modsCount - 1);
64 m_AllMods.Invert();
65 }
66
68
70 }
71
72 static void FilterDLCs(inout array<ref ModInfo> modArray)
73 {
74 if (!m_AllDlcsMap)
76 else
77 m_AllDlcsMap.Clear();
78
79 ModInfo info;
80 int count = modArray.Count();
81 for (int i = count - 1; i >= 0; i--)
82 {
83 info = modArray[i];
84 if (info.GetIsDLC())
85 {
86 string dlcName = info.GetName();
87 dlcName.ToLower();
88 dlcName.Replace("dayz ", "");
89 m_AllDlcsMap.Insert(dlcName, info);
90 }
91 }
92 }
93
94 static void CreateDLCArticles()
95 {
96 if (!m_AllDlcsMap)
97 {
98 ErrorEx("Failed to get DLC map data!", ErrorExSeverity.WARNING);
99 return;
100 }
101
102 if (!m_NewsData)
103 {
104 ErrorEx("Failed to get news data!", ErrorExSeverity.WARNING);
105 return;
106 }
107 else
108 {
109 m_NewsData.News.Clear();
110 }
111
112 for (int i = 0; i < m_AllDlcsMap.Count(); i++)
113 {
114 ModInfo info = m_AllDlcsMap.GetElement(i);
115 if (info.GetIsOwned())
116 {
117 continue;
118 }
119
120 JsonDataNewsArticle dlcArticle = new JsonDataNewsArticle();
121 dlcArticle.categoryID = NewsCategory.DLCS;
122 dlcArticle.excerpt = info.GetOverview();
123 dlcArticle.title = info.GetName();
124 dlcArticle.fullUrl = info.GetAction();
125 string dlcName = info.GetName();
126 dlcName.ToLower();
127 dlcName.Replace("dayz ", "");
128 dlcArticle.dlcName = dlcName;
129 dlcArticle.coverImage = info.GetPicture();
130 m_NewsData.News.Insert(dlcArticle);
131 }
132 }
133
134 static void ClearAllDLCs()
135 {
136 m_AllMods = null;
137 m_AllDlcsMap = null;
138 m_NewsData = null;
139 }
140
142 static ModInfo GetDLCModInfoByName(string dlcName)
143 {
144 ModInfo modInfo;
145 m_AllDlcsMap.Find(dlcName, modInfo);
146 return modInfo;
147 }
148
151 {
152 return m_AllMods;
153 }
154
155 static void OnDLCChange(EDLCId dlcId)
156 {
157 LoadMods();
158 GetOnDLCChangedSI().Invoke(dlcId);
159 }
160
162 {
163 if (!m_OnDLCChangeSI)
165
166 return m_OnDLCChangeSI;
167 }
168}
EDLCId
Определения ContentDLC.c:4
DayZGame g_Game
Определения DayZGame.c:4074
proto void Subscribe(func fnc)
Subscribe to changes: void() OR void(EDLCId) OR void(EDLCId,EDLCChange)
proto void Unsubscribe(func fnc)
ContentDLC is for query installed DLC (only as entitlement keys, not content)
Определения ContentDLC.c:19
int categoryID
Определения BiosLobbyService.c:8
string dlcName
Определения BiosLobbyService.c:11
string excerpt
Определения BiosLobbyService.c:17
string title
Определения BiosLobbyService.c:19
string coverImage
Определения BiosLobbyService.c:21
string fullUrl
Определения BiosLobbyService.c:22
Определения BiosLobbyService.c:6
static ref map< string, ref ModInfo > m_AllDlcsMap
Определения MainMenuData.c:5
static ref JsonDataNewsList m_NewsData
Определения MainMenuData.c:3
static void CreateDLCArticles()
Определения MainMenuData.c:94
static JsonDataNewsArticle GetNewsArticle(int index)
Определения MainMenuData.c:34
static JsonDataNewsList GetNewsData()
Определения MainMenuData.c:26
static void ClearAllDLCs()
Определения MainMenuData.c:134
static void LoadMods()
Определения MainMenuData.c:48
static void SubscribeDLCUpdate()
Определения MainMenuData.c:8
static ModInfo GetDLCModInfoByName(string dlcName)
DLCs only.
Определения MainMenuData.c:142
static ref array< ref ModInfo > m_AllMods
Определения MainMenuData.c:4
static void OnDLCChange(EDLCId dlcId)
Определения MainMenuData.c:155
static array< ref ModInfo > GetAllMods()
All mods including DLCs.
Определения MainMenuData.c:150
static ref ScriptInvoker m_OnDLCChangeSI
Определения MainMenuData.c:6
static void FilterDLCs(inout array< ref ModInfo > modArray)
Определения MainMenuData.c:72
static void UnsubscribeDLCUpdate()
Определения MainMenuData.c:17
static ScriptInvoker GetOnDLCChangedSI()
Определения MainMenuData.c:161
Определения MainMenuData.c:2
proto owned string GetAction()
proto owned string GetPicture()
proto owned string GetOverview()
proto bool GetIsDLC()
proto bool GetIsOwned()
proto owned string GetName()
Определения ModInfo.c:2
proto void Invoke(void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
invoke call on all inserted methods with given arguments
ScriptInvoker Class provide list of callbacks usage:
Определения 2_GameLib/DayZ/tools.c:116
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения Transport.c:70
ErrorExSeverity
Определения EnDebug.c:62
enum ShapeType ErrorEx
proto int Replace(string sample, string replace)
Replace all occurrances of 'sample' in 'str' by 'replace'.
proto int ToLower()
Changes string to lowercase. Returns length.