Beispiel #1
0
 private void createTree(ref int index, ref int nodeIndex, GameNode parent = null)
 {
     while (nodeIndex < m_listGameNode.Count)
     {
         char c = m_sgf[index];
         if (c == 'n')
         {
             if (parent != null)
             {
                 parent.AddChildren(m_listGameNode[nodeIndex]);
             }
             m_listGameNode[nodeIndex].SetParent(parent);
             parent    = m_listGameNode[nodeIndex];
             nodeIndex = nodeIndex + 1;
             index     = index + 1;
         }
         else if (c == '(')
         {
             index = index + 1;
             createTree(ref index, ref nodeIndex, parent);
         }
         else if (c == ')')
         {
             index = index + 1;
             return;
         }
         else
         {
             Debug.LogError("createTreeSimple Error not n or ( or )");
             return;
         }
     }
     return;
 }