// Draw graphics settings toggle bool DrawGraphicsToggle(bool val, string name, string prefsId) { bool newVal; using (new GUIHorizontal(GUILayout.Width(150))) { using (new GUIVerticalCenter(GUILayout.Height(28))) { if (val) { GUI.backgroundColor = GUIColor.MenuItemActive; } else { GUI.backgroundColor = GUIColor.MenuItemInactive; } newVal = val; if (GUIHelper.Button(name)) { newVal = !val; } } } if (newVal != val) { PlayerPrefs.SetInt("Graphics_" + prefsId, newVal ? 1 : 0); UpdateGraphicsSettings(); } return(newVal); }
private void MainWindow(int id) { GUI.DragWindow(new Rect(0, 0, MainRect.width - 90, 20)); if (GUIHelper.Button(new Rect(MainRect.width - 90, 2, 80, 20), $"Hide ({ModConfig.Instance.Main_Menu_Toggle})")) { ExplorerCore.ShowMenu = false; return; } GUIHelper.BeginArea(new Rect(5, 25, MainRect.width - 10, MainRect.height - 35), GUI.skin.box); MainHeader(); var page = Pages[m_currentPage]; page.scroll = GUIHelper.BeginScrollView(page.scroll); page.DrawWindow(); GUIHelper.EndScrollView(); MainRect = ResizeDrag.ResizeWindow(MainRect, MainWindowID); GUIHelper.EndArea(); }
// Draw public override void Draw() { // Confirm box using (new GUIVertical("box")) { // Title DrawText(); using (new GUIHorizontal()) { GUILayout.Space(4); GUI.SetNextControlName("FriendName"); friendName = GUIHelper.PlayerNameField(friendName); if (!friendNameFocused) { GUIHelper.Focus("FriendName"); friendNameFocused = true; } GUILayout.Space(4); } // TODO: Be able to change the group using (new GUIHorizontal()) { GUILayout.Space(4); GUIHelper.Button("Group: <b>" + group.name + "</b>", controlID); GUILayout.Space(4); } // Yes / No DrawButtons(); } }
// Draw skill void DrawSkill(Skill skill) { var lambdaSkill = skill; if (skill != currentSkill && skill.type == currentSkill.type && (skill == Magic.EmptySkill || skill == Magic.EmptyAutoAttackSkill || !build.HasSkill(skill.id))) { var skillIdString = skill.id.ToStringLookup(); if (GUIHelper.Button(new GUIContent(" " + skill.skillName, skill.icon, skillIdString), selectableStyle)) { ExecuteLater(() => { currentAttunementBuild.skills[currentSkillSlotIndex] = lambdaSkill.id; if (currentSkillSlotIndex < currentAttunementBuild.skills.Length - 1) { currentSkillSlotIndex++; } SaveSkillBuild(); }); } if (GUI.tooltip == skillIdString) { ExecuteLater(() => { showSkill = lambdaSkill; }); GUI.tooltip = null; } } }
// OnGUI void OnGUI() { if (disconnected) { GUIHelper.BeginBox(400, 72); GUILayout.Label("Disconnected from the game server."); if (server != null) { using (new GUIHorizontalCenter()) { if (GUIHelper.Button("Reconnect")) { LogManager.General.Log("Reconnecting to " + server.ToString()); if (InGameLobby.instance != null) { // Real server InGameLobby.instance.ConnectToGameServerByIPEndPoint(server); } else { // Test server Application.LoadLevel("Client"); uLink.Network.Connect(server); } } } } GUIHelper.EndBox(); } }
// Draw attunements void DrawAttunements() { GUILayout.Label("Elements", titleStyle); foreach (Attunement attunement in currentWeapon.attunements) { if (attunement.id != currentAttunementBuild.attunementId) { if (GUIHelper.Button(new GUIContent(" " + attunement.name, attunement.icon), selectableStyle)) { var lambdaAttunement = attunement; ExecuteLater(() => { var attunements = build.GetWeaponBuildById(currentWeapon.id).attunements; for (int i = 0; i < attunements.Length; i++) { if (attunements[i] == currentAttunementBuild) { attunements[i].SwitchAttunement(lambdaAttunement.id); break; } } SaveSkillBuild(); }); } } } }
private void DrawControlButtons() { GUI.backgroundColor = Color.red; GUILayout.BeginHorizontal(); { var playString = m_player.IsPlaying ? "▌▌" : "▶"; if (GUIHelper.Button(playString, BUTTON_WIDTH, BUTTON_WIDTH)) { if (m_player.IsPlaying) { m_player.Pause(); } else { m_player.Play(); } } if (GUIHelper.Button("▇", BUTTON_WIDTH, BUTTON_WIDTH)) { m_player.Stop(); } } GUI.backgroundColor = Color.white; GUILayout.EndHorizontal(); }
// Save or reset traits void DrawToolbar() { if (inGameLobby.displayedAccount.isMine) { if (lastCharacterStatsSent.Compare(charStats) == false) { GUI.enabled = true; } else { GUI.enabled = false; } GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); // Save button if (GUI.enabled) { GUI.backgroundColor = Color.yellow; } else { GUI.backgroundColor = Color.white; } if (GUIHelper.Button("Save", GUILayout.Width(96)) && charStats.valid) { Sounds.instance.buttonClick.Play(); Lobby.RPC("ClientCharacterStats", Lobby.lobby, charStats); if (Player.main != null) { Player.main.networkView.RPC("CharacterStatsUpdate", uLink.RPCMode.Server, charStats); } PlayerAccount.mine.charStats = charStats; lastCharacterStatsSent = new CharacterStats(charStats); } // Reset button GUI.backgroundColor = Color.white; if (GUIHelper.Button("Reset", GUILayout.Width(96))) { Sounds.instance.buttonClick.Play(); PlayerAccount.mine.charStats = new CharacterStats(lastCharacterStatsSent); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(8); GUI.enabled = true; } }
public static bool HCenteredButton(string text, params GUILayoutOption[] options) { bool result; GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); result = GUIHelper.Button(text, options); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); return(result); }
// Draw friend void DrawFriend(FriendsGroup friendsGroup, Friend friend) { if (string.IsNullOrEmpty(friend.accountId)) { LogManager.General.LogError("FriendsGUI: Account ID is empty"); return; } // TODO: ... var account = PlayerAccount.Get(friend.accountId); string playerName = account.playerName; if (string.IsNullOrEmpty(playerName)) { return; } // New row using (new GUIHorizontal()) { // Draw the player name DrawPlayerName(playerName, new GUIContent(playerName), friendNameStyle); // Space GUILayout.FlexibleSpace(); // Note noteContent.tooltip = friend.note; if (GUIHelper.Button(noteContent)) { new TextAreaWindow( _("Note for player <b>{0}</b>:", playerName), friend.note, newNote => { friend.note = newNote; Lobby.RPC("SetFriendNote", Lobby.lobby, playerName, friendsGroup.name, newNote); } ); } // Remove friend if (GUIHelper.Button(removeFriendContent)) { new Confirm( _("Do you really want to remove <b>{0}</b> from your friends list?", playerName), () => { Lobby.RPC("RemoveFriend", Lobby.lobby, playerName, friendsGroup.name); } ); } } }
// Draw friends group void DrawFriendsGroup(FriendsGroup friendsGroup) { // Header using (new GUIHorizontal(groupHeaderStyle)) { GUI.color = friendsGroup.color; GUILayout.Label(friendsGroup.name, groupNameStyle); GUI.color = Color.white; GUILayout.FlexibleSpace(); // Add friend if (GUIHelper.Button(addFriendContent)) { new FriendAddWindow( "Add a friend:", "", friendsGroup ); } // Remove group if (GUIHelper.Button(removeGroupContent)) { new Confirm( _("Do you really want to remove the group <b>{0}</b>? All friends in this group will be deleted from your list.", friendsGroup.name), () => { LogManager.General.Log(_("Removed friends list group {0}", friendsGroup.name)); Lobby.RPC("RemoveFriendsGroup", Lobby.lobby, friendsGroup.name); friendsList.RemoveGroup(friendsGroup.name); } ); } } // Draw friends in this group using (new GUIVertical("box")) { if (friendsGroup.friends.Count == 0) { GUILayout.Label("This group doesn't have any contacts yet.", friendNameStyle); } else { foreach (var friend in friendsGroup.friends) { DrawFriend(friendsGroup, friend); } } } }
public void DisconnectedGUI() { GUIHelper.BeginBox(400, 80); GUILayout.Label("Disconnected from lobby."); GUILayout.FlexibleSpace(); if (GUIHelper.Button("Reconnect", GUILayout.Width(100))) { Sounds.instance.buttonClick.Play(); ConnectToLobby(); } GUIHelper.EndBox(); }
// Draw public override void Draw() { using (new GUIScrollView(ref scrollPosition)) { // Donate button using (new GUIHorizontalCenter()) { if (GUIHelper.Button(new GUIContent(" Support the development of Battle of Mages! ", donateButtonImage), GUILayout.Width(buttonWidth), GUILayout.Height(buttonHeight))) { string baseURL; string buttonId; if (useSandBox) { baseURL = "https://www.sandbox.paypal.com"; buttonId = paypalSandboxButtonId; } else { baseURL = "https://www.paypal.com"; buttonId = paypalButtonId; } string accountName = loginClientGUI.accountEmail; string finalURL = baseURL + "/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=" + buttonId + "&item_name=Battle%20of%20Mages%20(Account:%20" + accountName + ")&custom=" + accountName; #if !UNITY_EDITOR Application.ExternalEval("window.open('" + finalURL + "', 'Battle of Mages - Donation')"); #else Application.OpenURL(finalURL); #endif } } // Donate text using (new GUIHorizontalCenter()) { GUILayout.Label(@" Unlike big companies whose goal is mainly to make profit, my main goal is to give players a highly enjoyable experience playing the game. Developing and maintaining a game of the scale of Battle of Mages costs a lot of money, not to mention the monthly server costs. Therefore I appreciate every single contribution because it helps me affording better servers and create better content which will affect <b>your</b> gameplay experience. If you'd like this game to improve and stay alive please consider a little donation."); } } }
// Draw public override void Draw() { if (!GameManager.isPvE || MainMenu.instance.currentState == InGameMenuState.Lobby) { return; } if (GUIHelper.Button(feedbackButtonContent)) { new TextAreaWindow( "Let us know what you like or dislike and how we can improve your experience with the game!", "\n\n\n\n\n", (text) => { Lobby.RPC("MailFeedback", Lobby.lobby, text); } ).acceptText = "Send"; } }
void DrawButtons(ref int stat) { var buttonLayout = GUILayout.Width(24); bool guiEnabled = GUI.enabled; bool accIsMine = inGameLobby.displayedAccount.isMine; GUI.enabled = accIsMine && (stat > 0); if (GUIHelper.Button("-", buttonLayout)) { Sounds.instance.buttonClick.Play(); stat -= 1; } GUI.enabled = accIsMine && (stat < 100) && (charStats.statPointsLeft > 0); if (GUIHelper.Button("+", buttonLayout)) { Sounds.instance.buttonClick.Play(); stat += 1; } buttonLayout = GUILayout.Width(42); for (int i = 0; i <= 100; i += 25) { GUI.enabled = accIsMine && ((i - stat) <= charStats.statPointsLeft) && (i != stat); if (i != stat) { GUI.contentColor = (i > stat ? Color.green : Color.red); } else { GUI.contentColor = Color.white; } if (GUIHelper.Button(i.ToString(), buttonLayout)) { Sounds.instance.buttonClick.Play(); stat = i; } } GUI.enabled = guiEnabled; GUI.contentColor = Color.white; }
// DrawFooter void DrawFooter() { using (new GUIHorizontal()) { GUILayout.FlexibleSpace(); // Create new group if (GUIHelper.Button(newGroupContent)) { new TextFieldWindow( "Enter new group name:", "", groupName => { Lobby.RPC("AddFriendsGroup", Lobby.lobby, groupName); friendsList.groups.Add(new FriendsGroup(groupName)); } ).acceptText = "Create"; } } }
// Matchmaking button void DrawMatchmakingButton(byte i) { string buttonCaption; string playerCount = "<size=11>" + GUIHelper.Plural(queuePlayers[i - 1], "player") + "</size>"; string prefix = "<b><size=16>"; string postfix = "</size></b>"; if (i == currentQueue) { if (matchFound) { GUI.backgroundColor = Color.green; } else { GUI.backgroundColor = Color.yellow; } buttonCaption = prefix + "In " + i + "v" + i + " queue..." + postfix + "\n" + playerCount; } else { GUI.backgroundColor = Color.white; buttonCaption = prefix + "Play " + i + "v" + i + postfix + "\n" + playerCount; } if (GUIHelper.Button(buttonCaption, GUILayout.Width(queueButtonWidth), GUILayout.Height(queueButtonHeight))) { Sounds.instance.buttonClick.Play(); if (i == currentQueue) { LeaveQueue(); } else { EnterQueue(i); } } // Reset color GUI.backgroundColor = Color.white; }
protected override void OnWindowGUI() { m_searchType = EditorGUILayout.TextField(m_searchType, GUILayout.Height(30)); m_searchText = EditorGUILayout.TextField(m_searchText, GUILayout.Height(30)); GUI.backgroundColor = Color.red; { if (GUILayout.Button("Search By Text")) { m_searchedFiles.Clear(); SearchByText(PREFAB_EXT_NAME); } if (GUILayout.Button("Search By Component")) { m_searchedFiles.Clear(); SearchByComponent(PREFAB_EXT_NAME); } } GUI.backgroundColor = Color.white; GUIHelper.HorizontalSplitter(1); foreach (var pair in m_searchedFiles) { var path = pair.Key; var fileName = pair.Value; GUILayout.BeginHorizontal(); { GUILayout.Label(fileName, GUILayout.Width(200)); GUI.backgroundColor = Color.cyan; { if (GUIHelper.Button("Select", 100, 20)) { var obj = AssetDatabase.LoadAssetAtPath(path, typeof(GameObject)); Selection.activeObject = obj; } } GUI.backgroundColor = Color.white; } GUILayout.EndHorizontal(); } }
// DrawArtifactSlots public void DrawArtifactSlots() { var acc = InGameLobby.instance.displayedAccount; artifactTree = acc.artifactTree; artifactTreeStatsInfo = acc.charStats.GetMultiLineStringCombined(artifactTree.charStats); if (artifactTree == null) { return; } using (new GUIVertical("box")) { using (new GUIScrollView(ref scrollPosition)) { GUI.Label(new Rect(5, 0, 200, 300), artifactTreeStatsInfo); for (int i = Artifact.maxLevel - 1; i >= 0; i--) { var slotLevel = artifactTree.slots[i]; using (new GUIHorizontalCenter()) { for (int slotIndex = 0; slotIndex < slotLevel.Length; slotIndex++) { var slot = slotLevel[slotIndex]; if (slot.artifact != null) { if (GUIHelper.Button(new GUIContent("", slot.artifact.icon, slot.artifact.tooltip), artifactStyle) && acc.isMine) // && !saving { Lobby.RPC("ClientArtifactUnequip", Lobby.lobby, (byte)i, (byte)slotIndex); } } else { GUIHelper.Button(_("L{0}", slot.requiredLevel + 1), artifactSlotStyle); } } } } } } }
public static int Toolbar(int selected, GUIContent[] contents, IsAvailableFunc[] availFuncs = null, params GUILayoutOption[] options) { var oldColor = GUI.backgroundColor; // Draw buttons for (int i = 0; i < contents.Length; i++) { if (selected == i) { if (availFuncs != null) { var availFunc = availFuncs[i]; if (availFunc == null || availFunc()) { GUI.backgroundColor = GUIColor.MenuItemActive; } else { GUI.backgroundColor = GUIColor.MenuItemLoading; } } else { GUI.backgroundColor = GUIColor.MenuItemActive; } } else { GUI.backgroundColor = GUIColor.MenuItemInactive; } if (GUIHelper.Button(contents[i], options)) { selected = i; } } GUI.backgroundColor = oldColor; return(selected); }
// Footer void DrawGuildFooter() { string representText; bool represent = (currentGuildId != guildList.mainGuildId); if (represent) { representText = "Represent"; } else { representText = "Don't represent"; } using (new GUIHorizontalCenter()) { if (GUIHelper.Button(representText)) { Sounds.instance.buttonClick.Play(); Lobby.RPC("GuildRepresentRequest", Lobby.lobby, currentGuildId, represent); // Live update in town if (Player.main != null) { Player.main.networkView.RPC("GuildRepresentRequest", uLink.RPCMode.Server, currentGuildId, represent); } } if (Guild.CanDisband(currentGuildId, PlayerAccount.mine.accountId) && GUIHelper.Button("Disband")) { Sounds.instance.buttonClick.Play(); var guild = GameDB.guildIdToGuild[currentGuildId]; new Confirm("Do you really want to disband '" + guild.ToString() + "'?", () => { Lobby.RPC("GuildDisbandRequest", Lobby.lobby, currentGuildId); }, null ); } } }
// Outstanding guild invitations void DrawInvitations() { if (invitationsList == null || invitationsList.Count == 0) { return; } GUILayout.Space(8); using (new GUIVertical()) { foreach (var guildId in invitationsList) { if (!GameDB.guildIdToGuild.ContainsKey(guildId)) { continue; } var guild = GameDB.guildIdToGuild[guildId]; using (new GUIHorizontalCenter()) { using (new GUIHorizontal("box")) { GUILayout.Label("Invitation to: <b>" + guild + "</b>"); GUILayout.FlexibleSpace(); // Accept if (GUIHelper.Button("Accept")) { Sounds.instance.buttonClick.Play(); Lobby.RPC("GuildInvitationResponse", Lobby.lobby, guildId, true); } // Deny if (GUIHelper.Button("Deny")) { Sounds.instance.buttonClick.Play(); Lobby.RPC("GuildInvitationResponse", Lobby.lobby, guildId, false); } } } } } }
// DrawButtons protected void DrawButtons() { using (new GUIHorizontalCenter()) { GUI.backgroundColor = Color.green; // Accept by key press bool acceptedWithKey = (allowAcceptWithReturn && Event.current.type == EventType.KeyUp && Event.current.keyCode == KeyCode.Return); if (acceptedWithKey) { Event.current.Use(); } if (GUIHelper.Button(acceptText, controlID, GUILayout.Width(60)) || acceptedWithKey) { Sounds.instance.buttonClick.Play(); if (accept != null) { this.Accept(); } this.Close(); } GUI.backgroundColor = Color.red; if (GUIHelper.Button(cancelText, controlID, GUILayout.Width(60))) { Sounds.instance.buttonClick.Play(); if (cancel != null) { cancel(); } this.Close(); } GUI.backgroundColor = Color.white; } }
// Guild invite interface void DrawGuildInvite() { string textFieldName = "InvitedPlayerName"; using (new GUIHorizontal()) { //GUI.SetNextControlName(textFieldName); //playerToInvite = GUILayout.TextField(playerToInvite, GUILayout.Width(120)); if (GUIHelper.Button("Invite", GUILayout.Width(70)) || (GUI.GetNameOfFocusedControl() == textFieldName && GUIHelper.ReturnPressed())) { Sounds.instance.buttonClick.Play(); new TextFieldWindow( "Which player would you like to invite?", "", (text) => { Lobby.RPC("GuildInvitationRequest", Lobby.lobby, currentGuildId, text); } ); } } }
// Display player name protected static void DrawPlayerName(string playerName, GUIContent content, GUIStyle style, params GUILayoutOption[] options) { // Add status icon if (content.image == null) { var account = PlayerAccount.GetByPlayerName(playerName); if (account != null) { content.image = account.onlineStatusImage; } } // Player name on button if (GUIHelper.Button(content, style, options)) { if (Event.current.button == 1) { InGameLobby.instance.CreatePlayerPopupMenu(playerName); } } }
void LicenseGUI() { GUIHelper.BeginBox(460, 300); GUILayout.Label(@"You hereby agree to the following conditions: 1. Understand that most graphics are simply dummy graphics used in the development process and do not represent the quality of the final product. 2. Your character will be reset at the start of the Closed Beta. 3. You will receive an Alpha Tester title in the future. "); GUILayout.FlexibleSpace(); using (new GUIHorizontalCenter()) { if (GUIHelper.Button("I agree.") || (Event.current.type == EventType.KeyUp && Event.current.keyCode == KeyCode.Return)) { Sounds.instance.buttonClick.Play(); ChangeState(State.Lobby); gameLobby.UpdateAccountInfo(); } } GUIHelper.EndBox(); }
private void DrawResult() { foreach (var result in m_results.Values) { GUILayout.BeginHorizontal(); { var collapsed = result.IsCollapsed ? "+" : "-"; if (GUIHelper.ColorButton(collapsed, Color.red, 20, 20)) { result.IsCollapsed = !result.IsCollapsed; } GUILayout.Label(result.Name, GUILayout.Width(200)); GUI.backgroundColor = Color.cyan; { if (GUIHelper.Button("Select", 100, 20)) { Selection.activeObject = AssetDatabase.LoadMainAssetAtPath(result.Path); } } GUI.backgroundColor = Color.white; } GUILayout.EndHorizontal(); if (result.IsCollapsed) { continue; } foreach (var property in result.Properties) { GUILayout.Label(property); } GUIHelper.HorizontalSplitter(1, 3); } }
// Draw public override void Draw() { custom = InGameLobby.instance.displayedAccount.custom; if (custom == null) { return; } int padding = 4; int width = (int)GUIArea.width / 4; Vector3 minRGB = new Vector3(0.05f, 0.05f, 0.05f); GUILayout.BeginArea(new Rect(GUIArea.width - width + padding, padding, width - padding * 2, GUIArea.height - padding * 2)); using (new GUIVertical("box")) { using (new GUIScrollView(ref scrollPosition)) { using (new GUIHorizontal()) { GUI.enabled = false; GUILayout.Button("Male", GUILayout.Width(70)); GUILayout.Button("Female", GUILayout.Width(70)); GUI.enabled = true; GUILayout.FlexibleSpace(); GUILayout.Label("Coming soon!"); } GUILayout.Label("Height:"); custom.height = GUILayout.HorizontalSlider(custom.height, 0f, 1f); using (new GUIHorizontal()) { GUILayout.Label("Voice:"); GUILayout.FlexibleSpace(); if (GUILayout.Button(voicePlayButtonContent)) { if (GameManager.inGame) { if (Player.main != null) { Player.main.audio.clip = Magic.instance.randomCastVoiceClip; Player.main.audio.Play(); } } else { CharacterPreview.instance.audio.clip = Magic.instance.randomCastVoiceClip; CharacterPreview.instance.audio.Play(); } } } //using(new GUIHorizontal()) { //GUILayout.Label("Mature", GUILayout.Width(60f)); //using(new GUIVertical()) { //GUILayout.Space(2); custom.voicePitch = GUILayout.HorizontalSlider(custom.voicePitch, 0f, 1f); if (GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition)) { GUI.tooltip = "Childish <-----> Mature"; } //} //GUILayout.Label("Childish", GUILayout.Width(60f)); //} GUILayout.Label("Hair color:"); custom.hairColor = GUIHelper.ColorPicker(custom.hairColor, minRGB); GUILayout.Label("Eye color:"); custom.eyeColor = GUIHelper.ColorPicker(custom.eyeColor, new Vector3(0.3f, 0.3f, 0.3f)); GUILayout.Label("Eye background color:"); custom.eyeBackgroundColor = GUIHelper.ColorPicker(custom.eyeBackgroundColor, minRGB); GUILayout.Label("Cloak color:"); custom.cloakColor = GUIHelper.ColorPicker(custom.cloakColor, minRGB); GUILayout.Label("Topwear color:"); custom.topWearColor = GUIHelper.ColorPicker(custom.topWearColor, minRGB); GUILayout.Label("Legwear color:"); custom.legWearColor = GUIHelper.ColorPicker(custom.legWearColor, minRGB); GUILayout.Label("Boots color:"); custom.bootsColor = GUIHelper.ColorPicker(custom.bootsColor, minRGB); } GUILayout.FlexibleSpace(); if (Player.main == null) { if (GUIHelper.Button("Finish")) { Sounds.instance.buttonClick.Play(); SendCustomization(); } } } GUILayout.EndArea(); // Visualize changes UpdateCustomization(); }
// DrawBag public static void DrawBag(Bag bag, int i, bool enabled) { if (bag == null) { return; } GUILayout.Label(_("L{0} inventory", i + 1)); GUILayout.BeginHorizontal(); for (int index = 0; index < bag.itemLimit; index++) { if (index % 10 == 0) { GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); } var itemSlot = bag.itemSlots[index]; GUILayoutOption[] options = { GUILayout.Width(ItemInventoryGUI.instance.inventorySlotSize), GUILayout.Height(ItemInventoryGUI.instance.inventorySlotSize) }; if (itemSlot != null && itemSlot.item != null) { var arti = (Artifact)itemSlot.item; GUI.enabled = enabled; if (GUIHelper.Button(new GUIContent("", arti.icon, arti.tooltip), null, options)) // && !saving { if (Event.current.button == 0) { Lobby.RPC("ClientArtifactEquip", Lobby.lobby, arti.id); } else if (Event.current.button == 1) { byte level = (byte)i; byte slotIndex = (byte)index; new PopupMenu( ArtifactsGUI.instance.artifactContextMenuContents, new PopupMenu.CallBack[] { // Equip () => { Lobby.RPC("ClientArtifactEquip", Lobby.lobby, arti.id); }, // Discard () => { new Confirm( "Do you really want to delete " + arti.name + " x" + itemSlot.count + "?", () => { Lobby.RPC("ClientArtifactDiscard", Lobby.lobby, level, slotIndex); }, null ); } } ); } } if (itemSlot.count > 1) { GUI.Label(GUILayoutUtility.GetLastRect(), itemSlot.count.ToString(), ArtifactsGUI.instance.itemCountStyle); } } else { GUI.enabled = false; GUIHelper.Button(new GUIContent(""), null, options); } } GUI.enabled = true; GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); }
// Draw weapon build void DrawWeaponBuild(WeaponBuild weaponBuild) { var weapon = Weapon.idToWeapon[weaponBuild.weaponId]; GUILayout.Label("Weapon: <b>" + weapon.name + "</b>", titleStyle); // Reset shown skill description ExecuteLater(() => { showSkill = null; }); // Add attunements from attunement IDs foreach (var attunementBuild in weaponBuild.attunements) { var lambdaAttunementBuild = attunementBuild; var attunement = Attunement.idToAttunement[attunementBuild.attunementId]; if (currentAttunementBuild != null && attunementBuild == currentAttunementBuild && currentSkillSlotIndex == -1) { GUI.backgroundColor = GUIColor.MenuItemActive; } else { GUI.backgroundColor = GUIColor.MenuItemInactive; } using (new GUIHorizontal()) { if (GUIHelper.Button(new GUIContent(attunement.icon))) { ExecuteLater(() => { currentWeapon = weapon; currentAttunementBuild = lambdaAttunementBuild; currentSkillSlotIndex = -1; scrollPositionSelect = Vector2.zero; }); } // Add skills from skill IDs for (int slotIndex = 0; slotIndex < attunementBuild.skills.Length; slotIndex++) { var skillId = attunementBuild.skills[slotIndex]; var skillIdString = skillId.ToStringLookup(); var skill = Skill.idToSkill[skillId]; if (attunementBuild == currentAttunementBuild && slotIndex == currentSkillSlotIndex) { GUI.backgroundColor = GUIColor.MenuItemActive; } else { GUI.backgroundColor = GUIColor.MenuItemInactive; } if (slotIndex == 0) { GUILayout.Space(8); } if (GUIHelper.Button(new GUIContent(skill.icon, skillIdString))) { var lambdaSlotIndex = slotIndex; // Remove skill from slot if (Event.current.button == 1) { ExecuteLater(() => { currentSkill = Skill.idToSkill[lambdaAttunementBuild.skills[lambdaSlotIndex]]; var lambdaSkill = currentSkill.type == Skill.SkillType.AutoAttack ? Magic.EmptyAutoAttackSkill : Magic.EmptySkill; lambdaAttunementBuild.skills[lambdaSlotIndex] = lambdaSkill.id; }); } else { ExecuteLater(() => { currentWeapon = weapon; currentAttunementBuild = lambdaAttunementBuild; currentSkillSlotIndex = lambdaSlotIndex; scrollPositionSelect = Vector2.zero; }); } } if (GUI.tooltip == skillIdString) { ExecuteLater(() => { showSkill = skill; }); GUI.tooltip = null; } if (slotIndex == 0) { GUILayout.Space(8); } } } } }