Jump to content

15 icon limit AbilityContainer - investigation


swinka6666

Recommended Posts

  • 2 weeks later...

The lack of multidimensional array support in Unrealscript is a bit annoying, I agree.

The "official" workaround to that, as I understand it, is to embed the inner array inside a struct, and then make the outer array an array of that struct.

struct MyInnerArray
{
    var array<UIIcon> inner;
};

var array<MyInnerArray> My2DArray;

function Foo()
{
    local MyInnerArray InnerArray;
    local Bar UIIcon;

    My2DArray.AddItem(InnerArray);
    ....
    My2DArray[i].inner[j] = Bar;
}
Link to comment
Share on other sites

Having fiddled around with the U.I i think there might be a way. Possibly only involving listeners so we don't break anything (i love not breaking things)

But i'm right in the middle of mid-terms right now, so i won't be able to work on it for a week.

For your spawning problem, the first parameter in InitButton (or any InitPannel function) is the panel name.

 

For example

Button = Spawn(class'UIButton');
Button.InitButton('FirstAbility');

Will create a Button named "FirstAbility", There's a helper function to get a child panel by name, which you can then remove.

On a side note, as Amineri stated, you can use struts to create a fake multidimensionnal array:

struct aSoldierAbilities {
  var array<UIButton> Perks;
};

  var array<aSoldierAbilities> Soldiers;

function DisplayPerkOfSoldier(int CurrentSoldierIndex) {
  Foreach Soldiers(Soldier, i) {
    if(i == CurrentSoldierIndex) 
      foreach Soldier.Perks(Perk) {
        Perk.Show();
      }
    else 
      foreach Soldier.Perks(Perk) {
        Perk.Hide();
      }
  }
}

Something like that would work (missing declarations of local vars for readability)

Edited by Superd22
Link to comment
Share on other sites

var UIPanel AnyPanel;


// This will spawn the icon on your pannel and call it "MyIconName" (works on UIScreen too since UIScreen extends UIPanel)
icon = Spawn(class'UIIcon', AnyPanel).InitIcon('MyIconName',, false, false, IconSize); 

[...] 

// This will return Icon by reference. 
IconRef = AnyPanel.GetChild('MyIconName');

 

That's how name works :smile:



And by "Possibly only involving listeners so we don't break anything" i meant i think we could actually extend the bottom AbilityBar rather than having to create a new one on the side :smile:

Edited by Superd22
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...