Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync Dialog_BillConfig target item style change #402

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions Source/Client/Syncing/Game/SyncFields.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public static class SyncFields
public static ISyncField SyncBillMechsOnly;
public static ISyncField SyncBillNonMechsOnly;

public static ISyncField SyncBillStyle;
public static ISyncField SyncBillGlobalStyle;
public static ISyncField SyncBillGraphicIndexOverride;

public static ISyncField SyncZoneLabel;

public static SyncField[] SyncBillProduction;
Expand Down Expand Up @@ -147,6 +151,10 @@ public static void Init()
SyncBillMechsOnly = Sync.Field(typeof(Bill), nameof(Bill.mechsOnly));
SyncBillNonMechsOnly = Sync.Field(typeof(Bill), nameof(Bill.nonMechsOnly));

SyncBillStyle = Sync.Field(typeof(Bill), nameof(Bill.style));
SyncBillGlobalStyle = Sync.Field(typeof(Bill), nameof(Bill.globalStyle));
SyncBillGraphicIndexOverride = Sync.Field(typeof(Bill), nameof(Bill.graphicIndexOverride));

SyncZoneLabel = Sync.Field(typeof(Zone), "label");

SyncBillProduction = Sync.Fields(
Expand Down Expand Up @@ -602,6 +610,41 @@ static void WatchMechCarrierMaxToFill(MechCarrierGizmo __instance)
SyncMechCarrierGizmoTargetValue.Watch(__instance);
SyncMechCarrierMaxToFill.Watch(__instance.carrier);
}

[MpPrefix(typeof(Dialog_BillConfig), nameof(Dialog_BillConfig.DoWindowContents), lambdaOrdinal: 8)]
static void WatchBillStyleGlobal(object __instance)
{
// Sets the graphic to default (global) style
WatchBillStyle(__instance.GetPropertyOrField("<>4__this/bill"));
}

[MpPrefix(typeof(Dialog_BillConfig), nameof(Dialog_BillConfig.DoWindowContents), lambdaOrdinal: 9)]
static void WatchBillStyleBasic(Dialog_BillConfig __instance)
{
// Sets the graphic to basic style (unstyled)
WatchBillStyle(__instance.bill);
}

[MpPrefix(typeof(Dialog_BillConfig), nameof(Dialog_BillConfig.DoWindowContents), lambdaOrdinal: 10)]
static void WatchBillStyleSpecific(object __instance)
{
// Sets the graphic to a specific style
WatchBillStyle(__instance.GetPropertyOrField("CS$<>8__locals2/<>4__this/bill"));
}

[MpPrefix(typeof(Dialog_BillConfig), nameof(Dialog_BillConfig.DoWindowContents), lambdaOrdinal: 11)]
static void WatchBillStyleSpecificIndex(object __instance)
{
// Sets the graphic to a specific style with specific subgraphic index for Graphic_Random
WatchBillStyle(__instance.GetPropertyOrField("CS$<>8__locals3/CS$<>8__locals2/<>4__this/bill"));
}

static void WatchBillStyle(object bill)
{
SyncBillStyle.Watch(bill);
SyncBillGlobalStyle.Watch(bill);
SyncBillGraphicIndexOverride.Watch(bill);
}
}

}
Loading