DayZ 1.24
Loading...
Searching...
No Matches
PlayerPreview.c
Go to the documentation of this file.
2{
4
5 protected int m_CharacterRotationX;
6 protected int m_CharacterRotationY;
7 protected int m_CharacterScaleDelta;
9 protected bool m_IsHolding;
10
12 {
13 m_CharacterPanelWidget = PlayerPreviewWidget.Cast(m_Parent.GetMainWidget().FindAnyWidget("CharacterPanelWidget"));
14
15 WidgetEventHandler.GetInstance().RegisterOnMouseButtonDown(m_Parent.GetMainWidget().FindAnyWidget("CharacterPanel"), this, "MouseButtonDown");
16 WidgetEventHandler.GetInstance().RegisterOnMouseWheel(m_Parent.GetMainWidget().FindAnyWidget("CharacterPanel"), this, "MouseWheel");
17
20 m_CharacterPanelWidget.SetModelPosition("0 0 0.605");
21 m_CharacterPanelWidget.SetSize(1.34, 1.34); // default scale
23 }
24
26 {
27 m_CharacterPanelWidget.Refresh();
28 }
29
43
45 {
47 {
48 float w, h;
49 m_CharacterPanelWidget.GetSize(w, h);
50 w = w + (m_CharacterScaleDelta / 25);
51 h = h + (m_CharacterScaleDelta / 25);
52 if (w > 0.62 && w < 3)
53 m_CharacterPanelWidget.SetSize(w, h);
54 else if (w < 0.62)
55 m_CharacterPanelWidget.SetSize(0.62, 0.62);
56 else if (w > 3)
57 m_CharacterPanelWidget.SetSize(3, 3);
58 }
59 }
60
61 bool MouseButtonDown(Widget w, int x, int y, int button)
62 {
64 m_IsHolding = true;
65 return true;
66 }
67
68 bool MouseWheel(Widget w, int x, int y, int wheel)
69 {
72 return true;
73 }
74
75 override void UpdateInterval()
76 {
77 // item in hands update
78 m_CharacterPanelWidget.UpdateItemInHands(GetGame().GetPlayer().GetHumanInventory().GetEntityInHands());
79
83 {
84 // injury animation update
85 HumanCommandAdditives hca = dummyPlayer.GetCommandModifier_Additives();
86 //dummyPlayer.UpdateDummyPlayerProxyVisibility(realPlayer.FindAttachmentBySlotName("Shoulder"), realPlayer.FindAttachmentBySlotName("Melee"));
87 if (hca && realPlayer.m_InjuryHandler)
88 hca.SetInjured(realPlayer.m_InjuryHandler.GetInjuryAnimValue(), realPlayer.m_InjuryHandler.IsInjuryAnimEnabled());
89 }
90
91 if (m_IsHolding)
92 {
93 int mouse_x;
94 int mouse_y;
95
97
98 if (GetMouseState(MouseState.LEFT) & 0x80000000)
100 else
101 {
103 m_IsHolding = false;
104 }
105 }
106 }
107}
Icon x
Icon y
PlayerBase GetPlayer()
Widget m_Parent
Definition SizeToChild.c:86
bool MouseButtonDown(Widget w, int x, int y, int button)
int m_CharacterRotationY
void UpdateRotation(int mouse_x, int mouse_y, bool is_dragging)
ref PlayerPreviewWidget m_CharacterPanelWidget
bool MouseWheel(Widget w, int x, int y, int wheel)
int m_CharacterRotationX
void PlayerPreview(LayoutHolder parent)
void RefreshPlayerPreview()
vector m_CharacterOrientation
int m_CharacterScaleDelta
override void UpdateInterval()
static WidgetEventHandler GetInstance()
proto native CGame GetGame()
MouseState
Definition EnSystem.c:311
proto native int GetMouseState(MouseState index)
proto void GetMousePos(out int x, out int y)
class HumanCommandWeapons HumanCommandAdditives()
Definition human.c:1086