Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_CampaignBuildingScreenEffectUIComponent.c
Go to the documentation of this file.
1 class SCR_CampaignBuildingScreenEffectUIComponent : ScriptedWidgetComponent
2 {
3  protected ImageWidget m_wScrenEffectColor;
4  protected ImageWidget m_wScrenEffectVignette;
5  protected BlurWidget m_wBlurEffect;
6  protected WidgetAnimationBase m_WidgetAnimation;
7 
8  protected const float DURATION_IN_ALPHA = 0.5;
9  protected const float DURATION_IN_BLUR = 0.75;
10  protected const float DURATION_OUT_ALPHA = 0.5;
11  protected const float DURATION_OUT_BLUR = 0.5;
12 
13  protected const float VALUE_ALPHA = 0.5;
14  protected const float VALUE_BLUR = 0.8;
15  protected const float VALUE_DISABLED = 0.0;
16 
17  //------------------------------------------------------------------------------------------------
18  override protected void HandlerAttached(Widget w)
19  {
20  m_wScrenEffectColor = ImageWidget.Cast(w.FindAnyWidget("ScreenEffectColor"));
21  m_wScrenEffectVignette = ImageWidget.Cast(w.FindAnyWidget("ScreenEffectVignette"));
22  m_wBlurEffect = BlurWidget.Cast(w.FindAnyWidget("ScreenEffectBlur"));
23 
24  SCR_CampaignBuildingEditorComponent CampaignBuildingEditorComponent = SCR_CampaignBuildingEditorComponent.Cast(SCR_CampaignBuildingEditorComponent.GetInstance(SCR_CampaignBuildingEditorComponent));
25  if (!CampaignBuildingEditorComponent)
26  return;
27 
28  CampaignBuildingEditorComponent.GetOnObstructionEventTriggered().Insert(AreaTriggerChange);
29  }
30 
31  //------------------------------------------------------------------------------------------------
34  void AreaTriggerChange(bool activated)
35  {
36  if (activated)
37  StartObstructionAnimation();
38  else
39  FinishObstructionAnimation();
40  }
41 
42  //------------------------------------------------------------------------------------------------
44  void StartObstructionAnimation()
45  {
46  m_WidgetAnimation = AnimateWidget.AlphaMask(m_wScrenEffectVignette, VALUE_ALPHA, DURATION_IN_ALPHA);
47  m_WidgetAnimation.SetCurve(EAnimationCurve.EASE_OUT_CUBIC);
48 
49  AnimateWidget.AddAnimation(new SCR_WidgetAnimationBlurIntensity(m_wBlurEffect, DURATION_IN_BLUR, VALUE_BLUR));
50  }
51 
52  //------------------------------------------------------------------------------------------------
54  void FinishObstructionAnimation()
55  {
56  m_WidgetAnimation = AnimateWidget.AlphaMask(m_wScrenEffectVignette, VALUE_DISABLED, DURATION_OUT_ALPHA);
57  m_WidgetAnimation.SetCurve(EAnimationCurve.EASE_IN_OUT_CUBIC);
58 
59  AnimateWidget.AddAnimation(new SCR_WidgetAnimationBlurIntensity(m_wBlurEffect, DURATION_OUT_BLUR, VALUE_DISABLED));
60  }
61 };
SCR_CampaignBuildingScreenEffectUIComponent
Definition: SCR_CampaignBuildingScreenEffectUIComponent.c:1
SCR_WidgetAnimationBlurIntensity
Definition: SCR_WidgetAnimationBlurIntensity.c:1