示例#1
0
 public NewPostPopUp()
 {
     InitializeComponent();
     TitleEntry.ReturnCommand = new Command(() => BodyEntry.Focus());
     newPostPopUp_myImage.Source = App.currentUser.imageUrl;
     newPostPopUp_posterName.Text = App.currentUser.name;
 }
        private static void LoadLists()
        {
            m_Monster = new ArrayList();
            m_Animal  = new ArrayList();
            m_Sea     = new ArrayList();
            m_Human   = new ArrayList();

            List <BodyEntry> entries = Docs.LoadBodies();

            for (int i = 0; i < entries.Count; ++i)
            {
                BodyEntry oldEntry = (BodyEntry)entries[i];
                int       bodyID   = oldEntry.Body.BodyID;

                if (((Body)bodyID).IsEmpty)
                {
                    continue;
                }

                ArrayList list = null;

                switch (oldEntry.BodyType)
                {
                case ModelBodyType.Monsters: list = m_Monster; break;

                case ModelBodyType.Animals: list = m_Animal; break;

                case ModelBodyType.Sea: list = m_Sea; break;

                case ModelBodyType.Human: list = m_Human; break;
                }

                if (list == null)
                {
                    continue;
                }

                int itemID = ShrinkTable.Lookup(bodyID, -1);

                if (itemID != -1)
                {
                    list.Add(new InternalEntry(bodyID, itemID, oldEntry.Name));
                }
            }

            m_Monster.Sort();
            m_Animal.Sort();
            m_Sea.Sort();
            m_Human.Sort();
        }
示例#3
0
        private static BodyEntry ParseBody(XmlNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException(nameof(node));
            }
            var entry = new BodyEntry();

            entry.Name = node.Attributes["name"].Value.ToLower();
            entry.Type = node.Attributes["type"].Value.ToLower();

            var parameterNode = node.SelectSingleNode("Parameters");

            if (parameterNode == null)
            {
                entry.LocalParameters = new Parameter();
            }
            else
            {
                entry.LocalParameters = ParseParameter(parameterNode);
            }

            var linkNode = node.SelectSingleNode("Link");

            if (linkNode == null)
            {
                throw new BadDefinitionException($"Error while parsing Body. Body must have exactly one \"Link\" entry.");
            }
            entry.LinkType   = linkNode.Attributes["type"].Value.ToLower();
            entry.LocalFrame = linkNode.Attributes["localframe"].Value.ToLower();

            var remoteText = linkNode.Attributes["remote"].Value.ToLower().Split('/');

            entry.RemoteBody  = remoteText[0];
            entry.RemoteFrame = remoteText.Length > 1 ? remoteText[1] : "origin";

            return(entry);
        }
示例#4
0
        public static ArrayList LoadBodies()
        {
            ArrayList list = new ArrayList();

            string path = Core.FindDataFile( "models/models.txt" );

            if ( File.Exists( path ) )
            {
                using ( StreamReader ip = new StreamReader( path ) )
                {
                    string line;

                    while ( (line = ip.ReadLine()) != null )
                    {
                        line = line.Trim();

                        if ( line.Length == 0 || line.StartsWith( "#" ) )
                            continue;

                        string[] split = line.Split( '\t' );

                        if ( split.Length >= 9 )
                        {
                            Body body = Utility.ToInt32( split[0] );
                            ModelBodyType type = (ModelBodyType)Utility.ToInt32( split[1] );
                            string name = split[8];

                            BodyEntry entry = new BodyEntry( body, type, name );

                            if ( !list.Contains( entry ) )
                                list.Add( entry );
                        }
                    }
                }
            }

            return list;
        }