-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #234 from misternebula/dev
0.7.1
- Loading branch information
Showing
65 changed files
with
775 additions
and
1,334 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
using OWML.ModHelper.Events; | ||
using OWML.Utils; | ||
using UnityEngine; | ||
|
||
namespace QSB.Animation | ||
|
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
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
using OWML.ModHelper.Events; | ||
using OWML.Utils; | ||
using QSB.Events; | ||
using QSB.Patches; | ||
|
||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
using OWML.ModHelper.Events; | ||
using OWML.Utils; | ||
using QSB.WorldSync; | ||
using UnityEngine; | ||
|
||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
using OWML.ModHelper.Events; | ||
using OWML.Utils; | ||
using QSB.Events; | ||
using QSB.WorldSync; | ||
|
||
|
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,70 @@ | ||
using UnityEngine; | ||
|
||
namespace QSB.Player | ||
{ | ||
public class PlayerMapMarker : MonoBehaviour | ||
{ | ||
public string PlayerName; | ||
private Transform _playerTransform; | ||
private CanvasMapMarker _canvasMarker; | ||
private bool _canvasMarkerInitialized; | ||
|
||
public void Awake() | ||
{ | ||
GlobalMessenger.AddListener("EnterMapView", new Callback(OnEnterMapView)); | ||
GlobalMessenger.AddListener("ExitMapView", new Callback(OnExitMapView)); | ||
} | ||
|
||
public void Start() | ||
{ | ||
enabled = false; | ||
_playerTransform = Locator.GetPlayerTransform(); | ||
} | ||
|
||
public void OnDestroy() | ||
{ | ||
GlobalMessenger.RemoveListener("EnterMapView", new Callback(OnEnterMapView)); | ||
GlobalMessenger.RemoveListener("ExitMapView", new Callback(OnExitMapView)); | ||
} | ||
|
||
public void InitMarker() | ||
{ | ||
var obj = GameObject.FindWithTag("MapCamera"); | ||
var markerManager = obj.GetRequiredComponent<MapController>().GetMarkerManager(); | ||
_canvasMarker = markerManager.InstantiateNewMarker(true); | ||
var component = GetComponent<OWRigidbody>(); | ||
if (component != null) | ||
{ | ||
markerManager.RegisterMarker(_canvasMarker, component); | ||
} | ||
else | ||
{ | ||
markerManager.RegisterMarker(_canvasMarker, transform); | ||
} | ||
_canvasMarker.SetLabel(PlayerName.ToUpper()); | ||
_canvasMarker.SetColor(Color.white); | ||
_canvasMarker.SetVisibility(false); | ||
_canvasMarkerInitialized = true; | ||
} | ||
|
||
private void OnEnterMapView() => enabled = true; | ||
private void OnExitMapView() => enabled = false; | ||
|
||
public void LateUpdate() | ||
{ | ||
if (!_canvasMarkerInitialized) | ||
{ | ||
InitMarker(); | ||
} | ||
var a = Locator.GetActiveCamera().WorldToScreenPoint(transform.position); | ||
var b = Locator.GetActiveCamera().WorldToScreenPoint(_playerTransform.position); | ||
var vector = a - b; | ||
vector.z = 0f; | ||
var flag = a.z > 0f; | ||
if (_canvasMarker.IsVisible() != flag) | ||
{ | ||
_canvasMarker.SetVisibility(flag); | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.