void ShowConsommableInteraction(int itemSelectedIndex) { AConsommable <TModuleType> consommable = this.inventory.Consommables[itemSelectedIndex]; string text = MultiResolutions.Font(13) + "<color=red>" + consommable.Name + "\n" + consommable.Description + "\n</color></size>\n"; Rect rect = StuffGUI <TModuleType> .GetRectOfMyGUIContent(text, 0.41f, 0.85f); float posX = rect.x + rect.width; float posY = rect.y; StuffGUI <TModuleType> .DisplayItemContent(MultiResolutions.Rectangle(rect), text); for (byte i = 0; i < 3; i++) { GUI.Box(MultiResolutions.Rectangle(posX, posY - 0.050f, 0.06f, 0.025f * 4), ""); } if (GUI.Button(MultiResolutions.Rectangle(posX, posY - 0.050F, 0.06f, 0.025f), MultiResolutions.Font(14) + "<color=#00FF00><b>Sell</b></color></size>")) { this.itemMgr.Sell(this.itemSelectedIndex, this.itemSelectedFiltre); } if (GUI.Button(MultiResolutions.Rectangle(posX, posY + 0.025f - 0.050F, 0.06f, 0.025f), MultiResolutions.Font(14) + "<color=#00FF00><b>Throw</b></color></size>")) { this.itemMgr.ThrowOut(this.itemSelectedIndex, this.itemSelectedFiltre); } if (GUI.Button(MultiResolutions.Rectangle(posX, posY + 0.025f * 2 - 0.050F, 0.06f, 0.025f), MultiResolutions.Font(14) + "<color=#00FF00><b>Destruct</b></color></size>")) { this.itemMgr.Destruct(this.itemSelectedIndex, this.itemSelectedFiltre); } if (GUI.Button(MultiResolutions.Rectangle(posX, posY + 0.025f * 3 - 0.050F, 0.06f, 0.025f), MultiResolutions.Font(14) + "<color=#00FF00><b>Use</b></color></size>")) { this.itemMgr.UseConsommable(this.itemSelectedIndex); } //StuffGUI.DisplayItemInteractionBorder(posX, posY, stuff); }
public void DisplayConsommable(ref byte offset, ref byte consommableIndex) { AConsommable <TModuleType> consommable = this.inventory.Consommables[consommableIndex]; if (GUI.Button(MultiResolutions.Rectangle(0, offset * 0.05f, 0.17f, 0.05f), MultiResolutions.Font(16) + "<color=purple>" + consommable.Name + "</color></size>")) { this.SelectThisItem(consommableIndex, ItemExtension.FiltreConsommable); } ++consommableIndex; ++offset; }
public void UseConsommable(int itemIndexSelected) { //this.itemManagerGUI.ResetItemSelected(); if (this.inventory.Consommables.Count > itemIndexSelected) { AConsommable <TModuleType> conso = this.inventory.Consommables[itemIndexSelected]; //A CORRIGERif (conso.CanUse(this.attribute)) //A CORRIGER{ //A CORRIGER conso.Use(this.attribute); //A CORRIGER this.inventory.RemoveItem(conso); //A CORRIGER} //A FIXE else //A FIXE ServiceLocator.Instance.ErrorDisplayStack.Add("You have to wait : " + Mathf.Ceil(conso.TimeRequieredToUseIt - this.attribute.TimerForPotion).ToString() + " seconds", e_errorDisplay.Warning); } }
AConsommable <TModuleType> GenerateConsommable(e_consommableProbability consommable) { AConsommable <TModuleType> consommableGenerated = null; switch (consommable) { case e_consommableProbability.Life_Potion: consommableGenerated = new LifePotion <TModuleType>(); break; case e_consommableProbability.Mana_Potion: consommableGenerated = new ManaPotion <TModuleType>(); break; case e_consommableProbability.Life_Food: consommableGenerated = new LifeFood <TModuleType>(); break; case e_consommableProbability.Mana_Food: consommableGenerated = new ManaFood <TModuleType>(); break; case e_consommableProbability.Life_And_Mana_Food: consommableGenerated = new LifeAndManaFood <TModuleType>(); break; case e_consommableProbability.Life_And_Mana_Potion: consommableGenerated = new LifeAndManaPotion <TModuleType>(); break; default: break; } return(consommableGenerated); }