/// <summary> /// Function that will be called to draw each visible element on screen /// The occupied area calculation will be made in another place to separate the logic to show one menu element of the rest /// </summary> /// <param name="rect">Area to draw your menu element</param> /// <param name="elementIndex">Index of the element that should be drawn</param> /// <param name="isActive">True if that element is active. False otherwise</param> public override void DrawElement(Rect rect, int elementIndex, bool isActive) { switch (numOfSlotsAvailable) { case 1: if (elementIndex > 0) { return; } break; case 2: if (elementIndex % 2 == 0) { return; } elementIndex--; break; case 3: if (elementIndex == 2) { return; } break; } if (abilityBorder) { GUI.DrawTexture(elementBorder.GetRect(rect), abilityBorder, ScaleMode.ScaleToFit); } Area ultAnimalFull = new Area(elementContent.GetRect(rect)); float percent = CoolDownManager.RemainingTimePercent(abilities[elementIndex].description.id.ToString()); if (isActive && this.isActive) { GUI.DrawTexture(ultAnimalFull.GetRect(), selectedImage.GetTexture(), ScaleMode.ScaleToFit); } else { GUI.DrawTexture(ultAnimalFull.GetRect(), abilities[elementIndex].texture, ScaleMode.ScaleToFit); } if (percent > 0) { percent = percent / 2; GUIMethods.DrawOverlayTexture(elementBorder.GetRect(rect), null, cdOverlayTexture, percent, Options.UP); GUIMethods.DrawOverlayTexture(elementBorder.GetRect(rect), null, cdOverlayTexture, percent, Options.DOWN); GUIMethods.DrawOverlayTexture(elementBorder.GetRect(rect), null, cdOverlayTexture, percent, Options.LEFT); GUIMethods.DrawOverlayTexture(elementBorder.GetRect(rect), null, cdOverlayTexture, percent, Options.RIGHT); } if ((abilities[elementIndex].description.id != Ability.AbilityId.NONE) && ButtonManager.Get(ButtonManager.ButtonID.L2)) { GUI.DrawTexture(buttonArea.GetRect(rect), ButtonManager.GetButtonTexture((ButtonManager.ButtonID)elementIndex)); } }
public void DrawBuffPlay() { if (player.modifiers.Count == 0) { return; } //print((( player.buffs[0] + " - " + player.buffs[0].cooldown.isOnCD()); int firstLineCount = 0; int secondLineCount = 0; for (int i = 0; i < player.modifiers.Count; i++) { if (CoolDownManager.RemainingTimeAbsolute("mod_" + player.modifiers[i].ToString()) == float.PositiveInfinity && player.modifiers[i].isBuff()) { continue; } if (CoolDownManager.RemainingTimePercent("mod_" + player.modifiers[i].ToString()) > 0) { if (firstModifier == 0) { if (player.modifiers[i].isBuff()) { firstModifier = 1; } else { firstModifier = -1; } } Rect rect; if ((player.modifiers[i].isBuff() && firstModifier == 1) || (!player.modifiers[i].isBuff() && firstModifier == -1)) { rect = firstLine[firstLineCount].GetRect(); firstLineCount++; } else { rect = secondLine[secondLineCount].GetRect(); secondLineCount++; } if (modTextures.Contains(player.modifiers[i])) { GUI.DrawTexture(rect, modTextures[player.modifiers[i]], ScaleMode.ScaleToFit); } } else { player.RemoveModifier(player.modifiers[i]); i = 0; } } //print("1stLine = " + firstLineCount + "\t2ndLine = " + secondLineCount + "\tfirstModifier = " + firstModifier); if (firstModifier == 1) { if (firstLineCount == 0) { if (secondLineCount == 0) { firstModifier = 0; } else { //print("else"); firstModifier = -1; } } } else if (firstModifier == -1) { if (firstLineCount == 0) { if (secondLineCount == 0) { firstModifier = 0; } else { firstModifier = 1; } } } }