Exemplo n.º 1
0
    /// <summary>
    /// Bring in elements that need to be known to this object, set properties related to this object and set the UI accordingly
    /// </summary>
    public void SetUp(bool usable, CrewMember crewMember, int mood, TrackerTriggerSource source = TrackerTriggerSource.TeamManagementScreen)
    {
        CrewMember = crewMember;
        Current    = crewMember.Current();
        Usable     = usable;
        _source    = source;

        _borderImage    = GetComponent <Image>();
        _backImage      = transform.FindImage("AvatarIcon");
        _button         = GetComponent <Button>();
        _avatarDisplay  = GetComponentInChildren <AvatarDisplay>();
        _positionImage  = transform.FindImage("Position");
        _positionButton = transform.FindButton("Position");
        _nameText       = transform.FindText("Name");
        _sortImage      = transform.FindImage("Sort");
        _sortText       = transform.FindText("Sort/Sort Text");
        _aspectFitter   = GetComponent <AspectRatioFitter>();

        _defaultParent     = transform.parent;
        _nameText.text     = CrewMember.FirstInitialLastName();
        _backImage.color   = Usable ? new Color(0, 1, 1) : Current ? new Color(0, 0.5f, 0.5f) : Color.white;
        _borderImage.color = ShowEmotion ? AvatarDisplay.MoodColor(mood) : Current ? Color.grey : Color.black;
        UpdateAvatar(mood);
        _button.enabled          = Current && GameManagement.SeasonOngoing;
        _positionButton.enabled  = GameManagement.SeasonOngoing;
        _aspectFitter.aspectMode = Usable ? AspectRatioFitter.AspectMode.FitInParent : AspectRatioFitter.AspectMode.WidthControlsHeight;
    }