Exemplo n.º 1
0
    public void SetToChoice(Choice choice)
    {
        //TODO fix this sound
        E_ActorCategory category = choice.ParentEvent.ConversationActor.ActorCategory;

        var data = uiTypes.GetDataForCategory(category);


        EmitterAppear.Play();
        if (data == null)
        {
            Debug.LogError($"No UI data found for {choice.ParentEvent.ConversationActor.ActorCategory}");
            return;
        }

        currentChoice = choice;
        SetVisible(true);
        choiceText.text = choice.Text;

        choiceText.font = data.font;
        //choiceText.UpdateFontAsset();
        choiceText.alignment = TextAlignmentOptions.Left;
        choiceText.font      = data.font;

        var parrentButton = choiceText.GetComponentInParent <Button>();
        var parrentImage  = choiceText.GetComponentInParent <Image>();

        var spriteState = parrentButton.spriteState;

        spriteState.pressedSprite     = data.PressedSprite;
        spriteState.selectedSprite    = data.SelectedSprite;
        spriteState.highlightedSprite = data.SelectedSprite;
        parrentButton.spriteState     = spriteState;
        parrentImage.sprite           = data.DefaultSprite;
    }
Exemplo n.º 2
0
    public void SetToEvent(Event newEvent)
    {
        if (newEvent.IsClosing)
        {
            return;
        }

        var data = uiTypes.GetDataForCategory(newEvent.EventActor.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.EventActor.Tint;
            ColorSkinImage.gameObject.SetActive(true);
        }
        else
        {
            ColorSkinImage.gameObject.SetActive(false);
        }


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

        var EventActorName = newEvent.EventActor.Name;

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