fixed azazel/players ESP being off-centered
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using MelonLoader;
|
||||||
|
|
||||||
namespace DevourClient.Render
|
namespace DevourClient.Render
|
||||||
{
|
{
|
||||||
@@ -49,14 +50,6 @@ namespace DevourClient.Render
|
|||||||
GUI.color = color2;
|
GUI.color = color2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DrawBox(float x, float y, float w, float h, Color color, float thickness)
|
|
||||||
{
|
|
||||||
DrawLine(new Vector2(x, y), new Vector2(x + w, y), color, thickness);
|
|
||||||
DrawLine(new Vector2(x, y), new Vector2(x, y + h), color, thickness);
|
|
||||||
DrawLine(new Vector2(x + w, y), new Vector2(x + w, y + h), color, thickness);
|
|
||||||
DrawLine(new Vector2(x, y + h), new Vector2(x + w, y + h), color, thickness);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void DrawNameESP(Vector3 pos, string name, Color color)
|
public static void DrawNameESP(Vector3 pos, string name, Color color)
|
||||||
{
|
{
|
||||||
if (Camera.main == null)
|
if (Camera.main == null)
|
||||||
@@ -75,27 +68,59 @@ namespace DevourClient.Render
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DrawBoxESP(Vector3 footpos, Vector3 headpos, Color color, string playername = "", bool snapline = false, bool esp = true, bool only_name = false)
|
public static void RectFilled(float x, float y, float width, float height, Texture2D text)
|
||||||
{
|
{
|
||||||
float height = headpos.y - footpos.y;
|
GUI.DrawTexture(new Rect(x, y, width, height), text);
|
||||||
float widthOffset = 2f;
|
}
|
||||||
float width = height / widthOffset;
|
|
||||||
|
|
||||||
if (playername != "" && esp || playername != "" && only_name)
|
public static void RectOutlined(float x, float y, float width, float height, Texture2D text, float thickness = 1f)
|
||||||
{
|
{
|
||||||
Render.DrawString(new Vector2((footpos.x - (width / 2)) + 25, (float)Screen.height - footpos.y - height), color, playername, false);
|
RectFilled(x, y, thickness, height, text);
|
||||||
}
|
RectFilled(x + width - thickness, y, thickness, height, text);
|
||||||
|
RectFilled(x + thickness, y, width - thickness * 2f, thickness, text);
|
||||||
//ESP BOX
|
RectFilled(x + thickness, y + height - thickness, width - thickness * 2f, thickness, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Box(float x, float y, float width, float height, Texture2D text, float thickness = 1f)
|
||||||
|
{
|
||||||
|
RectOutlined(x - width / 2f, y - height, width, height, text, thickness);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Texture2D texture2 = new Texture2D(2, 2, TextureFormat.ARGB32, false);
|
||||||
|
public static void DrawBoxESP(Vector3 pos, Transform child, Color color, string name, bool snapline = false, bool esp = false)
|
||||||
|
{
|
||||||
if (esp)
|
if (esp)
|
||||||
{
|
{
|
||||||
Render.DrawBox(footpos.x - (width / 2), (float)Screen.height - footpos.y - height, width, height, color, 2f);
|
//ESP BOX
|
||||||
|
texture2.SetPixel(0, 0, color);
|
||||||
|
texture2.SetPixel(1, 0, color);
|
||||||
|
texture2.SetPixel(0, 1, color);
|
||||||
|
texture2.SetPixel(1, 1, color);
|
||||||
|
texture2.Apply();
|
||||||
|
|
||||||
|
|
||||||
|
child.transform.position = new Vector3(child.transform.position.x, child.transform.position.y + 2.0f, child.transform.position.z);
|
||||||
|
|
||||||
|
Vector3 w2s = Camera.main.WorldToScreenPoint(pos);
|
||||||
|
Vector3 w2s2 = Camera.main.WorldToScreenPoint(child.position);
|
||||||
|
float num = Mathf.Abs(w2s.y - w2s2.y);
|
||||||
|
Box(w2s.x, Screen.height - w2s.y, num / 1.8f, num, texture2, 1f);
|
||||||
|
|
||||||
|
DrawString(new Vector2(w2s.x, Screen.height - w2s2.y + child.transform.position.y - 10.0f), color, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Snapline
|
|
||||||
|
// Snapline
|
||||||
if (snapline)
|
if (snapline)
|
||||||
{
|
{
|
||||||
Render.DrawLine(new Vector2((float)(Screen.width / 2), (float)(Screen.height / 2)), new Vector2(footpos.x, (float)Screen.height - footpos.y), color, 2f);
|
Vector3 pivotPos = pos;
|
||||||
|
Vector3 playerFootPos; playerFootPos.x = pivotPos.x; playerFootPos.z = pivotPos.z; playerFootPos.y = pivotPos.y; //At the feet
|
||||||
|
Vector3 w2s_footpos = Camera.main.WorldToScreenPoint(playerFootPos);
|
||||||
|
|
||||||
|
if (w2s_footpos.z > 0f)
|
||||||
|
{
|
||||||
|
Render.DrawLine(new Vector2((float)(Screen.width / 2), (float)(Screen.height / 2)), new Vector2(w2s_footpos.x, (float)Screen.height - w2s_footpos.y), color, 2f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,31 +166,12 @@ namespace DevourClient
|
|||||||
if (player != null)
|
if (player != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (player.GetComponent<Il2Cpp.NolanBehaviour>().entity.IsOwner)
|
||||||
Vector3 pivotPos = player.transform.position; //Pivot point NOT at the origin, at the center
|
|
||||||
Vector3 playerFootPos; playerFootPos.x = pivotPos.x; playerFootPos.z = pivotPos.z; playerFootPos.y = pivotPos.y - 2f; //At the feet
|
|
||||||
Vector3 playerHeadPos; playerHeadPos.x = pivotPos.x; playerHeadPos.z = pivotPos.z; playerHeadPos.y = pivotPos.y + 2f; //At the head
|
|
||||||
|
|
||||||
if (Camera.main == null)
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 w2s_footpos = Camera.main.WorldToScreenPoint(playerFootPos);
|
Render.Render.DrawBoxESP(player.transform.position, player.transform.GetComponentsInChildren<Transform>()[0], Settings.Settings.player_esp_color, p.Name, this.player_snapline, this.player_esp);
|
||||||
Vector3 w2s_headpos = Camera.main.WorldToScreenPoint(playerHeadPos);
|
|
||||||
|
|
||||||
if (w2s_footpos.z > 0f)
|
|
||||||
{
|
|
||||||
//string playername = player.field_Private_PhotonView_0.field_Private_ObjectPublicObInBoStBoHaStObInHaUnique_0.field_Private_String_0;//player.photonView._Controller_k__BackingField.NickName;
|
|
||||||
|
|
||||||
if (player.GetComponent<Il2Cpp.NolanBehaviour>().entity.IsOwner)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Render.Render.DrawBoxESP(w2s_footpos, w2s_headpos, Settings.Settings.player_esp_color, p.Name, this.player_snapline, this.player_esp);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -258,22 +239,7 @@ namespace DevourClient
|
|||||||
{
|
{
|
||||||
if (survivalAzazel != null)
|
if (survivalAzazel != null)
|
||||||
{
|
{
|
||||||
|
Render.Render.DrawBoxESP(survivalAzazel.transform.position, survivalAzazel.transform.GetComponentsInChildren<Transform>()[0], Settings.Settings.azazel_esp_color, "Azazel", this.azazel_snapline, this.azazel_esp);
|
||||||
|
|
||||||
Vector3 pivotPos = survivalAzazel.transform.position; //Pivot point NOT at the origin, at the center
|
|
||||||
Vector3 playerFootPos; playerFootPos.x = pivotPos.x; playerFootPos.z = pivotPos.z; playerFootPos.y = pivotPos.y - 2f; //At the feet
|
|
||||||
Vector3 playerHeadPos; playerHeadPos.x = pivotPos.x; playerHeadPos.z = pivotPos.z; playerHeadPos.y = pivotPos.y + 2f; //At the head
|
|
||||||
|
|
||||||
if (Camera.main != null)
|
|
||||||
{
|
|
||||||
Vector3 w2s_footpos = Camera.main.WorldToScreenPoint(playerFootPos);
|
|
||||||
Vector3 w2s_headpos = Camera.main.WorldToScreenPoint(playerHeadPos);
|
|
||||||
|
|
||||||
if (w2s_footpos.z > 0f)
|
|
||||||
{
|
|
||||||
Render.Render.DrawBoxESP(w2s_footpos, w2s_headpos, Settings.Settings.azazel_esp_color, "Azazel", this.azazel_snapline, this.azazel_esp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user