public void SpawnDeliveryTruck(DeliveryEvent deliveryEvent) { Order order = deliveryEvent.order; Database db = GameObject.Find("Database").GetComponent <Database>(); GameObject deliveryTruck = Instantiate(db.GetStoreObject("Delivery Truck 1").gameObject_); DeliveryTruck truck = deliveryTruck.GetComponent <DeliveryTruck>(); order.deliveryTruck = truck; truck.order = order; truck.manager = this; truck.leftSideText.text = order.vendor.vendorName; truck.rightSideText.text = order.vendor.vendorName; deliveryTruck.transform.position = truckLocation.transform.position; deliveryTruck.transform.eulerAngles = truckLocation.transform.eulerAngles; List <Box> deliveryBoxes = gameObject.GetComponent <Inventory>().BoxProducts(order); truck.boxes = deliveryBoxes; deliveries.Add(new Delivery(order, truck)); // UI UIManager_v5 uiManager = GameObject.Find("UIManager").GetComponent <UIManager_v5>(); uiManager.CreateDeliveryNotification(truck); uiManager.leftBarDeliveryPanel.AddDelivery(order); }
public void TryNext() { if (deliveries.Count < 1 && deliveryQueue.Count > 0) { DeliveryEvent nextOrder = deliveryQueue.Dequeue(); SpawnDeliveryTruck(nextOrder); } }
public override IEventModel CreateNewDataModel() { Delivery nwDelivery = new Delivery(); //nwStation.Save(); DeliveryEvent nwDeliveryEvent = new DeliveryEvent(nwDelivery); return(nwDeliveryEvent); }
public void SetCell() { if (!cellIsSet) { TraverseParms traverseParms = DeliveryEvent.DeliveryTraverseParms; traverseParms.pawn = lord.ownedPawns[0]; deliveryCell = DeliveryEvent.GetDeliveryCell(traverseParms, lord.Map); cellIsSet = true; } }
public ScheduledEventDisplayObject AlreadyExists(DispensaryEvent toCheck) { foreach (ScheduledEventDisplayObject displayObject in displayedEvents) { if (displayObject.containedEvents.Count > 0) { if (displayObject.containedEvents[0].containedEvent.eventType == DispensaryEvent.EventType.delivery) { try { DeliveryEvent possibleDeliveryEvent = (DeliveryEvent)toCheck; if (possibleDeliveryEvent != null) { return(displayObject); } } catch (System.InvalidCastException) { // do nothing } } else if (displayObject.containedEvents[0].containedEvent.eventType == DispensaryEvent.EventType.smokeLounge) { /*try * { * * } * catch (System.InvalidCastException) * { * // do nothing * }*/ } } } return(null); }
void IDeliveryEventListener.OnMessageDelivered(NetPeer peer, object userData) { DeliveryEvent?.Invoke(peer, userData); }
public ActionResult Details(int id) { DeliveryEvent delivery = db.deliveryEvent.Find(id); return(View(delivery)); }
public override void DoWindowContents(Rect inRect) { //grab before anchor/font GameFont fontBefore = Text.Font; TextAnchor anchorBefore = Text.Anchor; //top label Text.Font = GameFont.Small; Text.Anchor = TextAnchor.MiddleCenter; Text.Anchor = TextAnchor.MiddleLeft; int i = 0; foreach (FCPrisoner prisoner in prisoners) { Rect Box; Rect PawnIcon; Rect PawnName; Rect PawnHealth; Rect PawnUnrest; Rect PawnWorkload; Rect ButtonInfo; Rect ButtonAction; Box = optionBox; PawnIcon = optionPawnIcon; PawnName = optionPawnName; PawnHealth = optionPawnHealth; PawnUnrest = optionPawnUnrest; PawnWorkload = optionPawnWorkload; ButtonInfo = optionButtonInfo; ButtonAction = optionButtonAction; Box.y += scroll + optionHeight * i; PawnIcon.y += scroll + optionHeight * i; PawnName.y += scroll + optionHeight * i; PawnHealth.y += scroll + optionHeight * i; PawnUnrest.y += scroll + optionHeight * i; PawnWorkload.y += scroll + optionHeight * i; ButtonInfo.y += scroll + optionHeight * i; ButtonAction.y += scroll + optionHeight * i; //display stuff now Widgets.DrawMenuSection(Box); //on every other box if (i % 2 == 0) { Widgets.DrawHighlight(Box); } //show pawn; Widgets.ThingIcon(PawnIcon, prisoner.prisoner); //Pawn Name Widgets.Label(PawnName, prisoner.prisoner.Name.ToString()); //Pawn Health Widgets.Label(PawnHealth, "Health".Translate().CapitalizeFirst() + " " + prisoner.health); //Pawn Unrest //Widgets.Label(PawnUnrest, "Unrest".Translate().CapitalizeFirst() + " " + prisoner.unrest); //Pawn Workload string workload; switch (prisoner.workload) { case FCWorkLoad.Heavy: workload = "FCHeavy".Translate().CapitalizeFirst(); break; case FCWorkLoad.Medium: workload = "FCMedium".Translate().CapitalizeFirst(); break; case FCWorkLoad.Light: workload = "FCLight".Translate().CapitalizeFirst(); break; default: workload = "null"; break; } if (Widgets.ButtonText(PawnWorkload, "FCWorkload".Translate().CapitalizeFirst() + ": " + workload)) { List <FloatMenuOption> list = new List <FloatMenuOption>(); list.Add(new FloatMenuOption("FCHeavy".Translate().CapitalizeFirst() + " - " + "FCHeavyExplanation".Translate(), delegate { prisoner.workload = FCWorkLoad.Heavy; })); list.Add(new FloatMenuOption("FCMedium".Translate().CapitalizeFirst() + " - " + "FCMediumExplanation".Translate(), delegate { prisoner.workload = FCWorkLoad.Medium; })); list.Add(new FloatMenuOption("FCLight".Translate().CapitalizeFirst() + " - " + "FCLightExplanation".Translate(), delegate { prisoner.workload = FCWorkLoad.Light; })); FloatMenu menu = new FloatMenu(list); Find.WindowStack.Add(menu); } //Info Button if (Widgets.ButtonTextSubtle(ButtonInfo, "ViewInfo".Translate())) { Pawn pawn = new Pawn(); pawn = prisoner.prisoner; if (prisoner.healthTracker != null) { prisoner.prisoner.health = prisoner.healthTracker; } else { prisoner.prisoner.health = new Pawn_HealthTracker(prisoner.prisoner); prisoner.healthTracker = new Pawn_HealthTracker(prisoner.prisoner); } pawn.health = prisoner.healthTracker; Find.WindowStack.Add(new Dialog_InfoCard(pawn)); } //Action button if (Widgets.ButtonTextSubtle(ButtonAction, "Actions".Translate())) { List <FloatMenuOption> list = new List <FloatMenuOption>(); list.Add(new FloatMenuOption("SellPawn".Translate() + " $" + prisoner.prisoner.MarketValue + " " + "SellPawnInfo".Translate(), delegate { settlement.addSilverIncome(prisoner.prisoner.MarketValue); //reset window prisoners.Remove(prisoner); WindowUpdate(); return; })); list.Add(new FloatMenuOption("ReturnToPlayer".Translate(), delegate { if (prisoner.healthTracker != null) { prisoner.prisoner.health = prisoner.healthTracker; } else { prisoner.prisoner.health = new Pawn_HealthTracker(prisoner.prisoner); prisoner.healthTracker = new Pawn_HealthTracker(prisoner.prisoner); } if (!HealthUtility.TryAnesthetize(prisoner.prisoner)) { HealthUtility.DamageUntilDowned(prisoner.prisoner, false); } if (prisoner.prisoner.guest == null) { prisoner.prisoner.guest = new Pawn_GuestTracker(); } prisoner.prisoner.guest.guestStatusInt = GuestStatus.Prisoner; FieldInfo hostFaction = typeof(Pawn_GuestTracker).GetField("hostFactionInt", BindingFlags.NonPublic | BindingFlags.Instance); hostFaction.SetValue(prisoner.prisoner.guest, Find.FactionManager.OfPlayer); DeliveryEvent.CreateDeliveryEvent(new FCEvent { location = Find.AnyPlayerHomeMap.Tile, source = settlement.mapLocation, planetName = settlement.planetName, goods = new List <Thing> { prisoner.prisoner }, customDescription = "aPrisonerIsBeingDeliveredToYou".Translate(), timeTillTrigger = Find.TickManager.TicksGame + FactionColonies.ReturnTicksToArrive(settlement.mapLocation, Find.AnyPlayerHomeMap.Tile) }); //reset window prisoners.Remove(prisoner); WindowUpdate(); return; })); FloatMenu menu = new FloatMenu(list); Find.WindowStack.Add(menu); } //increment i i++; } Text.Font = fontBefore; Text.Anchor = anchorBefore; if (Event.current.type == EventType.ScrollWheel) { scrollWindow(Event.current.delta.y); } }
public void AddDeliveryToQueue(DeliveryEvent deliveryEvent) { deliveryQueue.Enqueue(deliveryEvent); TryNext(); }
private DeliveryEventViewModel CreateViewModel(DeliveryEvent evt) { return new DeliveryEventViewModel { Id = evt.Id, DateTime = evt.DateTime, OrderFulfillments = evt.OrderFulfillments.Select(f => new OrderFulfillmentViewModel { OrderId = f.OrderId, OrderSourceId = f.Order.SourceId, OrderCustomerSourceId = f.Order.Customer?.Name ?? "", Assets = f.Assets.Select(AssetViewModelExtensions.ToViewModel).ToList(), }), }; }
public void HandleEvent(DeliveryEvent evt) { foreach (var fulfillment in evt.OrderFulfillments) foreach (var asset in fulfillment.Assets) { asset.State = AssetState.WithCustomer; asset.WithCustomerId = fulfillment.Order.CustomerId; asset.History.Add(new AssetEventInfo { AssetId = asset.Id, EventId = evt.Id, EventType = AssetEventType.Delivered, }); _assets.Update(asset, commit: false); } _events.Add(evt); }
public static void deliverThings(List <Thing> things, int source, Letter let = null, Message msg = null) { DeliveryEvent.CreateDeliveryEvent(things, source, let, msg); }
public static void deliverThings(FCEvent evt, Letter let = null, Message msg = null) { DeliveryEvent.Action(evt, let, msg); }
public void LoadEvent(DispensaryEvent newSelectedEvent) { currentlyDisplayedEvent = newSelectedEvent; eventNameText.text = currentlyDisplayedEvent.eventName; string startTimePrefix = "Starts - "; string endTimePrefix = "Ends - "; try { // Try to cast the new event into a delivery event DeliveryEvent deliveryEvent = (DeliveryEvent)newSelectedEvent; if (deliveryEvent != null) { startTimePrefix = "Delivery Arrives - "; eventStartTimeText.gameObject.SetActive(true); eventEndTimeText.gameObject.SetActive(false); } } catch (System.InvalidCastException) { // Event is not a delivery event } try { // Try to cast the new event into a smokeLounge event SmokeLoungeEvent smokeLoungeEvent = (SmokeLoungeEvent)newSelectedEvent; if (smokeLoungeEvent != null) { startTimePrefix = "Event Starts - "; endTimePrefix = "Event Ends - "; eventStartTimeText.gameObject.SetActive(true); eventEndTimeText.gameObject.SetActive(false); } } catch (System.InvalidCastException) { // Event is not a smokeLounge event } try { // Try to cast the new event into a glassShop event GlassShopEvent glassShopEvent = (GlassShopEvent)newSelectedEvent; if (glassShopEvent != null) { startTimePrefix = "Event Starts - "; endTimePrefix = "Event Ends - "; eventStartTimeText.gameObject.SetActive(true); eventEndTimeText.gameObject.SetActive(false); } } catch (System.InvalidCastException) { // Event is not a glassShop event } try { // Try to cast the new event into a growroom event GrowroomEvent growroomEvent = (GrowroomEvent)newSelectedEvent; if (growroomEvent != null) { startTimePrefix = "Event Starts - "; endTimePrefix = "Event Ends - "; eventStartTimeText.gameObject.SetActive(true); eventEndTimeText.gameObject.SetActive(false); } } catch (System.InvalidCastException) { // Event is not a growroom event } eventStartTimeText.text = startTimePrefix + newSelectedEvent.eventStartDate.GetTimeString(); eventEndTimeText.text = endTimePrefix + newSelectedEvent.eventEndDate.GetTimeString(); }