mirror of
https://github.com/RaindropViewer/RaindropViewer.git
synced 2026-07-27 22:11:39 +00:00
refactor: RDI is now a singleton.. again.
This commit is contained in:
committed by
alexiscatnip
parent
df2f057365
commit
9b6bf20fab
@@ -11,7 +11,7 @@ using Logger = OpenMetaverse.Logger;
|
||||
//make the avatar play the standing animation.
|
||||
public class AnimateStandPrototype : MonoBehaviour
|
||||
{
|
||||
private RaindropInstance instance => ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
private RaindropInstance instance => RaindropInstance.GlobalInstance;
|
||||
|
||||
public UUID standAnim => Animations.STAND;
|
||||
public UUID anim => standAnim;
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
using Plugins.CommonDependencies;
|
||||
using Raindrop;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
[RequireComponent(typeof(Button))]
|
||||
public class LogoutButton : MonoBehaviour
|
||||
{
|
||||
//get own references.
|
||||
void Awake()
|
||||
{
|
||||
Button btn = this.GetComponent<Button>();
|
||||
btn.onClick.AddListener(Logout);
|
||||
}
|
||||
|
||||
private void Logout()
|
||||
{
|
||||
Debug.Log("logout requested by user UI");
|
||||
ServiceLocator.Instance.Get<RaindropInstance>().Netcom.Logout();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,7 +23,7 @@ namespace Raindrop.Bootstrap
|
||||
{
|
||||
var ui = ServiceLocator.Instance.Get<UIService>();
|
||||
Assert.IsNotNull(ui, "ui is not found.");
|
||||
// var instance = ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
// var instance = ServiceLocator.RaindropInstance.GlobalInstance;
|
||||
// ui.modalManager.showModal_NtfGeneric("Quick Re-log",
|
||||
// "Would you like to login with previous credentials: \n" +
|
||||
// instance.GlobalSettings["a"]
|
||||
|
||||
@@ -125,11 +125,7 @@ namespace Raindrop.Bootstrap
|
||||
|
||||
public static void CreateAndRegister_RaindropInstance()
|
||||
{
|
||||
if (ServiceLocator.Instance.IsRegistered<RaindropInstance>())
|
||||
return;
|
||||
|
||||
var rdi = new RaindropInstance(new GridClient());
|
||||
ServiceLocator.Instance.Register<RaindropInstance>(rdi);
|
||||
var instance = RaindropInstance.GlobalInstance;
|
||||
SendStartupMessageToLogger();
|
||||
}
|
||||
|
||||
@@ -164,7 +160,7 @@ namespace Raindrop.Bootstrap
|
||||
RaindropInstance instance;
|
||||
try
|
||||
{
|
||||
instance = ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
instance = RaindropInstance.GlobalInstance;
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -190,8 +186,6 @@ namespace Raindrop.Bootstrap
|
||||
|
||||
frmMain_Disposed(instance);
|
||||
|
||||
Unregister_RaindropInstance();
|
||||
|
||||
Debug.Log("disposed netcom and client! :) This marks the end of the app.");
|
||||
}
|
||||
|
||||
@@ -218,14 +212,6 @@ namespace Raindrop.Bootstrap
|
||||
|
||||
instance.CleanUp();
|
||||
}
|
||||
|
||||
public static void Unregister_RaindropInstance()
|
||||
{
|
||||
if (ServiceLocator.Instance.IsRegistered<RaindropInstance>())
|
||||
{
|
||||
ServiceLocator.Instance.Unregister<RaindropInstance>();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Raindrop.Bootstrap
|
||||
// link all the UI together
|
||||
class UIBootstrapper : MonoBehaviour
|
||||
{
|
||||
private RaindropInstance instance => ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
private RaindropInstance instance => RaindropInstance.GlobalInstance;
|
||||
private RaindropNetcom netcom => instance.Netcom;
|
||||
|
||||
[SerializeField] public References references;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Raindrop.Camera
|
||||
{
|
||||
public class RaindropCinemachineAssignLookAtAvatar : MonoBehaviour
|
||||
{
|
||||
private RaindropInstance instance { get { return ServiceLocator.Instance.Get<RaindropInstance>(); } }
|
||||
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
|
||||
//private RaindropNetcom netcom { get { return instance.Netcom; } }
|
||||
bool Active => instance.Client.Network.Connected;
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
using OpenMetaverse;
|
||||
using Plugins.CommonDependencies;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Raindrop.Camera
|
||||
{
|
||||
[RequireComponent(typeof(UnityEngine.Camera))]
|
||||
public class RaindropMainCameraDrawDistance : MonoBehaviour
|
||||
{
|
||||
public float DrawDistance;
|
||||
// private UIService ui => ServiceLocator.Instance.Get<UIService>();
|
||||
private RaindropInstance Instance => RaindropInstance.GlobalInstance;
|
||||
private GridClient Client => Instance.Client;
|
||||
|
||||
//private bool Active => ui.ScreensManager.TopCanvas.canvasType == CanvasType.Game;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
if (!Instance.GlobalSettings.ContainsKey("draw_distance"))
|
||||
{
|
||||
Instance.GlobalSettings["draw_distance"] = DrawDistance;
|
||||
}
|
||||
|
||||
this.GetComponent<UnityEngine.Camera>().farClipPlane = DrawDistance;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
//if (!Active)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ using Logger = OpenMetaverse.Logger;
|
||||
[RequireComponent(typeof(Image))]
|
||||
public class connectivityUI : MonoBehaviour
|
||||
{
|
||||
private RaindropInstance instance => ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
private RaindropInstance instance => RaindropInstance.GlobalInstance;
|
||||
|
||||
void Start()
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Assets.Raindrop.UI.Movement
|
||||
{
|
||||
private Selectable btn;
|
||||
|
||||
private RaindropInstance instance { get { return ServiceLocator.Instance.Get<RaindropInstance>(); } }
|
||||
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
|
||||
//can the component run?
|
||||
bool CanSendCommandsToSimulator => instance.Client.Network.Connected &&
|
||||
!instance.Netcom.IsTeleporting &&
|
||||
|
||||
@@ -26,7 +26,7 @@ public class JoystickCameraRelativeCharacterControl : MonoBehaviour
|
||||
public AgentPresenter agents;
|
||||
public bool debug;
|
||||
|
||||
private RaindropInstance instance { get { return ServiceLocator.Instance.Get<RaindropInstance>(); } }
|
||||
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
|
||||
//private RaindropNetcom netcom { get { return instance.Netcom; } }
|
||||
bool Active => instance.Client.Network.Connected;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Assets.Raindrop.UI.Movement
|
||||
{
|
||||
public Button btn;
|
||||
|
||||
private RaindropInstance instance { get { return ServiceLocator.Instance.Get<RaindropInstance>(); } }
|
||||
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
|
||||
|
||||
public void OnPointerDown(PointerEventData eventData)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ using OMV = OpenMetaverse;
|
||||
// we can send it in a lerp-y way, as we slowly turn in the scene.
|
||||
public class PlayerFacingInput : MonoBehaviour
|
||||
{
|
||||
private RaindropInstance instance { get { return ServiceLocator.Instance.Get<RaindropInstance>(); } }
|
||||
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
|
||||
private RaindropNetcom netcom { get { return instance.Netcom; } }
|
||||
private GridClient client { get { return instance.Client; } }
|
||||
bool Active => instance.Client.Network.Connected;
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Raindrop.Core
|
||||
/// </summary>
|
||||
public void BeginMonitoring()
|
||||
{
|
||||
var client = ServiceLocator.Instance.Get<RaindropInstance>().Client;
|
||||
var client = RaindropInstance.GlobalInstance.Client;
|
||||
client.Inventory.Store.InventoryObjectAdded += Store_InventoryObjectAdded;
|
||||
client.Inventory.Store.InventoryObjectUpdated += Store_InventoryObjectUpdated;
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Raindrop.Core
|
||||
/// </summary>
|
||||
public void StopMonitoring()
|
||||
{
|
||||
var client = ServiceLocator.Instance.Get<RaindropInstance>().Client;
|
||||
var client = RaindropInstance.GlobalInstance.Client;
|
||||
client.Inventory.Store.InventoryObjectAdded -= Store_InventoryObjectAdded;
|
||||
client.Inventory.Store.InventoryObjectUpdated -= Store_InventoryObjectUpdated;
|
||||
}
|
||||
@@ -115,7 +115,7 @@ namespace Raindrop.Core
|
||||
private bool ProcessWord(string word, StringBuilder outString)
|
||||
{
|
||||
var possibleTriggers = new List<GestureTrigger>();
|
||||
var client = ServiceLocator.Instance.Get<RaindropInstance>().Client;
|
||||
var client = RaindropInstance.GlobalInstance.Client;
|
||||
var lowerWord = word.ToLower();
|
||||
|
||||
client.Self.ActiveGestures.ForEach(pair =>
|
||||
@@ -170,7 +170,7 @@ namespace Raindrop.Core
|
||||
/// <param name="gesture">Gesture that was added or updated.</param>
|
||||
private void UpdateInventoryGesture(InventoryGesture gesture)
|
||||
{
|
||||
var client = ServiceLocator.Instance.Get<RaindropInstance>().Client;
|
||||
var client = RaindropInstance.GlobalInstance.Client;
|
||||
|
||||
client.Assets.RequestAsset(gesture.AssetUUID, AssetType.Gesture, false, (_, asset) =>
|
||||
{
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Raindrop
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
RaindropInstance instance = ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
RaindropInstance instance = RaindropInstance.GlobalInstance;
|
||||
string gridName;
|
||||
if (GridID == "custom_login_uri")
|
||||
{
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace Raindrop
|
||||
/// <returns>Display text for URI</returns>
|
||||
public string GetLinkName(string uri)
|
||||
{
|
||||
if (!ServiceLocator.Instance.Get<RaindropInstance>().GlobalSettings["resolve_uris"])
|
||||
if (!RaindropInstance.GlobalInstance.GlobalSettings["resolve_uris"])
|
||||
{
|
||||
return uri;
|
||||
}
|
||||
@@ -263,7 +263,7 @@ namespace Raindrop
|
||||
/// <returns>Name of agent on success, INCOMPLETE_NAME on failure or timeout</returns>
|
||||
private string GetAgentName(UUID agentID, ResolveType nameType)
|
||||
{
|
||||
RaindropInstance instance = ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
RaindropInstance instance = RaindropInstance.GlobalInstance;
|
||||
string name = RaindropInstance.IncompleteName;
|
||||
|
||||
using (ManualResetEvent gotName = new ManualResetEvent(false))
|
||||
@@ -319,7 +319,7 @@ namespace Raindrop
|
||||
/// <returns>Name of the group on success, INCOMPLETE_NAME on failure or timeout</returns>
|
||||
private string GetGroupName(UUID groupID)
|
||||
{
|
||||
RaindropInstance instance = ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
RaindropInstance instance = RaindropInstance.GlobalInstance;
|
||||
string name = RaindropInstance.IncompleteName;
|
||||
|
||||
using (ManualResetEvent gotName = new ManualResetEvent(false))
|
||||
@@ -357,7 +357,7 @@ namespace Raindrop
|
||||
/// <returns>Name of the parcel on success, INCOMPLETE_NAME on failure or timeout</returns>
|
||||
private string GetParcelName(UUID parcelID)
|
||||
{
|
||||
RaindropInstance instance = ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
RaindropInstance instance = RaindropInstance.GlobalInstance;
|
||||
string name = RaindropInstance.IncompleteName;
|
||||
|
||||
using (ManualResetEvent gotName = new ManualResetEvent(false))
|
||||
@@ -630,7 +630,7 @@ namespace Raindrop
|
||||
#region Link Execution
|
||||
private void ExecuteLinkRegionUri(Match match)
|
||||
{
|
||||
RaindropInstance instance = ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
RaindropInstance instance = RaindropInstance.GlobalInstance;
|
||||
|
||||
string name = HttpUtility.UrlDecode(match.Groups["region_name"].Value);
|
||||
int x = match.Groups["local_x"].Success ? int.Parse(match.Groups["local_x"].Value) : 128;
|
||||
@@ -644,7 +644,7 @@ namespace Raindrop
|
||||
|
||||
private void ExecuteLinkAgent(Match match)
|
||||
{
|
||||
RaindropInstance instance = ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
RaindropInstance instance = RaindropInstance.GlobalInstance;
|
||||
UUID agentID = new UUID(match.Groups["agent_id"].Value);
|
||||
//string action = match.Groups["action"].Value;
|
||||
|
||||
@@ -680,7 +680,7 @@ namespace Raindrop
|
||||
|
||||
private void ExecuteLinkGroup(Match match)
|
||||
{
|
||||
RaindropInstance instance = ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
RaindropInstance instance = RaindropInstance.GlobalInstance;
|
||||
string action = match.Groups["action"].Value;
|
||||
|
||||
switch (action)
|
||||
@@ -762,7 +762,7 @@ namespace Raindrop
|
||||
|
||||
private void ExecuteLinkWorldMap(Match match)
|
||||
{
|
||||
RaindropInstance instance = ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
RaindropInstance instance = RaindropInstance.GlobalInstance;
|
||||
|
||||
string name = HttpUtility.UrlDecode(match.Groups["region_name"].Value);
|
||||
int x = match.Groups["local_x"].Success ? int.Parse(match.Groups["local_x"].Value) : 128;
|
||||
|
||||
@@ -17,9 +17,12 @@ using Logger = OpenMetaverse.Logger;
|
||||
namespace Raindrop
|
||||
{
|
||||
// The singleton instance of the game client.
|
||||
public class RaindropInstance : IGameService
|
||||
public class RaindropInstance
|
||||
{
|
||||
//composition of many things...
|
||||
// Singleton, there can be only one instance
|
||||
private static RaindropInstance globalInstance = null;
|
||||
public static RaindropInstance GlobalInstance =>
|
||||
globalInstance ??= new RaindropInstance(new GridClient());
|
||||
|
||||
private GridClient _client; //backend monolith API
|
||||
private RaindropNetcom _netcom;
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Raindrop.Presenters
|
||||
// a cache for decoded scuplties
|
||||
Dictionary<UUID, Texture2D> sculptCache = new Dictionary<UUID, Texture2D>();
|
||||
|
||||
private RaindropInstance instance { get { return ServiceLocator.Instance.Get<RaindropInstance>(); } }
|
||||
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
|
||||
private GridClient Client { get { return instance?.Client; } }
|
||||
bool Active => instance.Client.Network.Connected;
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace Raindrop.Rendering
|
||||
if (BasePrim.Velocity != Vector3.Zero)
|
||||
{
|
||||
BasePrim.Position = InterpolatedPosition = BasePrim.Position + BasePrim.Velocity * time
|
||||
* 0.98f * ServiceLocator.Instance.Get<RaindropInstance>()
|
||||
* 0.98f * RaindropInstance.GlobalInstance
|
||||
.Client.Network.CurrentSim.Stats.Dilation;
|
||||
BasePrim.Velocity += BasePrim.Acceleration * time;
|
||||
}
|
||||
@@ -332,8 +332,8 @@ namespace Raindrop.Rendering
|
||||
try
|
||||
{
|
||||
string fname =
|
||||
ServiceLocator.Instance.Get<RaindropInstance>()
|
||||
.ComputeCacheName(ServiceLocator.Instance.Get<RaindropInstance>()
|
||||
RaindropInstance.GlobalInstance
|
||||
.ComputeCacheName(RaindropInstance.GlobalInstance
|
||||
.Client.Settings.ASSET_CACHE_DIR, textureID) + ".rzi";
|
||||
|
||||
using (var f = File.Open(fname, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
@@ -382,7 +382,7 @@ namespace Raindrop.Rendering
|
||||
{
|
||||
try
|
||||
{
|
||||
string fname = ServiceLocator.Instance.Get<RaindropInstance>().ComputeCacheName(ServiceLocator.Instance.Get<RaindropInstance>().Client.Settings.ASSET_CACHE_DIR, textureID) + ".rzi";
|
||||
string fname = RaindropInstance.GlobalInstance.ComputeCacheName(RaindropInstance.GlobalInstance.Client.Settings.ASSET_CACHE_DIR, textureID) + ".rzi";
|
||||
|
||||
using (var f = File.Open(fname, FileMode.Create, FileAccess.Write, FileShare.None))
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Raindrop.Presenters
|
||||
|
||||
public class AvatarInfoPresenter : MonoBehaviour
|
||||
{
|
||||
private RaindropInstance instance { get { return ServiceLocator.Instance.Get<RaindropInstance>(); } }
|
||||
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
|
||||
private RaindropNetcom netcom { get { return instance.Netcom; } }
|
||||
private UIService uimanager => ServiceLocator.Instance.Get<UIService>();
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ public class ScreenStackManager : MonoBehaviour
|
||||
|
||||
private bool IsEulaAccepted()
|
||||
{
|
||||
if (ServiceLocator.Instance.Get<RaindropInstance>().GlobalSettings["EulaAccepted"])
|
||||
if (RaindropInstance.GlobalInstance.GlobalSettings["EulaAccepted"])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
// {
|
||||
// notConnected();
|
||||
//
|
||||
// _instance = ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
// _instance = RaindropInstance.GlobalInstance;
|
||||
// }
|
||||
//
|
||||
//
|
||||
|
||||
@@ -9,7 +9,7 @@ using UnityEngine.UI;
|
||||
//a monobehavior that makes a toggle toggle the eula acceptance in globalSettings
|
||||
public class EulaView : MonoBehaviour
|
||||
{
|
||||
private RaindropInstance instance { get { return ServiceLocator.Instance.Get<RaindropInstance>(); } }
|
||||
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
|
||||
|
||||
[Tooltip("the Acceptance toggle that allows us to continue past this window")]
|
||||
public Toggle EulaToggle;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Raindrop.Presenters
|
||||
//2 . notifications - a dragdown list-like UI
|
||||
//3 . buttons to access other features.
|
||||
|
||||
private RaindropInstance instance { get { return ServiceLocator.Instance.Get<RaindropInstance>(); } }
|
||||
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
|
||||
private RaindropNetcom netcom { get { return instance.Netcom; } }
|
||||
private GridClient client { get { return instance.Client; } }
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Raindrop.GridSelection
|
||||
|
||||
//reference to model
|
||||
private RaindropInstance instance =>
|
||||
ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
RaindropInstance.GlobalInstance;
|
||||
private bool Ready => !(instance is null);
|
||||
private bool Connected => instance.Client.Network.Connected;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ using Logger = OpenMetaverse.Logger;
|
||||
//coordinates the loading in of some UIimage.
|
||||
public class Texturable_RawImage : MonoBehaviour
|
||||
{
|
||||
private RaindropInstance instance => ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
private RaindropInstance instance => RaindropInstance.GlobalInstance;
|
||||
|
||||
public UUID profileID;
|
||||
public GameObject LoadingImage;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Raindrop.UI.LoadingScreen
|
||||
public class LoadingController : IDisposable
|
||||
{
|
||||
private LoadingView view;
|
||||
private RaindropInstance instance { get { return ServiceLocator.Instance.Get<RaindropInstance>(); } }
|
||||
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
|
||||
private RaindropNetcom netcom { get { return instance.Netcom; } }
|
||||
|
||||
public bool isInteractable => view.canvas.interactable;
|
||||
|
||||
@@ -7,7 +7,7 @@ using UnityEngine;
|
||||
// show the currently-select grid name.
|
||||
public class GridNameView : MonoBehaviour
|
||||
{
|
||||
private RaindropInstance instance => ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
private RaindropInstance instance => RaindropInstance.GlobalInstance;
|
||||
|
||||
public TextView TextView;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Raindrop.UI.Login
|
||||
{
|
||||
public class LoginController
|
||||
{
|
||||
private RaindropInstance instance => ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
private RaindropInstance instance => RaindropInstance.GlobalInstance;
|
||||
public RaindropNetcom netcom => instance.Netcom;
|
||||
private LoginPresenter view;
|
||||
public bool isDoingLogin;
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Raindrop.UI.Login
|
||||
{
|
||||
public class LoginPresenter : MonoBehaviour
|
||||
{
|
||||
private RaindropInstance instance => ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
private RaindropInstance instance => RaindropInstance.GlobalInstance;
|
||||
|
||||
private UIService Uimanager =>
|
||||
ServiceLocator.Instance.Get<UIService>();
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using Plugins.CommonDependencies;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Raindrop.UI
|
||||
{
|
||||
[RequireComponent(typeof(Button))]
|
||||
public class LogoutButton : MonoBehaviour
|
||||
{
|
||||
//get own references.
|
||||
void Awake()
|
||||
{
|
||||
Button btn = this.GetComponent<Button>();
|
||||
btn.onClick.AddListener(Logout);
|
||||
}
|
||||
|
||||
private void Logout()
|
||||
{
|
||||
Debug.Log("logout requested by user UI");
|
||||
RaindropInstance.GlobalInstance.Netcom.Logout();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public class LandmarkController : IDisposable
|
||||
#endregion
|
||||
|
||||
#region globalrefs
|
||||
private RaindropInstance instance { get { return ServiceLocator.Instance.Get<RaindropInstance>(); } }
|
||||
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
|
||||
private RaindropNetcom netcom { get { return instance.Netcom; } }
|
||||
private GridClient client { get { return instance.Client; } }
|
||||
bool Active => instance.Client.Network.Connected;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Raindrop.Map.Model
|
||||
private MapTilesRAM _mapTilesRam;
|
||||
private MapTilesNetwork mapTilesNetwork;
|
||||
|
||||
private RaindropInstance instance => ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
private RaindropInstance instance => RaindropInstance.GlobalInstance;
|
||||
// private bool Secondlife; //=> instance.Netcom.LoginOptions.Grid.Platform == "SecondLife";
|
||||
public bool isReady = false;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Raindrop.Map.Model
|
||||
// for you to get map tiles from the network.
|
||||
public class MapTilesNetwork
|
||||
{
|
||||
private RaindropInstance instance => ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
private RaindropInstance instance => RaindropInstance.GlobalInstance;
|
||||
|
||||
List<ulong> tileRequests = new List<ulong>(); // a list of pending fetch requests. the ulongs are the x and y world coordinates (gridX * 256), packed.
|
||||
private DownloadManager downloader;
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Raindrop.UI.map.Map_SceneHierachy
|
||||
|
||||
public class MapScenePresenter : MonoBehaviour
|
||||
{
|
||||
RaindropInstance Instance => ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
RaindropInstance Instance => RaindropInstance.GlobalInstance;
|
||||
GridClient Client => Instance.Client;
|
||||
|
||||
[SerializeField]
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Raindrop.UI.Views
|
||||
|
||||
public MapScenePresenter MapScenePresenter;
|
||||
|
||||
private GridClient Client => ServiceLocator.Instance.Get<RaindropInstance>().Client;
|
||||
private GridClient Client => RaindropInstance.GlobalInstance.Client;
|
||||
|
||||
//global handle: handle + the offset within the simulator.
|
||||
public void OnFocusMapPosition(ulong global_handle, RaycastHit raycastHit)
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Raindrop.UI.Views
|
||||
{
|
||||
public class ParcelInfoPopup : MonoBehaviour
|
||||
{
|
||||
private GridClient Client => ServiceLocator.Instance.Get<RaindropInstance>().Client;
|
||||
private GridClient Client => RaindropInstance.GlobalInstance.Client;
|
||||
|
||||
public TMP_Text parcelNameTMP;
|
||||
public string parcelName;
|
||||
|
||||
@@ -128,7 +128,7 @@ public class ModalsManager : MonoBehaviour
|
||||
ui.ModalsManager.showModal_NotificationGeneric(
|
||||
"The desired feature is not implemented yet: ",
|
||||
type.ToString() + " UI + \n \n + Stay tuned for updates!");
|
||||
var instance = ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
var instance = RaindropInstance.GlobalInstance;
|
||||
instance.MediaManager.PlayUISound(UISounds.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Raindrop
|
||||
public class ntfGeneric : MonoBehaviour
|
||||
{
|
||||
private RaindropInstance instance =>
|
||||
ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
RaindropInstance.GlobalInstance;
|
||||
|
||||
public TMPro.TMP_Text txtMessage;
|
||||
public void Init(string msg)
|
||||
|
||||
@@ -12,7 +12,7 @@ using UnityEngine.Serialization;
|
||||
public class PeopleView : MonoBehaviour, IPointerClickHandler
|
||||
{
|
||||
public GridClient client => Instance.Client;
|
||||
public RaindropInstance Instance => ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
public RaindropInstance Instance => RaindropInstance.GlobalInstance;
|
||||
|
||||
|
||||
[SerializeField] public UUID agentID;
|
||||
|
||||
@@ -9,7 +9,7 @@ using UnityEngine;
|
||||
public class ButtonSound : MonoBehaviour
|
||||
{
|
||||
|
||||
public RaindropInstance Instance => ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
public RaindropInstance Instance => RaindropInstance.GlobalInstance;
|
||||
|
||||
private LeanButton btn;
|
||||
void Awake()
|
||||
|
||||
@@ -20,7 +20,7 @@ public class UpdateCameraBackend : MonoBehaviour
|
||||
void Start()
|
||||
{
|
||||
cam = GetComponent<Camera>();
|
||||
instance = ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
instance = RaindropInstance.GlobalInstance;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
||||
@@ -12,7 +12,7 @@ using Vector2 = UnityEngine.Vector2;
|
||||
//update the backend on user's (u,d,l,r)
|
||||
public class UpdateMovementBackend : MonoBehaviour
|
||||
{
|
||||
private RaindropInstance instance { get { return ServiceLocator.Instance.Get<RaindropInstance>(); } }
|
||||
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
|
||||
private RaindropNetcom netcom { get { return instance.Netcom; } }
|
||||
private GridClient client { get { return instance.Client; } }
|
||||
bool Active => instance.Client.Network.Connected;
|
||||
|
||||
@@ -10,7 +10,7 @@ using UnityEngine.UI;
|
||||
// View logic for the modal that allows us to select a person to IM with.
|
||||
public class AddAChatView : MonoBehaviour
|
||||
{
|
||||
public RaindropInstance instance => ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
public RaindropInstance instance => RaindropInstance.GlobalInstance;
|
||||
|
||||
public Button FriendsTab;
|
||||
public Button GroupsTab;
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Raindrop.UI.chat
|
||||
// | hello there.. |SEND|
|
||||
// _____________________
|
||||
|
||||
public RaindropInstance instance => ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
public RaindropInstance instance => RaindropInstance.GlobalInstance;
|
||||
|
||||
public IMPresenter DestChatInputAcceptor; // the monobehavior that accepts our input.
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Raindrop.Presenters
|
||||
{
|
||||
public class IMPresenter : MonoBehaviour
|
||||
{
|
||||
private RaindropInstance instance => ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
private RaindropInstance instance => RaindropInstance.GlobalInstance;
|
||||
private RaindropNetcom netcom => instance.Netcom;
|
||||
public TMPTextFieldPrinter printer; //the component in the textbox
|
||||
public IMManager manager;
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Raindrop.UI.chat
|
||||
// for local chat, manage the printer and the input box.
|
||||
public class LocalChatPresenter : MonoBehaviour
|
||||
{
|
||||
private RaindropInstance instance => ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
private RaindropInstance instance => RaindropInstance.GlobalInstance;
|
||||
private RaindropNetcom netcom => instance.Netcom;
|
||||
|
||||
public TMPTextFieldPrinter printer; //the component in the textbox
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Raindrop
|
||||
public ChatListView chatListView => presenter.chatListView;
|
||||
|
||||
|
||||
RaindropInstance instance => ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
RaindropInstance instance => RaindropInstance.GlobalInstance;
|
||||
public ChatManager(ChatPresenter view)
|
||||
{
|
||||
this.presenter = view;
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Raindrop.Presenters
|
||||
//right pane: the contents of the selected chat in the left pane.+
|
||||
// input bar of the text to send to said chat.
|
||||
|
||||
private RaindropInstance instance => ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
private RaindropInstance instance => RaindropInstance.GlobalInstance;
|
||||
|
||||
#region UI elements - left tabs
|
||||
[FormerlySerializedAs("chatList")] [Tooltip("The container of the list of chat tabs.")]
|
||||
|
||||
@@ -12,7 +12,7 @@ using Vector3 = OpenMetaverse.Vector3;
|
||||
public class prim_testrunner : MonoBehaviour
|
||||
{
|
||||
public ObjectManager obj_mgr;
|
||||
public GridClient client => ServiceLocator.Instance.Get<RaindropInstance>().Client;
|
||||
public GridClient client => RaindropInstance.GlobalInstance.Client;
|
||||
|
||||
void Start()
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Raindrop.Presenters
|
||||
= new Dictionary<UUID, GameObject>(); //user UUID -> user gameobject in minimap
|
||||
public GameObject agentReference; //reference to the agent, if rezzed - it should.
|
||||
|
||||
private RaindropInstance instance { get { return ServiceLocator.Instance.Get<RaindropInstance>(); } }
|
||||
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
|
||||
private RaindropNetcom netcom { get { return instance?.Netcom; } }
|
||||
private GridClient client { get { return instance?.Client; } }
|
||||
bool IsNetworkLayerActive => (instance != null) &&
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Raindrop.Unity3D
|
||||
// see @ MapCoordinatesConversionTests
|
||||
class MapPlayerLocationUpdater : MonoBehaviour
|
||||
{
|
||||
private RaindropInstance instance { get { return ServiceLocator.Instance.Get<RaindropInstance>(); } }
|
||||
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
|
||||
private RaindropNetcom netcom { get { return instance.Netcom; } }
|
||||
bool Active => instance.Client.Network.Connected;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Raindrop.Unity3D
|
||||
// it subscribes to the terrain of the sim it is responsible for rendering.
|
||||
public class TerrainMeshController
|
||||
{
|
||||
private RaindropInstance instance { get { return ServiceLocator.Instance.Get<RaindropInstance>(); } }
|
||||
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
|
||||
private GridClient Client { get { return instance.Client; } }
|
||||
private RaindropNetcom netcom { get { return instance.Netcom; } }
|
||||
bool Active => instance.Client.Network.Connected;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Raindrop.Unity3D
|
||||
{
|
||||
public TerrainMeshView TerrainMeshView;
|
||||
|
||||
private RaindropInstance instance { get { return ServiceLocator.Instance.Get<RaindropInstance>(); } }
|
||||
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
|
||||
|
||||
private float lastRenderTime = 0;
|
||||
private void OnEnable()
|
||||
|
||||
@@ -8,7 +8,7 @@ using UnityEngine;
|
||||
public class Origin_SimHandle : MonoBehaviour
|
||||
{
|
||||
public ulong simHandle => instance.Client.Network.CurrentSim.Handle;
|
||||
private RaindropInstance instance => ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
private RaindropInstance instance => RaindropInstance.GlobalInstance;
|
||||
|
||||
public ulong GetSimHandle()
|
||||
{
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
using OpenMetaverse;
|
||||
using Raindrop;
|
||||
using Raindrop.Services;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Plugins.CommonDependencies;
|
||||
using UnityEngine;
|
||||
|
||||
[RequireComponent(typeof(Camera))]
|
||||
public class RaindropMainCameraDrawDistance : MonoBehaviour
|
||||
{
|
||||
public float DrawDistance;
|
||||
// private UIService ui => ServiceLocator.Instance.Get<UIService>();
|
||||
private RaindropInstance Instance => ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
private GridClient Client => Instance.Client;
|
||||
|
||||
//private bool Active => ui.ScreensManager.TopCanvas.canvasType == CanvasType.Game;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
if (!Instance.GlobalSettings.ContainsKey("draw_distance"))
|
||||
{
|
||||
Instance.GlobalSettings["draw_distance"] = DrawDistance;
|
||||
}
|
||||
|
||||
this.GetComponent<Camera>().farClipPlane = DrawDistance;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
//if (!Active)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ using UnityEngine;
|
||||
[RequireComponent(typeof(OrthographicCameraView))]
|
||||
public class ResetMinimapCamera : MonoBehaviour
|
||||
{
|
||||
private RaindropInstance instance { get { return ServiceLocator.Instance.Get<RaindropInstance>(); } }
|
||||
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
|
||||
bool Active => instance.Client.Network.Connected;
|
||||
|
||||
public OrthographicCameraView cam;
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Raindrop.Tests.RaindropFullIntegrationTests
|
||||
yield return new WaitForSeconds(2);
|
||||
|
||||
//1. reject the EULA
|
||||
var instance = ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
var instance = RaindropInstance.GlobalInstance;
|
||||
instance.GlobalSettings["EulaAccepted"] = false;
|
||||
instance.GlobalSettings.Save();
|
||||
Assert.False(instance.GlobalSettings["EulaAccepted"]);
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Raindrop.Tests.RaindropFullIntegrationTests
|
||||
{
|
||||
|
||||
private RaindropNetcom netcom { get { return instance.Netcom; } }
|
||||
private RaindropInstance instance { get { return ServiceLocator.Instance.Get<RaindropInstance>(); } }
|
||||
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
|
||||
|
||||
[OneTimeSetUp]
|
||||
public void OneTimeSetUp()
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Raindrop.Tests.RaindropFullIntegrationTests
|
||||
public class LoginTests
|
||||
{
|
||||
private RaindropNetcom netcom { get { return instance.Netcom; } }
|
||||
private RaindropInstance instance { get { return ServiceLocator.Instance.Get<RaindropInstance>(); } }
|
||||
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Tests.Raindrop.SoundTests
|
||||
{
|
||||
yield return new WaitForSeconds(5);
|
||||
|
||||
var instance = ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
var instance = RaindropInstance.GlobalInstance;
|
||||
var internalDir = instance.UserDir;
|
||||
|
||||
//copy the sound file to cache path in a haphazard manner:
|
||||
@@ -86,7 +86,7 @@ namespace Tests.Raindrop.SoundTests
|
||||
[UnityTest]
|
||||
public IEnumerator OfflineUncachedSound_Playable_ButNoSound()
|
||||
{
|
||||
var instance = ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
var instance = RaindropInstance.GlobalInstance;
|
||||
|
||||
instance.MediaManager.PlayUISound(UUID.Zero);
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ namespace Raindrop.Tests.RaindropIntegrationTests.GridSelectorTests
|
||||
yield return SceneLoader.LoadHeadlessScene();
|
||||
|
||||
//at this point, raindropInstance is ready.
|
||||
var instance = ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
var instance = RaindropInstance.GlobalInstance;
|
||||
Assert.True(instance!=null, "instance is null");
|
||||
|
||||
//+++++++++++++finish load test scene+++++++
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Raindrop.Tests.RaindropIntegrationTests.Helpers
|
||||
bootstrap.GetComponent<RaindropBootstrapper>();
|
||||
Assert.True(raindropBootstrapper);
|
||||
|
||||
var instance = ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
var instance = RaindropInstance.GlobalInstance;
|
||||
Assert.True(instance != null);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user