Example #1
0
    // used by animation event
    public override void CheckHitbox()
    {
        // TODO:  cast magic ball here
        ItemData.Weapon weapon = player.playerRuntimeData.GetCurrentWeaponInfo().weapon;
        switch (weapon)
        {
        case ItemData.Weapon.Apprentice_Stick:
            ShootBall(data.MAS_apprenticeMagicBall);
            //Debug.Log("apprentice");
            break;

        case ItemData.Weapon.Master_Stick:
            ShootBall(data.MAS_masterMagicBall);
            //Debug.Log("master");
            break;

        case ItemData.Weapon.Sunlight_Stick:
            ShootBall(data.MAS_sunlightMagicBall);
            // Debug.Log("sunlight");
            break;

        default:
            ShootBall(data.MAS_apprenticeMagicBall);
            break;
        }
    }
Example #2
0
    public static void OnPickUpLoot(Player player, ItemData.Weapon weapon, int level)
    {
        player.playerRuntimeData.playerStock.Pick(new ItemData.WeaponRuntimeData(weapon, level));
        string info = "Pick up " + string.Join(" ", weapon.ToString().Split('_')) + (level > 0?" level " + level:"");

        UIEventListener.Instance.OnInfomationChange(new UIEventListener.InfomationChangeData(info));
    }
Example #3
0
 public bool Contains(ItemData.Weapon target)
 {
     foreach (ItemData.WeaponRuntimeData item in this.weaponStock)
     {
         if (item.weapon == target)
         {
             return(true);
         }
     }
     return(false);
 }
    protected void OnClickSelectionItem(int index, bool isInit = false)
    {
        if (currentSelection == index && !isInit)
        {
            ConfirmItemSelection();
            return;
        }

        selectionViews.ClearChosen();
        currentSelection = index;
        selectionViews.views[currentSelection].Choose();
        int offset = currentPage * itemsPerPage;

        if (currentSlot == 0)
        {
            if (index + offset >= playerStock.weaponStock.Count)
            {
                title.SetText("");
                content.SetText("");
            }
            else
            {
                ItemData.Weapon item = playerStock.weaponStock[index + offset].weapon;
                title.SetText(UIInventoryState.ParsingTitle(item.ToString()));
                content.SetText(ItemData.WeaponDescription[(int)item]);
            }
        }
        else if (currentSlot == 1 || currentSlot == 2)
        {
            if (index + offset >= playerStock.wearableStock.Count)
            {
                title.SetText("");
                content.SetText("");
            }
            else
            {
                ItemData.Wearable item = playerStock.wearableStock[index + offset].wearable;
                title.SetText(UIInventoryState.ParsingTitle(item.ToString()));
                content.SetText(ItemData.WearableDescription[(int)item]);
            }
        }
    }
    protected void OnClickSlotItem(int index, bool isInit = false)
    {
        if (index == currentSlot && !isInit)
        {
            // repeate click, confirm selection
            ConfirmSlotSelection();
            return;
        }

        // select represented slot
        currentPage = 0;
        DisplaySelectionView(index);
        currentSlot = index;
        slotViews.ClearChosen();
        slotViews.views[currentSlot].Choose();

        // display info
        if (currentSlot == 0)
        {
            ItemData.Weapon item = playerStock.weaponStock[playerSlot.weaponIndex].weapon;
            title.SetText(UIInventoryState.ParsingTitle(item.ToString()));
            content.SetText(ItemData.WeaponDescription[(int)item]);
        }
        else if (currentSlot == 1 && playerSlot.IsWearableInUse(playerStock, playerSlot.wearableOneIndex))
        {
            ItemData.Wearable item = playerStock.wearableStock[playerSlot.wearableOneIndex].wearable;
            title.SetText(UIInventoryState.ParsingTitle(item.ToString()));
            content.SetText(ItemData.WearableDescription[(int)item]);
        }
        else if (currentSlot == 2 && playerSlot.IsWearableInUse(playerStock, playerSlot.wearableTwoIndex))
        {
            ItemData.Wearable item = playerStock.wearableStock[playerSlot.wearableTwoIndex].wearable;
            title.SetText(UIInventoryState.ParsingTitle(item.ToString()));
            content.SetText(ItemData.WearableDescription[(int)item]);
        }
        else
        {
            title.SetText("");
            content.SetText("");
        }
    }