DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
BillboardSet.c
См. документацию.
2{
3 protected bool m_BillboardSetIndex = -1;
5 protected static const string ROOT_CLASS = "BillboardPresets";
6 protected static int m_SetIndexCached = -1;//once we resolve the name into an index, we cache it(this disallows dynamic index swapping during mission's runtime)
7
8 string GetTextureByType(string type)
9 {
10 if (m_BillboardSetIndex == -1)
11 return "";
13 return bbset.GetTextureByType(type);
14 }
15
16 void OnRPCIndex(int index)
17 {
18 if (!m_BillboardSets)
20
21 if (m_BillboardSets && m_BillboardSets.IsValidIndex(index))
22 {
23 m_BillboardSetIndex = index;
24 }
25 }
26
27 protected bool LoadBillboardConfigs()
28 {
30
31 int setCount = g_Game.ConfigGetChildrenCount(ROOT_CLASS);
32
33 for (int setIndex = 0; setIndex < setCount; setIndex++)
34 {
35 string setName;
36 g_Game.ConfigGetChildName(ROOT_CLASS, setIndex, setName);
37 string path = ROOT_CLASS + " " + setName;
39 }
40
41 return true;
42 }
43
44 static bool ActivateBillboardSet(string setClassName, PlayerIdentity identity)
45 {
46 if (!g_Game)
47 return false;
48
49 if (m_SetIndexCached == -1)
50 {
51 int setCount = g_Game.ConfigGetChildrenCount(ROOT_CLASS);
52 for (int setIndex = 0; setIndex < setCount; setIndex++)
53 {
54 string setName;
55 g_Game.ConfigGetChildName(ROOT_CLASS, setIndex, setName);
56
57 if (setName == setClassName)
58 {
59 m_SetIndexCached = setIndex;
60 break
61 }
62 }
63 }
64
65 if (m_SetIndexCached != -1)
66 {
67 auto param = new Param1<int>(m_SetIndexCached);
68 g_Game.RPCSingleParam( identity.GetPlayer(), ERPCs.RPC_SET_BILLBOARDS, param, true, identity );
69 return true;
70 }
71 return false;
72 }
73}
74
75
76class BillboardSet
77{
79
80 void BillboardSet(string path)
81 {
83 }
84
85 string GetTextureByType(string type)
86 {
87 return m_TypeTextureMapping.Get(type);
88 }
89
90 protected void LoadConfig(string path)
91 {
92 int count = g_Game.ConfigGetChildrenCount(path);
93 for ( int i = 0; i < count; i++ )
94 {
95 string itemName;
96 g_Game.ConfigGetChildName(path, i, itemName);
97
98 string typesPath = path + " " + itemName + " types";
99 string texturePath = path + " " + itemName + " texture";
100
101 if (g_Game.ConfigIsExisting(typesPath) && g_Game.ConfigIsExisting(texturePath))
102 {
103 TStringArray types = new TStringArray();
104 string texture;
105 g_Game.ConfigGetText(texturePath, texture);
106 g_Game.ConfigGetTextArray(typesPath, types);
107
108 foreach (string s: types)
109 {
110 m_TypeTextureMapping.Insert(s,texture);
111 }
112 }
113 else
114 {
115 ErrorEx("Billboard set incorrect configuration, type or texture param missing: " + path);
116 }
117
118 }
119 }
120}
class BillboardSetHandler m_TypeTextureMapping
void BillboardSet(string path)
Определения BillboardSet.c:80
string GetTextureByType(string type)
Определения BillboardSet.c:85
void LoadConfig(string path)
Определения BillboardSet.c:90
DayZGame g_Game
Определения DayZGame.c:3942
ERPCs
Определения ERPCs.c:2
string path
Определения OptionSelectorMultistate.c:142
void OnRPCIndex(int index)
Определения BillboardSet.c:16
static int m_SetIndexCached
Определения BillboardSet.c:6
static const string ROOT_CLASS
Определения BillboardSet.c:5
bool LoadBillboardConfigs()
Определения BillboardSet.c:27
bool m_BillboardSetIndex
Определения BillboardSet.c:3
string GetTextureByType(string type)
Определения BillboardSet.c:8
static bool ActivateBillboardSet(string setClassName, PlayerIdentity identity)
Определения BillboardSet.c:44
ref array< ref BillboardSet > m_BillboardSets
Определения BillboardSet.c:4
proto Man GetPlayer()
get player
The class that will be instanced (moddable)
Определения gameplay.c:389
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения CachedEquipmentStorage.c:4
enum ShapeType ErrorEx
array< string > TStringArray
Определения EnScript.c:712