Thread: Ultima SDK 2.1
View Single Post
Old 08-26-2008, 09:46 PM   #20 (permalink)
Jeff
ConnectUO Creator
 
Jeff's Avatar
 
Join Date: Jan 2004
Age: 28
Posts: 4,892
Default

Well for instance Animations.cs you would do this

Code:
        private static FileIndex m_FileIndex = new FileIndex( "Anim.idx", "Anim.mul", 0x40000, 6 );
        public static FileIndex FileIndex{ get{ return m_FileIndex; } }

        private static FileIndex m_FileIndex2 = new FileIndex( "Anim2.idx", "Anim2.mul", 0x10000, -1 );
        public static FileIndex FileIndex2{ get{ return m_FileIndex; } }

        private static FileIndex m_FileIndex3 = new FileIndex( "Anim3.idx", "Anim3.mul", 0x20000, -1 );
        public static FileIndex FileIndex3{ get{ return m_FileIndex; } }

        static Animations()
        {
            Initialize();
        }

        public static void Initialize()
        {
            Utility.EnsureClose(m_FileIndex);
            Utility.EnsureClose(m_FileIndex2);
            Utility.EnsureClose(m_FileIndex3);

            m_FileIndex = new FileIndex("Anim.idx", "Anim.mul", 0x40000, 6);
            m_FileIndex2 = new FileIndex("Anim2.idx", "Anim2.mul", 0x10000, -1);
            m_FileIndex3 = new FileIndex("Anim3.idx", "Anim3.mul", 0x20000, -1);
        }
Then make a Utility function EnsureClose
Code:
        public static void EnsureClose(FileIndex fileIndex)
        {
            if (fileIndex != null && fileIndex.Stream != null)
            {
                fileIndex.Stream.Close();
            }
        }

Be sure you inlude your custom paths, and whenenver the custom path changes call Animations.Initilize();, just do this for each class that has a FileIndex in it.
__________________
Jeff Boulanger
ConnectUO - Core Developer

Want to help make ConnectUO better? Click here to submit your ideas/requests
Use your talent to compete against other community members in RunUO hosted coding competitions

If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team.


Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO
Jeff is offline   Reply With Quote