18#ifndef PLATFORM_CONSOLE
59 #ifndef PLATFORM_CONSOLE
120 #ifdef CODELOCKCOMPONENT_LOG
129 return "gui/layouts/day_z_digital_lock.layout";
142 #ifdef PLATFORM_CONSOLE
157 m_NumButtons.Insert(ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"KeyNumber1_Button")));
158 m_NumButtons.Insert(ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"KeyNumber2_Button")));
159 m_NumButtons.Insert(ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"KeyNumber3_Button")));
160 m_NumButtons.Insert(ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"KeyNumber4_Button")));
161 m_NumButtons.Insert(ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"KeyNumber5_Button")));
162 m_NumButtons.Insert(ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"KeyNumber6_Button")));
163 m_NumButtons.Insert(ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"KeyNumber7_Button")));
164 m_NumButtons.Insert(ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"KeyNumber8_Button")));
165 m_NumButtons.Insert(ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"KeyNumber9_Button")));
166 m_NumButtons.Insert(ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"KeyClear_Button")));
167 m_NumButtons.Insert(ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"KeyNumber0_Button")));
168 m_NumButtons.Insert(ButtonWidget.Cast(layoutRoot.FindAnyWidget(
"KeyLock_Button")));
176 TextWidget digitTextW =
TextWidget.Cast(layoutRoot.FindAnyWidget(
"PasswordDigitNumber_Text" + i));
178 digitTextW.SetText(
"");
189 Param1<int> uiAction =
new Param1<int>(0);
192 uiAction.param1 = CodeLockUIAction.CONFIRM_INPUT;
198 uiAction.param1 = CodeLockUIAction.CLEAR_INPUT;
204 uiAction.param1 = CodeLockUIAction.DIGIT_INPUT;
217 int codeLength = codeText.
Length();
226 codeText = codeText + digit.
ToString();
229 #ifdef CODELOCKCOMPONENT_LOG
237 digitTextW =
TextWidget.Cast(layoutRoot.FindAnyWidget(
"PasswordDigitNumber_Text" + i));
261 #ifdef CODELOCKCOMPONENT_LOG
267 TextWidget digitTextW =
TextWidget.Cast(layoutRoot.FindAnyWidget(
"PasswordDigitNumber_Text" + i));
269 digitTextW.SetText(
"");
326 tickvalue += timeslice;
359 super.Update(timeslice);
364 Man player =
g_Game.GetPlayer();
365 vector playerPos = player.GetPosition();
381 #ifdef PLATFORM_CONSOLE
393 else if (input.
LocalPress(
"UAUICtrlY",
false))
510 navigateIcon =
string.
Format(
"<image set=\"%1\" name=\"%2\" scale=\"%3\" />",
"playstation_buttons2",
"DPAD_all_directions");
512 navigateIcon =
string.
Format(
"<image set=\"%1\" name=\"%2\" scale=\"%3\" />",
"xbox_buttons2",
"DPAD_all_directions");
514 string navigate =
string.
Format(
" %1 %2", navigateIcon,
"Navigate");
515 string text =
string.
Format(
"%1 %2 %3 %4 %5", navigate, select, confirm, clear, close);
523 MissionGameplay
mission = MissionGameplay.Cast(
g_Game.GetMission());
525 switch (pInputDeviceType)
532 mission.MoveHudForInventory(
true);
534 g_Game.GetUIManager().ShowUICursor(
false);
536 button = ButtonWidget.Cast(
GetFocus());
538 button.SetState(
false);
547 if (
g_Game.GetInput().IsEnabledMouseAndKeyboardEvenOnServer())
552 mission.MoveHudForInventory(
false);
554 g_Game.GetUIManager().ShowUICursor(
true);
556 button = ButtonWidget.Cast(
GetFocus());
558 button.SetState(
false);
571 MissionGameplay
mission = MissionGameplay.Cast(
g_Game.GetMission());
577 #ifdef PLATFORM_CONSOLE
582 mission.MoveHudForInventory(
true);
592 MissionGameplay
mission = MissionGameplay.Cast(
g_Game.GetMission());
597 #ifdef PLATFORM_CONSOLE
598 mission.MoveHudForInventory(
false);
606 super.OnClick(w,
x,
y, button);
622#ifndef PLATFORM_CONSOLE
627 int buttonIndex = -1;
628 if (
m_KeyCodeMap.Find(key, buttonIndex) && buttonIndex > -1)
void CodeLockComponent(notnull EntityAI parent, int minLockPinLength=MIN_LOCK_PIN_LENGTH)
Super root of all classes in Enforce script.
int GetMinLockPINLength()
void ControllerMovementButtonTickHandler(float timeslice)
void UpdateConsoleToolbar()
ref array< UAIDWrapper > m_InvInputWrappers
override void CodeResponse(bool response)
const float BT_THRESHOLD_VALUE
const int MAX_LOCK_PIN_LENGTH
override bool OnClick(Widget w, int x, int y, int button)
ref map< KeyCode, int > m_KeyCodeMap
override void KeyPress(int key)
override void Update(float timeslice)
void CheckControllerInputs(Input input, float timeslice)
ref array< string > m_InputExcludes
override void SetTargetLock(CodeLockComponent lock)
RichTextWidget m_ConsoleToolbarRichText
int m_SelectedButtonIndex
const float BT_REPEAT_DELAY
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
const int RESET_BUTTON_INDEX
ref array< string > m_InvInputNames
ref array< float > m_InvInputTimes
const int KEY_DIGIT_CONFIRM
const int KEY_DIGIT_CLEAR
const int CONFIRM_BUTTON_INDEX
void ~DigitalCodeLockUI()
void SetActive(bool active)
void InitInputWrapperData()
const float BT_REPEAT_TIME
ref array< ButtonWidget > m_NumButtons
const int MIN_LOCK_PIN_LENGTH
int m_InvInputWrappersCount
float m_SensitivityThreshold
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
proto native int Length()
Returns length of string.
static proto string ToString(void var, bool type=false, bool name=false, bool quotes=true)
Return string representation of variable.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.