From d3db59b3c21634c59b2ea4330f40923ebdd593ab Mon Sep 17 00:00:00 2001 From: Nelsonh Date: Wed, 8 Jan 2025 20:12:13 +0000 Subject: [PATCH] fix manage hot keys - create hot keys function for ui_manage - disable hotkeys when typing in company text bar --- scripts/scr_company_view/scr_company_view.gml | 28 +++++++++++++++ scripts/scr_ui_manage/scr_ui_manage.gml | 36 ++++--------------- 2 files changed, 35 insertions(+), 29 deletions(-) diff --git a/scripts/scr_company_view/scr_company_view.gml b/scripts/scr_company_view/scr_company_view.gml index a9e6ef12e..a78d137d5 100644 --- a/scripts/scr_company_view/scr_company_view.gml +++ b/scripts/scr_company_view/scr_company_view.gml @@ -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); + } + } +} diff --git a/scripts/scr_ui_manage/scr_ui_manage.gml b/scripts/scr_ui_manage/scr_ui_manage.gml index c20b53e0a..f422ccacc 100644 --- a/scripts/scr_ui_manage/scr_ui_manage.gml +++ b/scripts/scr_ui_manage/scr_ui_manage.gml @@ -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){ @@ -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]; }