-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFancyTextRuntime.cs
More file actions
836 lines (721 loc) · 27.7 KB
/
Copy pathFancyTextRuntime.cs
File metadata and controls
836 lines (721 loc) · 27.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.Xml;
using LiveSplit.Model;
using LiveSplit.UI;
namespace LiveSplit.UI.Components
{
internal sealed class FancyTextTargetInfo
{
public string Key { get; set; }
public string ComponentName { get; set; }
public string DisplayName { get; set; }
public string Path { get; set; }
public int LayoutIndex { get; set; }
public IComponent Component { get; set; }
public override string ToString()
{
return DisplayName;
}
}
public sealed class FancyTextResolvedEffects
{
public bool OverrideOutline { get; internal set; }
public Color OutlineColor { get; internal set; }
public float OutlineSize { get; internal set; }
public bool OverrideShadow { get; internal set; }
public bool ShadowEnabled { get; internal set; }
public bool ShadowNormalEnabled { get; internal set; }
public bool ShadowOutsideEnabled { get; internal set; }
public bool ShadowInsideEnabled { get; internal set; }
public Color ShadowColor { get; internal set; }
public float ShadowSize { get; internal set; }
public float ShadowBlur { get; internal set; }
public int ShadowPasses { get; internal set; }
public int ShadowSoftness { get { return (int)Math.Ceiling(ShadowBlur); } }
public bool HasGradient { get; internal set; }
public bool UseExistingColorMiddle { get; internal set; }
public Color GradientColor1 { get; internal set; }
public Color GradientColor2 { get; internal set; }
public Color GradientColor3 { get; internal set; }
public FancyTextGradientDirection GradientDirection { get; internal set; }
}
internal sealed class FancyTextActiveInstance
{
public FancyTextScopeMode ScopeMode { get; set; }
public HashSet<string> TargetKeys { get; private set; }
public HashSet<string> LegacyTargetNames { get; private set; }
public HashSet<IComponent> TargetComponents { get; private set; }
public FancyTextResolvedEffects Effects { get; set; }
public FancyTextActiveInstance()
{
TargetKeys = new HashSet<string>(StringComparer.Ordinal);
LegacyTargetNames = new HashSet<string>(StringComparer.Ordinal);
TargetComponents = new HashSet<IComponent>(ReferenceComponentComparer.Instance);
}
public bool AppliesTo(FancyTextTargetInfo target)
{
if (target == null)
{
return false;
}
if (ScopeMode == FancyTextScopeMode.AllComponents)
{
return true;
}
if (ScopeMode != FancyTextScopeMode.SelectedComponents)
{
return false;
}
return TargetComponents.Contains(target.Component)
|| TargetKeys.Contains(target.Key)
|| LegacyTargetNames.Contains(target.ComponentName);
}
public bool AppliesToComponent(IComponent component)
{
if (component == null)
{
return false;
}
if (ScopeMode == FancyTextScopeMode.AllComponents)
{
return true;
}
if (ScopeMode != FancyTextScopeMode.SelectedComponents)
{
return false;
}
return TargetComponents.Contains(component);
}
}
internal sealed class ReferenceComponentComparer : IEqualityComparer<IComponent>
{
public static readonly ReferenceComponentComparer Instance = new ReferenceComponentComparer();
public bool Equals(IComponent x, IComponent y)
{
return ReferenceEquals(x, y);
}
public int GetHashCode(IComponent obj)
{
return obj == null ? 0 : System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(obj);
}
}
public static class FancyTextRuntime
{
private static readonly object Sync = new object();
private static readonly Dictionary<FancyTextComponent, FancyTextActiveInstance> ActiveInstances =
new Dictionary<FancyTextComponent, FancyTextActiveInstance>();
[ThreadStatic]
private static Stack<FancyTextDrawContext> DrawStack;
private static readonly HashSet<FancyTextComponent> PendingReorders = new HashSet<FancyTextComponent>();
internal static Stack<FancyTextDrawContext> DrawStackForPop { get { return DrawStack; } }
public static void Publish(FancyTextComponent owner, LiveSplitState state, FancyTextSettings settings)
{
if (owner == null || settings == null)
{
return;
}
lock (Sync)
{
PruneInactiveInstances(state);
if (settings.ControllerMode != FancyTextControllerMode.Text
|| settings.ScopeMode == FancyTextScopeMode.ThisComponentOnly)
{
ActiveInstances.Remove(owner);
return;
}
ActiveInstances[owner] = CreateActiveInstance(state, settings);
}
}
public static void Unpublish(FancyTextComponent owner)
{
if (owner == null)
{
return;
}
lock (Sync)
{
ActiveInstances.Remove(owner);
}
}
public static FancyTextResolvedEffects GetEffectsForComponent(LiveSplitState state, IComponent component)
{
component = Unwrap(component);
if (component == null)
{
return null;
}
lock (Sync)
{
PruneInactiveInstances(state);
FancyTextResolvedEffects merged = null;
foreach (FancyTextActiveInstance instance in ActiveInstances.Values)
{
if (!instance.AppliesToComponent(component))
{
continue;
}
if (merged == null)
{
merged = new FancyTextResolvedEffects();
}
MergeInto(merged, instance.Effects);
}
return merged;
}
}
public static FancyTextResolvedEffects GetCurrentEffects()
{
if (DrawStack == null || DrawStack.Count == 0)
{
return GetGlobalEffectsFallback();
}
FancyTextDrawContext context = DrawStack.Peek();
return GetEffectsForComponent(context.State, context.Component);
}
internal static FancyTextResolvedEffects GetCurrentComponentEffects()
{
if (DrawStack == null || DrawStack.Count == 0)
{
return null;
}
FancyTextDrawContext context = DrawStack.Peek();
return GetEffectsForComponent(context.State, context.Component);
}
internal static LiveSplitState GetCurrentDrawState()
{
if (DrawStack == null || DrawStack.Count == 0)
{
return null;
}
return DrawStack.Peek().State;
}
public static IDisposable BeginComponentDraw(LiveSplitState state, IComponent component)
{
if (DrawStack == null)
{
DrawStack = new Stack<FancyTextDrawContext>();
}
DrawStack.Push(new FancyTextDrawContext(state, Unwrap(component)));
return new DrawContextPopper();
}
internal static void InstallHooks(LiveSplitState state)
{
FancyTextSimpleLabelHook.Install();
FancyTextExternalTextHook.Install();
PruneInactiveInstances(state);
ILayout layout = state != null ? state.Layout : null;
if (layout == null || layout.LayoutComponents == null)
{
return;
}
foreach (ILayoutComponent layoutComponent in layout.LayoutComponents)
{
if (layoutComponent == null || layoutComponent.Component == null)
{
continue;
}
if (layoutComponent.Component is FancyTextComponent
|| layoutComponent.Component is FancyTextComponentProxy)
{
continue;
}
layoutComponent.Component = new FancyTextComponentProxy(layoutComponent.Component);
}
}
internal static FancyTextComponent RecreateController(LiveSplitState state, FancyTextComponent owner, FancyTextSettings settings)
{
if (state == null || owner == null || settings == null
|| state.Layout == null || state.Layout.LayoutComponents == null)
{
return owner;
}
IList<ILayoutComponent> components = state.Layout.LayoutComponents;
int ownerIndex = IndexOfComponent(components, owner);
if (ownerIndex < 0)
{
InstallHooks(state);
Publish(owner, state, settings);
Invalidate(state);
return owner;
}
ILayoutComponent layoutComponent = components[ownerIndex];
var refreshedOwner = new FancyTextComponent(state, settings);
layoutComponent.Component = refreshedOwner;
components.RemoveAt(ownerIndex);
components.Add(layoutComponent);
Unpublish(owner);
Publish(refreshedOwner, state, settings);
InstallHooks(state);
state.Layout.HasChanged = true;
Invalidate(state);
return refreshedOwner;
}
internal static void ScheduleControllerFirst(LiveSplitState state, FancyTextComponent owner)
{
if (state == null || owner == null || state.Layout == null || state.Layout.LayoutComponents == null)
{
return;
}
IList<ILayoutComponent> components = state.Layout.LayoutComponents;
int ownerIndex = IndexOfComponent(components, owner);
if (ownerIndex <= 0)
{
return;
}
lock (Sync)
{
if (!PendingReorders.Add(owner))
{
return;
}
}
Form form = state.Form;
if (form == null || form.IsDisposed)
{
try
{
ReorderControllerFirst(state, owner);
}
finally
{
lock (Sync)
{
PendingReorders.Remove(owner);
}
}
return;
}
try
{
form.BeginInvoke((Action)(() =>
{
try
{
ReorderControllerFirst(state, owner);
form.Invalidate();
}
finally
{
lock (Sync)
{
PendingReorders.Remove(owner);
}
}
}));
}
catch
{
lock (Sync)
{
PendingReorders.Remove(owner);
}
}
}
internal static IList<FancyTextTargetInfo> GetTargets(LiveSplitState state, IComponent owner)
{
var targets = new List<FancyTextTargetInfo>();
ILayout layout = state != null ? state.Layout : null;
if (layout == null || layout.LayoutComponents == null)
{
return targets;
}
var occurrenceByBaseKey = new Dictionary<string, int>(StringComparer.Ordinal);
for (int index = 0; index < layout.LayoutComponents.Count; index++)
{
ILayoutComponent layoutComponent = layout.LayoutComponents[index];
IComponent component = layoutComponent != null ? Unwrap(layoutComponent.Component) : null;
if (component == null || ReferenceEquals(component, owner) || component is FancyTextComponent)
{
continue;
}
string path = layoutComponent.Path ?? string.Empty;
string componentName = SafeComponentName(component);
string baseKey = !string.IsNullOrEmpty(path)
? path
: component.GetType().FullName;
if (string.IsNullOrEmpty(baseKey))
{
baseKey = componentName;
}
int occurrence;
occurrenceByBaseKey.TryGetValue(baseKey, out occurrence);
occurrenceByBaseKey[baseKey] = occurrence + 1;
string key = baseKey + "#" + occurrence.ToString(System.Globalization.CultureInfo.InvariantCulture);
targets.Add(new FancyTextTargetInfo
{
Key = key,
ComponentName = componentName,
DisplayName = (index + 1).ToString(System.Globalization.CultureInfo.InvariantCulture) + ". " + componentName,
Path = path,
LayoutIndex = index,
Component = component
});
}
return targets;
}
private static FancyTextTargetInfo FindTarget(LiveSplitState state, IComponent component)
{
component = Unwrap(component);
if (component == null)
{
return null;
}
foreach (FancyTextTargetInfo target in GetTargets(state, null))
{
if (ReferenceEquals(target.Component, component))
{
return target;
}
}
return null;
}
private static FancyTextActiveInstance CreateActiveInstance(LiveSplitState state, FancyTextSettings settings)
{
var active = new FancyTextActiveInstance
{
ScopeMode = settings.ScopeMode,
Effects = new FancyTextResolvedEffects
{
OverrideOutline = settings.OverrideOutline,
OutlineColor = settings.OutlineColor,
OutlineSize = settings.OutlineSize,
OverrideShadow = settings.OverrideShadow,
ShadowEnabled = settings.ShadowEnabled,
ShadowNormalEnabled = settings.ShadowNormalEnabled,
ShadowOutsideEnabled = settings.ShadowOutsideEnabled,
ShadowInsideEnabled = settings.ShadowInsideEnabled,
ShadowColor = settings.ShadowColor,
ShadowSize = settings.ShadowSize,
ShadowBlur = settings.ShadowBlur,
ShadowPasses = settings.ShadowPasses,
HasGradient = settings.OverrideTextColors,
UseExistingColorMiddle = settings.GradientMode == FancyTextGradientMode.ExistingColors,
GradientColor1 = settings.TextColor1,
GradientColor2 = settings.TextColor2,
GradientColor3 = settings.TextColor3,
GradientDirection = settings.GradientDirection
}
};
foreach (string target in settings.TargetComponents)
{
if (string.IsNullOrWhiteSpace(target))
{
continue;
}
if (target.IndexOf("#", StringComparison.Ordinal) >= 0
|| target.IndexOf("\\", StringComparison.Ordinal) >= 0
|| target.IndexOf("/", StringComparison.Ordinal) >= 0)
{
active.TargetKeys.Add(target);
}
else
{
active.LegacyTargetNames.Add(target);
}
}
if (active.ScopeMode == FancyTextScopeMode.SelectedComponents)
{
foreach (FancyTextTargetInfo target in GetTargets(state, null))
{
if (target == null || target.Component == null)
{
continue;
}
if (active.TargetKeys.Contains(target.Key)
|| active.LegacyTargetNames.Contains(target.ComponentName))
{
active.TargetComponents.Add(target.Component);
}
}
}
return active;
}
private static void MergeInto(FancyTextResolvedEffects merged, FancyTextResolvedEffects next)
{
if (next == null)
{
return;
}
if (next.OverrideOutline)
{
merged.OverrideOutline = true;
merged.OutlineColor = next.OutlineColor;
merged.OutlineSize = next.OutlineSize;
}
if (next.OverrideShadow)
{
merged.OverrideShadow = true;
merged.ShadowEnabled = next.ShadowEnabled;
merged.ShadowNormalEnabled = next.ShadowNormalEnabled;
merged.ShadowOutsideEnabled = next.ShadowOutsideEnabled;
merged.ShadowInsideEnabled = next.ShadowInsideEnabled;
merged.ShadowColor = next.ShadowColor;
merged.ShadowSize = next.ShadowSize;
merged.ShadowBlur = next.ShadowBlur;
merged.ShadowPasses = next.ShadowPasses;
}
if (next.HasGradient)
{
merged.HasGradient = true;
merged.UseExistingColorMiddle = next.UseExistingColorMiddle;
merged.GradientColor1 = next.GradientColor1;
merged.GradientColor2 = next.GradientColor2;
merged.GradientColor3 = next.GradientColor3;
merged.GradientDirection = next.GradientDirection;
}
}
private static FancyTextResolvedEffects GetGlobalEffectsFallback()
{
lock (Sync)
{
PruneInactiveInstances(null);
FancyTextResolvedEffects merged = null;
foreach (FancyTextActiveInstance instance in ActiveInstances.Values)
{
if (instance.ScopeMode != FancyTextScopeMode.AllComponents)
{
continue;
}
if (merged == null)
{
merged = new FancyTextResolvedEffects();
}
MergeInto(merged, instance.Effects);
}
return merged;
}
}
private static void PruneInactiveInstances(LiveSplitState state)
{
if (state == null || state.Layout == null || state.Layout.LayoutComponents == null)
{
return;
}
lock (Sync)
{
if (ActiveInstances.Count == 0)
{
return;
}
var liveOwners = new HashSet<FancyTextComponent>();
foreach (ILayoutComponent layoutComponent in state.Layout.LayoutComponents)
{
IComponent component = layoutComponent != null ? Unwrap(layoutComponent.Component) : null;
var fancyText = component as FancyTextComponent;
if (fancyText != null)
{
liveOwners.Add(fancyText);
}
}
var staleOwners = new List<FancyTextComponent>();
foreach (FancyTextComponent owner in ActiveInstances.Keys)
{
if (!liveOwners.Contains(owner))
{
staleOwners.Add(owner);
}
}
foreach (FancyTextComponent owner in staleOwners)
{
ActiveInstances.Remove(owner);
PendingReorders.Remove(owner);
}
}
}
private static string SafeComponentName(IComponent component)
{
try
{
string name = component.ComponentName;
return string.IsNullOrWhiteSpace(name) ? component.GetType().Name : name;
}
catch
{
return component.GetType().Name;
}
}
internal static IComponent Unwrap(IComponent component)
{
var proxy = component as FancyTextComponentProxy;
return proxy != null ? proxy.Inner : component;
}
private static void ReorderControllerFirst(LiveSplitState state, FancyTextComponent owner)
{
if (state == null || state.Layout == null || state.Layout.LayoutComponents == null)
{
return;
}
IList<ILayoutComponent> components = state.Layout.LayoutComponents;
int ownerIndex = IndexOfComponent(components, owner);
if (ownerIndex <= 0)
{
return;
}
ILayoutComponent item = components[ownerIndex];
components.RemoveAt(ownerIndex);
components.Insert(0, item);
state.Layout.HasChanged = true;
}
private static int IndexOfComponent(IList<ILayoutComponent> components, IComponent component)
{
for (int i = 0; i < components.Count; i++)
{
IComponent current = components[i] != null ? Unwrap(components[i].Component) : null;
if (ReferenceEquals(current, component))
{
return i;
}
}
return -1;
}
private static void Invalidate(LiveSplitState state)
{
Form form = state != null ? state.Form : null;
if (form == null || form.IsDisposed)
{
return;
}
try
{
form.Invalidate();
}
catch
{
}
}
}
internal sealed class FancyTextDrawContext
{
public LiveSplitState State { get; private set; }
public IComponent Component { get; private set; }
public FancyTextDrawContext(LiveSplitState state, IComponent component)
{
State = state;
Component = component;
}
}
internal sealed class DrawContextPopper : IDisposable
{
public void Dispose()
{
if (FancyTextRuntime.DrawStackForPop != null && FancyTextRuntime.DrawStackForPop.Count > 0)
{
FancyTextRuntime.DrawStackForPop.Pop();
}
}
}
internal sealed class FancyTextComponentProxy : IDeactivatableComponent
{
public IComponent Inner { get; private set; }
public FancyTextComponentProxy(IComponent inner)
{
Inner = inner;
}
public string ComponentName { get { return Inner.ComponentName; } }
public float HorizontalWidth { get { return Inner.HorizontalWidth; } }
public float MinimumHeight { get { return Inner.MinimumHeight; } }
public float VerticalHeight { get { return Inner.VerticalHeight; } }
public float MinimumWidth { get { return Inner.MinimumWidth; } }
public float PaddingTop { get { return Inner.PaddingTop; } }
public float PaddingBottom { get { return Inner.PaddingBottom; } }
public float PaddingLeft { get { return Inner.PaddingLeft; } }
public float PaddingRight { get { return Inner.PaddingRight; } }
public IDictionary<string, Action> ContextMenuControls { get { return Inner.ContextMenuControls; } }
public bool Activated
{
get
{
var deactivatable = Inner as IDeactivatableComponent;
return deactivatable == null || deactivatable.Activated;
}
set
{
var deactivatable = Inner as IDeactivatableComponent;
if (deactivatable != null)
{
deactivatable.Activated = value;
}
}
}
public void DrawHorizontal(Graphics g, LiveSplitState state, float height, Region clipRegion)
{
using (FancyTextRuntime.BeginComponentDraw(state, Inner))
using (new LayoutSettingsScope(state, FancyTextRuntime.GetEffectsForComponent(state, Inner)))
{
Inner.DrawHorizontal(g, state, height, clipRegion);
}
}
public void DrawVertical(Graphics g, LiveSplitState state, float width, Region clipRegion)
{
using (FancyTextRuntime.BeginComponentDraw(state, Inner))
using (new LayoutSettingsScope(state, FancyTextRuntime.GetEffectsForComponent(state, Inner)))
{
Inner.DrawVertical(g, state, width, clipRegion);
}
}
public Control GetSettingsControl(LayoutMode mode)
{
return Inner.GetSettingsControl(mode);
}
public XmlNode GetSettings(XmlDocument document)
{
return Inner.GetSettings(document);
}
public void SetSettings(XmlNode settings)
{
Inner.SetSettings(settings);
}
public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
{
Inner.Update(invalidator, state, width, height, mode);
}
public void Dispose()
{
Inner.Dispose();
}
}
internal sealed class LayoutSettingsScope : IDisposable
{
private readonly LiveSplitState _state;
private readonly bool _hasEffects;
private readonly bool _dropShadows;
private readonly Color _shadowsColor;
private readonly Color _textOutlineColor;
public LayoutSettingsScope(LiveSplitState state, FancyTextResolvedEffects effects)
{
_state = state;
if (state == null || state.LayoutSettings == null || effects == null)
{
return;
}
_hasEffects = true;
_dropShadows = state.LayoutSettings.DropShadows;
_shadowsColor = state.LayoutSettings.ShadowsColor;
_textOutlineColor = state.LayoutSettings.TextOutlineColor;
if (effects.OverrideShadow)
{
state.LayoutSettings.DropShadows = effects.ShadowEnabled;
state.LayoutSettings.ShadowsColor = effects.ShadowColor;
}
if (effects.OverrideOutline)
{
state.LayoutSettings.TextOutlineColor = effects.OutlineSize > 0f
? effects.OutlineColor
: Color.Transparent;
}
}
public void Dispose()
{
if (!_hasEffects || _state == null || _state.LayoutSettings == null)
{
return;
}
_state.LayoutSettings.DropShadows = _dropShadows;
_state.LayoutSettings.ShadowsColor = _shadowsColor;
_state.LayoutSettings.TextOutlineColor = _textOutlineColor;
}
}
}