|
|
|
|
@@ -53,12 +53,14 @@ namespace MxValheim.KillFeed
|
|
|
|
|
string victimFormat = "";
|
|
|
|
|
string distanceFormat = "";
|
|
|
|
|
string starFormat = "";
|
|
|
|
|
string crossFormat = "";
|
|
|
|
|
// Format Message in Divided Section
|
|
|
|
|
starFormat = "<color=#fffb00>★</color>";
|
|
|
|
|
crossFormat = "<color=#a0a3a1>✝</color>";
|
|
|
|
|
attackerFormat = $"<color=#00ff06>{attacker.ToUpper()}</color>";
|
|
|
|
|
if(type == 1)
|
|
|
|
|
{
|
|
|
|
|
victimFormat = $"<color=#00ff06>{victim.ToUpper()}</color>";
|
|
|
|
|
victimFormat = $"{crossFormat} <color=#00ff06>{victim.ToUpper()}</color>";
|
|
|
|
|
} else if(type == 2)
|
|
|
|
|
{
|
|
|
|
|
switch (level)
|
|
|
|
|
@@ -75,18 +77,17 @@ namespace MxValheim.KillFeed
|
|
|
|
|
case 4:
|
|
|
|
|
victimFormat = $"{starFormat}{starFormat}{starFormat} <color=#00ff06>{victim.ToUpper()}</color>";
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
victimFormat = $"{starFormat}{starFormat}{starFormat}{starFormat} <color=#00ff06>{victim.ToUpper()}</color>";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
distanceFormat = $" à <color=#9402f5>{distance:F1}m</color> de distance.";
|
|
|
|
|
|
|
|
|
|
finalMsg =
|
|
|
|
|
(type == 1) ? $"{victimFormat}{type1Separator}{attackerFormat}{distanceFormat}":
|
|
|
|
|
(type == 2) ? $"{attackerFormat}{type2Separator}{victimFormat}{distanceFormat}" :
|
|
|
|
|
$"{attackerFormat}{type2Separator}{victimFormat}{distanceFormat}";
|
|
|
|
|
|
|
|
|
|
/*string finalMsg = (type == 1) ? $"<color=#FF3333>☠</color> <color=#00ff06>{victim.ToUpper()}</color> a été tué par <color=#ff0000>{attacker.ToUpper()}</color> à <color=#9402f5>{distance:F1}m</color> de distance." :
|
|
|
|
|
(type == 2) ? $"<color=#00ff06>{attacker.ToUpper()}</color> a tué <color=#00c0ff>{victim.ToUpper()}</color> à <color=#9402f5>{distance:F1}m</color> de distance." :
|
|
|
|
|
$"<color=#00ff06>{attacker.ToUpper()}</color> a tué <color=#00c0ff>{victim.ToUpper()}</color> à <color=#9402f5>{distance:F1}m</color> de distance.";*/
|
|
|
|
|
(type == 1) ? $"{victimFormat}{type1Separator}{attackerFormat}{distanceFormat}": // Player Death
|
|
|
|
|
(type == 2) ? $"{attackerFormat}{type2Separator}{victimFormat}{distanceFormat}": // Player Killed Something
|
|
|
|
|
$"{attackerFormat}{type2Separator}{victimFormat}{distanceFormat}"; // Failsafe
|
|
|
|
|
|
|
|
|
|
Sprite weaponIcon = null;
|
|
|
|
|
|
|
|
|
|
@@ -417,72 +418,5 @@ namespace MxValheim.KillFeed
|
|
|
|
|
|
|
|
|
|
_hudRoot.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
public void CreateCustomHud()
|
|
|
|
|
{
|
|
|
|
|
_hudRoot = new GameObject("MxKillFeed_Root");
|
|
|
|
|
UnityEngine.Object.DontDestroyOnLoad(_hudRoot);
|
|
|
|
|
|
|
|
|
|
Canvas c = _hudRoot.AddComponent<Canvas>();
|
|
|
|
|
c.renderMode = RenderMode.ScreenSpaceOverlay;
|
|
|
|
|
c.sortingOrder = 10000;
|
|
|
|
|
|
|
|
|
|
// Add a Scaler to ensure it looks right on all resolutions
|
|
|
|
|
CanvasScaler scaler = _hudRoot.AddComponent<CanvasScaler>();
|
|
|
|
|
scaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
|
|
|
|
|
scaler.referenceResolution = new Vector2(1920, 1080);
|
|
|
|
|
|
|
|
|
|
_canvasGroup = _hudRoot.AddComponent<CanvasGroup>();
|
|
|
|
|
|
|
|
|
|
GameObject panel = new GameObject("Background", typeof(RectTransform), typeof(Image));
|
|
|
|
|
panel.transform.SetParent(_hudRoot.transform, false);
|
|
|
|
|
_panelImage = panel.GetComponent<Image>();
|
|
|
|
|
|
|
|
|
|
// Fallback: Set a solid color first in case the sprite search fails
|
|
|
|
|
_panelImage.color = new Color(0, 0, 0, 0.8f);
|
|
|
|
|
|
|
|
|
|
foreach (Sprite s in Resources.FindObjectsOfTypeAll<Sprite>())
|
|
|
|
|
{
|
|
|
|
|
if (s.name == "shout_field")
|
|
|
|
|
{
|
|
|
|
|
_panelImage.sprite = s;
|
|
|
|
|
_panelImage.type = Image.Type.Sliced;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RectTransform pRect = panel.GetComponent<RectTransform>();
|
|
|
|
|
pRect.anchorMin = pRect.anchorMax = pRect.pivot = new Vector2(0.5f, 0.95f);
|
|
|
|
|
pRect.anchoredPosition = Vector2.zero; // Center top
|
|
|
|
|
pRect.sizeDelta = new Vector2(550, 40);
|
|
|
|
|
pRect.localScale = Vector3.one; // FORCE SCALE TO 1
|
|
|
|
|
|
|
|
|
|
// Icon
|
|
|
|
|
GameObject iconObj = new GameObject("Icon", typeof(RectTransform), typeof(Image));
|
|
|
|
|
iconObj.transform.SetParent(panel.transform, false);
|
|
|
|
|
_weaponIconSlot = iconObj.GetComponent<Image>();
|
|
|
|
|
_weaponIconSlot.preserveAspect = true;
|
|
|
|
|
RectTransform iRect = iconObj.GetComponent<RectTransform>();
|
|
|
|
|
iRect.anchorMin = iRect.anchorMax = iRect.pivot = new Vector2(0, 0.5f);
|
|
|
|
|
iRect.anchoredPosition = new Vector2(10, 0);
|
|
|
|
|
iRect.sizeDelta = new Vector2(30, 30);
|
|
|
|
|
|
|
|
|
|
// Text
|
|
|
|
|
GameObject textObj = new GameObject("Text", typeof(RectTransform), typeof(Text));
|
|
|
|
|
textObj.transform.SetParent(panel.transform, false);
|
|
|
|
|
_killText = textObj.GetComponent<Text>();
|
|
|
|
|
_killText.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
|
|
|
|
|
_killText.fontSize = 18;
|
|
|
|
|
_killText.alignment = TextAnchor.MiddleLeft;
|
|
|
|
|
_killText.supportRichText = true;
|
|
|
|
|
textObj.AddComponent<Outline>().effectColor = Color.black;
|
|
|
|
|
|
|
|
|
|
RectTransform tRect = textObj.GetComponent<RectTransform>();
|
|
|
|
|
tRect.anchorMin = Vector2.zero; tRect.anchorMax = Vector2.one;
|
|
|
|
|
tRect.offsetMin = new Vector2(50, 0); tRect.offsetMax = new Vector2(-10, 0);
|
|
|
|
|
|
|
|
|
|
_hudRoot.SetActive(false);
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
}
|