mirror of
https://github.com/RaindropViewer/RaindropViewer.git
synced 2026-08-14 00:57:55 +00:00
added a logout button and messed up the agent location updater
This commit is contained in:
@@ -35,19 +35,27 @@ using Debug = UnityEngine.Debug;
|
||||
|
||||
namespace Raindrop
|
||||
{
|
||||
// this class periodically updated the user movement to the backend.
|
||||
// the backend (Agent Managerr Movement.cs) has a timer that sends the
|
||||
// movment at 2.5 s per movement packet.
|
||||
|
||||
//to have fancy movements, we can add extend this class. (orbit, 3rd person camera movements...)
|
||||
public class RaindropMovement : IDisposable
|
||||
{
|
||||
private RaindropInstance instance;
|
||||
private GridClient client { get { return instance.Client; } }
|
||||
private Timer timer;
|
||||
private Vector3 forward = new Vector3(1, 0, 0);
|
||||
private bool turningLeft = false;
|
||||
private bool turningLeft = false;
|
||||
private bool turningRight = false;
|
||||
private bool movingForward = false;
|
||||
private bool movingBackward = false;
|
||||
private bool movingLeftward = false;
|
||||
private bool movingRightward = false;
|
||||
//private bool modified = false;
|
||||
|
||||
private bool movingForward = false; // ^
|
||||
private bool movingBackward = false; // v
|
||||
private bool movingLeftward = false; // <
|
||||
private bool movingRightward = false; // >
|
||||
|
||||
private bool modified = false;
|
||||
private bool isMoving => movingForward | movingBackward | movingLeftward | movingRightward;
|
||||
|
||||
public bool TurningLeft
|
||||
{
|
||||
@@ -85,11 +93,13 @@ namespace Raindrop
|
||||
turningRight = value;
|
||||
if (value)
|
||||
{
|
||||
//start movement immediate, set up the timer for more updates soon.
|
||||
timer_Elapsed(null, null);
|
||||
timer.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//stop movmeent immiate, stop timer updates.
|
||||
timer.Enabled = false;
|
||||
client.Self.Movement.TurnRight = false;
|
||||
client.Self.Movement.SendUpdate(true);
|
||||
@@ -97,121 +107,7 @@ namespace Raindrop
|
||||
}
|
||||
}
|
||||
|
||||
public bool MovingForward
|
||||
{
|
||||
get
|
||||
{
|
||||
return movingForward;
|
||||
}
|
||||
set
|
||||
{
|
||||
//modified = true;
|
||||
|
||||
//obviously you dont send packets if no change...
|
||||
bool nochange = (value == movingForward);
|
||||
if (nochange) { return; }
|
||||
|
||||
movingForward = value;
|
||||
if (value)
|
||||
{
|
||||
client.Self.Movement.AtPos = true;
|
||||
client.Self.Movement.SendUpdate(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
client.Self.Movement.AtPos = false;
|
||||
client.Self.Movement.SendUpdate(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool MovingBackward
|
||||
{
|
||||
get
|
||||
{
|
||||
return movingBackward;
|
||||
}
|
||||
set
|
||||
{
|
||||
//modified = true;
|
||||
|
||||
//obviously you dont send packets if no change...
|
||||
bool nochange = (value == movingBackward);
|
||||
if (nochange) { return; }
|
||||
|
||||
movingBackward = value;
|
||||
if (value)
|
||||
{
|
||||
client.Self.Movement.AtNeg = true;
|
||||
client.Self.Movement.SendUpdate(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
client.Self.Movement.AtNeg = false;
|
||||
client.Self.Movement.SendUpdate(true);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool MovingLeftward
|
||||
{
|
||||
get
|
||||
{
|
||||
return movingLeftward;
|
||||
}
|
||||
set
|
||||
{
|
||||
//modified = true;
|
||||
|
||||
//obviously you dont send packets if no change...
|
||||
bool nochange = (value == movingLeftward);
|
||||
if (nochange) { return; }
|
||||
|
||||
movingLeftward = value;
|
||||
if (value)
|
||||
{
|
||||
client.Self.Movement.LeftPos = true;
|
||||
client.Self.Movement.SendUpdate(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
client.Self.Movement.LeftPos = false;
|
||||
client.Self.Movement.SendUpdate(true);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool MovingRight
|
||||
{
|
||||
get
|
||||
{
|
||||
return movingRightward;
|
||||
}
|
||||
set
|
||||
{
|
||||
//modified = true;
|
||||
|
||||
//obviously you dont send packets if no change...
|
||||
bool nochange = (value == movingRightward);
|
||||
if (nochange) { return; }
|
||||
|
||||
movingRightward = value;
|
||||
if (value)
|
||||
{
|
||||
client.Self.Movement.LeftNeg = true;
|
||||
client.Self.Movement.SendUpdate(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
client.Self.Movement.LeftNeg= false;
|
||||
client.Self.Movement.SendUpdate(true);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public RaindropMovement(RaindropInstance instance)
|
||||
{
|
||||
this.instance = instance;
|
||||
@@ -244,6 +140,56 @@ namespace Raindrop
|
||||
client.Self.Movement.BodyRotation = client.Self.Movement.BodyRotation * Quaternion.CreateFromAxisAngle(Vector3.UnitZ, -delta);
|
||||
client.Self.Movement.SendUpdate(true);
|
||||
}
|
||||
|
||||
//update every periodic interval if i am still moving.
|
||||
if (isMoving)
|
||||
{
|
||||
client.Self.Movement.SendUpdate(true);
|
||||
}
|
||||
}
|
||||
|
||||
//tell the movement machine that we are moving forward.
|
||||
public void setForward()
|
||||
{
|
||||
client.Self.Movement.AtPos = true;
|
||||
client.Self.Movement.AtNeg = false;
|
||||
}
|
||||
public void setBackward()
|
||||
{
|
||||
client.Self.Movement.AtPos = false;
|
||||
client.Self.Movement.AtNeg = true;
|
||||
}
|
||||
|
||||
public void stopMovementAndSendUpdate()
|
||||
{
|
||||
client.Self.Movement.AtPos = false;
|
||||
client.Self.Movement.AtNeg = false;
|
||||
client.Self.Movement.LeftPos = false;
|
||||
client.Self.Movement.LeftNeg = false;
|
||||
client.Self.Movement.SendUpdate(false);
|
||||
}
|
||||
|
||||
public void setRightward()
|
||||
{
|
||||
client.Self.Movement.LeftPos = false;
|
||||
client.Self.Movement.LeftNeg = true;
|
||||
}
|
||||
public void setLeftward()
|
||||
{
|
||||
client.Self.Movement.LeftPos = true;
|
||||
client.Self.Movement.LeftNeg = false;
|
||||
}
|
||||
|
||||
public void setTurningLeft()
|
||||
{
|
||||
client.Self.Movement.TurnLeft = true;
|
||||
client.Self.Movement.TurnRight = false;
|
||||
}
|
||||
|
||||
public void setTurningRight()
|
||||
{
|
||||
client.Self.Movement.TurnLeft = false;
|
||||
client.Self.Movement.TurnRight = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,7 +298,8 @@ namespace Raindrop
|
||||
|
||||
_netcom = new RaindropNetcom(this);
|
||||
_state = new StateManager(this);
|
||||
_mediaManager = new MediaManager(this);
|
||||
//_mediaManager = new MediaManager(this);
|
||||
|
||||
//commandsManager = new CommandsManager(this);
|
||||
//ContextActionManager = new ContextActionsManager(this);
|
||||
//RegisterContextActions();
|
||||
@@ -351,7 +352,7 @@ namespace Raindrop
|
||||
client.Settings.MAX_CONCURRENT_TEXTURE_DOWNLOADS = 20;
|
||||
|
||||
client.Self.Movement.AutoResetControls = false;
|
||||
client.Self.Movement.UpdateInterval = 2500;
|
||||
client.Self.Movement.UpdateInterval = 2500; //2.5 seconds?
|
||||
|
||||
RegisterClientEvents(client);
|
||||
SetClientTag();
|
||||
@@ -536,12 +537,7 @@ namespace Raindrop
|
||||
//}
|
||||
Logger.Log("RaindropInstance finished cleaning up.", Helpers.LogLevel.Debug);
|
||||
}
|
||||
|
||||
void mainForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
//pluginManager.StartPlugins();
|
||||
}
|
||||
|
||||
|
||||
void netcom_ClientConnected(object sender, EventArgs e)
|
||||
{
|
||||
_client.Self.RequestMuteList();
|
||||
|
||||
@@ -30,6 +30,7 @@ using System.Drawing.Imaging;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Rendering;
|
||||
|
||||
//some base classes that are required for rendering
|
||||
namespace Raindrop.Rendering
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
|
||||
@@ -63,12 +63,10 @@ namespace Raindrop.Services.Bootstrap
|
||||
//1. main instance.
|
||||
CreateAndRegister_RaindropInstance();
|
||||
|
||||
// Application is ready to start, load your main UI.
|
||||
// Instantiate(UIBootstrapper);
|
||||
//set client settings here
|
||||
var client = ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>().Client;
|
||||
// client.Settings.USE_ASSET_CACHE = false;
|
||||
|
||||
// SceneManager.LoadScene("UIscene", LoadSceneMode.Additive); //blocking load required as the UIService will be requested a few lines from now.
|
||||
// SceneManager.LoadScene("3Dscene", LoadSceneMode.Additive);
|
||||
|
||||
//Debug.Log("main Bootstrap finished");
|
||||
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ namespace Raindrop.Services
|
||||
public void initialise()
|
||||
{
|
||||
startUIInitialView();
|
||||
ready = true;
|
||||
}
|
||||
|
||||
protected void startUIInitialView()
|
||||
@@ -139,6 +140,8 @@ namespace Raindrop.Services
|
||||
{
|
||||
modalManager.showModalNotification("Logged out", "you have/were logged out");
|
||||
|
||||
canvasManager.resetToInitialScreen();
|
||||
|
||||
//tsb3D.Enabled = tbtnVoice.Enabled = disconnectToolStripMenuItem.Enabled =
|
||||
//tbtnGroups.Enabled = tbnObjects.Enabled = tbtnWorld.Enabled = tbnTools.Enabled = tmnuImport.Enabled =
|
||||
// tbtnFriends.Enabled = tbtnInventory.Enabled = tbtnSearch.Enabled = tbtnMap.Enabled = false;
|
||||
@@ -173,6 +176,7 @@ namespace Raindrop.Services
|
||||
|
||||
bool firstMoneyNotification = true;
|
||||
private string tlblMoneyBalanceText;
|
||||
public bool ready = false;
|
||||
|
||||
void Self_MoneyBalance(object sender, BalanceEventArgs e)
|
||||
{
|
||||
|
||||
@@ -115,6 +115,17 @@ public class CanvasManager : MonoBehaviour
|
||||
}
|
||||
pushCanvas(theCanvasType);
|
||||
}
|
||||
|
||||
// pop the current login screen, and push the game view. This is for viewing chats offline.
|
||||
// planned for debug only.
|
||||
public void loginWithoutNetworking()
|
||||
{
|
||||
while ((activeCanvasStack.Count() != 0))
|
||||
{
|
||||
activeCanvasStack.Pop();
|
||||
}
|
||||
pushCanvasWithOrWithoutPop("Game", false);
|
||||
}
|
||||
|
||||
|
||||
public void pushCanvas(CanvasType _type)
|
||||
|
||||
@@ -49,15 +49,22 @@ namespace Raindrop.Presenters
|
||||
|
||||
|
||||
#region references to UI elements
|
||||
[Tooltip("button to close the chat view")]
|
||||
public Button CloseButton;
|
||||
[Tooltip("button to send the text box to the chat")]
|
||||
public Button SendButton;
|
||||
|
||||
[Tooltip("list of chats. buttons.")]
|
||||
public GameObject ChatButtonContainer;
|
||||
public List<GameObject> ChatButtons;
|
||||
public GameObject SelectedButton;
|
||||
|
||||
//public GameObject SelectedButton;
|
||||
[Tooltip("user types here.")]
|
||||
public TMP_InputField ChatInputField;
|
||||
|
||||
[Tooltip("show the current chat the user is viewing")]
|
||||
public TMP_Text ChatBox;
|
||||
//wtf is this?
|
||||
public TMPTextFieldPrinter tmp_printer;
|
||||
#endregion
|
||||
|
||||
@@ -202,7 +209,7 @@ namespace Raindrop.Presenters
|
||||
//add button and set transforms
|
||||
var chatButton = Instantiate(buttonPrefab, new Vector3(0, 0, 0), Quaternion.identity);
|
||||
ChatButtons.Add(chatButton);
|
||||
SelectedButton = chatButton;
|
||||
//SelectedButton = chatButton;
|
||||
chatButton.transform.SetParent(ChatButtonContainer.transform);
|
||||
|
||||
//setup internal lcoalchat manager.
|
||||
@@ -242,17 +249,12 @@ namespace Raindrop.Presenters
|
||||
|
||||
private void OnSendBtnClick()
|
||||
{
|
||||
if (selectedChatIdx == -1)
|
||||
{//public chat
|
||||
ProcessChatInput(msgtext, ChatType.Normal);
|
||||
Debug.LogError("ProcessChatInput");
|
||||
return;
|
||||
} else
|
||||
{
|
||||
Debug.LogError("not implemented IM sending yet.");
|
||||
}
|
||||
|
||||
//public chat
|
||||
ProcessChatInput(msgtext, ChatType.Normal);
|
||||
Debug.Log("Sending chat to local");
|
||||
return;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void OnCloseBtnClick()
|
||||
|
||||
@@ -7,77 +7,88 @@ using OpenMetaverse;
|
||||
using Raindrop.Netcom;
|
||||
using Lean.Gui;
|
||||
using Raindrop.ServiceLocator;
|
||||
using Vector2 = UnityEngine.Vector2;
|
||||
|
||||
//make the joystick position drive the user's movement (u,d,l,r) :)
|
||||
public class joystickToMovementBackend : MonoBehaviour
|
||||
{
|
||||
public LeanJoystick variableJoystick;
|
||||
public GameObject theJoystickInScene;
|
||||
public float joyThresh = 0.7f;
|
||||
private RaindropInstance instance { get { return ServiceLocator.Instance.Get<RaindropInstance>(); } }
|
||||
private RaindropNetcom netcom { get { return instance.Netcom; } }
|
||||
private GridClient client { get { return instance.Client; } }
|
||||
|
||||
bool Active => instance.Client.Network.Connected;
|
||||
|
||||
void Awake()
|
||||
void Start()
|
||||
{
|
||||
if (theJoystickInScene.GetComponent<LeanJoystick>() == null)
|
||||
{
|
||||
Debug.LogError("the joystick object is not found!");
|
||||
}
|
||||
variableJoystick = theJoystickInScene.GetComponent<LeanJoystick>();
|
||||
|
||||
//set zero.
|
||||
OnJoyUp();
|
||||
|
||||
variableJoystick.OnUp.AddListener(OnJoyUp);
|
||||
variableJoystick.OnSet.AddListener(OnJoySet);
|
||||
}
|
||||
|
||||
private void OnJoySet(Vector2 arg0)
|
||||
{
|
||||
setWASDMovements(arg0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void setWASDMovements(Vector2 arg0)
|
||||
{
|
||||
float vert = arg0.y;
|
||||
float horz = arg0.x;
|
||||
|
||||
if (vert > joyThresh)
|
||||
{
|
||||
instance.Movement.setForward();
|
||||
}
|
||||
if (vert < -joyThresh)
|
||||
{
|
||||
instance.Movement.setBackward();
|
||||
}
|
||||
|
||||
if (horz > joyThresh)
|
||||
{
|
||||
instance.Movement.setRightward();
|
||||
}
|
||||
if (horz < -joyThresh)
|
||||
{
|
||||
instance.Movement.setLeftward();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// no more sideways movment.
|
||||
private void OnJoyUp()
|
||||
{
|
||||
if (! Active)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
setWASDMovementsZero();
|
||||
|
||||
}
|
||||
|
||||
private void setWASDMovementsZero()
|
||||
{
|
||||
instance.Movement.stopMovementAndSendUpdate();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
//if (! Active)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
|
||||
////do not flood! no setting unless changed.
|
||||
//float vert = variableJoystick.ScaledValue.y;
|
||||
//float horz = variableJoystick.ScaledValue.x;
|
||||
|
||||
//float thresh = 0.7f;
|
||||
//if (vert > thresh)
|
||||
//{
|
||||
// instance.Movement.MovingBackward = false;
|
||||
// instance.Movement.MovingForward = true;
|
||||
|
||||
//}
|
||||
//else if (vert < -thresh)
|
||||
//{
|
||||
// instance.Movement.MovingBackward = true;
|
||||
// instance.Movement.MovingForward = false;
|
||||
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// instance.Movement.MovingBackward = false;
|
||||
// instance.Movement.MovingForward = false;
|
||||
|
||||
//}
|
||||
|
||||
//if (horz > thresh)
|
||||
//{
|
||||
// instance.Movement.TurningLeft = false;
|
||||
// instance.Movement.TurningRight = true;
|
||||
|
||||
//}
|
||||
//else if (horz < -thresh)
|
||||
//{
|
||||
// instance.Movement.TurningLeft = true;
|
||||
// instance.Movement.TurningRight = false;
|
||||
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// instance.Movement.TurningLeft = false;
|
||||
// instance.Movement.TurningRight = false;
|
||||
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class ModalManager : MonoBehaviour
|
||||
// private ModalPresenter eulaModalPresenter;
|
||||
private ModalPresenter loginStatusModal;
|
||||
|
||||
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Raindrop.Presenters
|
||||
public ReactiveProperty<string> Login_msg { get; private set; }
|
||||
private ReactiveProperty<bool> btnLoginEnabled;
|
||||
|
||||
public string uninitialised = "(unknown)";
|
||||
//public string uninitialised = "(unknown)";
|
||||
|
||||
private object lblLoginStatus;
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Raindrop.Presenters
|
||||
RememberCheckbox.OnValueChangedAsObservable().Subscribe(_ => cbRememberBool = _); //when toggle checkbox, set boolean to the same value as the toggle-state
|
||||
TOSCheckbox.OnValueChangedAsObservable().Subscribe(_ => cbTOStrue = _); //when toggle checkbox, set boolean to the same value as the toggle-state
|
||||
|
||||
Login_msg.AsObservable().Where(_ => ! _.Equals(uninitialised)).Subscribe(_ => UpdateModalText(_)); //no bug?
|
||||
Login_msg.AsObservable()./*Where(_ => ! _.Equals(uninitialised)).*/Subscribe(_ => UpdateModalText(_)); //no bug?
|
||||
|
||||
//gridDropdown.OnValueChangedAsObservable().Subscribe(_ => gridSelectedItem = _);
|
||||
//customURLCheckbox.onValueChanged.AsObservable().Subscribe(_ => cbCustomURL = _); //change username property.
|
||||
@@ -121,6 +121,12 @@ namespace Raindrop.Presenters
|
||||
|
||||
private void UpdateModalText(string _)
|
||||
{
|
||||
if (_ == null)
|
||||
return;
|
||||
if (uimanager == null)
|
||||
return;
|
||||
if (!uimanager.ready)
|
||||
return;
|
||||
uimanager.modalManager.setVisibleLoggingInModal(_);
|
||||
}
|
||||
|
||||
@@ -253,7 +259,7 @@ namespace Raindrop.Presenters
|
||||
Password = INIT_PASSWORD;
|
||||
|
||||
//login status message for the modal
|
||||
Login_msg = new ReactiveProperty<string>(uninitialised);
|
||||
Login_msg = new ReactiveProperty<string>("...");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,6 @@ namespace Raindrop.Unity3D
|
||||
agents.Remove(removeEntry);
|
||||
}
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,52 +3,130 @@ using Raindrop.Rendering;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Threading;
|
||||
using UniRx.Triggers;
|
||||
using UE = UnityEngine ;
|
||||
using UnityEngine ;
|
||||
|
||||
namespace Raindrop.Presenters
|
||||
{
|
||||
|
||||
//presents agents in the sim as boxes
|
||||
public class AgentPresenterAndPool : MonoBehaviour
|
||||
{
|
||||
private Dictionary<uint, UnityEngine.GameObject> avatarsGO;
|
||||
public GameObject AgentPrefab;
|
||||
public GameObject MainAgent;
|
||||
|
||||
private object avatarsDictLock = new object();
|
||||
private Dictionary<UUID, UnityEngine.GameObject> avatarsDict
|
||||
= new Dictionary<UUID, GameObject>(); //user UUID -> user gameobject
|
||||
|
||||
private RaindropInstance instance { get { return ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>(); } }
|
||||
//private RaindropNetcom netcom { get { return instance.Netcom; } }
|
||||
bool Active => instance.Client.Network.Connected;
|
||||
|
||||
// Start is called before the first frame update
|
||||
|
||||
void Start()
|
||||
{
|
||||
mainThread = System.Threading.Thread.CurrentThread;
|
||||
instance.Client.Objects.AvatarUpdate += new EventHandler<AvatarUpdateEventArgs>(Objects_AvatarUpdate);
|
||||
}
|
||||
|
||||
|
||||
private bool isOnMainThread()
|
||||
{
|
||||
return mainThread.Equals(System.Threading.Thread.CurrentThread);
|
||||
}
|
||||
|
||||
public Thread mainThread;
|
||||
|
||||
private void Objects_AvatarUpdate(object sender, AvatarUpdateEventArgs e)
|
||||
{
|
||||
if (e.Simulator != instance.Client.Network.CurrentSim)
|
||||
return;
|
||||
|
||||
|
||||
lock (avatarsGO)
|
||||
|
||||
if (isOnMainThread())
|
||||
{
|
||||
if (avatarsGO.ContainsKey(e.Avatar.LocalID))
|
||||
updateAvatar(e);
|
||||
} else
|
||||
{
|
||||
|
||||
UnityMainThreadDispatcher.Instance().Enqueue(() => {
|
||||
Debug.Log(" dispatching of update-avatar to main thread");
|
||||
updateAvatar(e);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//the routine that updates the position of the avatar or creates newly seen avatar
|
||||
private void updateAvatar(AvatarUpdateEventArgs e)
|
||||
{
|
||||
//as avatar tracking is enabled -> thus all of this event is a new avatar that we never seen before
|
||||
|
||||
if (e.Avatar.Name == instance.Client.Self.Name)
|
||||
{
|
||||
UE.Vector3 pos = RHelp.TKVector3(e.Avatar.Position);
|
||||
MainAgent.transform.position = pos;
|
||||
return;
|
||||
}
|
||||
|
||||
lock (avatarsDictLock)
|
||||
{
|
||||
GameObject aviGO = null;
|
||||
avatarsDict.TryGetValue(e.Avatar.ID, out aviGO);
|
||||
|
||||
if (aviGO == null)
|
||||
{
|
||||
//update existing avatar
|
||||
GameObject theavi = avatarsGO[e.Avatar.LocalID];
|
||||
theavi.transform.position = RHelp.TKVector3(e.Avatar.Position);
|
||||
Debug.Log("newly seen avi. rezzing " + e.Avatar.Name);
|
||||
aviGO = CreateAgentGameObject(e.Avatar.Name);
|
||||
|
||||
avatarsDict[e.Avatar.ID] = aviGO;
|
||||
}
|
||||
else
|
||||
{
|
||||
//make new avatar out of this information and add to dict.
|
||||
var newavi = new GameObject();
|
||||
newavi.transform.position = RHelp.TKVector3(e.Avatar.Position);
|
||||
avatarsGO.Add(e.Avatar.LocalID, newavi);
|
||||
|
||||
|
||||
Debug.Log("updating known-avi position. " + e.Avatar.Name);
|
||||
}
|
||||
|
||||
UE.Vector3 pos = RHelp.TKVector3(e.Avatar.Position);
|
||||
aviGO.transform.position = pos;
|
||||
|
||||
//
|
||||
// if (avatarsGO.ContainsKey(e.))
|
||||
// {
|
||||
// //update existing avatar
|
||||
// GameObject theavi = avatarsGO[e.Avatar.LocalID];
|
||||
// theavi.transform.position = RHelp.TKVector3(e.Avatar.Position);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //make new avatar out of this information and add to dict.
|
||||
// var newavi = new GameObject();
|
||||
// newavi.transform.position = RHelp.TKVector3(e.Avatar.Position);
|
||||
// avatarsGO.Add(e.Avatar.LocalID, newavi);
|
||||
//
|
||||
//
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//make the agent:
|
||||
// mesh
|
||||
// nametag
|
||||
// and more ???
|
||||
private GameObject CreateAgentGameObject(string aviname)
|
||||
{
|
||||
GameObject avi = Instantiate(AgentPrefab);
|
||||
|
||||
var nametag = avi.GetComponent<nameTagPresenter>();
|
||||
nametag.setName(aviname);
|
||||
|
||||
return avi;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,7 @@ using OpenMetaverse;
|
||||
using System.Threading;
|
||||
using RenderSettings = Raindrop.Rendering.RenderSettings;
|
||||
using OpenMetaverse.Rendering;
|
||||
using Mesh = UnityEngine.Mesh;
|
||||
|
||||
namespace Raindrop.Unity3D
|
||||
{
|
||||
@@ -32,13 +33,13 @@ namespace Raindrop.Unity3D
|
||||
int[] newTriangles;
|
||||
|
||||
|
||||
public bool Modified = true; //is the terrain data in OSL(backend) modified since our rendering?
|
||||
bool Modified = true; //is the terrain data in OSL(backend) modified since our rendering?
|
||||
float[,] heightTable = new float[256, 256]; //heightmap of terrain
|
||||
bool fetchingTerrainTexture = false; //semaphore for reading terrain tex.
|
||||
bool terrainTextureNeedsUpdate = false; //does the texture need to be redrawn?
|
||||
private OpenMetaverse.Simulator knownCurrentSim;
|
||||
float terrainTimeSinceUpdate = Rendering.RenderSettings.MinimumTimeBetweenTerrainUpdated + 1f; // Update terrain om first run
|
||||
bool terrainInProgress = false;
|
||||
// bool terrainInProgress = false;
|
||||
MeshmerizerR renderer;
|
||||
//private float lastTimeItRendered = 0f;
|
||||
|
||||
@@ -47,7 +48,7 @@ namespace Raindrop.Unity3D
|
||||
Face terrainFace; //seems like a 'face' is the secondlife kind of face (where each prim can have up to 8 faces.)
|
||||
ColorVertex[] terrainVertices;
|
||||
uint[] terrainIndices;
|
||||
private bool lastWorkWasDone = true;
|
||||
private bool terrainMesherIsIdle = true;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -74,7 +75,7 @@ namespace Raindrop.Unity3D
|
||||
{
|
||||
|
||||
|
||||
//Client.Terrain.LandPatchReceived += new EventHandler<LandPatchReceivedEventArgs>(Terrain_LandPatchReceived);
|
||||
Client.Terrain.LandPatchReceived += new EventHandler<LandPatchReceivedEventArgs>(Terrain_LandPatchReceived);
|
||||
|
||||
|
||||
}
|
||||
@@ -112,20 +113,24 @@ namespace Raindrop.Unity3D
|
||||
return;
|
||||
}
|
||||
|
||||
if (instance.Client.Network.CurrentSim != knownCurrentSim) //different sim now.
|
||||
{
|
||||
knownCurrentSim = instance.Client.Network.CurrentSim;
|
||||
ResetTerrain();
|
||||
}
|
||||
ResetIfSimChanged();
|
||||
|
||||
|
||||
if (terrainTextureNeedsUpdate)
|
||||
{
|
||||
UpdateTerrainTexture();
|
||||
}
|
||||
//
|
||||
// if (terrainTextureNeedsUpdate)
|
||||
// {
|
||||
// UpdateTerrainTexture();
|
||||
// }
|
||||
|
||||
render(Time.deltaTime);
|
||||
|
||||
void ResetIfSimChanged()
|
||||
{
|
||||
if (instance.Client.Network.CurrentSim != knownCurrentSim) //different sim now.
|
||||
{
|
||||
knownCurrentSim = instance.Client.Network.CurrentSim;
|
||||
ResetTerrainTex();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//this performs re-meshing and re-texturing. ONLY IF MODIFIED and sufficient time elapsed.
|
||||
@@ -133,7 +138,7 @@ namespace Raindrop.Unity3D
|
||||
{
|
||||
terrainTimeSinceUpdate += timeSinceLastFrame;
|
||||
|
||||
if (lastWorkWasDone == false)
|
||||
if (terrainMesherIsIdle == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -155,17 +160,14 @@ namespace Raindrop.Unity3D
|
||||
{
|
||||
Debug.Log("Processing new rendering of terrain!");
|
||||
|
||||
if (!terrainInProgress)
|
||||
{
|
||||
terrainInProgress = true;
|
||||
ResetTerrain(/*false*/);
|
||||
terrainMesherIsIdle = false;
|
||||
//ResetTerrainTex(/*false*/);
|
||||
UpdateTerrain();
|
||||
}
|
||||
}
|
||||
|
||||
if (terrainTextureNeedsUpdate)
|
||||
{
|
||||
UpdateTerrainTexture();
|
||||
//PaintTerrain();
|
||||
}
|
||||
|
||||
|
||||
@@ -196,10 +198,10 @@ namespace Raindrop.Unity3D
|
||||
ThreadPool.QueueUserWorkItem(sync =>
|
||||
{
|
||||
|
||||
lastWorkWasDone = false;
|
||||
terrainMesherIsIdle = false;
|
||||
Debug.Log("QueueUserWorkItem");
|
||||
// 1. generate heightTable from patches in memory.
|
||||
int step = 1;
|
||||
|
||||
for (int x = 0; x < 256; x += step)
|
||||
{
|
||||
for (int y = 0; y < 256; y += step)
|
||||
@@ -217,42 +219,53 @@ namespace Raindrop.Unity3D
|
||||
}
|
||||
Debug.Log("finished terrain height work!");
|
||||
|
||||
// 2. create mesh-face from heighttable, using the meshmeriser.
|
||||
terrainFace = renderer.TerrainMesh(heightTable, 0f, 255f, 0f, 255f); //generate mesh with heights //the result is a huge struct 'Face'
|
||||
|
||||
Debug.Log("terrainFace geenerated");
|
||||
//generate mesh with colors
|
||||
terrainVertices = new ColorVertex[terrainFace.Vertices.Count];
|
||||
for (int i = 0; i < terrainFace.Vertices.Count; i++) //for each vert in terrainFace, append the vert to terraiVerticies
|
||||
{
|
||||
byte[] part = Utils.IntToBytes(i);
|
||||
terrainVertices[i] = new ColorVertex()
|
||||
{
|
||||
Vertex = terrainFace.Vertices[i],
|
||||
Color = new Color4b()
|
||||
{
|
||||
R = part[0],
|
||||
G = part[1],
|
||||
B = part[2],
|
||||
A = 253 // terrain picking
|
||||
}
|
||||
};
|
||||
}
|
||||
terrainIndices = new uint[terrainFace.Indices.Count];
|
||||
for (int i = 0; i < terrainIndices.Length; i++)
|
||||
{
|
||||
terrainIndices[i] = terrainFace.Indices[i];
|
||||
}
|
||||
terrainInProgress = false;
|
||||
Modified = false;
|
||||
terrainTextureNeedsUpdate = true;
|
||||
terrainTimeSinceUpdate = 0f;
|
||||
|
||||
// 3. painting the face. we use ColorVertex objects to represent the color of the vertices of the terrain face.
|
||||
// terrainVertices = new ColorVertex[terrainFace.Vertices.Count];
|
||||
// for (int i = 0; i < terrainFace.Vertices.Count; i++) //for each vert in terrainFace, append the vert to terraiVerticies
|
||||
// {
|
||||
// byte[] part = Utils.IntToBytes(i); // i = 0x 0000 0000 0000 0000 0000 0000 0000 0000 - 32 bits / 4 bytes.
|
||||
// terrainVertices[i] = new ColorVertex()
|
||||
// {
|
||||
// Vertex = terrainFace.Vertices[i],
|
||||
// Color = new Color4b()
|
||||
// {
|
||||
// R = part[0],
|
||||
// G = part[1],
|
||||
// B = part[2],
|
||||
// A = 253 // terrain picking
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
// terrainIndices = new uint[terrainFace.Indices.Count];
|
||||
// for (int i = 0; i < terrainIndices.Length; i++)
|
||||
// {
|
||||
// terrainIndices[i] = terrainFace.Indices[i];
|
||||
// }
|
||||
// Modified = false;
|
||||
// //terrainTextureNeedsUpdate = true;
|
||||
// terrainTimeSinceUpdate = 0f;
|
||||
//
|
||||
// terrainMesherIsIdle = true;
|
||||
|
||||
// 4. apply this face-mesh to the gameobject's mesh component.
|
||||
setMesh(ref terrainMesh, terrainFace);
|
||||
|
||||
lastWorkWasDone = true;
|
||||
});
|
||||
}
|
||||
|
||||
private void setMesh(ref Mesh mesh, Face face)
|
||||
{
|
||||
//todo
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
//delete terrain tex
|
||||
private void ResetTerrain()
|
||||
private void ResetTerrainTex()
|
||||
{
|
||||
if (terrainImage != null)
|
||||
{
|
||||
@@ -268,7 +281,7 @@ namespace Raindrop.Unity3D
|
||||
}
|
||||
|
||||
|
||||
void UpdateTerrainTexture()
|
||||
void PaintTerrain()
|
||||
{
|
||||
if (!fetchingTerrainTexture)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class nameTagPresenter : MonoBehaviour
|
||||
{
|
||||
public TextMesh tm;
|
||||
|
||||
|
||||
|
||||
public void setName(string aviname)
|
||||
{
|
||||
tm.text = aviname;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6b29b2bb8e2b8c49b008fcd0f27e4c7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+507
-252
File diff suppressed because it is too large
Load Diff
+1399
-433
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,139 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &656262640871857040
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2936312484414191414}
|
||||
- component: {fileID: 7086636225613846425}
|
||||
- component: {fileID: 1715235872856988920}
|
||||
m_Layer: 5
|
||||
m_Name: Text (TMP)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &2936312484414191414
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 656262640871857040}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4000207759485342017}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7086636225613846425
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 656262640871857040}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &1715235872856988920
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 656262640871857040}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: Login without the network (view chats saved in phone.)
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4281479730
|
||||
m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
topLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
topRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_fontColorGradientPreset: {fileID: 0}
|
||||
m_spriteAsset: {fileID: 0}
|
||||
m_tintAllSprites: 0
|
||||
m_StyleSheet: {fileID: 0}
|
||||
m_TextStyleHashCode: -1183493901
|
||||
m_overrideHtmlColors: 0
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 36.27
|
||||
m_fontSizeBase: 36.27
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 0
|
||||
m_fontSizeMax: 0
|
||||
m_fontStyle: 0
|
||||
m_HorizontalAlignment: 2
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_enableWordWrapping: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 0
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_parseCtrlCharacters: 1
|
||||
m_isOrthographic: 1
|
||||
m_isCullingEnabled: 0
|
||||
m_horizontalMapping: 0
|
||||
m_verticalMapping: 0
|
||||
m_uvLineOffset: 0
|
||||
m_geometrySortingOrder: 0
|
||||
m_IsTextObjectScaleStatic: 0
|
||||
m_VertexBufferAutoSizeReduction: 0
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!1 &1141797016919610140
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -75,6 +209,139 @@ MonoBehaviour:
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &3775511210413060700
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4000207759485342017}
|
||||
- component: {fileID: 9070887963873109881}
|
||||
- component: {fileID: 1122330574146285983}
|
||||
- component: {fileID: 1667866890351966123}
|
||||
m_Layer: 5
|
||||
m_Name: LoginBtnOverride
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &4000207759485342017
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3775511210413060700}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 2936312484414191414}
|
||||
m_Father: {fileID: 4000849117327746565}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 1198, y: -205}
|
||||
m_SizeDelta: {x: 227.9186, y: 333.2573}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &9070887963873109881
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3775511210413060700}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &1122330574146285983
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3775511210413060700}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &1667866890351966123
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3775511210413060700}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 0.75513566, b: 0.044025064, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 1122330574146285983}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 0}
|
||||
m_TargetAssemblyTypeName:
|
||||
m_MethodName:
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName:
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
--- !u!1 &4000849116734926424
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -2049,6 +2316,7 @@ RectTransform:
|
||||
- {fileID: 4000849118651321683}
|
||||
- {fileID: 4000849117609312322}
|
||||
- {fileID: 4000849116890187672}
|
||||
- {fileID: 4000207759485342017}
|
||||
m_Father: {fileID: 4000849118368597045}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
using Raindrop;
|
||||
using UnityEngine;
|
||||
using Raindrop.Netcom;
|
||||
using Raindrop.ServiceLocator;
|
||||
using UnityEngine.UI;
|
||||
|
||||
// change the color of the image to red or green based on connection to server.
|
||||
[RequireComponent(typeof(Image))]
|
||||
public class connectivityUI : MonoBehaviour
|
||||
{
|
||||
|
||||
void Start()
|
||||
{
|
||||
notConnected();
|
||||
|
||||
var _instance = ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
_instance.Netcom.ClientLoginStatus += NetcomOnClientLoginStatus;
|
||||
_instance.Netcom.ClientLoggedOut += NetcomOnClientLoggedOut;
|
||||
|
||||
}
|
||||
|
||||
private void NetcomOnClientLoggedOut(object sender, EventArgs e)
|
||||
{
|
||||
notConnected();
|
||||
}
|
||||
|
||||
private void NetcomOnClientLoginStatus(object sender, LoginProgressEventArgs e)
|
||||
{
|
||||
if (e.Status == LoginStatus.Success)
|
||||
{
|
||||
yesConnected();
|
||||
}
|
||||
else if (e.Status == LoginStatus.Failed)
|
||||
{
|
||||
notConnected();
|
||||
}
|
||||
}
|
||||
|
||||
private void notConnected()
|
||||
{
|
||||
this.GetComponent<Image>().color = Color.red;
|
||||
}
|
||||
private void yesConnected()
|
||||
{
|
||||
this.GetComponent<Image>().color = Color.green;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d60ab10a4b9fa8e48a346e34a37e512e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,46 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Lean.Gui;
|
||||
using Raindrop;
|
||||
using Raindrop.ServiceLocator;
|
||||
using UnityEngine;
|
||||
|
||||
// currently, this turns the character. in the future, we will use this as input the the 3rd person camera controller.
|
||||
|
||||
[RequireComponent(typeof(LeanJoystick))]
|
||||
public class joystickToCameraBackend : MonoBehaviour
|
||||
{
|
||||
LeanJoystick joy;
|
||||
private RaindropInstance instance;
|
||||
public float thresh = 0.7f;
|
||||
|
||||
void Start()
|
||||
{
|
||||
joy = this.gameObject.GetComponent<LeanJoystick>();
|
||||
joy.OnSet.AddListener(OnJoySet);
|
||||
|
||||
instance = ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
}
|
||||
|
||||
private void OnJoySet(Vector2 arg0)
|
||||
{
|
||||
float vert = arg0.y;
|
||||
float horz = arg0.x;
|
||||
|
||||
if (Mathf.Abs(horz) > thresh)
|
||||
{
|
||||
//process vertical camera movment.
|
||||
if (horz > 0)
|
||||
{
|
||||
instance.Movement.setTurningLeft();
|
||||
}
|
||||
else
|
||||
{
|
||||
instance.Movement.setTurningRight();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10d6c5679cacf1d4e80421f665a50371
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,26 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Raindrop;
|
||||
using Raindrop.ServiceLocator;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
|
||||
[RequireComponent(typeof(Button))]
|
||||
public class logoutButton : MonoBehaviour
|
||||
{
|
||||
|
||||
void Start()
|
||||
{
|
||||
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();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a89bf46e4fd933b42a4cb4a49910fe00
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5291819f184de164c90c09f51c8ae8b2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,207 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &3767279658298423867
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2145357367057657423}
|
||||
- component: {fileID: 6270978613980838506}
|
||||
- component: {fileID: 4263168154616483493}
|
||||
- component: {fileID: 1271366560738967570}
|
||||
- component: {fileID: 6769652233357756075}
|
||||
m_Layer: 7
|
||||
m_Name: AgentPrototype
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &2145357367057657423
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3767279658298423867}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 3, y: 0, z: 1}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 6426211062083564601}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &6270978613980838506
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3767279658298423867}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &4263168154616483493
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3767279658298423867}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!65 &1271366560738967570
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3767279658298423867}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 1, y: 1, z: 1}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &6769652233357756075
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3767279658298423867}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d6b29b2bb8e2b8c49b008fcd0f27e4c7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
tm: {fileID: 1215507854730738474}
|
||||
--- !u!1 &8737598692518959133
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6426211062083564601}
|
||||
- component: {fileID: 4574116789423547262}
|
||||
- component: {fileID: 1215507854730738474}
|
||||
m_Layer: 7
|
||||
m_Name: Nametag
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &6426211062083564601
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8737598692518959133}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1.777, z: 0}
|
||||
m_LocalScale: {x: 0.2, y: 0.2, z: 0.2}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 2145357367057657423}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &4574116789423547262
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8737598692518959133}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!102 &1215507854730738474
|
||||
TextMesh:
|
||||
serializedVersion: 3
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8737598692518959133}
|
||||
m_Text: AvatarName
|
||||
m_OffsetZ: 0
|
||||
m_CharacterSize: 1
|
||||
m_LineSpacing: 1
|
||||
m_Anchor: 4
|
||||
m_Alignment: 0
|
||||
m_TabSize: 4
|
||||
m_FontSize: 0
|
||||
m_FontStyle: 0
|
||||
m_RichText: 1
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_Color:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cfe12f7ee96c31241ac9858db2bb167c
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,45 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
using Raindrop;
|
||||
using Raindrop.ServiceLocator;
|
||||
using UnityEngine;
|
||||
|
||||
//this one have bug : update does not run when disabled.
|
||||
public class toggleInteractivityBasedOnConnectionStatus : MonoBehaviour
|
||||
{
|
||||
private RaindropInstance _instance;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
notConnected();
|
||||
|
||||
_instance = ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
}
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (_instance.Client.Network.Connected == false)
|
||||
{
|
||||
notConnected();
|
||||
}
|
||||
else
|
||||
{
|
||||
yesConnected();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void notConnected()
|
||||
{
|
||||
this.gameObject.SetActive(false);
|
||||
}
|
||||
private void yesConnected()
|
||||
{
|
||||
this.gameObject.SetActive(true);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b673a61eebaf27a4d8bd620fa97780de
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -12,7 +12,7 @@ TagManager:
|
||||
- Water
|
||||
- UI
|
||||
- Minimap
|
||||
-
|
||||
- 3DScene
|
||||
-
|
||||
-
|
||||
-
|
||||
|
||||
Reference in New Issue
Block a user