/** * Update Screen information */ void Update() { int p_discount = 0; // Applying discount code string discount_auth_yn = GameObject.Find("v_discount_auth_yn").GetComponent <Text>().text; if (discount_auth_yn.Equals("Y")) { p_discount = GlobalEnv.ReturnDiscountPrice(lang); // v_discount.color = Color.red; } // Update counting GameObject.Find("v_scanned_item_cnt").GetComponent <Text>().text = scanned_list.Count.ToString(); string v_current_canvas = GameObject.Find("v_current_canvas").GetComponent <Text>().text; // Update item info if (update_tf == true && (v_current_canvas.Equals("screen1") || v_current_canvas.Equals("screen2"))) { // 1. Reset all information on the self-checkout screen ClearAllInformation(); // 3. Update items list int i = 1; int p_total = 0; foreach (KeyValuePair <string, string> kv in scanned_list) { string o_item_name = kv.Key; string o_item_qty = kv.Value; string o_item_price = GlobalEnv.ReturnItemPrice(o_item_name, lang); // Notify the first calling if (firstItem_tf == false && i == 1) { v_firstItem_yn.text = "Y"; firstItem_tf = true; } // GameObject.Find("checkbox"+i).GetComponent<Toggle>().interactable = true; GameObject.Find("checkbox" + i).GetComponent <Toggle>().isOn = true; GameObject.Find("item_name" + i.ToString()).GetComponent <TextMeshProUGUI>().text = LangText.ReturnItemName(o_item_name, lang); GameObject.Find("item_qty" + i.ToString()).GetComponent <TextMeshProUGUI>().text = o_item_qty; GameObject.Find("item_price" + i.ToString()).GetComponent <TextMeshProUGUI>().text = o_item_price; p_total += Int32.Parse(o_item_qty) * Int32.Parse(o_item_price); i++; } v_total.text = p_total.ToString(); // 4. Update total price Info int total_price = (p_total - p_discount); if (total_price < 0) { total_price = 0; } total_amount.text = total_price.ToString(); M_EventLogger.EventLogging(GlobalEnv.ACTOR_SYSTEM, GlobalEnv.EVENT_CATE_SCREEN, GlobalEnv.EVENT_TYPE_SCREEN_UPDATE, "UPDATE", "Screen information Updated"); } // Update update_tf = false; }
/** * @ Function : Screen4 Interaction for discount code * * @ Author : Minjung KIM * @ Date : 2020.04.19 * @ History : * - 2020.04.19 Minjung Kim : Initial commit * - 2020.05.03 Minjugn Kim : Remove checkbox interaction and Add cancel interacton * - 2020.05.23 Minjung Kim : Add Event Log * - 2020.06.16 Minjung Kim : Clear the disocunt code input field **/ private void OnTriggerExit(Collider other) { if (touch == true) { touch = false; string key = currentBtnObj.tag; // Add Event log M_EventLogger.EventLogging(GlobalEnv.ACTOR_USER, GlobalEnv.EVENT_CATE_ACT, GlobalEnv.EVENT_TYPE_BTN_TOUCH, key, ""); // ---------------------------------- // BTN_BACK // ---------------------------------- if (key.Equals("btn_back")) { string org_text = input_discount_code.text; if (org_text.Length > 0) { string new_text = org_text.Substring(0, org_text.Length - 1); input_discount_code.text = new_text; M_EventLogger.EventLogging(GlobalEnv.ACTOR_USER, GlobalEnv.EVENT_CATE_SYS_MSG, GlobalEnv.EVENT_TYPE_SCREEN_UPDATE, "input_discount_code", new_text); } // ---------------------------------- // BTN_APPLY // ---------------------------------- } else if (key.Equals("btn_apply")) { result_message.text = ""; int v_dc = GlobalEnv.ReturnDiscountPrice(lang); v_discount.text = v_dc.ToString(); int total = Int32.Parse(screen1_total_amount.text); // ---------------------------------- // REAL MODE // ---------------------------------- if (gameMode.Equals(GlobalEnv.GAMEMODE_START)) { // ---------------------------------- // CHECKING DISCOUNT CODE // ---------------------------------- string v_level = GameObject.Find("v_level").GetComponent <Text>().text; if (GlobalEnv.DISCOUNT_CODE_EASY.Equals(input_discount_code.text) || GlobalEnv.DISCOUNT_CODE_NORMAL.Equals(input_discount_code.text) || GlobalEnv.DISCOUNT_CODE_HARD.Equals(input_discount_code.text)) { screen1_total_amount.text = (total - v_dc).ToString(); M_EventLogger.EventLogging(GlobalEnv.ACTOR_USER, GlobalEnv.EVENT_CATE_ACT, GlobalEnv.EVENT_TYPE_CODE_SUCC, (total - v_dc).ToString(), "screen4"); result_message.text = LangText.screen4_succ_dc[lang]; result_message.color = Color.blue; result_background.color = Color.white; M_EventLogger.EventLogging(GlobalEnv.ACTOR_SYSTEM, GlobalEnv.EVENT_CATE_SYS_MSG, GlobalEnv.EVENT_TYPE_CODE_SUCC, "result_message", "screen4:" + LangText.screen4_succ_dc[lang]); SoundManager.instance.PlaySound(GlobalEnv.SOUND_SUCC, lang); Invoke("ChangeScreen4toScreen1After1s", 1f); } else { input_discount_code.text = ""; // clear the input field errors += 1; v_errors.text = errors.ToString(); M_EventLogger.EventLogging(GlobalEnv.ACTOR_USER, GlobalEnv.EVENT_CATE_ACT, GlobalEnv.EVENT_TYPE_CODE_FAIL, input_discount_code.text, "errors:" + errors); // If the user does 3 errors, they will receive a full discount code. result_message.text = LangText.screen4_fail_dc[lang]; result_message.color = Color.red; result_background.color = Color.yellow; M_EventLogger.EventLogging(GlobalEnv.ACTOR_SYSTEM, GlobalEnv.EVENT_CATE_SYS_MSG, GlobalEnv.EVENT_TYPE_CODE_FAIL, "result_message", "screen4:" + LangText.screen4_fail_dc[lang]); SoundManager.instance.PlaySound(GlobalEnv.SOUND_ERROR, lang); } // ---------------------------------- // TEST MODE // ---------------------------------- } else { if (GlobalEnv.DISCOUNT_CODE_TEST.Equals(input_discount_code.text)) { screen1_total_amount.text = (total - GlobalEnv.ReturnDiscountPrice(lang)).ToString(); M_EventLogger.EventLogging(GlobalEnv.ACTOR_USER, GlobalEnv.EVENT_CATE_ACT, GlobalEnv.EVENT_TYPE_CODE_SUCC, (total - v_dc).ToString(), "screen4"); result_message.text = LangText.screen4_succ_dc[lang]; result_message.color = Color.blue; result_background.color = Color.white; M_EventLogger.EventLogging(GlobalEnv.ACTOR_SYSTEM, GlobalEnv.EVENT_CATE_SYS_MSG, GlobalEnv.EVENT_TYPE_CODE_SUCC, "result_message", "screen4: " + LangText.screen4_succ_dc[lang]); SoundManager.instance.PlaySound(GlobalEnv.SOUND_SUCC, lang); Invoke("ChangeScreen4toScreen1After1s", 1f); } else { input_discount_code.text = ""; // clear the input field errors += 1; v_errors.text = errors.ToString(); M_EventLogger.EventLogging(GlobalEnv.ACTOR_USER, GlobalEnv.EVENT_CATE_ACT, GlobalEnv.EVENT_TYPE_CODE_FAIL, input_discount_code.text, "errors:" + errors); // If the user does 3 errors, they will receive a full discount code. result_message.text = LangText.screen4_fail_dc[lang]; result_message.color = Color.red; result_background.color = Color.yellow; SoundManager.instance.PlaySound(GlobalEnv.SOUND_ERROR, lang); M_EventLogger.EventLogging(GlobalEnv.ACTOR_SYSTEM, GlobalEnv.EVENT_CATE_SYS_MSG, GlobalEnv.EVENT_TYPE_CODE_FAIL, "result_message", "screen4:" + LangText.screen4_fail_dc[lang]); } } // ---------------------------------- // KEYBOARD BUTTON // ---------------------------------- } else if (key.Equals("Key_1")) { input_discount_code.text += "1"; } else if (key.Equals("Key_2")) { input_discount_code.text += "2"; } else if (key.Equals("Key_3")) { input_discount_code.text += "3"; } else if (key.Equals("Key_4")) { input_discount_code.text += "4"; } else if (key.Equals("Key_5")) { input_discount_code.text += "5"; } else if (key.Equals("Key_6")) { input_discount_code.text += "6"; } else if (key.Equals("Key_7")) { input_discount_code.text += "7"; } else if (key.Equals("Key_8")) { input_discount_code.text += "8"; } else if (key.Equals("Key_9")) { input_discount_code.text += "9"; } else if (key.Equals("Key_0")) { input_discount_code.text += "0"; } else if (key.Equals("Key_A")) { input_discount_code.text += "A"; } else if (key.Equals("Key_B")) { input_discount_code.text += "B"; } else if (key.Equals("Key_C")) { input_discount_code.text += "C"; } else if (key.Equals("Key_D")) { input_discount_code.text += "D"; } else if (key.Equals("Key_E")) { input_discount_code.text += "E"; } else if (key.Equals("Key_F")) { input_discount_code.text += "F"; } else if (key.Equals("Key_G")) { input_discount_code.text += "G"; } else if (key.Equals("Key_H")) { input_discount_code.text += "H"; } else if (key.Equals("Key_I")) { input_discount_code.text += "I"; } else if (key.Equals("Key_J")) { input_discount_code.text += "J"; } else if (key.Equals("Key_K")) { input_discount_code.text += "K"; } else if (key.Equals("Key_L")) { input_discount_code.text += "L"; } else if (key.Equals("Key_M")) { input_discount_code.text += "M"; } else if (key.Equals("Key_N")) { input_discount_code.text += "N"; } else if (key.Equals("Key_O")) { input_discount_code.text += "O"; } else if (key.Equals("Key_P")) { input_discount_code.text += "P"; } else if (key.Equals("Key_Q")) { input_discount_code.text += "Q"; } else if (key.Equals("Key_R")) { input_discount_code.text += "R"; } else if (key.Equals("Key_S")) { input_discount_code.text += "S"; } else if (key.Equals("Key_T")) { input_discount_code.text += "T"; } else if (key.Equals("Key_U")) { input_discount_code.text += "U"; } else if (key.Equals("Key_V")) { input_discount_code.text += "V"; } else if (key.Equals("Key_W")) { input_discount_code.text += "W"; } else if (key.Equals("Key_X")) { input_discount_code.text += "X"; } else if (key.Equals("Key_Y")) { input_discount_code.text += "Y"; } else if (key.Equals("Key_Z")) { input_discount_code.text += "Z"; } } currentBtnObj.GetComponent <Image>().color = org_normalColor; }