Skip to content

Commit

Permalink
fix manage hot keys
Browse files Browse the repository at this point in the history
- create hot keys function for ui_manage
- disable hotkeys when typing in company text bar
  • Loading branch information
OH296 committed Jan 8, 2025
1 parent d6b52df commit d3db59b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 29 deletions.
28 changes: 28 additions & 0 deletions scripts/scr_company_view/scr_company_view.gml
Original file line number Diff line number Diff line change
Expand Up @@ -494,3 +494,31 @@ function company_manage_actions(){
switch_view_company(new_view)
}
}

function ui_manage_hotkeys(){
if (managing >=0){
for (var i=1;i<10;i++){
if (press_exclusive(ord(string(i)))){
switch_view_company(i);
}
}
if (press_exclusive(ord("0"))){
switch_view_company(10);
}
else if (press_exclusive(ord("Q"))){
switch_view_company(11);
}
else if (press_exclusive(ord("E"))){
switch_view_company(12);
}
else if (press_exclusive(ord("R"))){
switch_view_company(13);
}
else if (press_exclusive(ord("T"))){
switch_view_company(14);
}
else if (press_exclusive(ord("Y"))){
switch_view_company(15);
}
}
}
36 changes: 7 additions & 29 deletions scripts/scr_ui_manage/scr_ui_manage.gml
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,9 @@ function scr_ui_manage() {
if((managing>0)){
company_manage_actions();
}
if (managing >=0){
for (var i=1;i<10;i++){
if (press_exclusive(ord(string(i)))){
switch_view_company(i);
}
}
if (press_exclusive(ord("0"))){
switch_view_company(10);
}
else if (press_exclusive(ord("Q"))){
switch_view_company(11);
}
else if (press_exclusive(ord("E"))){
switch_view_company(12);
}
else if (press_exclusive(ord("R"))){
switch_view_company(13);
}
else if (press_exclusive(ord("T"))){
switch_view_company(14);
}
else if (press_exclusive(ord("Y"))){
switch_view_company(15);
}
}
if (!text_bar){
ui_manage_hotkeys();
};
}

if (menu==1) and (managing>0 || managing <0){
Expand Down Expand Up @@ -113,14 +91,14 @@ function scr_ui_manage() {
draw_rectangle(xx+800-(bar_wid/2),yy+108,xx+800+(bar_wid/2),yy+100+string_h,1);
click_check = scr_hit(xx+800-(bar_wid/2),yy+108,xx+800+(bar_wid/2),yy+100+string_h);
obj_cursor.image_index=0;
if (!click_check) and (mouse_left==1) and (cooldown<=0){
text_bar=0;
if (!click_check) and (mouse_left==1) and (!cooldown){
text_bar=false;
}else if(click_check){
obj_cursor.image_index=2;

if (cooldown<=0) and (mouse_left==1) and (text_bar=0){
if (!cooldown) and (mouse_left==1) and (!text_bar){
cooldown=8000;
text_bar=1;
text_bar=true;
keyboard_string=obj_ini.company_title[managing];
}

Expand Down

0 comments on commit d3db59b

Please sign in to comment.