CrabUI
Loading...
Searching...
No Matches
CUIComponent.Animations.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Reflection;
5using System.Diagnostics;
6using System.Runtime.CompilerServices;
7using System.IO;
8
9using Barotrauma;
10using Microsoft.Xna.Framework;
11using Microsoft.Xna.Framework.Input;
12using Microsoft.Xna.Framework.Graphics;
13
14using System.Xml;
15using System.Xml.Linq;
16using HarmonyLib;
17
18namespace CrabUI
19{
20 public partial class CUIComponent : IDisposable
21 {
22 private void SetupAnimations()
23 {
24 Animations = new Indexer<string, CUIAnimation>(
25 (key) => animations.GetValueOrDefault(key),
26 (key, value) => AddAnimation(key, value)
27 );
28 }
29 private Dictionary<string, CUIAnimation> animations = new();
30 public Indexer<string, CUIAnimation> Animations;
31 public void AddAnimation(string name, CUIAnimation animation)
32 {
33 animation.Target = this;
34 animations[name] = animation;
35 }
36
37 public void BlockChildrenAnimations()
38 {
39 foreach (CUIComponent child in Children)
40 {
41 foreach (CUIAnimation animation in child.animations.Values)
42 {
43 animation.Stop();
44 animation.Blocked = true;
45 }
46 child.BlockChildrenAnimations();
47 }
48 }
49 }
50}