Exemple #1
0
    public void RpcLeaveRestaurant(bool isCustomerAngry)
    {
        if (isCustomerAngry)
        {
            CustomerFeedbackScript.PlayAngryPFX();
            tableSeatedAt.GetComponent <TableFeedback>().CustomerLeaves();
        }

        tableSeatedAt.GetComponent <CustomerPatience>().ResetCustomerPatience();
        TableColliderManager.Instance.ToggleTableDetection(false);
        CustomerAnimScript.LeaveAnim();
        Destroy(this.gameObject, 1f);
    }
    //set alarm on or off
    public void SetAlarm(string B1, string B2, string B3, string Message, string status)
    {
        string time = System.DateTime.Now.ToString("dd.MM HH:mm:ss");

        //add message to historical message log
        //MessageLog.Insert(0, new string[] {time, B1, B2, B3, Message, "ALARM:" + status});
        MessageLog.Add(new string[] { time, B1, B2, B3, Message, "ALARM:" + status });

        //set/modify message from alarm-log
        foreach (GameObject[] lineObject in AlarmLog.getTable())
        {   //find the same object
            if (lineObject[2].GetComponentInChildren <TMP_Text>().text == B1 &&
                lineObject[3].GetComponentInChildren <TMP_Text>().text == B2 &&
                lineObject[4].GetComponentInChildren <TMP_Text>().text == B3 &&
                lineObject[5].GetComponentInChildren <TMP_Text>().text == Message)
            {   //if found, update status
                lineObject[6].GetComponentInChildren <TMP_Text>().text = status;
                if (status.Contains("Off"))
                {
                    AlarmLog.Recolor(lineObject, Color.blue, Color.blue);
                }
                else
                {
                    AlarmLog.Recolor(lineObject);
                }
                LayoutRebuilder.ForceRebuildLayoutImmediate(AlarmLog.GetComponent <RectTransform>());
                return;
            }
        }
        //no object found, so add a new one
        int index = AlarmLog.Insert(0, new string[] { "A", time, B1, B2, B3, Message, status });

        AlarmLog.setOnHoverEvent(index);
        AlarmLog.setOnClickEvent(index, onClickEvent);
        if (status.Contains("Off"))
        {
            GameObject[] lineObject = AlarmLog.getLine(index);
            AlarmLog.Recolor(lineObject, Color.blue, Color.blue);
        }
    }