Beispiel #1
0
    public void SwapAbility(SelectedItem item1, SelectedItem item2)
    {
        item1.headList.displays[item1.index].Select(false);
        item2.headList.displays[item2.index].Select(false);
        if (item1.headList.abilities[item1.index] == null)
        {
            SwapWithEmpty(item1, item2);
            return;
        }
        else if (item2.headList.abilities[item2.index] == null)
        {
            SwapWithEmpty(item2, item1);
            return;
        }


        Ability ability1 = item1.headList.abilities[item1.index];
        Ability ability2 = item2.headList.abilities[item2.index];

        item1.headList.abilities[item1.index] = ability2;
        item2.headList.abilities[item2.index] = ability1;

        Debug.Log(item1.headList.abilities[item1.index]._name);
        Debug.Log(item2.headList.abilities[item2.index]._name);
        selectTyp = currentSelection.selectAbility;
        if (currentList != 0)
        {
            currentList = 0;
        }

        UpdateUI();
    }
 public void GoToSelectTyp()
 {
     SelectedFolder_p = null;
     SelectedFolder_p = null;
     ability_selected = null;
     CS = currentSelection.selectTyp;
     UI.GetComponent <TestUI>().EmptyBackpack();
     UI.GetComponent <TestUI>().EmptyPlayer();
 }
 public void GoToAbilitySelector(int typ)
 {
     SelectedFolder_p = playerStats.Ability_typs[typ];
     SelectedFolder_b = backpack.abilities[typ];
     BackPackAbilityUI();
     PlayerAbilityUI();
     ability_selected = null;
     CS = currentSelection.selectAbility;
     Seach_in_backpack = false;
 }
 public void GoToSelectAction(Ability ability)
 {
     Seach_in_backpack = !Seach_in_backpack;
     ability_selected  = ability;
     UI.GetComponent <TestUI>().SetStatUI(ability_selected, ActionUI(ability_selected));
     CS = currentSelection.selectAction;
     UI.GetComponent <TestUI>().SetPNumberEmpty();
     UI.GetComponent <TestUI>().SetBNumberEmpty();
     Debug.Log(ability_selected._name);
 }
    public void GoToAbilitySelector(Player_universal.Ability_Typ SelectedFolder_1, Player_universal.Ability_Typ SelectedFolder_2)
    {
        SelectedFolder_p = SelectedFolder_1;
        SelectedFolder_b = SelectedFolder_2;
        BackPackAbilityUI();
        PlayerAbilityUI();

        ability_selected = null;
        CS = currentSelection.selectAbility;
        UI.GetComponent <TestUI>().EmptyAction();
        Debug.Log(SelectedFolder_p._name);
        SetNumbers(Seach_in_backpack);
    }
Beispiel #6
0
 public void GoToAdd(SelectedItem cItem)
 {
     currentItem = cItem;
     if (currentList == 0)
     {
         currentList = 1;
         ShowPage(currentList);
     }
     else
     {
         currentList = 0;
     }
     selectTyp = currentSelection.selectAdd;
 }
Beispiel #7
0
    public void SwapWithEmpty(SelectedItem empty, SelectedItem item)
    {
        Ability ability = item.headList.abilities[item.index];

        empty.headList.abilities[empty.index] = ability;
        item.headList.abilities[item.index]   = null;

        selectTyp = currentSelection.selectAbility;
        if (currentList != 0)
        {
            currentList = 0;
        }

        UpdateUI();
    }
Beispiel #8
0
 public void GoToSwap()
 {
     if (currentList == 0)
     {
         currentList = 1;
         ShowPage(currentList);
     }
     else
     {
         currentList = 0;
     }
     ASUI.SetVisible(false);
     PBUI.SetVisible(false);
     selectTyp = currentSelection.selectSwap;
 }
 public void GoToSelectAction(int ability_int, bool fromBackPack)
 {
     if (fromBackPack)
     {
         ability_selected = SelectedFolder_b.abilities[ability_int];
     }
     else
     {
         ability_selected = SelectedFolder_p.abilities[ability_int];
     }
     UI.GetComponent <TestUI>().SetStatUI(ability_selected, ActionUI(ability_selected));
     CS = currentSelection.selectAction;
     UI.GetComponent <TestUI>().SetPNumberEmpty();
     UI.GetComponent <TestUI>().SetBNumberEmpty();
     Debug.Log(ability_selected._name);
 }
Beispiel #10
0
    public void ItemSelected(SelectedItem SI)
    {
        currentItem = SI;
        if (currenAbilityTyp == state.inBody)
        {
            PBUI.SetVisible(true);
            PBUI.ShowBody(SetBodyUI(SI));
        }
        else
        {
            ASUI.SetUI(currentItem.headList.abilities[SI.index]);
            ASUI.SetVisible(true);
        }

        selectTyp = currentSelection.selectAction;
        SetActionText(SI.headList.abilities[SI.index]);
    }
Beispiel #11
0
    public void UseItem(SelectedItem item)
    {
        AB.PlaySound(useItemSound, 1);
        var ability = item.headList.abilities[item.index];
        var player  = FindObjectOfType <PlayerStats>();

        if (ability._cost_typ == Cost.mp)
        {
            if (player.mp < ability._cost)
            {
                Debug.Log("not enoght mana");
                return;
            }
            player.mp -= ability._cost;
        }
        switch (ability._typ)
        {
        case ability_typ.heal:
            player.hp = Mathf.Min(player.hp_max, player.hp + ability.power + player.intellect / 2);
            break;

        case ability_typ.item_heal:
            player.hp = Mathf.Min(player.hp_max, player.hp + ability.power);
            break;

        case ability_typ.mp_heal:
            player.mp = Mathf.Min(player.mp_max, player.mp + ability.power);
            break;
        }
        if (ability._cost_typ == Cost.consumable)
        {
            item.headList.displays[item.index].Select(false);
            item.headList.abilities[item.index] = null;
            UpdateUI();
            //SelectedFolder_p.abilities.Remove(ability);
            //UI.GetComponent<TestUI>().EmptyActionUI();
            //UI.GetComponent<TestUI>().EmptyStatUI();
            //GoToAbilitySelector(SelectedFolder_p, SelectedFolder_b);
            selectTyp = currentSelection.selectAbility;
            ASUI.SetVisible(false);
            PBUI.SetVisible(false);
        }
    }
Beispiel #12
0
    public void Add(SelectedItem newItem, SelectedItem emptySlot)
    {
        newItem.headList.displays[newItem.index].Select(false);
        emptySlot.headList.displays[emptySlot.index].Select(false);
        Ability ability = newItem.headList.abilities[newItem.index];

        emptySlot.headList.abilities.Add(ability);
        newItem.headList.abilities[newItem.index] = null;
        selectTyp = currentSelection.selectAbility;
        UpdateUI();
        if (currentList == 0)
        {
            currentList = 1;
            ShowPage(currentList);
        }
        else
        {
            currentList = 0;
        }
    }
Beispiel #13
0
    public void GoBack()
    {
        cursor.SetActive(false);
        switch (selectTyp)
        {
        case currentSelection.selectAbility:
            if (!FindObjectOfType <BackPackControle>().GetDelay())
            {
                CloseMenu();
            }
            break;

        case currentSelection.selectAction:
            PBUI.SetVisible(false);
            ASUI.SetVisible(false);
            currentItem.headList.displays[currentItem.index].Select(false);
            currentItem = null;
            selectTyp   = currentSelection.selectAbility;
            break;

        case currentSelection.selectSwap:
            if (currenAbilityTyp == state.inBody)
            {
                PBUI.SetVisible(true);
            }
            else
            {
                ASUI.SetVisible(true);
            }

            selectTyp = currentSelection.selectAction;
            break;

        case currentSelection.selectAdd:
            PBUI.SetVisible(false);
            ASUI.SetVisible(false);
            currentItem = null;
            selectTyp   = currentSelection.selectAbility;
            break;
        }
    }
Beispiel #14
0
    public void ItemSelected(SelectedItem cItem, currentSelection CS)
    {
        AB.PlaySound(selectOption, 1);
        Debug.Log(abilitieLists_u[currentList].displays.Length);
        if (abilitieLists_u[currentList].displays[cItem.index]._number.text == "")
        {
            Debug.Log("emptySpaceBro");
            return;
        }
        else if (abilitieLists_u[currentList].abilities.Count <= cItem.index)
        {
            if (selectTyp == currentSelection.selectAbility)
            {
                abilitieLists_u[currentList].displays[cItem.index].Select(true);
                GoToAdd(cItem);
                return;
            }
            else if (selectTyp == currentSelection.selectSwap)
            {
                Add(currentItem, cItem);
                return;
            }
            else
            {
                Debug.Log("emptySpaceBro");
                return;
            }
        }
        else if (abilitieLists_u[currentList].abilities[cItem.index] == null)
        {
            if (selectTyp == currentSelection.selectAbility)
            {
                abilitieLists_u[currentList].displays[cItem.index].Select(true);
                currentItem = cItem;
                GoToSwap();
                return;
            }
            else if (selectTyp == currentSelection.selectSwap)
            {
                SwapAbility(currentItem, cItem);
                return;
            }
            else
            {
                Debug.Log("emptySpaceBro");
                return;
            }
        }


        switch (selectTyp)
        {
        case currentSelection.selectAbility:
            abilitieLists_u[currentList].displays[cItem.index].Select(true);
            ItemSelected(cItem);
            break;

        case currentSelection.selectAction:

            break;

        case currentSelection.selectSwap:
            SwapAbility(cItem, currentItem);
            break;

        case currentSelection.selectAdd:
            Add(cItem, currentItem);
            break;
        }
    }
 public void GoToAdd()
 {
     Seach_in_backpack = true;
     CS = currentSelection.selectAdd;
     UI.GetComponent <TestUI>().EmptyAction();
 }
 public void GoToSwapScreen()
 {
     Seach_in_backpack = !Seach_in_backpack;
     CS = currentSelection.selectSwap;
     UI.GetComponent <TestUI>().EmptyActionUI();
 }