예제 #1
0
 // Update is called once per frame
 void Update()
 {
     if (CC.Size == SizeReq && Vector3.Distance(Player.transform.position, this.transform.position) < pickupDist)
     {
         pointingArrow.GetComponent <SpriteRenderer>().enabled = true;
         if (Inventory.HeldItem == null && Input.GetMouseButtonDown(0) && Mathf.Abs(Cursor.transform.position.x - this.transform.position.x) < clickDist)
         {
             if (ShowPopup)
             {
                 GameObject pop = Instantiate(Popup);
                 ItemPopup  IP  = pop.GetComponent <ItemPopup>();
                 IP.title = itemName;
                 IP.words = description;
                 IP.Sp    = GetComponent <SpriteRenderer>().sprite;
             }
             Inventory.HeldItem   = itemName;
             Inventory.SR.sprite  = GetComponent <SpriteRenderer>().sprite;
             Inventory.SR.enabled = true;
             GameObject.Destroy(this.gameObject);
         }
     }
     else
     {
         pointingArrow.GetComponent <SpriteRenderer>().enabled = false;
     }
 }
예제 #2
0
        public void Execute(object parameter)
        {
            SearchItemPage searchItemPage = parameter as SearchItemPage;
            ItemViewModel  vm             = searchItemPage.Resources["ItemVM"] as ItemViewModel;
            ItemPopup      popup          = new ItemPopup();

            popup.Resources["ItemVM"] = vm;
            vm.IsItemPopup            = true;
            ItemPopupViewModel popUpVM = popup.Resources["PopUpVM"] as ItemPopupViewModel;
            //TODO 내일 한다. 응애
            ItemModel model = DBConnecter.getItem(1);

            popUpVM.Shop_Name = model.Shop_Name;
            popUpVM.Memo      = model.Memo;
            popUpVM.Name      = model.Name;
            popUpVM.Link      = model.Link;
            popUpVM.Item_ID   = model.Item_ID;
            popUpVM.Price     = model.Price;
            if (model.Liked == 1)
            {
                popUpVM.Liked = true;
            }
            else
            {
                popUpVM.Liked = false;
            }
            popUpVM.Temp     = model.Temp;
            popUpVM.Image    = model.Image;
            popUpVM.Category = model.Category;
            popup.Show();
        }
예제 #3
0
        public void Execute(object parameter)
        {
            ItemID_ItemPage_Class data  = parameter as ItemID_ItemPage_Class;
            ItemViewModel         vm    = data._ItemViewPage.Resources["ItemVM"] as ItemViewModel;
            ItemPopup             popup = new ItemPopup();

            popup.Resources["ItemVM"] = vm;
            vm.IsItemPopup            = true;
            ItemPopupViewModel popUpVM = popup.Resources["PopUpVM"] as ItemPopupViewModel;
            ItemModel          model   = DBConnecter.getItem(data.ItemID);

            popUpVM.Shop_Name = model.Shop_Name;
            popUpVM.Memo      = model.Memo;
            popUpVM.Name      = model.Name;
            popUpVM.Link      = model.Link;
            popUpVM.Item_ID   = model.Item_ID;
            popUpVM.Price     = model.Price;
            if (model.Liked == 1)
            {
                popUpVM.Liked = true;
            }
            else
            {
                popUpVM.Liked = false;
            }
            popUpVM.Temp     = model.Temp;
            popUpVM.Image    = model.Image;
            popUpVM.Category = model.Category;
            popup.Show();
        }
예제 #4
0
    // Update is called once per frame
    void Update()
    {
        if (Vector3.Distance(Player.transform.position, this.transform.position) < pickupDist)
        {
            pointingArrow.enabled = true;
            if (Input.GetMouseButtonDown(0) && Mathf.Abs(Cursor.transform.position.x - this.transform.position.x) < clickDist)
            {
                PotC.unlockNextPot();
                pop = Instantiate(Popup);
                ItemPopup IP = pop.GetComponent <ItemPopup>();
                IP.title = itemName;
                IP.words = description;
                IP.Sp    = GetComponent <SpriteRenderer>().sprite;

                /*
                 * for (int i = 0; i < itemName.Length; i++) {
                 *      Debug.Log(itemName[i]);
                 *      IP.title.Enqueue(itemName[i]);
                 * }
                 * for (int i = 0; i < description.Length; i++) {
                 *      Debug.Log(description[i]);
                 *      IP.words.Enqueue(description[i]);
                 * }
                 * Debug.Log("SEPPUKU");
                 */
                GameObject.Destroy(this.gameObject);
            }
        }
        else
        {
            pointingArrow.GetComponent <SpriteRenderer>().enabled = false;
        }
    }
예제 #5
0
 public void Execute(object parameter)
 {
     if (parameter.GetType() == typeof(ItemPopup))
     {
         ItemPopup          itemPopup = parameter as ItemPopup;
         ItemPopupViewModel vm        = itemPopup.Resources["PopUpVM"] as ItemPopupViewModel;
         //true
         if (vm.IsReadOnly)
         {
             vm.IsReadOnly = false;
         }
         else
         //false
         {
             vm.IsReadOnly = true;
         }
     }
     else if (parameter.GetType() == typeof(SearchItemPopup))
     {
         SearchItemPopup    itemPopup = parameter as SearchItemPopup;
         ItemPopupViewModel vm        = itemPopup.Resources["PopUpVM"] as ItemPopupViewModel;
         //true
         if (vm.IsReadOnly)
         {
             vm.IsReadOnly = false;
         }
         else
         //false
         {
             vm.IsReadOnly = true;
         }
     }
 }
    public override void CallNode()
    {
        GameManager gameManager = cutsceneManager.gameManager;

        switch (manipulationMode)
        {
        case ManipulationMode.ADD:
            for (int i = 0; i < quantity; i++)
            {
                gameManager.GetBackpack().items.Add(targetItem);
            }

            ItemPopup popup = Instantiate(itemGotPopupPrefab, gameManager.uiParent.transform).GetComponent <ItemPopup>();
            gameManager.playerMachine.audioSource.PlayOneShot(collectSound);
            gameManager.playerMachine.art.animator.SetBool("ItemGet", true);
            popup.StartPopup(targetItem, gameManager.playerMachine, quantity, ItemGotPopupClosed, false);

            break;

        case ManipulationMode.REMOVE:
            try{
                for (int i = 0; i < quantity; i++)
                {
                    gameManager.GetBackpack().items.Remove(targetItem);
                }
                CallOutputSlot("Next Node");
            } catch (Exception) {
                CallOutputSlot("On Error");
            }
            break;
        }
    }
        public bool CanExecute(object parameter)
        {
            ItemPopup itemPopup = parameter as ItemPopup;

            if (itemPopup == null)
            {
                return(true);
            }
            ItemPopupViewModel itemPopupVM = itemPopup.Resources["PopUpVM"] as ItemPopupViewModel;

            return(itemPopupVM == null ? true : !(itemPopupVM.IsCategoryPopup));
        }
        public void Execute(object parameter)
        {
            ItemPopup              itemPopup     = parameter as ItemPopup;
            ItemPopupViewModel     itemPopupVM   = itemPopup.Resources["PopUpVM"] as ItemPopupViewModel;
            ItemPopupCategoryPopup categoryPopup = new ItemPopupCategoryPopup();

            categoryPopup.Resources["ItemPopupVM"] = itemPopupVM;
            CategoryViewModel categoryVM = categoryPopup.Resources["CategoryVM"] as CategoryViewModel;

            categoryVM.category         = itemPopupVM.Category;
            itemPopupVM.IsCategoryPopup = true;
            categoryPopup.Show();
        }
예제 #9
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            player = other.gameObject.GetComponent <PlayerMachine>();

            player.gameManager.GetBackpack().items.Add(itemType);
            ItemPopup popup = Instantiate(itemPopup, player.gameManager.uiParent.transform).GetComponent <ItemPopup>();
            player.audioSource.PlayOneShot(collectSound);
            player.art.animator.SetBool("ItemGet", true);
            popup.StartPopup(itemType, player);
            Destroy(gameObject);
        }
    }
예제 #10
0
    // Start is called before the first frame update

    private void Awake()
    {
        {
            if (Instance == null)
            {
                Instance = this;
            }
            else
            {
                Debug.LogWarning("Multiple PopupText instances warning destorying self!!!");

                Destroy(gameObject);
            }
        }
    }
예제 #11
0
    // Use this for initialization
    void Start()
    {
        if (instance != null)
        {
            Destroy(instance.gameObject);
        }

        instance = this;

        floatingTextManager = GetComponent <FloatingTextManager>();
        healthBarManager    = GetComponent <HealthBarManager>();
        playerGUI           = GetComponent <PlayerGUI>();
        itemPopup           = itemPopupObject.GetComponent <ItemPopup>();
        loadScreen          = GetComponent <LoadScreen>();
        deathScreen         = GetComponent <DeathScreen>();
        bossGUI             = GetComponent <BossGUI>();
    }
 public void Execute(object parameter)
 {
     if (parameter.GetType() == typeof(ItemPopup))
     {
         ItemPopup itemPopup = parameter as ItemPopup;
         itemPopup.DragMove();
     }
     else if (parameter.GetType() == typeof(SearchItemPopup))
     {
         SearchItemPopup searchItemPopup = parameter as SearchItemPopup;
         searchItemPopup.DragMove();
     }
     else if (parameter.GetType() == typeof(AddItemPopup))
     {
         AddItemPopup addItemPopup = parameter as AddItemPopup;
         addItemPopup.DragMove();
     }
 }
예제 #13
0
    public void OnPointerEnter(PointerEventData eventData)
    {
        if (!this.popupCreated)
        {
            this.instantiatedPopup = Instantiate(popupPrefab, this.popupSpawn.transform);
            this.popupCreated      = true;

            ItemPopup itemInfo = this.instantiatedPopup.GetComponent <ItemPopup>();
            this.itemInfo             = itemInfo;
            itemInfo.description.text = this.item.description;
            itemInfo.item             = this.item;

            if (!this.item.beenPurchased)
            {
                itemInfo.equipButton.interactable = false;
            }
        }
    }
예제 #14
0
    private IEnumerator HarvestCoroutine(GameObject character)
    {
        character.GetComponent <CharacterMovement>().CanMove = false;

        CanHarvest = false;
        interactText.gameObject.SetActive(false);

        for (int i = 0; i < harvestTime; i++)
        {
            yield return(new WaitForSeconds(1));

            progressBar.fillAmount = (1f / harvestTime) * (i + 1);
        }

        progressBar.fillAmount = 0;
        Item itemToAdd = availableItems[Random.Range(0, availableItems.Count)];

        character.GetComponent <Inventory>().AddItem(itemToAdd);
        CanHarvest = true;
        character.GetComponent <CharacterMovement>().CanMove = true;

        ItemPopup.Show(itemToAdd);
    }
예제 #15
0
        private void Add_Item_Click(object sender, RoutedEventArgs e)
        {
            this.IsEnabled = false;
            this.Opacity   = 0.2;
            Popup add = new Popup();
            CategorieViewModel cvm = (sender as MenuItem).DataContext as CategorieViewModel;
            Categorie          ca  = new Categorie()
            {
                Id = cvm.Id
            };
            ItemPopup popup = new ItemPopup(ca, cvm.Items);

            popup.Width          = Application.Current.Host.Content.ActualWidth - 40;
            add.Child            = popup;
            add.IsOpen           = true;
            add.VerticalOffset   = 50;
            add.HorizontalOffset = 20;
            add.Closed          += (s1, e1) =>
            {
                this.Opacity   = 1;
                this.IsEnabled = true;
            };
        }
예제 #16
0
 private void ItemGotPopupClosed(ItemPopup popup)
 {
     CallOutputSlot("Next Node");
 }
예제 #17
0
        // Update is called once per frame
        void LateUpdate()
        {
            //set position
            transform.position = new Vector2(Position.x, Position.y);

            //change animations
            if (Velocity.x > 0)
            {
                GetComponent <SpriteRenderer>().flipX = false;
            }
            else if (Velocity.x < 0)
            {
                GetComponent <SpriteRenderer>().flipX = true;
            }

            if (GetComponent <Animator>())
            {
                //assign animations
                if (r || l)
                {
                    GetComponent <Animator>().SetBool("HoldingHorz", true);
                }
                else
                {
                    GetComponent <Animator>().SetBool("HoldingHorz", false);
                }

                GetComponent <Animator>().SetFloat("HorzSpeed", Mathf.Abs(Velocity.x));
                GetComponent <Animator>().SetFloat("VertSpeed", Mathf.Abs(Velocity.y));
                GetComponent <Animator>().SetBool("Grounded", Grounded);
                GetComponent <Animator>().SetBool("Hanging", Hanging);
                GetComponent <Animator>().ResetTrigger("Climb");
            }
            //handle activatable entities
            collider.UpdateBroadEntities(Position, 0.5f);

            //chests
            if (ItemPopupBasic)
            {
                if (!collider.OtherEntitiesNear.Contains(ItemPopupBasic.GetComponent <Entity.Entity>()))
                {
                    if (ItemPopupBasic)
                    {
                        ItemPoping = null;
                        Destroy(ItemPopupBasic.gameObject);
                    }
                }
            }
            bool pickedItem = false;

            foreach (Entity.Entity e in collider.OtherEntitiesNear)
            {
                if (e.GetComponent <Entity.Chest>() && Input.GetButtonDown("Use"))
                {
                    e.ActivateWith(this);
                }
                if (e.GetComponent <Item>() && !pickedItem)
                {
                    Item item = e.GetComponent <Item>();
                    if (ItemPoping == item)
                    {
                        continue;
                    }
                    else
                    {
                        if (ItemPopupBasic)
                        {
                            Destroy(ItemPopupBasic.gameObject);
                        }
                    }
                    ItemPoping = item;
                    UnityEngine.Object prefab = Resources.Load("Items/UI/ItemPopupBasic");
                    ItemPopupBasic = Instantiate(prefab) as GameObject;
                    ItemPopupBasic.transform.position = new Vector3(e.transform.position.x, e.transform.position.y + 0.5f, -2);

                    ItemPopup popup = ItemPopupBasic.GetComponent <ItemPopup>();

                    popup.ItemName.text  = item.UIName;
                    popup.ItemName.color = item.GetTextColor();

                    popup.Desc.text   = "Level " + item.Stats.ItemLevel + " " + item.ImpericalName;
                    popup.Hold.text   = "One Handed";
                    popup.Rarity.text = item.Rarity.ToString();

                    if (Input.GetButtonDown("Use"))
                    {
                        e.ActivateWith(this);
                    }

                    pickedItem = true;

                    continue;
                }
            }
        }
예제 #18
0
 public void Initialize()
 {
     inst = this;
 }
 public void Execute(object parameter)
 {
     if (parameter.GetType() == typeof(ItemPopup))
     {
         ItemPopup          popup = parameter as ItemPopup;
         ItemViewModel      vm    = popup.Resources["ItemVM"] as ItemViewModel;
         ItemPopupViewModel popVM = popup.Resources["PopUpVM"] as ItemPopupViewModel;
         ItemModel          model = new ItemModel(popVM.Item_ID, popVM.Name, popVM.Shop_Name, popVM.Price, popVM.Temp, popVM.Link, popVM.Memo, popVM.Liked ? 1 : 2);
         model.Category = popVM.Category;
         DBConnecter.updateItem(model);
         vm.setItemlist();
         vm.updateWeatherRecommands(vm.Temp);
         vm.recommand_four = new ObservableCollection <ItemModel>();
         if (vm.recommandsList.Count() > 4)
         {
             for (int i = 0; i < 4; i++)
             {
                 vm.recommand_four.Add(vm.recommandsList[i]);
                 vm.recommand_four[i].x = i;
             }
         }
         else
         {
             for (int i = 0; i < vm.recommandsList.Count(); i++)
             {
                 vm.recommand_four.Add(vm.recommandsList[i]);
                 vm.recommand_four[i].x = i;
             }
         }
         vm.itemViewPage.itemListView.ItemsSource      = vm.items;
         vm.itemViewPage.recommandListView.ItemsSource = vm.recommand_four;
         vm.IsItemPopup = false;
         popup.Close();
     }
     else if (parameter.GetType() == typeof(AddItemPopup))
     {
         AddItemPopup       popup = parameter as AddItemPopup;
         ItemViewModel      vm    = popup.Resources["ItemVM"] as ItemViewModel;
         ItemPopupViewModel popVM = popup.Resources["PopUpVM"] as ItemPopupViewModel;
         ItemModel          model = new ItemModel(popVM.Item_ID, popVM.Name, popVM.Shop_Name, popVM.Price, popVM.Temp, popVM.Link, popVM.Memo, popVM.Liked ? 1 : 2);
         model.Category = popVM.Category;
         DBConnecter.setItem(vm.user, model);
         vm.setItemlist();
         vm.updateWeatherRecommands(vm.Temp);
         vm.recommand_four = new ObservableCollection <ItemModel>();
         if (vm.recommandsList.Count() > 4)
         {
             for (int i = 0; i < 4; i++)
             {
                 vm.recommand_four.Add(vm.recommandsList[i]);
                 vm.recommand_four[i].x = i;
             }
         }
         else
         {
             for (int i = 0; i < vm.recommandsList.Count(); i++)
             {
                 vm.recommand_four.Add(vm.recommandsList[i]);
                 vm.recommand_four[i].x = i;
             }
         }
         vm.itemViewPage.itemListView.ItemsSource      = vm.items;
         vm.itemViewPage.recommandListView.ItemsSource = vm.recommand_four;
         vm.IsItemPopup = false;
         popup.Close();
     }
 }