Skip to content

Commit

Permalink
* redirect on mobile/unsupported browser to alternate page
Browse files Browse the repository at this point in the history
* improved webgl template appearance
* updated to latest field day core
  • Loading branch information
BeauchesneFieldDay committed May 23, 2024
1 parent 710e3dc commit 7526185
Show file tree
Hide file tree
Showing 87 changed files with 1,795 additions and 523 deletions.
2 changes: 1 addition & 1 deletion Assets/Code/Alerts/AlertCreationSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public override void ProcessWorkForComponent(EventActor component, float deltaTi
}

ZavalaGame.Events.Dispatch(GameEvents.AlertAppeared, new Data.AlertData(peekEvent.Alert, peekEvent.TileIndex, node.FullName));
Debug.Log("[Alerts] Created new alert!" + node.FullName);
Log.Debug("[Alerts] Created new alert!" + node.FullName);
component.DisplayingEvent = alert;
}
}
Expand Down
4 changes: 2 additions & 2 deletions Assets/Code/Alerts/ExcessRunoffAlertSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ public override void ProcessWorkForComponent(ActorPhosphorusGenerator generator,
}

// check if runoff is excessive
Log.Msg("[ExcessRunoffAlertSystem] Amount generated last tick by {0}: {1}", actor.name, generator.AmountProducedLastTick);
Log.Debug("[ExcessRunoffAlertSystem] Amount generated last tick by {0}: {1}", actor.name, generator.AmountProducedLastTick);
if (generator.AmountProducedLastTick >= RunoffParams.ExcessRunoffThreshold) {
// if so, create alert on this tile
Log.Msg("-----> Sending runoff alert from {0}", actor.name);
Log.Debug("-----> Sending runoff alert from {0}", actor.name);
EventActorUtility.QueueAlert(actor, EventActorAlertType.ExcessRunoff, tile.TileIndex, tile.RegionIndex,
new NamedVariant("isFromGrainFarm", isFromGrainFarm));
}
Expand Down
2 changes: 1 addition & 1 deletion Assets/Code/Alerts/GlobalAlertButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public static class GlobalAlertUtility {
public static void TickGlobalAlertDelay(GlobalAlertButton button) {
if (button.TicksSinceFired < GlobalAlertParams.GlobalAlertDelay) {
button.TicksSinceFired++;
Log.Msg("[GlobalAlertButton] Ticking global alert delay... {0} of {1}", button.TicksSinceFired, GlobalAlertParams.GlobalAlertDelay);
Log.Debug("[GlobalAlertButton] Ticking global alert delay... {0} of {1}", button.TicksSinceFired, GlobalAlertParams.GlobalAlertDelay);
}
if (button.TicksSinceFired >= GlobalAlertParams.GlobalAlertDelay) {
button.UpdateButtonRoutine();
Expand Down
4 changes: 2 additions & 2 deletions Assets/Code/Alerts/UIAlert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public static void SetAlertFaded(UIAlert alert, bool faded) {

public static bool ClearAlert(UIAlert alert, bool recycleEvent = false) {
if (alert == null) {
Log.Msg("[UIAlertUtility] Clear Alert: attempted to clear null alert, skipping.");
Log.Debug("[UIAlertUtility] Clear Alert: attempted to clear null alert, skipping.");
; return false;
}
alert.KeepFaded = false;
Expand All @@ -131,7 +131,7 @@ public static bool ClearAlert(UIAlert alert, bool recycleEvent = false) {

public static bool ClearAlertImmediate(UIAlert alert, bool recycleEvent = false) {
if (alert == null) {
Log.Msg("[UIAlertUtility] Clear Alert: attempted to clear null alert, skipping.");
Log.Debug("[UIAlertUtility] Clear Alert: attempted to clear null alert, skipping.");
return false;
}
alert.KeepFaded = false;
Expand Down
14 changes: 7 additions & 7 deletions Assets/Code/Building/UserBuildingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private int RaycastTileIndex(SimWorldState world, SimGridState grid) {
if (Game.Input.IsPointerOverCanvas()) {
// return if over UI
// TODO: more permanent solution
Log.Msg("[UserBuildingSystem] Raycast over UI, discarding.");
Log.Debug("[UserBuildingSystem] Raycast over UI, discarding.");
return CODE_INVALID;
}
Ray mouseRay = m_StateB.Camera.ScreenPointToRay(m_StateA.ScreenMousePos);
Expand All @@ -145,7 +145,7 @@ private int RaycastTileIndex(SimWorldState world, SimGridState grid) {
return CODE_INVALID;
}

Log.Msg("[UserBuildingSystem] New raycast hit Tile {0}", i);
Log.Debug("[UserBuildingSystem] New raycast hit Tile {0}", i);

// TODO: check if valid neighbor (otherwise try to draw line between current and previous, or wait for return)

Expand All @@ -155,7 +155,7 @@ private int RaycastTileIndex(SimWorldState world, SimGridState grid) {
return i;
}
else {
Log.Msg("[UserBuildingSystem] Raycast missed.");
Log.Debug("[UserBuildingSystem] Raycast missed.");
return CODE_INVALID;
}
}
Expand All @@ -170,7 +170,7 @@ private Collider RaycastBuilding(SimWorldState world, SimGridState grid) {
if (Game.Input.IsPointerOverCanvas()) {
// return if over UI
// TODO: more permanent solution
Log.Msg("[UserBuildingSystem] Raycast over UI, discarding.");
Log.Debug("[UserBuildingSystem] Raycast over UI, discarding.");
return null;
}
Ray mouseRay = m_StateB.Camera.ScreenPointToRay(m_StateA.ScreenMousePos);
Expand All @@ -185,7 +185,7 @@ private Collider RaycastBuilding(SimWorldState world, SimGridState grid) {
/// </summary>
private void TryApplyTool(SimGridState grid, RoadNetwork network, UserBuildTool activeTool, int tileIndex) {
if (tileIndex == CODE_INVALID) {
Log.Msg("[UserBuildingSystem] Invalid build location: tile {0} out of bounds", tileIndex);
Log.Debug("[UserBuildingSystem] Invalid build location: tile {0} out of bounds", tileIndex);

if (activeTool == UserBuildTool.Road) {
// cancel in-progress road
Expand All @@ -200,7 +200,7 @@ private void TryApplyTool(SimGridState grid, RoadNetwork network, UserBuildTool
return;
}
if ((grid.Terrain.Info[tileIndex].Flags & TerrainFlags.NonBuildable) != 0) {
Log.Msg("[UserBuildingSystem] Invalid build location: tile {0} unbuildable", tileIndex);
Log.Debug("[UserBuildingSystem] Invalid build location: tile {0} unbuildable", tileIndex);
if (activeTool == UserBuildTool.Road) {
SfxUtility.PlaySfx("road-nonbuildable");
}
Expand Down Expand Up @@ -442,7 +442,7 @@ private bool TryStageRoad(SimGridState grid, RoadNetwork network, int tileIndex,
RoadTileInfo idxRoadTile = network.Roads.Info[tileIndex];
RoadTileConstructionInfo idxRoadConstruct = network.Roads.ConstructInfo[tileIndex];
if ((idxRoadConstruct.InProgressMask | idxRoadTile.FlowMask)[dir]) {
Log.Msg("[UserBuildingSystem] Trying to build across a connection that already exists or is staged");
Log.Debug("[UserBuildingSystem] Trying to build across a connection that already exists or is staged");
return false;
}

Expand Down
26 changes: 1 addition & 25 deletions Assets/Code/Data/Logging/AnalyticsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
using Zavala.World;
using BeauData;
using FieldDay.Components;
using OGD;

namespace Zavala.Data {

Expand Down Expand Up @@ -163,17 +164,6 @@ public GrainFarmData(List<GFarmGrainTabData> grainTab, List<GFarmFertilizerTabDa
GrainTab = grainTab;
FertilizerTab = fertilizerTab;
}

public StringBuilder GrainTabJSON() {
using (PooledStringBuilder psb = PooledStringBuilder.Create()) {
psb.Builder.Append('[');
foreach (GFarmGrainTabData grain in GrainTab) {
psb.Builder.Append(grain.ToJsonString()).Append(',');
}
psb.Builder.Append(']');
return psb.Builder;
}
}
}

[Serializable]
Expand All @@ -185,20 +175,6 @@ public struct GFarmGrainTabData
public int BasePrice;
public int ShippingCost;
public int TotalProfit;

public StringBuilder ToJsonString() {
using (PooledStringBuilder psb = PooledStringBuilder.Create()) {
psb.Builder.Append('{');
psb.Builder.Append("is_active:").Append(IsActive ? "true" : "false").Append(',');
psb.Builder.Append("farm_name:").Append(FarmName).Append(',');
psb.Builder.Append("farm_county:").Append(FarmCounty).Append(',');
psb.Builder.Append("base_price:").Append(BasePrice.ToStringLookup()).Append(',');
psb.Builder.Append("shipping_cost:").Append(ShippingCost.ToStringLookup()).Append(',');
psb.Builder.Append("total_profit:").Append(TotalProfit.ToStringLookup());
psb.Builder.Append('}');
return psb.Builder;
}
}
}

[Serializable]
Expand Down
2 changes: 1 addition & 1 deletion Assets/Code/Economy/MarketData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ static public bool QueueRequest(ResourceRequester requester, ResourceBlock reque
MarketData marketData = Game.SharedState.Get<MarketData>();
Assert.NotNull(marketData);
marketData.RequestQueue.PushBack(new MarketRequestInfo(requester, request));
Log.Msg("[MarketUtility] Producer '{0}' requested {1}", requester.name, request);
Log.Debug("[MarketUtility] Producer '{0}' requested {1}", requester.name, request);
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions Assets/Code/Economy/MarketSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ private void UpdateAllSupplierPriorities()
m_RequesterWorkList.Clear();
m_BuyerPriorityWorkList.Clear();

Log.Msg("[MarketSystem] Updated supplier priorities");
Log.Debug("[MarketSystem] Updated supplier priorities");
}

private void UpdateSupplierPriority(ResourceSupplier supplier, MarketData data, MarketConfig config, RoadNetwork network, HexGridSize gridSize, TutorialState tutorialState)
Expand Down Expand Up @@ -606,7 +606,7 @@ private void UpdateAllRequesterPriorities()
m_RequesterWorkList.Clear();
m_SellerPriorityWorkList.Clear();

Log.Msg("[MarketSystem] Updated buyer priorities");
Log.Debug("[MarketSystem] Updated buyer priorities");
}


Expand Down
2 changes: 1 addition & 1 deletion Assets/Code/Economy/MoneyProducerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override void ProcessWorkForComponent(MoneyProducer producer, ActorTimer

MarketUtility.RecordMilkRevenueToHistory(marketData, producedAmt, position.RegionIndex);

Log.Msg("[MoneyProducerSystem] Producer '{0}' consumed {1} to produce {2} money units", producer.name, consumed, producedAmt);
Log.Debug("[MoneyProducerSystem] Producer '{0}' consumed {1} to produce {2} money units", producer.name, consumed, producedAmt);
// TODO: events?
DebugDraw.AddWorldText(producer.transform.position, "Produced $!", Color.green, 2, TextAnchor.MiddleCenter, DebugTextStyle.BackgroundDark);
ResourceStorageUtility.RefreshStorageDisplays(producer.Storage);
Expand Down
2 changes: 1 addition & 1 deletion Assets/Code/Economy/RequestFulfillmentSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ private void OrientAirship(ref RequestFulfiller fulfiller) {
private void DeliverFulfillment(MarketData marketData, RequestFulfiller component, RequestVisualState visualState) {
component.Target.Received += component.Carrying;
component.Target.RequestCount--;
Log.Msg("[RequestFulfillmentSystem] Shipment of {0} received by '{1}'", component.Carrying, component.Target.name);
Log.Debug("[RequestFulfillmentSystem] Shipment of {0} received by '{1}'", component.Carrying, component.Target.name);
DebugDraw.AddWorldText(component.Target.transform.position, "Received!", Color.black, 2, TextAnchor.MiddleCenter, DebugTextStyle.BackgroundLightOpaque);
ResourceStorageUtility.RefreshStorageDisplays(component.Target.Storage);

Expand Down
2 changes: 1 addition & 1 deletion Assets/Code/Economy/ResourceProducerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public override void ProcessWorkForComponent(ResourceProducer producer, ActorTim
}

ResourceRequester requester = producer.GetComponent<ResourceRequester>();
Log.Msg("[ResourceProducerSystem] Producer '{0}' consumed {1} to produce {2}", producer.name, consumed, produced);
Log.Debug("[ResourceProducerSystem] Producer '{0}' consumed {1} to produce {2}", producer.name, consumed, produced);
DebugDraw.AddWorldText(producer.transform.position, "Produced!", Color.green, 2, TextAnchor.MiddleCenter, DebugTextStyle.BackgroundDark);

if (requester != null && requester.IsLocalOption) {
Expand Down
2 changes: 1 addition & 1 deletion Assets/Code/Economy/ResourcePurchaser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void ChangeRequestAmount(ResourceId resource, int change) {
public void ChangeDemandAmount(ResourceId resource, int change) {
ChangeRequestAmount(resource, change);
// ChangePurchasePrice(resource, change);
Log.Msg("[ResourcePurchaser] {0} demand changed by {1} for actor {2}", resource, change, transform.name);
Log.Debug("[ResourcePurchaser] {0} demand changed by {1} for actor {2}", resource, change, transform.name);
}

private void Awake() {
Expand Down
4 changes: 2 additions & 2 deletions Assets/Code/Scripting/Actors/EventActorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public override void ProcessWorkForComponent(EventActor component, float deltaTi
}
HashSet<AutoAlertCondition> conditions = ZavalaGame.SharedState.Get<AlertState>().AutoTriggerAlerts;
foreach (AutoAlertCondition autoTrig in conditions) {
Log.Msg("[EventActorUtility] Checking for AutoTriggerAlert...");
Log.Debug("[EventActorUtility] Checking for AutoTriggerAlert...");
if ((autoTrig.Alert == EventActorAlertType.None || autoTrig.Alert == queuedEvent.Alert) &&
(autoTrig.RegionIndex == -1 || autoTrig.RegionIndex == queuedEvent.RegionIndex.Value) &&
(autoTrig.CafosOnly == false || (queuedEvent.SecondArg.Id == "isFromGrainFarm" && queuedEvent.SecondArg.Value == false))) {
Expand All @@ -72,7 +72,7 @@ public override void ProcessWorkForComponent(EventActor component, float deltaTi
conditions.Remove(autoTrig);
break;
} else {
Log.Msg("[EventActorUtility] AutoTriggerAlert BYPASSED.");
Log.Debug("[EventActorUtility] AutoTriggerAlert BYPASSED.");
}

}
Expand Down
2 changes: 1 addition & 1 deletion Assets/Code/Scripting/WinLossSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private void EvaluateFertilizerProportions(ref bool triggered, TargetRatio MFert

float MFertVal = ratios[0];
float DFertVal = ratios[2];
Log.Msg("[WinLossSystem: Evaluating Fert. proportions: {0}:{1}:{2} over past {3} ticks", ratios[0], ratios[1], ratios[2], depth );
Log.Debug("[WinLossSystem: Evaluating Fert. proportions: {0}:{1}:{2} over past {3} ticks", ratios[0], ratios[1], ratios[2], depth );

if (MFertProp.Target == 0 && !MFertProp.Above) {
// uninitialized
Expand Down
4 changes: 3 additions & 1 deletion Assets/Code/Services/Localization/LocText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using TMPro;
using UnityEngine;
using System.Text;
using BeauUtil.Debugger;


#if UNITY_EDITOR
using UnityEditor;
Expand Down Expand Up @@ -46,7 +48,7 @@ public struct TextMetrics
public TextMetrics Metrics { get { return m_LastMetrics; } }

public void SetText(TextId inId, object inContext = null) {
Debug.Log("[Loc] Setting text for " + inId);
Log.Trace("[Loc] Setting text for {0}", inId);

m_LastId = inId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public override void ProcessWorkForComponent(StressableActor actor, ActorTimer t
}

int soldUnstressed = financeStress.NonMilkSoldSinceLast - financeStress.SoldAtLossSinceLast;
Log.Msg("[SupplierFinancialStressSystem] NonMilkSold: {0}, SoldAtLoss: {1}", financeStress.NonMilkSoldSinceLast, financeStress.SoldAtLossSinceLast);
Log.Debug("[SupplierFinancialStressSystem] NonMilkSold: {0}, SoldAtLoss: {1}", financeStress.NonMilkSoldSinceLast, financeStress.SoldAtLossSinceLast);

// TODO: may need to shift this to AFTER market system?
if (financeStress.NonMilkSoldSinceLast > 0 && financeStress.SoldAtLossSinceLast >= soldUnstressed)
Expand Down
6 changes: 6 additions & 0 deletions Assets/Code/ZavalaGame.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System;
using System.Runtime.InteropServices;
using BeauUtil;
using FieldDay;
using FieldDay.HID;
Expand All @@ -6,7 +8,9 @@
using UnityEngine;
using UnityEngine.Profiling;
using UnityEngine.Scripting;
using Zavala.Advisor;
using Zavala.Data;
using Zavala.Economy;
using Zavala.Sim;
using Zavala.World;

Expand Down Expand Up @@ -47,6 +51,8 @@ static private void OnPreBoot() {
Game.SetEventDispatcher(Events);
SaveBuffer = new SaveMgr();

Game.Rendering.EnableMinimumAspectClamping(1024, 660);

UserSettings settings = new UserSettings();
Game.SharedState.Register(settings);

Expand Down
Loading

0 comments on commit 7526185

Please sign in to comment.