예제 #1
0
        void sortList()
        {
            SinglyLinkedNode first = null;

            foreach (character character in characterlist)
            {
                if (first == null)
                {
                    first = new SinglyLinkedNode(character, null);
                }
                else
                {
                    if (character.initiative > first.character.initiative)
                    {
                        first = new SinglyLinkedNode(character, first);
                    }
                    else
                    {
                        first.insert(character);
                    }
                }
            }
            characterlist = new List <character>();
            first.getList(characterlist);
            InitiativeList.ItemsSource = characterlist;
        }
예제 #2
0
 public void insert(character _char)
 {
     if (node != null)
     {
         if (_char.initiative > node.character.initiative)
         {
             SinglyLinkedNode newnode = new SinglyLinkedNode(_char, node);
             node = newnode;
         }
         else
         {
             node.insert(_char);
         }
     }
     else
     {
         node = new SinglyLinkedNode(_char, node);
     }
 }
예제 #3
0
 public SinglyLinkedNode(character _char, SinglyLinkedNode _node)
 {
     character = _char;
     node      = _node;
 }