Can't find reference to integer in vanilla code

Users who are viewing this thread

I'm trying to add a new icon to settlement nameplates in 1.5.6 and the icon types are defined in the widget class SettlementNameplateEventVisualWidget.

This is the class decompiled with dnSpy:

C#:
using System;
using TaleWorlds.GauntletUI;

namespace TaleWorlds.MountAndBlade.GauntletUI.Widgets.Nameplate
{
    // Token: 0x0200005F RID: 95
    public class SettlementNameplateEventVisualWidget : BrushWidget
    {
        // Token: 0x060004EF RID: 1263 RVA: 0x00010123 File Offset: 0x0000E323
        public SettlementNameplateEventVisualWidget(UIContext context) : base(context)
        {
        }

        // Token: 0x060004F0 RID: 1264 RVA: 0x00010133 File Offset: 0x0000E333
        protected override void OnLateUpdate(float dt)
        {
            base.OnLateUpdate(dt);
            if (!this._determinedVisual)
            {
                this.RegisterBrushStatesOfWidget();
                this.UpdateVisual(this.Type);
                this._determinedVisual = true;
            }
        }

        // Token: 0x060004F1 RID: 1265 RVA: 0x00010160 File Offset: 0x0000E360
        private void UpdateVisual(int type)
        {
            switch (type)
            {
            case 0:
                this.SetState("Tournament");
                return;
            case 1:
                this.SetState("AvailableIssue");
                return;
            case 2:
                this.SetState("ActiveIssue");
                return;
            case 3:
                this.SetState("AvailableQuest");
                return;
            case 4:
                this.SetState("ActiveQuest");
                return;
            default:
                return;
            }
        }

        // Token: 0x170001C8 RID: 456
        // (get) Token: 0x060004F2 RID: 1266 RVA: 0x000101C3 File Offset: 0x0000E3C3
        // (set) Token: 0x060004F3 RID: 1267 RVA: 0x000101CB File Offset: 0x0000E3CB
        [Editor(false)]
        public int Type
        {
            get
            {
                return this._type;
            }
            set
            {
                if (this._type != value)
                {
                    this._type = value;
                    base.OnPropertyChanged(value, "Type");
                }
            }
        }

        // Token: 0x04000267 RID: 615
        private bool _determinedVisual;

        // Token: 0x04000268 RID: 616
        private int _type = -1;
    }
}

The integer Type defines which icon is displayed in the settlement nameplate. If I want to add a new icon I have to add case 5 to the switch statement in the UpdateVisual method. However, I cannot seem to find any reference to Type anywhere else in the vanilla code, and I cannot find any reference to SettlementNameplateEventVisualWidget as well. I am able to print the value of Type though and I get 0, 1, 2 etc. Does anyone know what is setting the value of Type?
 
Problem solved, Type is being assigned in SettlementNameplateItem.xml.

XML:
<SettlementNameplateEventVisualWidget WidthSizePolicy="Fixed" HeightSizePolicy="Fixed" SuggestedWidth="25" SuggestedHeight="25" Brush="Settlement.Event.Type.Image" Type="@Type" />
 
Upvote 0
Back
Top Bottom