mirror of
https://github.com/RaindropViewer/RaindropViewer.git
synced 2026-07-27 22:11:39 +00:00
added functionality to print text to the main chat box. you can try it out in the chatview, click the SENDbutton
This commit is contained in:
@@ -13,6 +13,7 @@ GameObject:
|
||||
- component: {fileID: 9160917217469581314}
|
||||
- component: {fileID: 9160917217469581315}
|
||||
- component: {fileID: 9160917217469581312}
|
||||
- component: {fileID: 2200992579668676165}
|
||||
m_Layer: 5
|
||||
m_Name: ChatButton
|
||||
m_TagString: Untagged
|
||||
@@ -129,7 +130,7 @@ MonoBehaviour:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 9160917217469581326}
|
||||
m_Enabled: 1
|
||||
m_Enabled: 0
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
|
||||
m_Name:
|
||||
@@ -142,6 +143,21 @@ MonoBehaviour:
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
--- !u!114 &2200992579668676165
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 9160917217469581326}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3519366cc6f6159448e93458bcd34783, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
nameOfChat:
|
||||
chatPane: {fileID: 0}
|
||||
isSelected: 0
|
||||
--- !u!1 &9160917218642360352
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using OpenMetaverse.Packets;
|
||||
using UnityEngine;
|
||||
|
||||
namespace OpenMetaverse
|
||||
{
|
||||
@@ -598,6 +599,8 @@ namespace OpenMetaverse
|
||||
/// <param name="simulator">Simulator to send the update to</param>
|
||||
public void SendUpdate(bool reliable, Simulator simulator)
|
||||
{
|
||||
Debug.Log("sending movement packet.");
|
||||
|
||||
// Since version 1.40.4 of the Linden simulator, sending this update
|
||||
// causes corruption of the agent position in the simulator
|
||||
if (simulator != null && (!simulator.AgentMovementComplete))
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
using System;
|
||||
using OpenMetaverse;
|
||||
using System.Collections.Generic;
|
||||
using Raindrop.Services;
|
||||
|
||||
namespace Raindrop
|
||||
{
|
||||
@@ -39,30 +40,35 @@ namespace Raindrop
|
||||
// equivalent to a chat window with all the tabs and chats the user is chatting in.
|
||||
public class ChatManager
|
||||
{
|
||||
public ChatTextManager localChatManager { get; private set; } //TODO: refactor this class to become model. UI can access data in the model as required.
|
||||
//public List<IMTextManager> IMManagerList { get; private set; }
|
||||
public ChatTextManager localChatManager { get; private set; }
|
||||
|
||||
RaindropInstance instance;
|
||||
GridClient client { get { return instance.Client; } }
|
||||
|
||||
//this is the main chat.
|
||||
private string mainChatStringReference;
|
||||
|
||||
|
||||
public ChatManager(RaindropInstance instance)
|
||||
|
||||
public ChatManager(RaindropInstance instance, ITextPrinter textPrinter)
|
||||
{
|
||||
instance = this.instance;
|
||||
this.instance = instance;
|
||||
TextPrinter = textPrinter;
|
||||
|
||||
UnityEngine.Debug.Log("chatmanager being constructed");
|
||||
//setup
|
||||
|
||||
//start local chat if connected to localsim
|
||||
instance.Client.Network.SimConnected += Network_SimConnected;
|
||||
instance.Client.Network.Disconnected += Network_Disconnected;
|
||||
|
||||
//make the chat manager. (seems like we destroy it on disconnection.)
|
||||
localChatManager = new ChatTextManager(instance, TextPrinter);
|
||||
|
||||
//subscribe to localchat received event
|
||||
// localChatManager.ChatLineAdded += LocalChatManager_ChatLineAdded;
|
||||
}
|
||||
|
||||
public ITextPrinter TextPrinter { get; set; }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
localChatManager = null;
|
||||
@@ -83,23 +89,27 @@ namespace Raindrop
|
||||
Logger.Log("Simulator Connected", Helpers.LogLevel.Info);
|
||||
|
||||
if (localChatManager == null)
|
||||
localChatManager = new ChatTextManager(instance, ref mainChatStringReference);
|
||||
localChatManager = new ChatTextManager(instance, TextPrinter);
|
||||
Logger.Log("creating local chat in memory.", Helpers.LogLevel.Info);
|
||||
|
||||
printToMainChat("Simulator Connected");
|
||||
}
|
||||
|
||||
public void printToMainChat(string message)
|
||||
{
|
||||
//print success msg.
|
||||
ChatBufferItem line = new ChatBufferItem(
|
||||
DateTime.Now,
|
||||
string.Empty,
|
||||
UUID.Zero,
|
||||
"Simulator Connected",
|
||||
message,
|
||||
ChatBufferTextStyle.Normal
|
||||
);
|
||||
localChatManager.ProcessBufferItem(line, true);
|
||||
|
||||
UnityMainThreadDispatcher.Instance().Enqueue(() =>
|
||||
{
|
||||
//process printing in main thread.
|
||||
localChatManager.ProcessBufferItem(line, true);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -60,9 +60,9 @@ namespace Raindrop
|
||||
|
||||
//public static Dictionary<string, Settings.FontSetting> fontSettings = new Dictionary<string, Settings.FontSetting>();
|
||||
|
||||
public ChatTextManager(RaindropInstance instance, ref string localChat)
|
||||
public ChatTextManager(RaindropInstance instance, ITextPrinter textPrinter)
|
||||
{
|
||||
//TextPrinter = textPrinter;
|
||||
TextPrinter = textPrinter;
|
||||
textBuffer = new List<ChatBufferItem>(); // a pipe into the string.
|
||||
|
||||
|
||||
@@ -187,77 +187,22 @@ namespace Raindrop
|
||||
// put the buffer item into the chat string.
|
||||
public void ProcessBufferItem(ChatBufferItem item, bool addToBuffer)
|
||||
{
|
||||
// tell the world that a chat line is added.
|
||||
ChatLineAdded?.Invoke(this, new ChatLineAddedArgs(item));
|
||||
|
||||
lock (SyncChat)
|
||||
{
|
||||
this.localChat += ((string)(item.From + item.Text)); //ok... it seems, the list of chatbufferitem is like each line of the chat. This helps us iterate thru each line of chat in a sane fashion. i see. This can enable scrolling iteratively, like array.
|
||||
instance.LogClientMessage("chat.txt", item.From + item.Text);
|
||||
|
||||
return; //for now...
|
||||
|
||||
if (addToBuffer) textBuffer.Add(item);
|
||||
|
||||
if (showTimestamps)
|
||||
{
|
||||
//if(fontSettings.ContainsKey("Timestamp"))
|
||||
//{
|
||||
// var fontSetting = fontSettings["Timestamp"];
|
||||
// TextPrinter.ForeColor = fontSetting.ForeColor;
|
||||
// TextPrinter.BackColor = fontSetting.BackColor;
|
||||
// TextPrinter.Font = fontSetting.Font;
|
||||
// TextPrinter.PrintText(item.Timestamp.ToString("[HH:mm] "));
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
//TextPrinter.ForeColor = SystemColors.GrayText;
|
||||
//TextPrinter.BackColor = Color.Transparent;
|
||||
//TextPrinter.Font = Settings.FontSetting.DefaultFont;
|
||||
//TextPrinter.PrintText(item.Timestamp.ToString("[HH:mm] "));
|
||||
//}
|
||||
}
|
||||
|
||||
//if(fontSettings.ContainsKey("Name"))
|
||||
//{
|
||||
// var fontSetting = fontSettings["Name"];
|
||||
// TextPrinter.ForeColor = fontSetting.ForeColor;
|
||||
// TextPrinter.BackColor = fontSetting.BackColor;
|
||||
// TextPrinter.Font = fontSetting.Font;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
//TextPrinter.ForeColor = SystemColors.WindowText;
|
||||
//TextPrinter.BackColor = Color.Transparent;
|
||||
//TextPrinter.Font = Settings.FontSetting.DefaultFont;
|
||||
//}
|
||||
|
||||
if (item.Style == ChatBufferTextStyle.Normal && item.ID != UUID.Zero && instance.GlobalSettings["av_name_link"])
|
||||
{
|
||||
//TextPrinter.InsertLink(item.From, $"secondlife:///app/agent/{item.ID}/about");
|
||||
}
|
||||
else
|
||||
{
|
||||
//TextPrinter.PrintText(item.From);
|
||||
}
|
||||
|
||||
//if(fontSettings.ContainsKey(item.Style.ToString()))
|
||||
//{
|
||||
// var fontSetting = fontSettings[item.Style.ToString()];
|
||||
// TextPrinter.ForeColor = fontSetting.ForeColor;
|
||||
// TextPrinter.BackColor = fontSetting.BackColor;
|
||||
// TextPrinter.Font = fontSetting.Font;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// TextPrinter.ForeColor = SystemColors.WindowText;
|
||||
// TextPrinter.BackColor = Color.Transparent;
|
||||
// TextPrinter.Font = Settings.FontSetting.DefaultFont;
|
||||
//}
|
||||
//TextPrinter.PrintTextLine(item.Text);
|
||||
TextPrinter.PrintText(item.Timestamp.ToString("[HH:mm] "));
|
||||
TextPrinter.PrintText(item.From);
|
||||
TextPrinter.PrintTextLine(item.Text);
|
||||
}
|
||||
|
||||
ChatLineAdded?.Invoke(this, new ChatLineAddedArgs(item));
|
||||
}
|
||||
|
||||
public ITextPrinter TextPrinter { get; set; }
|
||||
|
||||
//process sending-out of local chat
|
||||
internal void ProcessChatInput(string input, ChatType type)
|
||||
{
|
||||
|
||||
@@ -49,41 +49,43 @@ namespace Raindrop
|
||||
private Vector3 forward = new Vector3(1, 0, 0);
|
||||
private bool turningLeft = false;
|
||||
private bool turningRight = false;
|
||||
|
||||
public bool TurningLeft
|
||||
private uint _prev;
|
||||
|
||||
public void TurningRight()
|
||||
{
|
||||
get => turningLeft;
|
||||
set {
|
||||
turningLeft = value;
|
||||
if (value) {
|
||||
timer_Elapsed(null, null);
|
||||
timer.Enabled = true;
|
||||
} else {
|
||||
timer.Enabled = false;
|
||||
client.Self.Movement.TurnLeft = false;
|
||||
client.Self.Movement.SendUpdate(true);
|
||||
}
|
||||
}
|
||||
turningRight = true;
|
||||
turningLeft = false;
|
||||
//start turning
|
||||
TurnStart();
|
||||
}
|
||||
|
||||
public bool TurningRight
|
||||
public void TurningLeft()
|
||||
{
|
||||
get => turningRight;
|
||||
set
|
||||
{
|
||||
turningRight = value;
|
||||
if (value) {
|
||||
timer_Elapsed(null, null);
|
||||
timer.Enabled = true;
|
||||
} else {
|
||||
timer.Enabled = false;
|
||||
client.Self.Movement.TurnRight = false;
|
||||
client.Self.Movement.SendUpdate(true);
|
||||
}
|
||||
}
|
||||
turningRight = false;
|
||||
turningLeft = true;
|
||||
//start turning
|
||||
TurnStart();
|
||||
}
|
||||
public void TurningStop()
|
||||
{
|
||||
turningRight = false;
|
||||
turningLeft = false;
|
||||
//start turning
|
||||
TurnStop();
|
||||
}
|
||||
|
||||
|
||||
private void TurnStart()
|
||||
{
|
||||
timer_Elapsed(null, null);
|
||||
timer.Enabled = true; //this timer is only required for turning.
|
||||
}
|
||||
private void TurnStop()
|
||||
{
|
||||
timer.Enabled = false;
|
||||
SendMovementPacketIfChanged();
|
||||
}
|
||||
|
||||
|
||||
public RaindropMovement(RaindropInstance instance)
|
||||
{
|
||||
this.instance = instance;
|
||||
@@ -106,11 +108,18 @@ namespace Raindrop
|
||||
if (turningLeft) {
|
||||
client.Self.Movement.TurnLeft = true;
|
||||
client.Self.Movement.BodyRotation = client.Self.Movement.BodyRotation * Quaternion.CreateFromAxisAngle(Vector3.UnitZ, delta);
|
||||
client.Self.Movement.SendUpdate(true);
|
||||
|
||||
SendMovementPacketIfChanged();
|
||||
} else if (turningRight) {
|
||||
client.Self.Movement.TurnRight = true;
|
||||
// client.Self.Movement.TurnRight = true;
|
||||
client.Self.Movement.BodyRotation = client.Self.Movement.BodyRotation * Quaternion.CreateFromAxisAngle(Vector3.UnitZ, -delta);
|
||||
client.Self.Movement.SendUpdate(true);
|
||||
|
||||
SendMovementPacketIfChanged();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
SendMovementPacketIfChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,15 +146,6 @@ namespace Raindrop
|
||||
client.Self.Movement.LeftNeg = false;
|
||||
}
|
||||
|
||||
public void setTurningLeft()
|
||||
{
|
||||
TurningLeft = true;
|
||||
}
|
||||
|
||||
public void setTurningRight()
|
||||
{
|
||||
TurningRight = true;
|
||||
}
|
||||
|
||||
// stop moving.
|
||||
public void zero2DInput()
|
||||
@@ -154,7 +154,8 @@ namespace Raindrop
|
||||
client.Self.Movement.AtNeg = false;
|
||||
client.Self.Movement.LeftPos = false;
|
||||
client.Self.Movement.LeftNeg = false;
|
||||
client.Self.Movement.SendUpdate(true);
|
||||
|
||||
SendMovementPacketIfChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +163,7 @@ namespace Raindrop
|
||||
{
|
||||
//note: is impossible to be no movement due to that is being handled by zero2DInput.
|
||||
|
||||
uint prev = client.Self.Movement.AgentControls;
|
||||
|
||||
|
||||
bool isUp = arg0.y > 0;
|
||||
bool isDown = arg0.y < 0;
|
||||
@@ -189,9 +190,15 @@ namespace Raindrop
|
||||
setLeftward();
|
||||
}
|
||||
|
||||
SendMovementPacketIfChanged();
|
||||
}
|
||||
|
||||
private void SendMovementPacketIfChanged()
|
||||
{
|
||||
var present = client.Self.Movement.AgentControls;
|
||||
if (prev != present)
|
||||
if (_prev != present)
|
||||
{
|
||||
_prev = client.Self.Movement.AgentControls;
|
||||
client.Self.Movement.SendUpdate(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,10 +9,7 @@ namespace Raindrop.Services.Bootstrap
|
||||
//show the first UI panel to the user.
|
||||
class UIBootstrapper : MonoBehaviour
|
||||
{
|
||||
public bool UI_Is_on = false;
|
||||
|
||||
private RaindropInstance instance => ServiceLocator.ServiceLocator.Instance.Get<RaindropInstance>();
|
||||
|
||||
private RaindropNetcom netcom => instance.Netcom;
|
||||
|
||||
// bootstraps in order to obtain the canvasmanager instance.
|
||||
@@ -45,19 +42,12 @@ namespace Raindrop.Services.Bootstrap
|
||||
//return;
|
||||
}
|
||||
|
||||
bool success = false;
|
||||
var cm = GetComponentInChildren<CanvasManager>();
|
||||
if (cm == null) Debug.LogError("canvasmanager not present");
|
||||
var mm = GetComponentInChildren<ModalManager>();
|
||||
if (mm == null) Debug.LogError("modalmanager not present");
|
||||
|
||||
ServiceLocator.ServiceLocator.Instance.Register<UIService>(new UIService(cm, mm));
|
||||
|
||||
|
||||
// in start, lauch the ui.
|
||||
|
||||
// if (UI_Is_on)
|
||||
// ServiceLocator.ServiceLocator.Instance.Get<UIService>().init();
|
||||
}
|
||||
|
||||
|
||||
@@ -72,21 +62,6 @@ namespace Raindrop.Services.Bootstrap
|
||||
// statusTimer = null;
|
||||
//}
|
||||
|
||||
//if (MediaConsole != null)
|
||||
//{
|
||||
// if (TabConsole.TabExists("media"))
|
||||
// {
|
||||
// TabConsole.Tabs["media"].AllowClose = true;
|
||||
// TabConsole.Tabs["media"].Close();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// MediaConsole.Dispose();
|
||||
// }
|
||||
// MediaConsole = null;
|
||||
// if (MessageBox.Show("Are you sure you
|
||||
//}
|
||||
|
||||
if (!netcom.IsLoggedIn) return;
|
||||
|
||||
Thread saveInvToDisk = new Thread(delegate ()
|
||||
@@ -111,16 +86,13 @@ namespace Raindrop.Services.Bootstrap
|
||||
{
|
||||
if (netcom != null)
|
||||
{
|
||||
//netcom = null;
|
||||
//netcom.ClientLoginStatus -= new EventHandler<LoginProgressEventArgs>(netcom_ClientLoginStatus);
|
||||
//netcom.ClientLoggedOut -= new EventHandler(netcom_ClientLoggedOut);
|
||||
//netcom.ClientDisconnected -= new EventHandler<DisconnectedEventArgs>(netcom_ClientDisconnected);
|
||||
netcom.Dispose();
|
||||
}
|
||||
|
||||
//if (instance.Client != null)
|
||||
//{
|
||||
// UnregisterClientEvents(client);
|
||||
//}
|
||||
//
|
||||
// if (instance.Client != null)
|
||||
// {
|
||||
// instance.UnregisterClientEvents(client);
|
||||
// }
|
||||
|
||||
//if (instance?.Names != null)
|
||||
//{
|
||||
@@ -129,5 +101,6 @@ namespace Raindrop.Services.Bootstrap
|
||||
|
||||
instance.CleanUp();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,16 @@ using UnityEngine.UI;
|
||||
namespace Raindrop.Presenters
|
||||
{
|
||||
//controls and handles input from chat buttons.
|
||||
//this is attached to a chat button
|
||||
[RequireComponent(typeof(Button))]
|
||||
public class ChatButtonPresenter : MonoBehaviour
|
||||
{
|
||||
//name to display.
|
||||
public string nameOfChat;
|
||||
public IMTextManager manager; //it makes sense for a chat tab to hold the chat manager instance.
|
||||
public ChatPresenter chatPane; //it also makes sense that the chat tab holds the right side panel.. i think
|
||||
//the chat button holds the printer for the chat window.
|
||||
public IMTextManager manager;
|
||||
|
||||
public ChatPresenter chatPane;
|
||||
public bool isSelected;
|
||||
|
||||
// Start is called before the first frame update
|
||||
|
||||
@@ -21,7 +21,8 @@ using Vector3 = UnityEngine.Vector3;
|
||||
//view(unitytext) -- presenter(this) -- controller(this?) -- model (raindropinstance singleton)
|
||||
namespace Raindrop.Presenters
|
||||
{
|
||||
|
||||
//this class is attached to the chatview gameobject.
|
||||
//it launches the manager that takes care of incoming and outgoing chats.
|
||||
public class ChatPresenter : MonoBehaviour
|
||||
{
|
||||
//left pane: scrollable list of chats.
|
||||
@@ -36,11 +37,6 @@ namespace Raindrop.Presenters
|
||||
bool Active => instance.Client.Network.Connected;
|
||||
|
||||
private ChatManager chatManager;
|
||||
|
||||
|
||||
|
||||
//private List<IMPresenter> listOfIMpanels;
|
||||
//private IMPresenter selectedChatLog;
|
||||
|
||||
public readonly Dictionary<UUID, ulong> agentSimHandle = new Dictionary<UUID, ulong>();
|
||||
private static readonly string LOCALCHATTITLE = "Local Chat";
|
||||
@@ -64,8 +60,8 @@ namespace Raindrop.Presenters
|
||||
|
||||
[Tooltip("show the current chat the user is viewing")]
|
||||
public TMP_Text ChatBox;
|
||||
//wtf is this?
|
||||
public TMPTextFieldPrinter tmp_printer;
|
||||
//the printer that is printing into the big chat box.
|
||||
public TMPTextFieldPrinter localChatPrinter;
|
||||
#endregion
|
||||
|
||||
#region internal representations
|
||||
@@ -87,7 +83,6 @@ namespace Raindrop.Presenters
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
|
||||
CloseButton.onClick.AsObservable().Subscribe(_ => OnCloseBtnClick()); //when clicked, runs this method.
|
||||
SendButton.onClick.AsObservable().Subscribe(_ => OnSendBtnClick()); //change username property.
|
||||
ChatInputField.onValueChanged.AsObservable().Subscribe(_ => OnInputChanged(_)); //change username property.
|
||||
@@ -95,26 +90,26 @@ namespace Raindrop.Presenters
|
||||
RegisterClientEvents(client);
|
||||
|
||||
//check if printer is attached to textbox. else attach it.
|
||||
tmp_printer = ChatBox.gameObject.GetComponent<TMPTextFieldPrinter>();
|
||||
if (!tmp_printer)
|
||||
localChatPrinter = ChatBox.gameObject.GetComponent<TMPTextFieldPrinter>();
|
||||
if (!localChatPrinter)
|
||||
{
|
||||
tmp_printer = ChatBox.gameObject.AddComponent<TMPTextFieldPrinter>();
|
||||
localChatPrinter = ChatBox.gameObject.AddComponent<TMPTextFieldPrinter>();
|
||||
//OpenMetaverse.Logger.Log("failed to make the tmp_printer component to the tmp textbox.", Helpers.LogLevel.Error);
|
||||
}
|
||||
|
||||
chatManager = new ChatManager(instance, localChatPrinter);
|
||||
|
||||
chatManager = new ChatManager(instance);
|
||||
// chatManager.localChatManager.ChatLineAdded += LocalChatManager_ChatLineAdded;
|
||||
|
||||
chatManager.localChatManager.ChatLineAdded += LocalChatManager_ChatLineAdded;
|
||||
|
||||
startChat(true);
|
||||
//startChat(true);
|
||||
}
|
||||
|
||||
private void LocalChatManager_ChatLineAdded(object sender, ChatLineAddedArgs e)
|
||||
{
|
||||
//new message in local chat! print it.
|
||||
ChatBufferItem item = e.Item;
|
||||
runPrinterOnItem(tmp_printer, item);
|
||||
}
|
||||
// private void LocalChatManager_ChatLineAdded(object sender, ChatLineAddedArgs e)
|
||||
// {
|
||||
// //new message in local chat! print it.
|
||||
// ChatBufferItem item = e.Item;
|
||||
// runPrinterOnItem(tmp_printer, item);
|
||||
// }
|
||||
|
||||
//id relative to the list. -1 means local. 0 means others.
|
||||
public void setShowingChat(int id)
|
||||
@@ -123,83 +118,83 @@ namespace Raindrop.Presenters
|
||||
{
|
||||
//print everything in text buffer list.
|
||||
List<ChatBufferItem> x = chatManager.localChatManager.getChatBuffer();
|
||||
runPrinterOnList(tmp_printer, x, 0,20); //print the selected range into the UI
|
||||
// runPrinterOnList(tmp_printer, x, 0,20); //print the selected range into the UI
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void runPrinterOnItem(TMPTextFieldPrinter TextPrinter, ChatBufferItem item)
|
||||
{
|
||||
//ChatBufferItem item = x[i];
|
||||
|
||||
if (/*showTimestamps*/ true)
|
||||
{
|
||||
//if(fontSettings.ContainsKey("Timestamp"))
|
||||
//{
|
||||
// var fontSetting = fontSettings["Timestamp"];
|
||||
// TextPrinter.ForeColor = fontSetting.ForeColor;
|
||||
// TextPrinter.BackColor = fontSetting.BackColor;
|
||||
// TextPrinter.Font = fontSetting.Font;
|
||||
// TextPrinter.PrintText(item.Timestamp.ToString("[HH:mm] "));
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
//TextPrinter.ForeColor = SystemColors.GrayText;
|
||||
//TextPrinter.BackColor = Color.Transparent;
|
||||
//TextPrinter.Font = Settings.FontSetting.DefaultFont;
|
||||
TextPrinter.PrintText(item.Timestamp.ToString("[HH:mm] "));
|
||||
//}
|
||||
}
|
||||
|
||||
//if(fontSettings.ContainsKey("Name"))
|
||||
//{
|
||||
// var fontSetting = fontSettings["Name"];
|
||||
// TextPrinter.ForeColor = fontSetting.ForeColor;
|
||||
// TextPrinter.BackColor = fontSetting.BackColor;
|
||||
// TextPrinter.Font = fontSetting.Font;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
//TextPrinter.ForeColor = SystemColors.WindowText;
|
||||
//TextPrinter.BackColor = Color.Transparent;
|
||||
//TextPrinter.Font = Settings.FontSetting.DefaultFont;
|
||||
//}
|
||||
|
||||
if (item.Style == ChatBufferTextStyle.Normal && item.ID != UUID.Zero && instance.GlobalSettings["av_name_link"])
|
||||
{
|
||||
TextPrinter.InsertLink(item.From, $"secondlife:///app/agent/{item.ID}/about");
|
||||
}
|
||||
else
|
||||
{
|
||||
TextPrinter.PrintText(item.From);
|
||||
}
|
||||
|
||||
//if(fontSettings.ContainsKey(item.Style.ToString()))
|
||||
//{
|
||||
// var fontSetting = fontSettings[item.Style.ToString()];
|
||||
// TextPrinter.ForeColor = fontSetting.ForeColor;
|
||||
// TextPrinter.BackColor = fontSetting.BackColor;
|
||||
// TextPrinter.Font = fontSetting.Font;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// TextPrinter.ForeColor = SystemColors.WindowText;
|
||||
// TextPrinter.BackColor = Color.Transparent;
|
||||
// TextPrinter.Font = Settings.FontSetting.DefaultFont;
|
||||
//}
|
||||
|
||||
TextPrinter.PrintTextLine(item.Text);
|
||||
}
|
||||
|
||||
//you can run the printer when a new text comes in.
|
||||
//or you can run it when the user opens a new chat and you gotta update the chat text.
|
||||
public void runPrinterOnList(TMPTextFieldPrinter TextPrinter, List<ChatBufferItem> x, int rangeNew, int rangeOld)
|
||||
{
|
||||
for (int i = rangeNew; i < rangeOld; i++)
|
||||
{
|
||||
runPrinterOnItem(TextPrinter, x[i]);
|
||||
}
|
||||
}
|
||||
//
|
||||
// public void runPrinterOnItem(TMPTextFieldPrinter TextPrinter, ChatBufferItem item)
|
||||
// {
|
||||
// //ChatBufferItem item = x[i];
|
||||
//
|
||||
// if (/*showTimestamps*/ true)
|
||||
// {
|
||||
// //if(fontSettings.ContainsKey("Timestamp"))
|
||||
// //{
|
||||
// // var fontSetting = fontSettings["Timestamp"];
|
||||
// // TextPrinter.ForeColor = fontSetting.ForeColor;
|
||||
// // TextPrinter.BackColor = fontSetting.BackColor;
|
||||
// // TextPrinter.Font = fontSetting.Font;
|
||||
// // TextPrinter.PrintText(item.Timestamp.ToString("[HH:mm] "));
|
||||
// //}
|
||||
// //else
|
||||
// //{
|
||||
// //TextPrinter.ForeColor = SystemColors.GrayText;
|
||||
// //TextPrinter.BackColor = Color.Transparent;
|
||||
// //TextPrinter.Font = Settings.FontSetting.DefaultFont;
|
||||
// TextPrinter.PrintText(item.Timestamp.ToString("[HH:mm] "));
|
||||
// //}
|
||||
// }
|
||||
//
|
||||
// //if(fontSettings.ContainsKey("Name"))
|
||||
// //{
|
||||
// // var fontSetting = fontSettings["Name"];
|
||||
// // TextPrinter.ForeColor = fontSetting.ForeColor;
|
||||
// // TextPrinter.BackColor = fontSetting.BackColor;
|
||||
// // TextPrinter.Font = fontSetting.Font;
|
||||
// //}
|
||||
// //else
|
||||
// //{
|
||||
// //TextPrinter.ForeColor = SystemColors.WindowText;
|
||||
// //TextPrinter.BackColor = Color.Transparent;
|
||||
// //TextPrinter.Font = Settings.FontSetting.DefaultFont;
|
||||
// //}
|
||||
//
|
||||
// if (item.Style == ChatBufferTextStyle.Normal && item.ID != UUID.Zero && instance.GlobalSettings["av_name_link"])
|
||||
// {
|
||||
// TextPrinter.InsertLink(item.From, $"secondlife:///app/agent/{item.ID}/about");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// TextPrinter.PrintText(item.From);
|
||||
// }
|
||||
//
|
||||
// //if(fontSettings.ContainsKey(item.Style.ToString()))
|
||||
// //{
|
||||
// // var fontSetting = fontSettings[item.Style.ToString()];
|
||||
// // TextPrinter.ForeColor = fontSetting.ForeColor;
|
||||
// // TextPrinter.BackColor = fontSetting.BackColor;
|
||||
// // TextPrinter.Font = fontSetting.Font;
|
||||
// //}
|
||||
// //else
|
||||
// //{
|
||||
// // TextPrinter.ForeColor = SystemColors.WindowText;
|
||||
// // TextPrinter.BackColor = Color.Transparent;
|
||||
// // TextPrinter.Font = Settings.FontSetting.DefaultFont;
|
||||
// //}
|
||||
//
|
||||
// TextPrinter.PrintTextLine(item.Text);
|
||||
// }
|
||||
//
|
||||
// //you can run the printer when a new text comes in.
|
||||
// //or you can run it when the user opens a new chat and you gotta update the chat text.
|
||||
// public void runPrinterOnList(TMPTextFieldPrinter TextPrinter, List<ChatBufferItem> x, int rangeNew, int rangeOld)
|
||||
// {
|
||||
// for (int i = rangeNew; i < rangeOld; i++)
|
||||
// {
|
||||
// runPrinterOnItem(TextPrinter, x[i]);
|
||||
// }
|
||||
// }
|
||||
|
||||
//adds another chat to the left side
|
||||
public void startChat(bool isSimChat)
|
||||
@@ -252,8 +247,8 @@ namespace Raindrop.Presenters
|
||||
//public chat
|
||||
ProcessChatInput(msgtext, ChatType.Normal);
|
||||
Debug.Log("Sending chat to local");
|
||||
return;
|
||||
|
||||
|
||||
chatManager.printToMainChat("sending message (test)");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -32,13 +32,18 @@ public class joystickToCameraBackend : MonoBehaviour
|
||||
//process vertical camera movment.
|
||||
if (horz > 0)
|
||||
{
|
||||
instance.Movement.setTurningLeft();
|
||||
instance.Movement.TurningLeft();
|
||||
}
|
||||
else
|
||||
{
|
||||
instance.Movement.setTurningRight();
|
||||
instance.Movement.TurningRight();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
instance.Movement.TurningStop();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Raindrop.ServiceLocator;
|
||||
using Raindrop.Services;
|
||||
using TMPro;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
@@ -17,8 +18,7 @@ public class EulaView : MonoBehaviour
|
||||
private Toggle EulaToggle;
|
||||
public GameObject EulaToggleGO;
|
||||
|
||||
private Button closeBtn;
|
||||
public GameObject closeBtnGO;
|
||||
public Button closeBtn;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
@@ -41,6 +41,18 @@ public class EulaView : MonoBehaviour
|
||||
|
||||
bool isAcceptedEULA = instance.GlobalSettings["EulaAccepted"];
|
||||
onToggleChanged(isAcceptedEULA);
|
||||
|
||||
closeBtn.onClick.AddListener(closeEula);
|
||||
}
|
||||
|
||||
private void closeEula()
|
||||
{
|
||||
if (instance.GlobalSettings["EulaAccepted"] == null)
|
||||
return;
|
||||
if (instance.GlobalSettings["EulaAccepted"] == false)
|
||||
return;
|
||||
|
||||
ServiceLocator.Instance.Get<UIService>().canvasManager.resetToInitialScreen();
|
||||
}
|
||||
|
||||
private void onToggleChanged(bool isEulaAccepted)
|
||||
@@ -49,12 +61,12 @@ public class EulaView : MonoBehaviour
|
||||
|
||||
if (isEulaAccepted)
|
||||
{
|
||||
closeBtnGO.SetActive(true);
|
||||
closeBtn.gameObject.SetActive(true);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
closeBtnGO.SetActive(false);
|
||||
closeBtn.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
|
||||
public class textBoxTMP : MonoBehaviour
|
||||
{
|
||||
private TMP_Text textBox;
|
||||
private string text;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
textBox = this.gameObject.GetComponent<TMP_Text>();
|
||||
Clear();
|
||||
}
|
||||
|
||||
|
||||
public void appendtext(string text)
|
||||
{
|
||||
this.text += text;
|
||||
textBox.text = this.text;
|
||||
|
||||
return;
|
||||
}
|
||||
public void Clear()
|
||||
{
|
||||
this.text = "";
|
||||
textBox.text = this.text;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
// using System.Collections;
|
||||
// using System.Collections.Generic;
|
||||
// using UnityEngine;
|
||||
// using TMPro;
|
||||
//
|
||||
// public class textBoxTMP : MonoBehaviour
|
||||
// {
|
||||
// private TMP_Text textBox;
|
||||
// private string text;
|
||||
// // Start is called before the first frame update
|
||||
// void Start()
|
||||
// {
|
||||
// textBox = this.gameObject.GetComponent<TMP_Text>();
|
||||
// Clear();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public void appendtext(string text)
|
||||
// {
|
||||
// this.text += text;
|
||||
// textBox.text = this.text;
|
||||
//
|
||||
// return;
|
||||
// }
|
||||
// public void Clear()
|
||||
// {
|
||||
// this.text = "";
|
||||
// textBox.text = this.text;
|
||||
//
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -34,14 +34,6 @@ namespace Raindrop
|
||||
Regex urlRegex;
|
||||
private SlUriParser uriParser;
|
||||
|
||||
//public TMPTextFieldPrinter(IPrintableTMP_GO textBox)
|
||||
//{
|
||||
// rtb =
|
||||
// if (rtb == null)
|
||||
// {
|
||||
// rtb = this.
|
||||
// }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
rtb = this.GetComponent<TMP_Text>();
|
||||
|
||||
@@ -7,7 +7,6 @@ using System.Threading;
|
||||
using UniRx.Triggers;
|
||||
using UE = UnityEngine ;
|
||||
using UnityEngine ;
|
||||
using Vector3 = OpenMetaverse.Vector3;
|
||||
|
||||
namespace Raindrop.Presenters
|
||||
{
|
||||
@@ -61,9 +60,7 @@ namespace Raindrop.Presenters
|
||||
avatarsDict.TryGetValue(e.Prim.ID, out agent);
|
||||
if (agent != null)
|
||||
{
|
||||
Debug.Log("agent " + e.Prim.ID.ToString() + "has moved");
|
||||
UE.Vector3 pos = RHelp.TKVector3(e.Prim.Position);
|
||||
agent.transform.position = pos;
|
||||
UpdateAvatarTransforms(e.Prim, agent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,12 +119,18 @@ namespace Raindrop.Presenters
|
||||
Debug.Log("updating known-avi position. " + e.Avatar.Name);
|
||||
}
|
||||
|
||||
UE.Vector3 pos = RHelp.TKVector3(e.Avatar.Position);
|
||||
aviGO.transform.position = pos;
|
||||
|
||||
UpdateAvatarTransforms(e.Avatar, aviGO);
|
||||
}
|
||||
}
|
||||
|
||||
private static void UpdateAvatarTransforms(Primitive e, GameObject aviGO)
|
||||
{
|
||||
UE.Vector3 pos = RHelp.TKVector3(e.Position);
|
||||
UE.Quaternion rot = RHelp.TKQuaternion4(e.Rotation);
|
||||
aviGO.transform.position = pos;
|
||||
aviGO.transform.rotation = rot;
|
||||
}
|
||||
|
||||
//give the object for the main camera to track.
|
||||
private void cameraTrackAgent(GameObject aviGo)
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Raindrop.Presenters
|
||||
objects.TryGetValue(e.Prim.ID, out res);
|
||||
if (res != null)
|
||||
{
|
||||
Debug.Log("object " + e.Prim.ID.ToString() + "has moved");
|
||||
//Debug.Log("object " + e.Prim.ID.ToString() + "has moved");
|
||||
Debug.LogWarning("object move to be implemented");
|
||||
}
|
||||
}
|
||||
|
||||
+430
-168
File diff suppressed because it is too large
Load Diff
@@ -141,7 +141,6 @@ PlayerSettings:
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
metroInputSource: 0
|
||||
wsaTransparentSwapchain: 0
|
||||
m_HolographicPauseOnTrackingLoss: 1
|
||||
|
||||
Reference in New Issue
Block a user