示例#1
0
        static void ReadList <T>(List <T> list, BinaryReader r, int start, int end) where T : GameMakerStructure, new()
        {
            bool isNamedResouce = typeof(T).GetInterfaces().Contains(typeof(INamedResrouce));

            list.Clear();
            foreach (var e in r.ForEachEntry(start))
            {
                T t = new T();
                t.Read(r, e.Index);
                list.Add(t);
                if (isNamedResouce)
                {
                    INamedResrouce nr = t as INamedResrouce;
                    if (namedResourceLookup == null)
                    {
                        namedResourceLookup = new Dictionary <string, GameMakerStructure>();
                    }
                    namedResourceLookup.Add(nr.Name, t);
                }
            }
        }
示例#2
0
            public override string ToString()
            {
                INamedResrouce ns = this as INamedResrouce;

                return(ns != null ? ns.Name : this.GetType().Name);
            }