public void OpenGUI(e_PlayerGUIWindow indexGUI) { int openedWindow = 0; for (short i = 0; i < ((int)e_PlayerGUIWindow.SIZE); i++) { if (i != ((int)(e_PlayerGUIWindow.Main_Menu)) && this.windows[i].IsActive && this.windows[i].IsClosable) { ++openedWindow; } } if (openedWindow < maximumDisplayWindowsNumber || this.windows[(int)(indexGUI)].IsActive) { this.windows[(int)(indexGUI)].IsActive = !this.windows[(int)(indexGUI)].IsActive; if (this.windows[(int)(indexGUI)].IsActive) { this.windows[(int)(indexGUI)].DragPosition = MultiResolutions.Rectangle(this.windows[(int)(indexGUI)].GetInitialWindowPosition()); } } else if (!this.windows[(int)(indexGUI)].IsClosable) { this.windows[(int)(indexGUI)].IsActive = true; } else { ServiceLocator.Instance.ErrorDisplayStack.Add("You can't displays more than " + this.maximumDisplayWindowsNumber + " and main menu in the same time", e_errorDisplay.Critical); } }
void DestroyInteraction(ref float posX, ref float posY, AItem <TModuleType> stuff) { if (GUI.Button(MultiResolutions.Rectangle(posX, posY, 0.06f, 0.025f), MultiResolutions.Font(14) + "<color=red><b>Détruire</b></color>" + "</size>")) { this.itemMgr.Destruct(itemSelectedIndex, itemSelectedFiltre); } }
void Modifieur() { GUI.Box(MultiResolutions.Rectangle(0, 0.85f, 1.0f, 0.15f), ""); GUI.Label(MultiResolutions.Rectangle(0.7f, 0.85f, 1, 1), MultiResolutions.Font(24) + "<color=red><b>Poids</b></color> : " + this.inventory.CurrentWeight + "/" + this.inventory.MaxWeight + "\t\t<color=red><b>Or</b></color> : " + this.inventory.Gold + "</size>"); }
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 static void OnHoverTextWithCenterMousePosition(Rect colliderRect, Rect baseRect, string label, string GUIStyle = null, float lineHeight = 0.0f, int whichLine = 0, float width = 0.15f, float heightFactor = 1.0f) { if (CollideMousePositionWithRect(colliderRect)) { Rect hoverRect = new Rect( Input.mousePosition.x - (baseRect.width * 0.5f * MultiResolutions.Width()), (MultiResolutions.Height() - Input.mousePosition.y) - (baseRect.y + lineHeight * whichLine) * MultiResolutions.Height(), width * MultiResolutions.Width(), (baseRect.height) * MultiResolutions.Height() * 2 * heightFactor); for (uint i = 0; i < 3; i++) { if (GUIStyle != "") { GUI.Box(new Rect(colliderRect.x + hoverRect.x, colliderRect.y + hoverRect.y - hoverRect.height, hoverRect.width, hoverRect.height), label, GUIStyle); } else { GUI.Box(new Rect(colliderRect.x + hoverRect.x, colliderRect.y + hoverRect.y - hoverRect.height, hoverRect.width, hoverRect.height), label); } } } }
public static bool CreatNecromancerWindow(ref Rect rect, string title) { Font oldFont = GUI.skin.label.font; GUI.skin.label.font = ServiceLocator.Instance.FontManager.Get("Necromancer"); GUI.DrawTexture(MultiResolutions.Rectangle(0, 0, rect.width, rect.height), ServiceLocator.Instance.TextureManager.GetGUITexture("window")); GUIExtension.AddSpikes((int)((rect.width) * Screen.width), rect.height); GUIExtension.FancyTop((int)((/*this.initPosition.x + */ rect.width) * Screen.width)); GUI.skin.label.alignment = TextAnchor.MiddleCenter; Rect labelRect = new Rect(rect.x + rect.width * 0.1f, rect.y + 0.1f, rect.width * 0.8f, 0.04f); GUI.Label(MultiResolutions.Rectangle(labelRect), "<b>" + title + "</b>"); GUILayout.BeginArea(MultiResolutions.Rectangle(new Rect(labelRect.x, labelRect.y + 0.045f, labelRect.width, 0.05f))); GUILayout.Label("", "Divider"); GUILayout.EndArea(); GUI.skin.label.font = oldFont; return(true); //return !GUI.Button(MultiResolutions.Rectangle(new Rect( // rect.x + rect.width - rect.width * 0.08f, // rect.y + 0.015f, // rect.width * 0.03f, // rect.height * 0.05f)), "<color=#FF0000FF><b>X</b></color>", "details"); }
void EquipInteraction(ref float posX, ref float posY, AStuff <TModuleType> stuff) { if (stuff.equipmentEmplacement == e_equipmentEmplacement.Left_Hand || stuff.equipmentEmplacement == e_equipmentEmplacement.Right_Hand) { if (GUI.Button(MultiResolutions.Rectangle(posX, posY, 0.06f, 0.025f), MultiResolutions.Font(14) + "<color=#00FF00><b>Equiper(L)</b></color>" + "</size>")) { stuff.equipmentEmplacement = e_equipmentEmplacement.Left_Hand; this.itemMgr.Equip(stuff); } posY += 0.025f; if (GUI.Button(MultiResolutions.Rectangle(posX, posY, 0.06f, 0.025f), MultiResolutions.Font(14) + "<color=#00FF00><b>Equiper(R)</b></color>" + "</size>")) { stuff.equipmentEmplacement = e_equipmentEmplacement.Right_Hand; this.itemMgr.Equip(stuff); } posY += 0.025f; } else { if (GUI.Button(MultiResolutions.Rectangle(posX, posY, 0.06f, 0.025f), MultiResolutions.Font(14) + "<color=#00FF00><b>Equiper</b></color>" + "</size>")) { this.itemMgr.Equip(stuff); } posY += 0.025f; } }
public static string GetStuffTitle(AStuff <TModuleType> stuff, Inventory <TModuleType> inventory, byte itemSelectedIndex) { string result = GetItemColor(stuff) + "<b>" + MultiResolutions.Font(13); if (stuff.Filtre == ItemExtension.FiltreWeapon) { result += StringExtension.FirstLetterMaj(inventory.Weapons[itemSelectedIndex].Name); } else if (stuff.Filtre == ItemExtension.FiltreClothe) { result += StringExtension.FirstLetterMaj(inventory.Clothes[itemSelectedIndex].Name); } result += "\n</size>" + MultiResolutions.Font(12); if (stuff.Filtre == ItemExtension.FiltreWeapon) { result += GetWeaponCategory(inventory.Weapons[itemSelectedIndex]); } else if (stuff.Filtre == ItemExtension.FiltreClothe) { result += GetClotheCategory(inventory.Clothes[itemSelectedIndex]); } result += "</size></b></color>\n" + MultiResolutions.Font(12); return(result); }
void OnGUI() { List <ErrorDisplay> errors = this.errorStack.Errors; int numberOfErrorDisplay = errors.Count; if (numberOfErrorDisplay > 5) { numberOfErrorDisplay = 5; } for (short i = 0; i < numberOfErrorDisplay; i++) { string color = "<color=white>"; switch (errors[i].ErrorDisplayType) { case e_errorDisplay.Error: color = "<color=red>"; break; case e_errorDisplay.Warning: color = "<color=orange>"; break; case e_errorDisplay.Critical: color = "<color=purple>"; break; default: break; } GUI.Label(MultiResolutions.Rectangle(0, i * 0.1f, 1, 1), MultiResolutions.Font(errors[i].FontSize) + color + errors[i].description + "</color></size>"); } }
public static string GetAttributeString(int x, string color, string colorOfPlus, AStuff <TModuleType> stuff) { return(color + MultiResolutions.Font(12) + "<b>" + stuff.GetDisplayEquipmentAttribute(stuff.blueAttributes[x].WhichAttribute) + "</b>: " + (!(stuff.IsFloatEquipmentAttribute(stuff.blueAttributes[x].WhichAttribute)) ? (colorOfPlus + "+</color>") : "") + stuff.GetCorrectEquipmentAttributeValue(stuff.blueAttributes[x]) + stuff.GetFinalSignEquipmentAttribute(stuff.blueAttributes[x].WhichAttribute) + "</size></color>"); }
void UnEquipInteraction(ref float posX, ref float posY, AStuff <TModuleType> stuff) { if (GUI.Button(MultiResolutions.Rectangle(posX, posY, 0.06f, 0.025f), MultiResolutions.Font(14) + "<color=#00FF00><b>Déséquiper</b></color>" + "</size>")) { this.itemMgr.Unequip(stuff); } posY += 0.025f; }
void ThrowInteraction(ref float posX, ref float posY, AItem <TModuleType> stuff) { if (GUI.Button(MultiResolutions.Rectangle(posX, posY, 0.06f, 0.025f), MultiResolutions.Font(14) + "<color=red><b>Jeter</b></color>" + "</size>")) { this.itemMgr.ThrowOut(this.itemSelectedIndex, this.itemSelectedFiltre); } posY += 0.025f; }
public static Vector2 GetGUIMousePositionNormalize() { Vector2 mousePosition = Event.current.mousePosition; mousePosition.x /= MultiResolutions.Width(); mousePosition.y /= MultiResolutions.Height(); return(mousePosition); }
void Liste() { GUI.Box(MultiResolutions.Rectangle(0.21f, 0, 0.20f, 1.0f), ""); GUI.Label(MultiResolutions.Rectangle(0.28f, 0.3f, 1f, 1f), MultiResolutions.Font(20) + "<b><color=red>Liste</color></b></size>"); GUI.Box(MultiResolutions.Rectangle(0.22f, 0.35f, 0.17f, 0.45f), ""); this.BeginScrollViewList(CountFiltreLength()); this.DisplayItemList(); }
public string GetTheBlueAttributesCompared(AStuff <TModuleType> stuff, AStuff <TModuleType> equippedStuff) { string result = MultiResolutions.Font(12); result += ComparedToString(stuff.GetStuffComparatorThatItemHave(equippedStuff), 0, false); result += DefinedToString(stuff, stuff.GetStuffComparatorThatItemDontHave(equippedStuff, true), 0, true); result += DefinedToString(equippedStuff, equippedStuff.GetStuffComparatorThatItemDontHave(stuff, false), 0, true); return(result + "</size>"); }
void MinimapBorderAndInformations() { if (GUI.Button(MultiResolutions.Rectangle(ref base.rects[(int)e_rect.MinimapButton]), base.ModuleManager.ServiceLocator.TextureManager.GetMenuTexture("Minimap Menu"))) { base.ModuleManager.ServiceLocator.SoundManager.PlaySoundIfItNotPlaying("Click"); this.cameras.EnableAndDisableMinimap(); } GUI.Label(MultiResolutions.Rectangle(ref base.rects[(int)e_rect.ZoomFactorLabel]), "x" + (0.01f * this.cameras.Parameters[(int)e_whichCamera.Minimap].Height).ToString("F2")); GUI.Box(MultiResolutions.Rectangle(ref base.rects[(int)e_rect.MinimapBorder]), ""); GUI.DrawTexture(MultiResolutions.Rectangle(ref base.rects[(int)e_rect.MinimapBorder]), base.ModuleManager.ServiceLocator.TextureManager.GetPlayerCameraTexture("borderMinimap")); }
void DateLabel() { System.TimeSpan time = System.DateTime.Now.TimeOfDay; GUI.skin.label.alignment = TextAnchor.UpperRight; GUI.Label(MultiResolutions.Rectangle(ref base.rects[(int)e_rect.DifficultyAndDate]), string.Format("<b>" + base.ModuleManager.LanguageManager.GetText("Easy").ToUpper() + " {0:D2}:{1:D2}:{2:D2}</b>", time.Hours, time.Minutes, time.Seconds)); GUI.skin.label.alignment = TextAnchor.UpperLeft; }
public override void OnGUI() { var oldMat = GUI.matrix; GUI.matrix = MultiResolutions.GetGUIMatrix(); this.ShowBorderAndFlamesIfWindowActive(); base.OnGUI(); GUI.matrix = oldMat; }
public virtual void OnGUI() { for (short i = 0; i < this.windows.Length; i++) { if (this.windows[i].IsActive) { GUILayout.BeginArea(MultiResolutions.Rectangle(this.windows[i].InitPosition)); this.windows[i].DoMyWindow(i); GUILayout.EndArea(); } } }
public static void DrawTexutrePart(Rect rect, e_FillDirection direction, float fullPercent, Texture2D texture, Material material = null) { Vector2 offset = new Vector2(0.0f, 0.0f); switch (direction) { case e_FillDirection.TopToBottom: offset.y = rect.height * (1.0f - fullPercent); break; case e_FillDirection.BottomToTop: offset.y = -(rect.height * (1.0f - fullPercent)); break; case e_FillDirection.LeftToRight: offset.x = -(rect.width * (1.0f - fullPercent)); break; case e_FillDirection.RightToLeft: offset.x = rect.width * (1.0f - fullPercent); break; default: break; } if (direction == e_FillDirection.TopToBottom || direction == e_FillDirection.RightToLeft) { GUI.BeginGroup(MultiResolutions.Rectangle(rect.x + offset.x, rect.y + offset.y, rect.width - offset.x, rect.height - offset.y)); if (null != material) { Graphics.DrawTexture(MultiResolutions.Rectangle(-offset.x, -offset.y, rect.width, rect.height), texture, material); } else { GUI.DrawTexture(MultiResolutions.Rectangle(-offset.x, -offset.y, rect.width, rect.height), texture); } GUI.EndGroup(); } else { GUI.BeginGroup(MultiResolutions.Rectangle(rect.x, rect.y, rect.width + offset.x, rect.height + offset.y)); if (null != material) { Graphics.DrawTexture(MultiResolutions.Rectangle(0, 0, rect.width, rect.height), texture, material); } else { GUI.DrawTexture(MultiResolutions.Rectangle(0, 0, rect.width, rect.height), texture); } GUI.EndGroup(); } }
public static bool NoButton(ref Rect rect, GUIStyle style, LanguageManager languageManager) { for (byte i = 0; i < 3; i++) { GUI.Box(MultiResolutions.Rectangle(rect), "", style); } return(GUI.Button(MultiResolutions.Rectangle(rect), "<b><color=#00FF00>" + MultiResolutions.Font(18) + languageManager.GetText("NO") + "</size></color></b>", style)); }
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 DisplayKey(ref byte offset, ref byte keyIndex) { Keys <TModuleType> key = this.inventory.Keys[keyIndex]; if (GUI.Button(MultiResolutions.Rectangle(0, offset * 0.05f, 0.17f, 0.05f), StuffGUI <TModuleType> .GetKeyName(key))) { this.SelectThisItem(keyIndex, ItemExtension.FiltreKeys); } ++keyIndex; ++offset; }
void RotateLeftAndRightButtons() { if (GUI.RepeatButton(MultiResolutions.Rectangle(ref base.rects[(int)e_rect.RotateLeft]), base.ModuleManager.ServiceLocator.TextureManager.GetPlayerCameraTexture("rotateLeft"))) { base.ModuleManager.ServiceLocator.SoundManager.PlaySoundIfItNotPlaying("Click"); this.cameras.RotateLeftMinimap(); } if (GUI.RepeatButton(MultiResolutions.Rectangle(ref base.rects[(int)e_rect.RotateRight]), base.ModuleManager.ServiceLocator.TextureManager.GetPlayerCameraTexture("rotateRight"))) { base.ModuleManager.ServiceLocator.SoundManager.PlaySoundIfItNotPlaying("Click"); this.cameras.RotateRightMinimap(); } }
void ItemInteraction(string text, AStuff <TModuleType> stuff) { 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); StuffGUI <TModuleType> .DisplayItemInteractionBorder(posX, posY, stuff); this.ItemInteractionBehaviour(ref posX, ref posY, stuff); }
void MinusAndMajusButtons() { if (GUI.RepeatButton(MultiResolutions.Rectangle(ref base.rects[(int)e_rect.Dezoom]), base.ModuleManager.ServiceLocator.TextureManager.GetPlayerCameraTexture("minus"))) { base.ModuleManager.ServiceLocator.SoundManager.PlaySoundIfItNotPlaying("Click"); this.cameras.DezoomMinimap(); } if (GUI.RepeatButton(MultiResolutions.Rectangle(ref base.rects[(int)e_rect.Zoom]), base.ModuleManager.ServiceLocator.TextureManager.GetPlayerCameraTexture("majus"))) { base.ModuleManager.ServiceLocator.SoundManager.PlaySoundIfItNotPlaying("Click"); this.cameras.ZoomMinimap(); } }
public static void DisplayItemInteractionBorder(float posX, float posY, AStuff <TModuleType> stuff) { for (byte i = 0; i < 3; i++) { GUI.Box(MultiResolutions.Rectangle(posX, posY, 0.06f, 0.025f * (((stuff.Filtre == ItemExtension.FiltreClothe || stuff.Filtre == ItemExtension.FiltreWeapon) ? 1 : 0) + ((stuff.equipped == e_equipmentEquipped.NOT_EQUIPPED) ? 3 : 1) + (((stuff.equipped == e_equipmentEquipped.NOT_EQUIPPED) && (stuff.equipmentEmplacement == e_equipmentEmplacement.Left_Hand || stuff.equipmentEmplacement == e_equipmentEmplacement.Right_Hand)) ? 1 : 0))), ""); } }
public static void AddSpikes(int winX, float height) { float spiky = Mathf.Floor(winX - 152) / 22; //float spikeCount = Mathf.Floor(winX - 152)/22; GUILayout.BeginArea(MultiResolutions.Rectangle(0.0215f, height * 0.09f, 1f, 1f)); GUILayout.BeginHorizontal(); GUILayout.Label("", "SpikeLeft"); //-------------------------------- custom for (var i = 0; i < spiky; i++) { GUILayout.Label("", "SpikeMid"); //-------------------------------- custom } GUILayout.Label("", "SpikeRight"); //-------------------------------- custom GUILayout.EndHorizontal(); GUILayout.EndArea(); }
//CA MARHCHE !! public static void OnHoverTextCenterWithMousePosition(Rect rectThatNeedToBeOnHover, Rect offsetAndSize, string label, GUIStyle style = null) { if (MultiResolutions.Rectangle(rectThatNeedToBeOnHover).Contains(GetGUIMousePosition())) { Vector2 mousePosition = GetGUIMousePositionNormalize(); Rect rect = MultiResolutions.Rectangle(new Rect( offsetAndSize.x + mousePosition.x - (offsetAndSize.width * 0.5f), offsetAndSize.y + mousePosition.y - offsetAndSize.height, offsetAndSize.width, offsetAndSize.height)); GUI.Box(rect, "", style); GUI.Box(rect, "", style); GUI.Box(rect, label, style); } }
private void InitializationAfterBindage() { for (short i = 0; i < this.windows.Length; i++) { this.windows[i].DragPosition = MultiResolutions.Rectangle(this.windows[i].InitPosition); if (this.windows[i].IsDraggable) { this.windows[i].InitPosition = new Rect(0, 0, this.windows[i].InitPosition.width, this.windows[i].InitPosition.height); //.x = 0; //this.windows[i].InitPosition.y = 0; } if (!this.windows[i].IsClosable) { this.windows[i].DragPosition = MultiResolutions.Rectangle(this.windows[i].GetInitialWindowPosition()); } } }