Пример #1
0
        public bool Start(InteractionEvent interactionEvent, InteractionReference reference)
        {
            if (interactionEvent.Source.Parent is Hands hands)
            {
                hands.PlaceHeldItem(interactionEvent.Point);
            }

            return(false);
        }
Пример #2
0
        public bool Start(InteractionEvent interactionEvent, InteractionReference reference)
        {
            if (interactionEvent.Source.Parent is Hands hands)
            {
                hands.PlaceHeldItem(interactionEvent.Point, hands.GetItemInHand().transform.rotation);
            }

            return(false);
        }
Пример #3
0
 public bool Start(InteractionEvent interactionEvent, InteractionReference reference)
 {
     if (interactionEvent.Target is DisposalBin disposal)
     {
         // Calls the dispose method on the bin
         disposal.DisposeContents();
     }
     return(false);
 }
Пример #4
0
        public bool Start(InteractionEvent interactionEvent, InteractionReference reference)
        {
            var inventory         = interactionEvent.Source.GetComponentInTree <Inventory>();
            var attachedContainer = interactionEvent.Target.GetComponent <AttachedContainer>();

            inventory.OpenContainer(attachedContainer);

            return(false);
        }
        public static int GetPageViewsCount(string itemId)
        {
            int counter = 0;

            using (var client = XConnectHelper.GetClient())
            {
                try
                {
                    IAsyncQueryable <Sitecore.XConnect.Contact> queryable = client.Contacts
                                                                            .Where(c => c.Interactions.Any(f => f.Events.OfType <PageViewEvent>().Any()))
                                                                            .WithExpandOptions(new Sitecore.XConnect.ContactExpandOptions()
                    {
                        Interactions = new Sitecore.XConnect.RelatedInteractionsExpandOptions()
                        {
                            Limit = 2000      // Returns top 20 of all contact's interactions - interactions not affected by query
                        }
                    });

                    var enumerable = queryable.GetBatchEnumeratorSync(10);
                    var urlList    = new List <string>();
                    while (enumerable.MoveNext())
                    {
                        foreach (var contact in enumerable.Current)
                        {
                            InteractionReference interactionReference = new InteractionReference((Guid)contact.Id, (Guid)contact.Interactions.ElementAt(0).Id);

                            Interaction interaction = client.Get <Interaction>(interactionReference, new InteractionExpandOptions(new string[] { IpInfo.DefaultFacetKey })
                            {
                                Contact = new RelatedContactExpandOptions(new string[] { PersonalInformation.DefaultFacetKey })
                            });
                            var pageViews = interaction.Events.OfType <PageViewEvent>().OrderBy(ev => ev.Timestamp).ToList();
                            foreach (var page in pageViews)
                            {
                                // item id is in page
                                if (page.ItemId.Equals(Guid.Parse(itemId)))
                                {
                                    counter++;
                                }
                                urlList.Add(page.Url);
                            }

                            Console.WriteLine("Page Url: " + pageViews.FirstOrDefault().Url);
                        }
                    }

                    //var count = urlList.GroupBy(x => x).Select(y => new { } x.Count());

                    var count = urlList.GroupBy(n => n).Select(c => new { Key = c.Key, total = c.Count() });
                    return(counter);
                }
                catch (XdbExecutionException ex)
                {
                }
                return(counter);
            }
        }
Пример #6
0
        public bool Start(InteractionEvent interactionEvent, InteractionReference reference)
        {
            GameObject target   = ((IGameObjectProvider)interactionEvent.Target).GameObject;
            Animator   animator = target.GetComponent <Animator>();
            bool       open     = animator.GetBool(OpenId);

            animator.SetBool(OpenId, !open);
            OnOpenStateChange(!open);
            return(false);
        }
Пример #7
0
        public bool Start(InteractionEvent interactionEvent, InteractionReference reference)
        {
            // we check if the source of the interaction is a hand
            if (interactionEvent.Source.Parent is Hands hands)
            {
                // we place the item in the hand in the point we clicked
                hands.PlaceHeldItem(interactionEvent.Point, hands.ItemInHand.transform.rotation);
            }

            return(false);
        }
Пример #8
0
 public bool Start(InteractionEvent interactionEvent, InteractionReference reference)
 {
     // remember that when we call this Start, we are starting the interaction per se
     // so we check if the source of the interaction is a Hand, and if the target is an Item
     if (interactionEvent.Source is Hands hands && interactionEvent.Target is Item target)
     {
         // and then we run the function that adds it to the container
         hands.Pickup(target);
     }
     return(false);
 }
Пример #9
0
    private void Toggle(InteractionEvent interactionEvent, InteractionReference reference)
    {
        on = !on;

        animator.SetBool(OnHash, on);
        foreach (Light light in lights)
        {
            light.enabled = on;
        }

        RpcToggle(on);
    }
Пример #10
0
 public bool Start(InteractionEvent interactionEvent, InteractionReference reference)
 {
     if (interactionEvent.Target is Bikehorn horn)
     {
         horn.Honk();
     }
     if (interactionEvent.Source is Bikehorn horn1)
     {
         horn1.Honk();
     }
     return(false);
 }
Пример #11
0
        public virtual bool Start(InteractionEvent interactionEvent, InteractionReference reference)
        {
            Hands hands      = (Hands)interactionEvent.Source;
            Item  PickupItem = interactionEvent.Target.GetComponent <AttachedContainer>().Container.StoredItems[0].Item;

            if (PickupItem != null)
            {
                hands.Pickup(PickupItem);
            }

            return(false);
        }
Пример #12
0
        public virtual bool Start(InteractionEvent interactionEvent, InteractionReference reference)
        {
            Hands hands      = (Hands)interactionEvent.Source;
            int   index      = containerDescriptor.attachedContainer.Container.StoredItems.Count - 1;
            Item  PickupItem = containerDescriptor.attachedContainer.Container.StoredItems[index].Item;

            if (PickupItem != null)
            {
                hands.Pickup(PickupItem);
            }
            return(false);
        }
Пример #13
0
        public bool Start(InteractionEvent interactionEvent, InteractionReference reference)
        {
            if (interactionEvent.Target is IToggleable toggle1)
            {
                toggle1.Toggle();
            }
            else if (interactionEvent.Source is IToggleable toggle)
            {
                toggle.Toggle();
            }

            return(false);
        }
Пример #14
0
    private void Toggle(InteractionEvent interactionEvent, InteractionReference reference)
    {
        on = !on;

        foreach (Light light in lights)
        {
            light.enabled = on;
        }

        bulbRenderer.material = on ? onMaterial : offMaterial;

        RpcToggle(on);
    }
Пример #15
0
 private void ModeInteract(InteractionEvent interactionEvent, InteractionReference arg2)
 {
     if (mode == OperatingMode.Scrubbing)
     {
         mode         = OperatingMode.Siphoning;
         siphonActive = true;
     }
     else if (mode == OperatingMode.Siphoning)
     {
         mode         = OperatingMode.Scrubbing;
         siphonActive = false;
     }
 }
Пример #16
0
 private void ModeInteract(InteractionEvent interactionEvent, InteractionReference arg2)
 {
     if (mode == OperatingMode.Internal)
     {
         mode           = OperatingMode.External;
         internalActive = false;
     }
     else if (mode == OperatingMode.External)
     {
         mode           = OperatingMode.Internal;
         internalActive = true;
     }
 }
Пример #17
0
        public bool Start(InteractionEvent interactionEvent, InteractionReference reference)
        {
            if (interactionEvent.Source is IGameObjectProvider provider)
            {
                SubstanceContainer container = provider.GameObject.GetComponent <SubstanceContainer>();
                if (container != null)
                {
                    container.AddSubstance(Substance.Substance, Substance.Moles);
                    container.MarkDirty();
                }
            }

            return(false);
        }
Пример #18
0
        public bool Start(InteractionEvent interactionEvent, InteractionReference reference)
        {
            if (interactionEvent.Source is IGameObjectProvider provider)
            {
                SubstanceContainer container = provider.GameObject.GetComponent <SubstanceContainer>();
                if (container != null)
                {
                    var targetContainer = interactionEvent.Target.GetComponent <SubstanceContainer>();
                    container.TransferVolume(targetContainer, 25);
                    container.MarkDirty();
                    targetContainer.MarkDirty();
                }
            }

            return(false);
        }
Пример #19
0
        public bool Start(InteractionEvent interactionEvent, InteractionReference reference)
        {
            GameObject source    = ((IGameObjectProvider)interactionEvent.Source.GetRootSource()).GameObject;
            GameObject target    = ((IGameObjectProvider)interactionEvent.Target).GameObject;
            Inventory  inventory = source.GetComponent <Inventory>();

            if (!inventory.HasContainer(target))
            {
                var attacher = source.AddComponent <ContainerAttachment>();
                attacher.container = target.GetComponent <Container>();
                attacher.inventory = inventory;
                attacher.range     = MaxDistance;
            }
            else
            {
                inventory.RemoveContainer(target);
            }

            return(false);
        }
Пример #20
0
        public bool Start(InteractionEvent interactionEvent, InteractionReference reference)
        {
            if (!InteractionExtensions.RangeCheck(interactionEvent))
            {
                return(false);
            }

            if (!(interactionEvent.Target is IIgnitable ignitable))
            {
                return(false);
            }

            if (ignitable.Lit)
            {
                ignitable.Extinguish();
            }
            else
            {
                ignitable.Ignite();
            }
            return(false);
        }
Пример #21
0
 private void PumpInteract(InteractionEvent interactionEvent, InteractionReference arg2)
 {
     SetActive(!pumpActive);
 }
Пример #22
0
 private void FilterInteract(InteractionEvent interactionEvent, InteractionReference arg2)
 {
     SetActive(!filterActive);
 }
Пример #23
0
 public override void Cancel(InteractionEvent interactionEvent, InteractionReference reference)
 {
 }
Пример #24
0
 public bool Start(InteractionEvent interactionEvent, InteractionReference reference)
 {
     return(false);
 }
Пример #25
0
 private void ActiveInteract(InteractionEvent interactionEvent, InteractionReference arg2)
 {
     deviceActive = !deviceActive;
 }
Пример #26
0
        private void ValveInteract(InteractionEvent interactionEvent, InteractionReference arg2)
        {
            valveOpen = !valveOpen;

            //canisterUI.gameObject.SetActive(true);
        }
Пример #27
0
 private void IncreasePressure(InteractionEvent interactionEvent, InteractionReference arg2)
 {
     valvePressure += 20;
 }
Пример #28
0
 public bool Update(InteractionEvent interactionEvent, InteractionReference reference)
 {
     throw new System.NotImplementedException();
 }
Пример #29
0
 public void Cancel(InteractionEvent interactionEvent, InteractionReference reference)
 {
     throw new System.NotImplementedException();
 }
Пример #30
0
 private void ValveInteract(InteractionEvent interactionEvent, InteractionReference arg2)
 {
     SetValve(!isEnabled);
 }