Ejemplo n.º 1
0
    public void SetToEvent(EventBase newEvent)
    {
        if (newEvent.IsClosing())
        {
            return;
        }

        var data = uiTypes.GetDataForCategory(newEvent.ConversationActor.ActorCategory);

        eventText.text      = newEvent.Text;
        eventText.alignment = data.alignment;
        eventText.font      = data.font;

        var eventBorderRect = eventText.transform.parent.GetComponent <RectTransform>();

        if (data.RightTextPanelOverride != 0)
        {
            var oldScale = eventBorderRect.sizeDelta;
            oldScale.x = data.RightTextPanelOverride;
            eventBorderRect.sizeDelta = oldScale;
        }
        else
        {
            eventBorderRect.sizeDelta = originalScale;
        }

        if (data.UseColorBorder)
        {
            ColorSkinImage.color = newEvent.ConversationActor.Tint;
            ColorSkinImage.gameObject.SetActive(true);
        }
        else
        {
            ColorSkinImage.gameObject.SetActive(false);
        }


        eventText.GetComponentInParent <Image>().sprite = data.TextBoxSprite;

        var EventActorName = newEvent.ConversationActor.Name;

        if (EventActorName != "")
        {
            eventTitleText.transform.parent.gameObject.SetActive(true);
            eventTitleText.text = "-" + newEvent.ConversationActor.Name;
            eventTitleText.font = data.font;
            eventTitleText.GetComponentInParent <Image>().sprite = data.TitleSprite;
        }
        else
        {
            eventTitleText.transform.parent.gameObject.SetActive(false);
        }
    }