Ejemplo n.º 1
0
    public void HandleUIPacket(Dictionary <string, object> packetData)
    {
        if (packetData.ContainsKey("dialog"))
        {
            UIHandler uiHandler = GameManager.instance.GetComponent <UIHandler>();

            UIBase currentUI = uiHandler.GetCurrentUI();
            if (currentUI == null || currentUI.GetType() != typeof(Chatbox))
            {
                uiHandler.SetUI(typeof(Chatbox));

                try
                {
                    Chatbox chat = uiHandler.GetCurrentUI(typeof(Chatbox)) as Chatbox;
                    if (chat != null)
                    {
                        chat.SetDialog(packetData["dialog"].ToString());
                    }
                }
                catch (System.InvalidOperationException ex)
                {
                    Debug.Log($"[UIHandler::ExceptionCaught]: {ex.Message}");
                }
            }
        }
    }