mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-07-18 03:24:15 -04:00
Prototype animation export
This commit is contained in:
71
AssetStudioUtility/ObjChildren.cs
Normal file
71
AssetStudioUtility/ObjChildren.cs
Normal file
@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public interface IObjChild
|
||||
{
|
||||
dynamic Parent { get; set; }
|
||||
}
|
||||
|
||||
public abstract class ObjChildren<T> : IEnumerable<T> where T : IObjChild
|
||||
{
|
||||
protected List<T> children;
|
||||
|
||||
public T this[int i]
|
||||
{
|
||||
get { return (T)children[i]; }
|
||||
}
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { return children.Count; }
|
||||
}
|
||||
|
||||
public void InitChildren(int count)
|
||||
{
|
||||
children = new List<T>(count);
|
||||
}
|
||||
|
||||
public void AddChild(T obj)
|
||||
{
|
||||
children.Add(obj);
|
||||
obj.Parent = this;
|
||||
}
|
||||
|
||||
public void InsertChild(int i, T obj)
|
||||
{
|
||||
children.Insert(i, obj);
|
||||
obj.Parent = this;
|
||||
}
|
||||
|
||||
public void RemoveChild(T obj)
|
||||
{
|
||||
obj.Parent = null;
|
||||
children.Remove(obj);
|
||||
}
|
||||
|
||||
public void RemoveChild(int i)
|
||||
{
|
||||
children[i].Parent = null;
|
||||
children.RemoveAt(i);
|
||||
}
|
||||
|
||||
public int IndexOf(T obj)
|
||||
{
|
||||
return children.IndexOf(obj);
|
||||
}
|
||||
|
||||
public IEnumerator<T> GetEnumerator()
|
||||
{
|
||||
return children.GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user