3 protected bool m_BillboardSetIndex = -1;
5 protected static const string ROOT_CLASS =
"BillboardPresets";
6 protected static int m_SetIndexCached = -1;
8 string GetTextureByType(
string type)
10 if (m_BillboardSetIndex == -1)
12 BillboardSet bbset = m_BillboardSets.Get(m_BillboardSetIndex);
13 return bbset.GetTextureByType(type);
16 void OnRPCIndex(
int index)
19 LoadBillboardConfigs();
21 if (m_BillboardSets && m_BillboardSets.IsValidIndex(index))
23 m_BillboardSetIndex = index;
27 protected bool LoadBillboardConfigs()
31 int setCount =
g_Game.ConfigGetChildrenCount(ROOT_CLASS);
33 for (
int setIndex = 0; setIndex < setCount; setIndex++)
36 GetGame().ConfigGetChildName(ROOT_CLASS, setIndex, setName);
37 string path = ROOT_CLASS +
" " + setName;
44 static bool ActivateBillboardSet(
string setClassName,
PlayerIdentity identity)
49 if (m_SetIndexCached == -1)
51 int setCount =
g_Game.ConfigGetChildrenCount(ROOT_CLASS);
52 for (
int setIndex = 0; setIndex < setCount; setIndex++)
55 GetGame().ConfigGetChildName(ROOT_CLASS, setIndex, setName);
57 if (setName == setClassName)
59 m_SetIndexCached = setIndex;
65 if (m_SetIndexCached != -1)
67 auto param =
new Param1<int>(m_SetIndexCached);
68 GetGame().RPCSingleParam( identity.GetPlayer(),
ERPCs.RPC_SET_BILLBOARDS, param,
true, identity );
92 int count =
g_Game.ConfigGetChildrenCount(
path);
93 for (
int i = 0; i < count; i++ )
98 string typesPath =
path +
" " + itemName +
" types";
99 string texturePath =
path +
" " + itemName +
" texture";
101 if (
GetGame().ConfigIsExisting(typesPath) &&
GetGame().ConfigIsExisting(texturePath))
105 GetGame().ConfigGetText(texturePath, texture);
106 GetGame().ConfigGetTextArray(typesPath, types);
108 foreach (
string s: types)
115 ErrorEx(
"Billboard set incorrect configuration, type or texture param missing: " +
path);