DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
PlayerPreview.c
См. документацию.
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
30 void UpdateRotation( int mouse_x, int mouse_y, bool is_dragging )
31 {
33 {
34 vector orientation = m_CharacterOrientation;
35 orientation[1] = orientation[1] - ( m_CharacterRotationX - mouse_x );
36
37 m_CharacterPanelWidget.SetModelOrientation( orientation );
38
39 if ( !is_dragging )
40 {
41 m_CharacterOrientation = orientation;
42 }
43 }
44 }
45
47 {
49 {
50 float w, h;
51 m_CharacterPanelWidget.GetSize( w, h );
52 w = w + ( m_CharacterScaleDelta / 25 );
53 h = h + ( m_CharacterScaleDelta / 25 );
54 if ( w > 0.62 && w < 3 )
55 {
56 m_CharacterPanelWidget.SetSize( w, h );
57 }
58 else if ( w < 0.62 )
59 {
60 m_CharacterPanelWidget.SetSize( 0.62, 0.62 );
61 }
62 else if ( w > 3 )
63 {
64 m_CharacterPanelWidget.SetSize( 3, 3 );
65 }
66 }
67 }
68
69 bool MouseButtonDown(Widget w, int x, int y, int button)
70 {
72 m_IsHolding = true;
73 return true;
74 }
75
76 bool MouseWheel(Widget w, int x, int y, int wheel)
77 {
80 return true;
81 }
82
83 override void UpdateInterval()
84 {
85 // item in hands update
86 m_CharacterPanelWidget.UpdateItemInHands(GetGame().GetPlayer().GetHumanInventory().GetEntityInHands());
87
88 PlayerBase realPlayer = PlayerBase.Cast(GetGame().GetPlayer());
89 DayZPlayer dummyPlayer = m_CharacterPanelWidget.GetDummyPlayer();
90 if ( realPlayer && dummyPlayer )
91 {
92 // injury animation update
93 HumanCommandAdditives hca = dummyPlayer.GetCommandModifier_Additives();
94 //dummyPlayer.UpdateDummyPlayerProxyVisibility(realPlayer.FindAttachmentBySlotName("Shoulder"), realPlayer.FindAttachmentBySlotName("Melee"));
95 if ( hca && realPlayer.m_InjuryHandler )
96 hca.SetInjured(realPlayer.m_InjuryHandler.GetInjuryAnimValue(), realPlayer.m_InjuryHandler.IsInjuryAnimEnabled());
97 }
98
99 if ( m_IsHolding )
100 {
101 int mouse_x;
102 int mouse_y;
103
104 GetMousePos(mouse_x, mouse_y);
105
106 if ( GetMouseState(MouseState.LEFT) & 0x80000000 )
107 {
108 UpdateRotation( mouse_x, mouse_y, true );
109 }
110 else
111 {
112 UpdateRotation( mouse_x, mouse_y, false );
113 m_IsHolding = false;
114 }
115 }
116 }
117}
Icon x
Icon y
PlayerBase GetPlayer()
Определения ModifierBase.c:51
Widget m_Parent
Определения SizeToChild.c:92
Определения Container.c:2
Определения PlayerBaseClient.c:2
bool MouseButtonDown(Widget w, int x, int y, int button)
Определения PlayerPreview.c:69
int m_CharacterRotationY
Определения PlayerPreview.c:6
void UpdateRotation(int mouse_x, int mouse_y, bool is_dragging)
Определения PlayerPreview.c:30
ref PlayerPreviewWidget m_CharacterPanelWidget
Определения PlayerPreview.c:3
bool MouseWheel(Widget w, int x, int y, int wheel)
Определения PlayerPreview.c:76
int m_CharacterRotationX
Определения PlayerPreview.c:5
void PlayerPreview(LayoutHolder parent)
Определения PlayerPreview.c:11
void RefreshPlayerPreview()
Определения PlayerPreview.c:25
vector m_CharacterOrientation
Определения PlayerPreview.c:8
bool m_IsHolding
Определения PlayerPreview.c:9
int m_CharacterScaleDelta
Определения PlayerPreview.c:7
override void UpdateInterval()
Определения PlayerPreview.c:83
void UpdateScale()
Определения PlayerPreview.c:46
Определения gameplay.c:301
void RegisterOnMouseWheel(Widget w, Managed eventHandler, string functionName)
Определения WidgetEventHandler.c:84
static WidgetEventHandler GetInstance()
Определения WidgetEventHandler.c:22
void RegisterOnMouseButtonDown(Widget w, Managed eventHandler, string functionName)
Определения WidgetEventHandler.c:70
Определения EnWidgets.c:190
Определения EnConvert.c:106
proto native CGame GetGame()
MouseState
Определения EnSystem.c:311
proto native int GetMouseState(MouseState index)
proto void GetMousePos(out int x, out int y)
class HumanCommandWeapons HumanCommandAdditives()
Определения human.c:1112