-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
*cleanup and finished loading portraits without configuring game files
- Loading branch information
Showing
7 changed files
with
316 additions
and
204 deletions.
There are no files selected for viewing
This file contains 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 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 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,61 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using Harmony; | ||
using BattleTech; | ||
using System.Reflection; | ||
using System.IO; | ||
using BattleTech.Portraits; | ||
using UnityEngine; | ||
using UnityEngine.Rendering; | ||
using BattleTech.UI; | ||
using HBS; | ||
using HBS.Collections; | ||
using BattleTech.Data; | ||
using Newtonsoft.Json.Linq; | ||
using Newtonsoft.Json; | ||
|
||
namespace CommanderPortraitLoader { | ||
public class Helper{ | ||
// Token: 0x0600564D RID: 22093 RVA: 0x0023F158 File Offset: 0x0023D358 | ||
public static Sprite DownsampleSprite(Sprite oldSprite) { | ||
Texture2D texture = oldSprite.texture; | ||
RenderTexture temporary = RenderTexture.GetTemporary(texture.width / 2, texture.height / 2, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.sRGB); | ||
RenderTexture temporary2 = RenderTexture.GetTemporary(texture.width / 4, texture.height / 4, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.sRGB); | ||
Graphics.Blit(texture, temporary); | ||
Graphics.Blit(temporary, temporary2); | ||
Texture2D texture2D = new Texture2D(texture.width / 4, texture.height / 4, TextureFormat.ARGB32, false); | ||
RenderTexture.active = temporary2; | ||
texture2D.ReadPixels(new Rect(0f, 0f, (float)texture2D.width, (float)texture2D.height), 0, 0); | ||
texture2D.Apply(false, true); | ||
Texture2D texture2D2 = texture2D; | ||
texture2D2.name = texture2D2.name + texture.name + " Thumb"; | ||
RenderTexture.ReleaseTemporary(temporary); | ||
RenderTexture.ReleaseTemporary(temporary2); | ||
return Sprite.Create(texture2D, new Rect(0f, 0f, (float)texture2D.width, (float)texture2D.height), new Vector2(0.5f, 0.5f), 100f, 0u, SpriteMeshType.FullRect, Vector4.zero); | ||
} | ||
|
||
public static List<string> GetAbilities(int gunnery, int piloting, int guts, int tactics) { | ||
List<string> list = new List<string>(); | ||
SimPilotProgressionConstantsDef progression = LazySingletonBehavior<UnityGameInstance>.Instance.Game.Simulation.Constants.Progression; | ||
int abilityLevel = gunnery; | ||
int abilityLevel2 = piloting; | ||
int abilityLevel3 = guts; | ||
int abilityLevel4 = tactics; | ||
list.AddRange(GetAbilityDefsForSkill(progression.GunnerySkills, abilityLevel)); | ||
list.AddRange(GetAbilityDefsForSkill(progression.PilotingSkills, abilityLevel2)); | ||
list.AddRange(GetAbilityDefsForSkill(progression.GutsSkills, abilityLevel3)); | ||
list.AddRange(GetAbilityDefsForSkill(progression.TacticsSkills, abilityLevel4)); | ||
return list; | ||
} | ||
|
||
public static List<string> GetAbilityDefsForSkill(string[][] abilityDefConsts, int abilityLevel) { | ||
List<string> list = new List<string>(); | ||
for (int i = 0; i < abilityLevel; i++) { | ||
list.AddRange(abilityDefConsts[i]); | ||
} | ||
return list; | ||
} | ||
} | ||
} |
This file contains 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,33 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using Harmony; | ||
using BattleTech; | ||
using System.Reflection; | ||
using System.IO; | ||
using BattleTech.Portraits; | ||
using UnityEngine; | ||
using UnityEngine.Rendering; | ||
using BattleTech.UI; | ||
using HBS; | ||
using HBS.Collections; | ||
using BattleTech.Data; | ||
using Newtonsoft.Json.Linq; | ||
using Newtonsoft.Json; | ||
|
||
namespace CommanderPortraitLoader { | ||
public class CustomPreset { | ||
public CustomDescription Description = new CustomDescription(); | ||
public bool isCommander; | ||
|
||
} | ||
|
||
public class CustomDescription { | ||
public string Id; | ||
public string Name; | ||
public string Details; | ||
public string Icon; | ||
|
||
} | ||
} |
Oops, something went wrong.