コード例 #1
0
 public virtual void HandleItem(UnderItem item)
 {
     if (!CustomItemHandler(item))
     {
         item.inCombatUse();
     }
 }
コード例 #2
0
 public override void HandleItem(UnderItem item)
 {
     if (!CustomItemHandler(item))
     {
         item.inCombatUse();
     }
 }
コード例 #3
0
    // <summary>
    // Overrideable item handler on a per-encounter basis. Should return true if a custom action is executed for the given item.
    // </summary>
    // <param name="item">Item to be checked for custom action</param>
    // <returns>true if a custom action should be executed for given item, false if the default action should happen</returns>
    protected virtual bool CustomItemHandler(UnderItem item)
    {
        return(true);
        // the following was test code that allowed you to activate dogs in order 2-3-1 to replace all bullets with dogs

        /*if (dogTest[0] && dogTest[1] && dogTest[2])
         * {
         *  UIController.instance.ActionDialogResult(new RegularMessage[]{
         *      new RegularMessage("After unlocking the\r[color:ffff00]Secret of Dog[color:ffffff],\ryou don't feel like using dog " + item.ID[7] + "."),
         *      new RegularMessage("So you released it.\nFarewell, dog!")
         *  }, UIController.UIState.ENEMYDIALOGUE);
         *  Inventory.container.Remove(item);
         *  return true;
         * }
         *
         * if (item.ID == "DOGTEST2")
         * {
         *  UIController.instance.ActionDialogResult(new RegularMessage("Selected dog 2.\nMight be part of a pattern."), UIController.UIState.ENEMYDIALOGUE);
         *  dogTest[0] = true;
         *  return true;
         * }
         *
         * if (item.ID == "DOGTEST3" && dogTest[0])
         * {
         *  UIController.instance.ActionDialogResult(new RegularMessage("Selected dog 3.\nThis seems about right..."), UIController.UIState.ENEMYDIALOGUE);
         *  dogTest[1] = true;
         *  return true;
         * }
         *
         * if (item.ID == "DOGTEST1" && dogTest[1])
         * {
         *  AudioClip yay = Resources.Load<AudioClip>("Sounds/dogsecret");
         *  AudioSource.PlayClipAtPoint(yay, Camera.main.transform.position);
         *  UIController.instance.ActionDialogResult(new RegularMessage[]{
         *      new RegularMessage("You have unlocked the\r[color:ffff00]Secret of Dog[color:ffffff].\nYou are overcome with happiness."),
         *      new RegularMessage("And spiders, too.")
         *  }, UIController.UIState.ENEMYDIALOGUE);
         *  dogTest[2] = true;
         *  return true;
         * }
         *
         * if (dogTest[0] || dogTest[1] || dogTest[2])
         *  UIController.instance.ActionDialogResult(new RegularMessage("Selected dog " + item.ID[7] + ".\nNo... that's not it."), UIController.UIState.ENEMYDIALOGUE);
         * else
         *  UIController.instance.ActionDialogResult(new RegularMessage("Selected dog " + item.ID[7] + ".\nIt feels off."), UIController.UIState.ENEMYDIALOGUE);
         *
         * dogTest[0] = false;
         * dogTest[1] = false;
         * dogTest[2] = false;
         * return true;*/
    }
コード例 #4
0
ファイル: Inventory.cs プロジェクト: deonix37/CreateYourFrisk
 public static void SetItem(int index, string Name)
 {
     if (index >= inventorySize)
     {
         throw new CYFException("The inventory can only contain " + inventorySize + " items.");
     }
     if (index >= inventory.Count)
     {
         AddItem(Name);
     }
     else
     {
         inventory[index] = new UnderItem(Name);
     }
 }
コード例 #5
0
 public static void SetItem(int index, string Name)
 {
     if (index > 7)
     {
         UnitaleUtil.DisplayLuaError("Setting an item", "The inventory can only contain 8 items.");
     }
     else if (index >= inventory.Count)
     {
         AddItem(Name);
     }
     else
     {
         inventory[index] = new UnderItem(Name);
     }
 }
コード例 #6
0
    // Update is called once per frame
    void Update()
    {
        if (GlobalControls.input.Confirm == UndertaleInput.ButtonState.PRESSED)
        {
            List <UnderItem> selectedInv = inventoryColumn ? Inventory.inventory : ItemBox.items;
            List <UnderItem> otherInv    = inventoryColumn ? ItemBox.items : Inventory.inventory;
            int otherInvCapacity         = inventoryColumn ? ItemBox.capacity : Inventory.inventorySize;

            if (lineIndex < selectedInv.Count)
            {
                UnderItem item = selectedInv[lineIndex];
                if (otherInv.Count < otherInvCapacity)
                {
                    if (inventoryColumn)
                    {
                        ItemBox.AddToBox(item.Name);
                        Inventory.RemoveItem(lineIndex);
                    }
                    else
                    {
                        Inventory.AddItem(item.Name);
                        ItemBox.RemoveFromBox(lineIndex);
                    }
                    UnitaleUtil.PlaySound("SeparateSound", "menuconfirm");
                }
                else
                {
                    UnitaleUtil.PlaySound("SeparateSound", "menumove");
                }
            }
            else
            {
                UnitaleUtil.PlaySound("SeparateSound", "menumove");
            }
            RefreshDisplay();
        }
        else if (GlobalControls.input.Up == UndertaleInput.ButtonState.PRESSED)
        {
            lineIndex--;
            if (lineIndex < 0)
            {
                lineIndex = (inventoryColumn ? Inventory.inventorySize : ItemBox.capacity) - 1;
            }
            UnitaleUtil.PlaySound("SeparateSound", "menumove");
            RefreshDisplay();
        }
        else if (GlobalControls.input.Down == UndertaleInput.ButtonState.PRESSED)
        {
            lineIndex++;
            if (lineIndex >= (inventoryColumn ? Inventory.inventorySize : ItemBox.capacity))
            {
                lineIndex = 0;
            }
            UnitaleUtil.PlaySound("SeparateSound", "menumove");
            RefreshDisplay();
        }
        else if (GlobalControls.input.Left == UndertaleInput.ButtonState.PRESSED || GlobalControls.input.Right == UndertaleInput.ButtonState.PRESSED)
        {
            if (lineIndex < Inventory.inventorySize && lineIndex < ItemBox.capacity)
            {
                inventoryColumn = !inventoryColumn;
                UnitaleUtil.PlaySound("SeparateSound", "menumove");
                RefreshDisplay();
            }
        }
        else if (GlobalControls.input.Cancel == UndertaleInput.ButtonState.PRESSED)
        {
            UnitaleUtil.PlaySound("SeparateSound", "menumove");
            DestroySelf();
        }
    }
コード例 #7
0
 // /<summary>
 // /Overrideable item handler on a per-encounter basis. Should return true if a custom action is executed for the given item.
 // /</summary>
 // /<param name="item">Item to be checked for custom action</param>
 // /<returns>true if a custom action should be executed for given item, false if the default action should happen</returns>
 protected virtual bool CustomItemHandler(UnderItem item)
 {
     return(CallOnSelfOrChildren("HandleItem", new DynValue[] { DynValue.NewString(item.ID) }));
 }