Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
colormanager.c
Go to the documentation of this file.
2 {
3  private ref static ColorManager m_Instance;
4 
5  static int COLOR_NORMAL_TEXT = ARGB( 255, 255, 255, 255 );
6  static int COLOR_NORMAL_PANEL = ARGB( 140, 0, 0, 0 );
7  static int COLOR_HIGHLIGHT_TEXT = ARGB( 255, 200, 0, 0 );
8  static int COLOR_HIGHLIGHT_PANEL = ARGB( 255, 0, 0, 0 );
9  static int COLOR_SELECTED_TEXT = ARGB( 255, 255, 255, 255 );
10  static int COLOR_SELECTED_PANEL = ARGB( 255, 200, 0, 0 );
11  static int COLOR_DISABLED_TEXT = ARGB( 100, 255, 255, 255 );
12  static int COLOR_DISABLED_PANEL = ARGB( 140, 0, 0, 0 );
13 
14  static int ITEM_BACKGROUND_COLOR = ARGB( 50, 255, 255, 255 );
15  static int BASE_COLOR = ARGB( 10, 255, 255, 255 );
16  static int RED_COLOR = ARGB( 150, 255, 1, 1 );
17  static int GREEN_COLOR = ARGB( 150, 1, 255, 1 );
18  static int SWAP_COLOR = ARGB( 150, 135, 206, 250 );
19  static int FSWAP_COLOR = ARGB( 150, 35, 106, 150 );
20  static int COMBINE_COLOR = ARGB( 150, 255, 165, 0 );
21 
22  void ColorManager()
23  {
24  m_Instance = this;
25  }
26 
27  static ColorManager GetInstance()
28  {
29  return m_Instance;
30  }
31 
32  void SetColor( Widget w, int color )
33  {
34  if ( w.FindAnyWidget( "Cursor" ) )
35  {
36  w.FindAnyWidget( "Cursor" ).SetColor( color );
37  }
38  else
39  {
40  string name = w.GetName();
41  name.Replace( "PanelWidget", "Cursor" );
42  Widget w2 = w.GetParent().FindAnyWidget( name );
43  if( w2 )
44  {
45  w2.SetColor( color );
46  }
47  }
48  }
49 
50  int GetItemColor( ItemBase item )
51  {
52  int color = -1;
53  ItemBase dragged_item = ItemBase.Cast( ItemManager.GetInstance().GetDraggedItem() );
54  PlayerBase player = PlayerBase.Cast( GetGame().GetPlayer() );
55 
56  if ( dragged_item )
57  return 0;
58 
59  // if item icon is main icon (view, viewgrid )
60  if ( item.GetHierarchyParent() && item.GetHierarchyParent() != player )
61  {
62  color = -1;
63  }
64 
65  if ( item )
66  {
67  float temperature = item.GetTemperature();
68  if ( temperature )
69  {
70  color = GetTemperatureColor( temperature );
71  }
72  }
73  return color;
74  }
75 }
ItemBase
Definition: inventoryitem.c:730
GetGame
proto native CGame GetGame()
PlayerBase
Definition: playerbaseclient.c:1
ColorManager
Definition: colormanager.c:1
ItemManager
Definition: itemmanager.c:1
GetTemperatureColor
int GetTemperatureColor(int temperature)
Definition: tools.c:992
name
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
GetPlayer
protected void GetPlayer()
Definition: crosshairselector.c:127
Widget
Definition: enwidgets.c:189
ARGB
int ARGB(int a, int r, int g, int b)
Definition: proto.c:322