コード例 #1
0
    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);
    }
コード例 #2
0
 public void TryNext()
 {
     if (deliveries.Count < 1 && deliveryQueue.Count > 0)
     {
         DeliveryEvent nextOrder = deliveryQueue.Dequeue();
         SpawnDeliveryTruck(nextOrder);
     }
 }
コード例 #3
0
        public override IEventModel CreateNewDataModel()
        {
            Delivery nwDelivery = new Delivery();
            //nwStation.Save();
            DeliveryEvent nwDeliveryEvent = new DeliveryEvent(nwDelivery);

            return(nwDeliveryEvent);
        }
コード例 #4
0
 public void SetCell()
 {
     if (!cellIsSet)
     {
         TraverseParms traverseParms = DeliveryEvent.DeliveryTraverseParms;
         traverseParms.pawn = lord.ownedPawns[0];
         deliveryCell       = DeliveryEvent.GetDeliveryCell(traverseParms, lord.Map);
         cellIsSet          = true;
     }
 }
コード例 #5
0
 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);
 }
コード例 #6
0
 void IDeliveryEventListener.OnMessageDelivered(NetPeer peer, object userData)
 {
     DeliveryEvent?.Invoke(peer, userData);
 }
コード例 #7
0
        public ActionResult Details(int id)
        {
            DeliveryEvent delivery = db.deliveryEvent.Find(id);

            return(View(delivery));
        }
コード例 #8
0
        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);
            }
        }
コード例 #9
0
 public void AddDeliveryToQueue(DeliveryEvent deliveryEvent)
 {
     deliveryQueue.Enqueue(deliveryEvent);
     TryNext();
 }
コード例 #10
0
 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(),
         }),
     };
 }
コード例 #11
0
        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);
        }
コード例 #12
0
 public static void deliverThings(List <Thing> things, int source, Letter let = null, Message msg = null)
 {
     DeliveryEvent.CreateDeliveryEvent(things, source, let, msg);
 }
コード例 #13
0
 public static void deliverThings(FCEvent evt, Letter let = null, Message msg = null)
 {
     DeliveryEvent.Action(evt, let, msg);
 }
コード例 #14
0
    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();
    }