forked from KaBooMa/S1API
-
-
Notifications
You must be signed in to change notification settings - Fork 22
Issues backlog: PhoneApp onDestroyed, custom commands enhancement, employee appearances, more checks in CombatBehaviour #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
01b05f1
fix(phoneapp): wire OnDestroyed
k073l d2563ce
feat(commands): add custom commands to command list
k073l a8c0dfa
feat(employees): expose employee appearance data
k073l b6197c2
fix(combat): switch to melonlogger, typecast safely, update xml docs
k073l 6d00589
fix(api): harden backlog feature integrations
ifBars File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| #if IL2CPPMELON | ||
| using S1Employees = Il2CppScheduleOne.Employees; | ||
| #elif MONOMELON | ||
| using S1Employees = ScheduleOne.Employees; | ||
| #endif | ||
| using System.Collections.Generic; | ||
| using S1API.Avatar; | ||
| using UnityEngine; | ||
|
|
||
| namespace S1API.Entities.Employees | ||
| { | ||
| /// <summary> | ||
| /// Provides methods for managing employee appearances and related data. | ||
| /// </summary> | ||
| public static class EmployeeManager | ||
| { | ||
| private static readonly Logging.Log Logger = new("EmployeeManager"); | ||
|
|
||
| /// <summary> | ||
| /// Gets an employee appearance by index. | ||
| /// </summary> | ||
| /// <param name="male">Whether to choose from male employee appearance pool</param> | ||
| /// <param name="index">The index of the appearance to retrieve</param> | ||
| /// <returns>An <see cref="EmployeeAppearance"/> representing the employee appearance at the specified index if successful; otherwise, null.</returns> | ||
| public static EmployeeAppearance? GetAppearance(bool male, int index) | ||
| { | ||
| if (!S1Employees.EmployeeManager.InstanceExists) | ||
| { | ||
| Logger.Error("EmployeeManager instance does not exist; cannot get appearance"); | ||
| return null; | ||
| } | ||
|
|
||
| var appearance = S1Employees.EmployeeManager.Instance.GetAppearance(male, index); | ||
| return appearance == null ? null : new EmployeeAppearance(appearance); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets a random employee appearance. | ||
| /// </summary> | ||
| /// <param name="male">Whether to choose from male employee appearance pool</param> | ||
| /// <param name="index">The index of the appearance that was retrieved</param> | ||
| /// <param name="settings">The avatar settings of the appearance that was retrieved</param> | ||
| /// <returns>True if an appearance was successfully retrieved; otherwise, false.</returns> | ||
| public static bool GetRandomAppearance(bool male, out int index, out AvatarSettings? settings) | ||
| { | ||
| if (!S1Employees.EmployeeManager.InstanceExists) | ||
| { | ||
| settings = null; | ||
| index = -1; | ||
| Logger.Error("EmployeeManager instance does not exist; cannot get random appearance"); | ||
| return false; | ||
| } | ||
|
|
||
| S1Employees.EmployeeManager.Instance.GetRandomAppearance(male, out var i, out var avatarSettings); | ||
| if (avatarSettings == null) | ||
| { | ||
| settings = null; | ||
| index = -1; | ||
| return false; | ||
| } | ||
|
|
||
| index = i; | ||
| settings = new AvatarSettings(avatarSettings); | ||
| return true; | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Represents an employee appearance, including avatar settings and mugshot sprite. | ||
| /// </summary> | ||
| public class EmployeeAppearance | ||
| { | ||
| /// <summary> | ||
| /// INTERNAL: The underlying employee appearance from the base game. | ||
| /// </summary> | ||
| internal S1Employees.EmployeeManager.EmployeeAppearance S1EmployeeAppearance; | ||
|
|
||
| /// <summary> | ||
| /// Gets the avatar settings associated with this employee appearance. | ||
| /// </summary> | ||
| public AvatarSettings Settings => new(S1EmployeeAppearance.Settings); | ||
|
|
||
| /// <summary> | ||
| /// Gets the mugshot sprite associated with this employee appearance. | ||
| /// </summary> | ||
| public Sprite Mugshot => S1EmployeeAppearance.Mugshot; | ||
|
|
||
| /// <summary> | ||
| /// INTERNAL: Initializes a new instance of the EmployeeAppearance class with the specified base game type appearance. | ||
| /// </summary> | ||
| internal EmployeeAppearance(S1Employees.EmployeeManager.EmployeeAppearance s1EmployeeAppearance) | ||
| { | ||
| S1EmployeeAppearance = s1EmployeeAppearance; | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.