Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: changed some ui.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jul 31, 2023
1 parent 7422723 commit a75f140
Show file tree
Hide file tree
Showing 10 changed files with 408 additions and 205 deletions.
33 changes: 12 additions & 21 deletions RotationSolver.Basic/Attributes/AssemblyLinkAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,6 @@
[AttributeUsage(AttributeTargets.Assembly)]
public class AssemblyLinkAttribute : Attribute
{
/// <summary>
/// The support link
/// </summary>
public string SupportLink { get; }

/// <summary>
/// Wiki link.
/// </summary>
public string HelpLink { get; }

/// <summary>
/// A link to change log.
/// </summary>
public string ChangeLog { get; }

/// <summary>
/// A link for donate.
/// </summary>
Expand All @@ -29,16 +14,22 @@ public class AssemblyLinkAttribute : Attribute
/// <summary>
/// Constructer.
/// </summary>
/// <param name="supportLink"><see cref="SupportLink"/></param>
/// <param name="helpLink"><see cref="HelpLink"/></param>
/// <param name="changeLog"><see cref="ChangeLog"/></param>
/// <param name="supportLink"></param>
/// <param name="helpLink"></param>
/// <param name="changeLog"></param>
/// <param name="donate"><see cref="Donate"/></param>
[Obsolete()]
public AssemblyLinkAttribute(string supportLink = null, string helpLink = null,
string changeLog = null, string donate = null)
{
SupportLink = supportLink;
HelpLink = helpLink;
ChangeLog = changeLog;
Donate = donate;
}

/// <summary>
///
/// </summary>
public AssemblyLinkAttribute()
{

}
}
3 changes: 2 additions & 1 deletion RotationSolver.Basic/Rotations/CustomRotation_Ability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,13 @@ protected virtual bool DefenseAreaAbility(out IAction act)
}

/// <summary>
/// The ability that speeds your chacacter up.
/// The ability that speeds your character up.
/// </summary>
/// <param name="act">Result action.</param>
/// <returns>Can we use it.</returns>

[RotationDesc(DescType.SpeedAbility)]
[RotationDesc(ActionID.Sprint)]
protected virtual bool SpeedAbility(out IAction act)
{
if (Sprint.CanUse(out act, CanUseOption.MustUse)) return true;
Expand Down
11 changes: 1 addition & 10 deletions RotationSolver/Data/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RotationSolver.Data
namespace RotationSolver.Data
{
internal record AssemblyInfo(
string Name,
string Author,
string FilePath,
string SupportLink,
string HelpLink,
string ChangeLog,
string DonateLink);
}
22 changes: 1 addition & 21 deletions RotationSolver/Helpers/RotationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,15 @@ public static AssemblyInfo GetInfo(this Assembly assembly)

var name = assembly.GetName().Name;
var location = assembly.Location;
var version = assembly.GetName().Version?.ToString();
var description = assembly.GetCustomAttribute<AssemblyDescriptionAttribute>()?.Description;
var company = assembly.GetCustomAttribute<AssemblyCompanyAttribute>()?.Company;
var product = assembly.GetCustomAttribute<AssemblyProductAttribute>()?.Product;
var trademark = assembly.GetCustomAttribute<AssemblyTrademarkAttribute>()?.Trademark;

var assemblyInfo = new AssemblyInfo(name, version, location, description, company, product, trademark);
var assemblyInfo = new AssemblyInfo(name, company, location, string.Empty);

_assemblyInfos[assembly] = assemblyInfo;

return assemblyInfo;
}

//public static Assembly GetTypeAssembly(this ICustomRotation rotation)
//{
// try
// {
// return rotation.GetType().Assembly;
// }
// catch (Exception ex)
// {
// PluginLog.LogError($"Failed to get assembly for rotation {rotation.GetType().Name}: {ex}");
// return null;
// }
//}

public static Vector4 GetColor(this ICustomRotation rotation)
{
if (!rotation.IsValid)
Expand Down Expand Up @@ -82,9 +65,6 @@ public static Assembly LoadCustomRotationAssembly(string filePath)
assemblyName,
author,
filePath,
attr?.SupportLink,
attr?.HelpLink,
attr?.ChangeLog,
attr?.Donate);

var existingAssembly = GetAssemblyFromPath(filePath);
Expand Down
2 changes: 2 additions & 0 deletions RotationSolver/Localization/EnumTranslations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ internal static class EnumTranslations
DescType.DefenseSingleAbility => LocalizationManager.RightLang.DescType_DefenseSingleAbility,
DescType.DefenseAreaAbility => LocalizationManager.RightLang.DescType_DefenseAreaAbility,

DescType.SpeedAbility => LocalizationManager.RightLang.DescType_SpeedAbility,

_ => string.Empty,
};

Expand Down
8 changes: 6 additions & 2 deletions RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"ConfigWindow_Helper_RunCommand": "Click to execute the command",
"ConfigWindow_Helper_CopyCommand": "Right-click to copy the command",
"ConfigWindow_Helper_InsertCommand": "Insert \"{0}\" first in {1}s",
"ConfigWindow_Rotation_Description": "You can enable the function for each job you want and configure the setting about how to use actions.",
"ConfigWindow_Rotation_Description_Old": "You can enable the function for each job you want and configure the setting about how to use actions.",
"ConfigWindow_Rotation_KeyName": "The key name is",
"ConfigWindow_Events_AddEvent": "AddEvents",
"ConfigWindow_Events_Description": "In this window, you can set what macro will be trigger after using an action.",
Expand Down Expand Up @@ -310,6 +310,7 @@
"DescType_DefenseSingleAbility": "Single Defense Ability",
"DescType_MoveForwardAbility": "Move Forward Ability",
"DescType_MoveBackAbility": "Move Back Ability",
"DescType_SpeedAbility": "Speed Ability",
"JobRole_None": "Gathering&Production",
"JobRole_Tank": "Tank",
"JobRole_Melee": "Melee",
Expand Down Expand Up @@ -437,5 +438,8 @@
"ConfigWindow_About_Compatibility_Description": "literally, Rotation Solver helps you to choose the target and then click the action. So any plugin that changes these will affect its decision.\n\nHere is a list of known incompatible plugins:",
"ConfigWindow_About_Compatibility_Mistake": "Can't properly execute the behavior that RS is going to do.",
"ConfigWindow_About_Compatibility_Mislead": "Misleading RS to make the right decision.",
"ConfigWindow_About_Compatibility_Crash": "Cause the game to crash."
"ConfigWindow_About_Compatibility_Crash": "Cause the game to crash.",
"ConfigWindow_Rotation_Description": "Description",
"ConfigWindow_Rotation_Configuration": "Configuration",
"ConfigWindow_Rotation_Information": "Information"
}
7 changes: 5 additions & 2 deletions RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ internal partial class Strings
public string ConfigWindow_Helper_RunCommand { get; set; } = "Click to execute the command";
public string ConfigWindow_Helper_CopyCommand { get; set; } = "Right-click to copy the command";
public string ConfigWindow_Helper_InsertCommand { get; set; } = "Insert \"{0}\" first in {1}s";
public string ConfigWindow_Rotation_Description { get; set; } = "You can enable the function for each job you want and configure the setting about how to use actions.";
public string ConfigWindow_Rotation_Description_Old { get; set; } = "You can enable the function for each job you want and configure the setting about how to use actions.";

public string ConfigWindow_Rotation_KeyName { get; set; } = "The key name is";
public string ConfigWindow_Events_AddEvent { get; set; } = "AddEvents";
Expand Down Expand Up @@ -431,6 +431,7 @@ internal partial class Strings
public string DescType_DefenseSingleAbility { get; set; } = "Single Defense Ability";
public string DescType_MoveForwardAbility { get; set; } = "Move Forward Ability";
public string DescType_MoveBackAbility { get; set; } = "Move Back Ability";
public string DescType_SpeedAbility { get; set; } = "Speed Ability";

#endregion

Expand Down Expand Up @@ -635,5 +636,7 @@ internal partial class Strings
public string ConfigWindow_About_Compatibility_Mislead { get; set; } = "Misleading RS to make the right decision.";
public string ConfigWindow_About_Compatibility_Crash { get; set; } = "Cause the game to crash.";


public string ConfigWindow_Rotation_Description { get; set; } = "Description";
public string ConfigWindow_Rotation_Configuration { get; set; } = "Configuration";
public string ConfigWindow_Rotation_Information { get; set; } = "Information";
}
13 changes: 7 additions & 6 deletions RotationSolver/UI/ImGuiHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -429,22 +429,22 @@ internal static void DisplayCommandHelp<T>(this T command, string extraCommand =

public unsafe static void Display(this ICustomRotation rotation, ICustomRotation[] rotations, bool canAddButton)
=> rotation.DrawEnableTexture(canAddButton, null,
text =>
rotation =>
{
ImguiTooltips.ShowTooltip(() =>
{
var t = IconSet.GetTexture(IconSet.GetJobIcon(rotation, IconType.Framed));
ImGui.Image(t.ImGuiHandle, new Vector2(t.Width, t.Height));

if (!string.IsNullOrEmpty(text.Description))
if (!string.IsNullOrEmpty(rotation.Description))
{
ImGui.SameLine();
ImGui.Text(" ");
ImGui.SameLine();
ImGui.Text(text.Description);
ImGui.Text(rotation.Description);
}

var type = text.GetType();
var type = rotation.GetType();

var attrs = new List<RotationDescAttribute> { RotationDescAttribute.MergeToOne(type.GetCustomAttributes<RotationDescAttribute>()) };

Expand All @@ -457,7 +457,7 @@ public unsafe static void Display(this ICustomRotation rotation, ICustomRotation
{
foreach (var a in RotationDescAttribute.Merge(attrs))
{
RotationDescAttribute.MergeToOne(a)?.Display(text);
RotationDescAttribute.MergeToOne(a)?.Display(rotation);
}
}
catch (Exception ex)
Expand Down Expand Up @@ -892,8 +892,9 @@ public static void Display(this RotationDescAttribute attr, ICustomRotation rota
ImGui.Text(" ");
ImGui.SameLine();
}
ControlWindow.DrawIAction(item.GetTexture().ImGuiHandle, 24, 1);
ImGuiHelper.HoveredString(item.Name);

ImGui.Image(item.GetTexture().ImGuiHandle, PIC_SIZE);
notStart = true;
}
ImGui.Unindent(ATTR_INDENT);
Expand Down
Loading

0 comments on commit a75f140

Please sign in to comment.