예제 #1
0
 public Button(ConsoleKey key_,bool alt,bool ctrl,bool shift,int row,int col,int height,int width)
 {
     key = key_;
     mods = (ConsoleModifiers)0;
     if(alt){
         mods |= ConsoleModifiers.Alt;
     }
     if(ctrl){
         mods |= ConsoleModifiers.Control;
     }
     if(shift){
         mods |= ConsoleModifiers.Shift;
     }
     rect = new Rectangle(col,row,width,height);
 }
예제 #2
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;
                     }
                 }
             }
         }
     }
 }
예제 #3
0
 public static void CreateStatsButton(ConsoleKey key_,bool shifted,int row,int height)
 {
     Button[,] buttons = ButtonMap;
     if(buttons[row,0] == null){ //if there's already a button there, do nothing.
         Button b = new Button(key_,false,false,shifted,row,0,height,Global.STATUS_WIDTH);
         for(int i=row;i<row+height;++i){
             for(int j=0;j<Global.STATUS_WIDTH;++j){
                 buttons[i,j] = b;
             }
         }
     }
 }
예제 #4
0
 public static void CreateMapButton(ConsoleKey key_,bool shifted,int row,int height)
 {
     Button[,] buttons = ButtonMap;
     row += Global.MAP_OFFSET_ROWS;
     int col = Global.MAP_OFFSET_COLS;
     int width = Global.COLS;
     if(buttons[row,col] == null){ //if there's already a button there, do nothing.
         Button b = new Button(key_,false,false,shifted,row,col,height,width);
         for(int i=row;i<row+height;++i){
             for(int j=col;j<col+width;++j){
                 buttons[i,j] = b;
             }
         }
     }
 }