Exemplo n.º 1
0
 public static void CreatePlayerStatsButtons()
 {
     if (Mode != MouseMode.Map)
     {
         return;
     }
     ConsoleKey[] keys    = new ConsoleKey[] { ConsoleKey.C, ConsoleKey.E, ConsoleKey.M };
     int[]        rows    = new int[] { 0, UI.equipment_row, UI.depth_row };
     int[]        heights = new int[] { UI.equipment_row, UI.depth_row - UI.equipment_row, UI.status_row_start - UI.depth_row - 1 };
     if (MouseUI.GetButton(0, 0) == null)            // if there's no button here, assume that there are no buttons in this area at all.
     {
         for (int n = 0; n < 3; ++n)
         {
             if (rows[n] + heights[n] > UI.status_row_cutoff)
             {
                 return;
             }
             CreateStatsButton(keys[n], false, rows[n], heights[n]);
         }
     }
     else
     {
         bool all_found = false;
         for (int n = 0; n < 3; ++n)
         {
             if (heights[n] <= 0 || rows[n] + heights[n] > UI.status_row_cutoff)
             {
                 break;
             }
             Button b = MouseUI.GetButton(rows[n], 0);
             if (b != null && b.key == keys[n] && b.row == rows[n] && b.height == heights[n])                     //perfect match, keep it there.
             {
                 if (b.key == ConsoleKey.M)
                 {
                     all_found = true;
                 }
             }
             else
             {
                 for (int i = rows[n]; i < rows[n] + heights[n]; ++i)
                 {
                     Button b2 = MouseUI.GetButton(i, 0);
                     if (b2 != null)
                     {
                         if (b2.key == ConsoleKey.M)
                         {
                             all_found = true;
                         }
                         MouseUI.RemoveButton(b2);
                     }
                 }
                 CreateStatsButton(keys[n], false, rows[n], heights[n]);
             }
         }
         if (!all_found)
         {
             for (int i = rows[2] + heights[2]; i <= UI.status_row_cutoff; ++i) //gotta continue downward until all the previous
             {
                 Button b = MouseUI.GetButton(i, 0);                            // buttons have been accounted for.
                 if (b != null)
                 {
                     MouseUI.RemoveButton(b);
                     if (b.key == ConsoleKey.M)
                     {
                         break;
                     }
                 }
             }
         }
     }
 }