hiddenselectionsdata.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. class HiddenSelectionsData
  2. {
  3. ref array<string> m_HiddenSelections = new array<string>;
  4. ref array<string> m_HiddenSelectionsTextures = new array<string>;
  5. ref array<string> m_HiddenSelectionsMaterials = new array<string>;
  6. ref map<string, int> m_HiddenSelectionNameToIndex = new map<string, int>;
  7. void HiddenSelectionsData(string type)
  8. {
  9. GetGame().ConfigGetTextArray( string.Format("CfgVehicles %1 hiddenSelections", type), m_HiddenSelections );
  10. GetGame().ConfigGetTextArray( string.Format("CfgVehicles %1 hiddenSelectionsTextures", type), m_HiddenSelectionsTextures );
  11. GetGame().ConfigGetTextArray( string.Format("CfgVehicles %1 hiddenSelectionsMaterials", type), m_HiddenSelectionsMaterials );
  12. for (int i = 0; i < m_HiddenSelections.Count(); ++i)
  13. m_HiddenSelectionNameToIndex.Insert(m_HiddenSelections[i], i);
  14. }
  15. int GetHiddenSelectionIndex(string selection)
  16. {
  17. int index;
  18. if (m_HiddenSelectionNameToIndex.Find(selection, index))
  19. return index;
  20. return -1;
  21. }
  22. TStringArray GetHiddenSelectionsTextures()
  23. {
  24. return m_HiddenSelectionsTextures;
  25. }
  26. TStringArray GetHiddenSelectionsMaterials()
  27. {
  28. return m_HiddenSelectionsMaterials;
  29. }
  30. static array<string> GetHiddenSelectionsConfig(string type)
  31. {
  32. array<string> hiddenSelections = new array<string>;
  33. GetGame().ConfigGetTextArray( string.Format("CfgVehicles %1 hiddenSelections", type), hiddenSelections );
  34. return hiddenSelections;
  35. }
  36. static array<string> GetHiddenSelectionsTexturesConfig(string type)
  37. {
  38. array<string> hiddenSelectionsTextures = new array<string>;
  39. GetGame().ConfigGetTextArray( string.Format("CfgVehicles %1 hiddenSelectionsTextures", type), hiddenSelectionsTextures );
  40. return hiddenSelectionsTextures;
  41. }
  42. static array<string> GetHiddenSelectionsMaterialsConfig(string type)
  43. {
  44. array<string> hiddenSelectionsMaterials = new array<string>;
  45. GetGame().ConfigGetTextArray( string.Format("CfgVehicles %1 hiddenSelectionsMaterials", type), hiddenSelectionsMaterials );
  46. return hiddenSelectionsMaterials;
  47. }
  48. }