Пример #1
0
    void RPC_UpdateScoreboardScore(int id, int gotten, int needed, int newScore)
    {
        CartStorage stor = PhotonNetwork.GetPhotonView(id).GetComponent <CartStorage>();

        if (stor)
        {
            stor.productsGotten = gotten;
            stor.productsNeededInCurrentList = needed;
        }
        for (int iB = 0; iB < storages.Length; iB++)
        {
            if (storages[iB])
            {
                for (int i = 0; i < storages[iB].sbListingsList.Count; i++)
                {
                    if (storages[iB].sbListingsList[i].id == id)
                    {
                        storages[iB].sbListingsList[i].text_Score.text       = newScore.ToString();
                        storages[iB].sbListingsList[i].text_ItemsInCart.text = gotten + "/" + needed;
                        break;
                    }
                }
            }
        }
    }
Пример #2
0
 private void Start()
 {
     controller            = GetComponent <Controller>();
     storage               = GetComponent <CartStorage>();
     pView                 = GetComponent <PlayerView>();
     text_ProductName.text = "";
 }
Пример #3
0
        public IActionResult RemoveFromCart(int id)
        {
            var product = context.Products.FirstOrDefault(x => x.Id == id);

            CartStorage.RemoveFromCart(HttpContext.Session, product);
            return(RedirectToAction("Index"));
        }
Пример #4
0
 public override void Interact(CartStorage cartStorage)
 {
     base.Interact(cartStorage);
     if (currentPlace != Place.InShelve)
     {
         ProductInteractions.pi_Single.EnableDisableAllProductColliders(index, false, RpcTarget.All);
     }
 }
Пример #5
0
    void RPC_SetPowerUp(int index, int id)
    {
        CartStorage storage       = PhotonNetwork.GetPhotonView(id).GetComponent <CartStorage>();
        GameObject  productObject = PhotonProductList.staticUseableProductList[index].gameObject;

        productObject.transform.SetParent(storage.transform_PowerUpHolder);
        productObject.transform.localPosition = Vector3.zero;
        productObject.transform.localRotation = Quaternion.Euler(Vector3.zero);
    }
Пример #6
0
 public override void Interact(CartStorage cartStorage)
 {
     if (cartStorage.heldProducts.Count > 0 && cartStorage.productsGotten == cartStorage.productsNeededInCurrentList)
     {
         PlayInteractSound();
         photonView.RPC("RPC_ChangeSpecificScore", RpcTarget.All, cartStorage.photonView.ViewID, cartStorage.score + 1);
         //cartStorage.score++;
         cartStorage.PhotonUpdateGroceryList(ZoneControl.zc_Single.currentZoneIndex + 1, RpcTarget.All);
         photonView.RPC("RPC_DestroyHeldProduct", RpcTarget.MasterClient);
     }
 }
Пример #7
0
    void RPC_AddToCart(int index, int id)
    {
        CartStorage storage       = PhotonNetwork.GetPhotonView(id).GetComponent <CartStorage>();
        GameObject  productObject = PhotonProductList.staticInteratableProductList[index].gameObject;

        storage.heldProducts.Add(PhotonProductList.staticInteratableProductList[index].scriptableProduct);
        storage.heldProductModels.Add(productObject);
        productObject.transform.SetParent(storage.itemHolders[storage.heldProducts.Count - 1]);
        productObject.transform.localPosition = Vector3.zero;
        productObject.transform.localRotation = Quaternion.Euler(Vector3.zero);
    }
Пример #8
0
    public override void Interact(CartStorage cartStorage)
    {
        Vector3 interactPos = transform.position;

        if (currentPlace == Place.InShelve && cartStorage.SetPowerUp(index))
        {
            ProductInteractions.pi_Single.PlaypickUpSoundAndInstantiateParticleOnUseableProduct(index, interactParticleDestroyTime, true, false, interactPos, RpcTarget.All);
            ProductInteractions.pi_Single.ChangePowerUpPlace(index, (int)Place.InCart, RpcTarget.All);
            affectedCartStorage = cartStorage;
            affectedController  = cartStorage.controller;
            if (GetComponent <Outline>())
            {
                GetComponent <Outline>().enabled = false;
            }
        }
    }
Пример #9
0
        public IActionResult NewOrder(Order order)
        {
            var resultOrder = context.Orders.Add(order).Entity;

            context.SaveChanges();

            var cartProducts = CartStorage.GetCartProducts(HttpContext.Session);

            foreach (var item in cartProducts)
            {
                context.OrderProducts.Add(new OrderProduct {
                    ProductId = item.Id, OrderId = resultOrder.Id
                });
            }
            context.SaveChanges();

            CartStorage.ClearCart(HttpContext.Session);

            TempData["Order"] = $"Your order is placed! Your order ID: {resultOrder.Id}";
            return(RedirectToAction("Index", "Home"));
        }
Пример #10
0
    public override void Interact(CartStorage cartStorage)
    {
        Vector3 interactPos = transform.position;

        if (interactable && currentPlace == Place.InShelve && cartStorage.AddToCart(index))
        {
            ProductInteractions.pi_Single.PlaypickUpSoundAndInstantiateParticleOnInteractableProduct(index, interactParticleDestroyTime, true, interactPos, RpcTarget.All);
            ProductInteractions.pi_Single.ChangeProductPlace(index, (int)Place.InCart, RpcTarget.All);
            if (SpecialPosAndRot.use)
            {
                ProductInteractions.pi_Single.SetLocalInteractableProductPositionAndRotation(index, SpecialPosAndRot.pos, Quaternion.Euler(SpecialPosAndRot.rot), RpcTarget.All);
            }
            if (SpecialPosAndRot.productScaling.useNewScale)
            {
                ProductInteractions.pi_Single.SetLocalInteractableProductScale(index, SpecialPosAndRot.productScaling.scale, RpcTarget.All);
            }
            if (GetComponent <Outline>())
            {
                GetComponent <Outline>().enabled = false;
            }
        }
    }
Пример #11
0
 private void Awake()
 {
     TurnCollidersOnOff(false);
     cams       = GetComponentsInChildren <Camera>();
     defaultFov = cams[0].fieldOfView;
     for (int i = 0; i < cams.Length; i++)
     {
         cams[i].enabled = false;
     }
     SetCameraFOVS();
     audioListeners         = GetComponentInChildren <AudioListener>();
     audioListeners.enabled = false;
     if (photonView.IsMine || playerView.devView)
     {
         text_Nickname.gameObject.SetActive(false);
         if (meshRenderersToDisableLocally.Length > 0 && !keepLocalMeshesEnabled)
         {
             for (int i = 0; i < meshRenderersToDisableLocally.Length; i++)
             {
                 meshRenderersToDisableLocally[i].enabled = false;
             }
         }
         if (GameObject.Find("GameManager"))
         {
             gameObject.layer = Manager.staticInformation.int_LocalPlayerLayer;
         }
     }
     else
     {
         localInGameHud.SetActive(false);
     }
     if (PhotonNetwork.IsConnected)
     {
         photonView.RPC("RPC_SetNicknameTargets", RpcTarget.All);
     }
     cartStorage       = GetComponent <CartStorage>();
     myOutline         = GetComponentInChildren <Outline>();
     myOutline.enabled = false;
 }
Пример #12
0
 public virtual void Interact(CartStorage cartStorage)
 {
 }