//maybe we should use index's throughout this class instead of ChampItemPair, than have a
        // getChampAtIndex(), it might be a little messy but its only for the raid select screen
        internal void setDisabledChamp(ChampItemPair champ, bool disabled)
        {
            int champIndex = getChampIndex(champ, disabled);

            if(disabled){
                disabledButtons.Add(champIndex);
            }else{
                disabledButtons.Remove(champIndex);
            }
            return;
        }
        //if careForDisabled is true, it returns the first non disabled index
        //if its false it returns the first index;
        internal int getChampIndex(ChampItemPair? champN, bool careForDisabled)
        {
            if (!champN.HasValue) throw new Exception("null champ in getChampIndex()");//TODO should this be nullable?
            ChampItemPair champ = champN.Value;

            int champIndex = -1;
            //we need to find champ index firs
            List<ChampItemPair> champs = mBarracks.getChamps();
            for(int i=0;i<champs.Count;i++){
                if(champ.id == champs[i].id){
                    champIndex = i;
                    break;
                }
            }
            if (champIndex == -1)
                throw new Exception();
            return champIndex;
        }
 internal void drawChampBar(RenderWindow window, ChampItemPair champ,IconToolTip toolTip, Vector2f start, bool disabled)
 {
     Texture unitIcon = null;
     switch(champ.hero){
         case PlayerClassNum.vang:
             unitIcon = vang; break;
         case PlayerClassNum.assa:
             unitIcon = assa; break;
         case PlayerClassNum.mage:
             unitIcon = pyro ;break;
         case PlayerClassNum.puri:
             unitIcon = puri; break;
         case PlayerClassNum.archer:
             unitIcon = arch; break;
         case PlayerClassNum.bard:
             unitIcon = bard; break;
     }
     champBarSprite.Position = start;
     window.Draw(champBarSprite);
     if (unitIcon != null) {
         unitIconSprite.Texture = unitIcon;
         unitIconSprite.Position = new Vector2f(start.X + 8, start.Y);
         window.Draw(unitIconSprite);
     }
     //spriteBatch.Draw(Item.getItemTexture(champ.item), new Vector2f(start.X + itemIconStart.X, start.Y + itemIconStart.Y), Color.White);
     //new icondraw
     toolTip.draw(window);
     playerClassText.DisplayedString = PlayerClassI.getClassName(champ.hero).ToUpper();
     playerClassText.Position = new Vector2f(start.X + 57, start.Y + 5);
     playerClassText.Color = disabled ? new Color(128,128,128) : Color.White;
     window.Draw(playerClassText);
     playerItemText.DisplayedString = Item.getItemName(champ.item);
     playerItemText.Position = new Vector2f(start.X + 57, start.Y + 28);
     playerItemText.Color = disabled ? new Color(128, 128, 128) : Color.White;
     window.Draw(playerItemText);
 }
Example #4
0
 internal void addUnit(ChampItemPair addedChamp)
 {
     units.Add(addedChamp);
 }
Example #5
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="mouseState"></param>
        /// <param name="addedChamp"></param>
        /// <returns> if you could drop it there</returns>
        internal bool hoverAndDrop(Vector2f release, SimpleMouseState mouseState, ChampItemPair addedChamp)
        {
            //throw new System.NotImplementedException ();
            if (!GeoLib.isInRect(rect,release))
                return false;
            for(int i=0;i<GROUPS;i++){
                if(pillars[i].update(release)){
                    pillars[i].addUnit(addedChamp);
                    Console.WriteLine(i + " pillar");
                    return true;//only one of these can be true;
                }
            }

            return false;
        }
Example #6
0
        internal void swapItems(int changingChampIndex, ItemID newItem)
        {
            if (!spareItems.Contains(newItem) ^ newItem == ItemID.none)
                throw new Exception("item not in inventory");

            //take give the champ the item
            ItemID exItem = champs[changingChampIndex].item;
            if(newItem != ItemID.none)
                spareItems.Remove(newItem);
            champs[changingChampIndex] = new ChampItemPair(champs[changingChampIndex].hero, newItem, champs[changingChampIndex].id);
            //than put the other item back in spareItems
            if(exItem != ItemID.none)
                spareItems.Add(exItem);
        }