mirror of
https://github.com/RaindropViewer/RaindropViewer.git
synced 2026-07-27 22:11:39 +00:00
Added a welcome screen. tested and wired the following screens up together: welcome,eula,login
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ExitAppBehaviorCallable : MonoBehaviour
|
||||
{
|
||||
|
||||
public void closeApp()
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0ec448f9fd0f246449491c7fee276e7b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -7,13 +7,15 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Raindrop
|
||||
{
|
||||
class LoginUtils
|
||||
{
|
||||
// this function saves content of loginoptions to globalsettings file.
|
||||
public static void SaveConfig(LoginOptions loginoptions, Raindrop.Settings globalSettings)
|
||||
// this function appends (and saves) content of loginoptions to globalsettings file.
|
||||
//it is called when the user clicks the login button.
|
||||
public static void SaveConfig(LoginOptions loginoptions, Raindrop.Settings globalSettings, bool isSaveCredentials)
|
||||
{
|
||||
Raindrop.Settings s = globalSettings;
|
||||
SavedLogin sl = new SavedLogin();
|
||||
@@ -21,6 +23,7 @@ namespace Raindrop
|
||||
string username = loginoptions.FirstName + " " + loginoptions.LastName;
|
||||
string Password = loginoptions.Password;
|
||||
|
||||
//checks if the username selected is a dropdown option. this means you use the username from the settings instead of the text box.
|
||||
//if (cbxUsername.SelectedIndex > 0 && cbxUsername.SelectedItem is SavedLogin)
|
||||
//{
|
||||
// username = ((SavedLogin)cbxUsername.SelectedItem).Username;
|
||||
@@ -44,9 +47,9 @@ namespace Raindrop
|
||||
s["saved_logins"] = new OSDMap();
|
||||
}
|
||||
|
||||
if (loginoptions.IsSaveCredentials)
|
||||
if (isSaveCredentials)
|
||||
{
|
||||
|
||||
Debug.Log("Saving user cred");
|
||||
sl.Username = s["username"] = username;
|
||||
|
||||
if (LoginOptions.IsPasswordMD5(Password))
|
||||
@@ -59,6 +62,9 @@ namespace Raindrop
|
||||
sl.Password = Utils.MD5(Password);
|
||||
s["password"] = Utils.MD5(Password);
|
||||
}
|
||||
|
||||
//apparently the startlocation is also part of saveCredentials?
|
||||
|
||||
//if (cbxLocation.SelectedIndex == -1)
|
||||
//{
|
||||
// sl.CustomStartLocation = cbxLocation.Text;
|
||||
@@ -80,7 +86,7 @@ namespace Raindrop
|
||||
|
||||
//s["login_grid"] = OSD.FromInteger(gridmgr.); //note: this was removed as this was literally a magic number (int) that corresponds to the position of the dropbox selection.
|
||||
s["login_uri"] = OSD.FromString(loginoptions.GridLoginUri);
|
||||
s["remember_login"] = OSD.FromBoolean (loginoptions.IsSaveCredentials);
|
||||
s["remember_login"] = isSaveCredentials; //OSD.FromBoolean (loginoptions.IsSaveCredentials);
|
||||
}
|
||||
|
||||
public class SavedLogin
|
||||
@@ -168,5 +174,7 @@ namespace Raindrop
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,9 +131,9 @@ namespace Raindrop.Netcom
|
||||
set { lastExecEvent = value; }
|
||||
}
|
||||
|
||||
public bool IsSaveCredentials {
|
||||
get => isSaveCredentials;
|
||||
set => isSaveCredentials = value;
|
||||
}
|
||||
//public bool IsSaveCredentials {
|
||||
// get => isSaveCredentials;
|
||||
// set => isSaveCredentials = value;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Raindrop
|
||||
private string streaming_assets_dir;
|
||||
|
||||
//private frmMain mainForm; //frmMain is a class that inherits RadegastForm. It seems to be the code-behind of the overall UI, that includes the view and buttons.
|
||||
private mainUIManager mainCanvas;
|
||||
private UIManager ui_manager;
|
||||
//private RaindropUnitySceneRenderer mainWorldRenderer;
|
||||
|
||||
// Singleton, there can be only one instance
|
||||
@@ -325,7 +325,7 @@ namespace Raindrop
|
||||
names = new NameManager(this);
|
||||
COF = new CurrentOutfitFolder(this);
|
||||
|
||||
mainCanvas = new mainUIManager(this);
|
||||
ui_manager = new UIManager(this);
|
||||
//mainCanvas.InitializeControls();
|
||||
|
||||
//mainCanvas.Load += new EventHandler(mainForm_Load);
|
||||
@@ -349,6 +349,7 @@ namespace Raindrop
|
||||
|
||||
client.Settings.USE_ASSET_CACHE = true;
|
||||
client.Settings.ASSET_CACHE_DIR = Path.Combine(userDir, "cache");
|
||||
Debug.Log("Userdir:" + userDir);
|
||||
client.Assets.Cache.AutoPruneEnabled = false;
|
||||
client.Assets.Cache.ComputeAssetCacheFilename = ComputeCacheName;
|
||||
|
||||
@@ -663,6 +664,8 @@ namespace Raindrop
|
||||
userDir = System.Environment.CurrentDirectory;
|
||||
};
|
||||
|
||||
Debug.Log("Userdir:" + userDir);
|
||||
|
||||
globalLogFile = Path.Combine(userDir, PROGRAMNAME + ".log");
|
||||
globalSettings = new Settings(Path.Combine(userDir, "settings.xml"));
|
||||
//frmSettings.InitSettigs(globalSettings, monoRuntime);
|
||||
@@ -683,9 +686,9 @@ namespace Raindrop
|
||||
get { return state; }
|
||||
}
|
||||
|
||||
public mainUIManager MainCanvas
|
||||
public UIManager UI
|
||||
{
|
||||
get { return mainCanvas; }
|
||||
get { return ui_manager; }
|
||||
}
|
||||
|
||||
public OpenMetaverse.Vector3 cameraLoc { get; internal set; }
|
||||
|
||||
@@ -40,6 +40,43 @@ public class CanvasManager : Singleton<CanvasManager>
|
||||
|
||||
return activeCanvasStack.Peek().gameObject;
|
||||
}
|
||||
public CanvasType getCanvasTypeFromString(string _type)
|
||||
{
|
||||
foreach(CanvasIdentifier _ in canvasControllerList)
|
||||
{
|
||||
var thecanvastype = _.canvasType;
|
||||
if (_type == thecanvastype.ToString())
|
||||
{
|
||||
return thecanvastype;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return CanvasType.UNKNOWN;
|
||||
|
||||
}
|
||||
public void pushCanvas(string _type)
|
||||
{
|
||||
pushCanvas(_type, false);
|
||||
}
|
||||
|
||||
//isPopCurrentActiveCanvas true will pop the current top canvas and then push the new desired one.
|
||||
public void pushCanvas(string _type, bool isPopCurrentActiveCanvas)
|
||||
{
|
||||
CanvasType theCanvasType = getCanvasTypeFromString(_type);
|
||||
if (theCanvasType ==CanvasType.UNKNOWN)
|
||||
{
|
||||
Debug.LogError("unable to get the canvas of identifer: "+ _type);
|
||||
}
|
||||
|
||||
if (isPopCurrentActiveCanvas)
|
||||
{
|
||||
popCanvas();
|
||||
}
|
||||
pushCanvas(theCanvasType);
|
||||
}
|
||||
|
||||
|
||||
public void pushCanvas(CanvasType _type)
|
||||
{
|
||||
if (activeCanvasStack.Count() != 0)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
Game,
|
||||
Chat,
|
||||
Map,
|
||||
EULA,
|
||||
EULA_modal,
|
||||
Settings,
|
||||
|
||||
UNKNOWN
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using Raindrop.Netcom;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace Raindrop.Presenters
|
||||
{
|
||||
public class LoadingCanvasPresenter : MonoBehaviour
|
||||
{
|
||||
private RaindropInstance instance { get { return RaindropInstance.GlobalInstance; } }
|
||||
private RaindropNetcom netcom { get { return instance.Netcom; } }
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 74f0a76d6b05c674c809ba6529de56c0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -11,29 +11,77 @@ public class ModalManager : Singleton<ModalManager>
|
||||
{
|
||||
Thread mainThread;
|
||||
//pool of modals.
|
||||
modalPresenter modalsAvailable;
|
||||
public modalPresenter genericModal;
|
||||
public modalPresenter eulaModal;
|
||||
public modalPresenter loggingInStatusModal;
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
//find yo modals in scene.
|
||||
if (FindObjectsOfType<modalPresenter>().Length != 0)
|
||||
//foreach(modalPresenter _ in FindObjectsOfType<modalPresenter>())
|
||||
//{
|
||||
|
||||
// genericModal.Add(_);
|
||||
// _.closeModal();
|
||||
//}
|
||||
|
||||
//if (FindObjectsOfType<modalPresenter>().Length != 0)
|
||||
//{
|
||||
// genericModal = FindObjectsOfType<modalPresenter>()[0];
|
||||
// genericModal.closeModal();
|
||||
//}
|
||||
|
||||
if (genericModal == null)
|
||||
{
|
||||
modalsAvailable = FindObjectsOfType<modalPresenter>()[0];
|
||||
modalsAvailable.closeModal();
|
||||
Debug.LogError("cannot find the gneric modal");
|
||||
}
|
||||
|
||||
mainThread = System.Threading.Thread.CurrentThread;
|
||||
}
|
||||
|
||||
public void showModal(string title, string content)
|
||||
public void openEula()
|
||||
{
|
||||
setVisibleEulaModal(true);
|
||||
}
|
||||
|
||||
public void closeEula()
|
||||
{
|
||||
setVisibleEulaModal(false);
|
||||
}
|
||||
|
||||
public void setVisibleEulaModal(bool visibility)
|
||||
{
|
||||
if (isOnMainThread())
|
||||
{
|
||||
if (modalsAvailable != null)
|
||||
if (eulaModal != null)
|
||||
{
|
||||
modalsAvailable.setModal(title, content);
|
||||
modalsAvailable.gameObject.SetActive(true);
|
||||
eulaModal.gameObject.SetActive(visibility);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("unable to get the modalPresenter object!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
UnityMainThreadDispatcher.Instance().Enqueue(() => {
|
||||
Debug.Log(" dispatching of showing modal");
|
||||
setVisibleEulaModal(visibility);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public void setVisibleGenericModal(string title, string content, bool visibility)
|
||||
{
|
||||
if (isOnMainThread())
|
||||
{
|
||||
if (genericModal != null)
|
||||
{
|
||||
genericModal.setModal(title, content);
|
||||
genericModal.gameObject.SetActive(visibility);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -44,7 +92,37 @@ public class ModalManager : Singleton<ModalManager>
|
||||
|
||||
UnityMainThreadDispatcher.Instance().Enqueue(() => {
|
||||
Debug.Log(" dispatching of showing modal");
|
||||
showModal(title, content);
|
||||
setVisibleGenericModal(title, content, visibility);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//by default obviously this must be visible; we are updating the login status.
|
||||
public void setVisibleLoggingInModal(string content)
|
||||
{
|
||||
string title = "Logging in status...";
|
||||
|
||||
if (isOnMainThread())
|
||||
{
|
||||
if (loggingInStatusModal != null)
|
||||
{
|
||||
loggingInStatusModal.setModal(title, content);
|
||||
loggingInStatusModal.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("unable to get the modalPresenter object!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
UnityMainThreadDispatcher.Instance().Enqueue(() => {
|
||||
Debug.Log(" dispatching of showing modal");
|
||||
setVisibleLoggingInModal(content);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -59,10 +137,10 @@ public class ModalManager : Singleton<ModalManager>
|
||||
|
||||
public void showSimpleModalBoxWithActionBtn(string title, string content, string Action)
|
||||
{
|
||||
if (modalsAvailable != null)
|
||||
if (genericModal != null)
|
||||
{
|
||||
modalsAvailable.setModal(title, content, Action);
|
||||
modalsAvailable.gameObject.SetActive(true);
|
||||
genericModal.setModal(title, content, Action);
|
||||
genericModal.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+4
-4
@@ -12,7 +12,7 @@ using UnityEngine;
|
||||
|
||||
namespace Raindrop
|
||||
{
|
||||
public class mainUIManager
|
||||
public class UIManager
|
||||
{
|
||||
//mainUImanager has dependencies:
|
||||
// CanvasManager - stores and manages the pops, push of views onto the ui stack.
|
||||
@@ -26,7 +26,7 @@ namespace Raindrop
|
||||
public CanvasManager canvasManager { get { return CanvasManager.GetInstance(); } }
|
||||
public ModalManager modalManager { get { return ModalManager.GetInstance(); } }
|
||||
|
||||
public mainUIManager(RaindropInstance raindropInstance)
|
||||
public UIManager(RaindropInstance raindropInstance)
|
||||
{
|
||||
this.instance = raindropInstance;
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Raindrop
|
||||
{
|
||||
if (e.Status == LoginStatus.Failed)
|
||||
{
|
||||
modalManager.showModal("Login failed.", e.Message);
|
||||
modalManager.setVisibleGenericModal("Login failed.", e.Message, true);
|
||||
//if (InAutoReconnect)
|
||||
//{
|
||||
// if (instance.GlobalSettings["auto_reconnect"].AsBoolean() && e.FailReason != "tos")
|
||||
@@ -89,7 +89,7 @@ namespace Raindrop
|
||||
}
|
||||
else if (e.Status == LoginStatus.Success)
|
||||
{
|
||||
modalManager.showModal("Login success!", e.Message);
|
||||
modalManager.setVisibleGenericModal("Login success!", e.Message, true);
|
||||
//InAutoReconnect = false;
|
||||
//reconnectToolStripMenuItem.Enabled = false;
|
||||
//loginToolStripMenuItem.Enabled = false;
|
||||
@@ -9,7 +9,7 @@ using UnityEngine.UI;
|
||||
public class modalPresenter : MonoBehaviour
|
||||
{
|
||||
|
||||
public Text titletext;
|
||||
public TMP_Text titletext;
|
||||
public TMP_Text contenttext;
|
||||
public TMP_Text actionText;
|
||||
public GameObject modal;
|
||||
@@ -29,9 +29,9 @@ public class modalPresenter : MonoBehaviour
|
||||
{
|
||||
BackgroundButton.onClick.AsObservable().Subscribe(_ => closeModal()); //when clicked, runs this method.
|
||||
}
|
||||
if (titletext.GetComponent<Text>() == null)
|
||||
if (titletext.GetComponent<TMP_Text>() == null)
|
||||
{
|
||||
Debug.LogError("titletext.GetComponent<Text>() failed");
|
||||
Debug.LogError("titletext.GetComponent<TMP_Text>() failed");
|
||||
}
|
||||
if (contenttext.GetComponent<TMP_Text>() == null)
|
||||
{
|
||||
@@ -43,7 +43,7 @@ public class modalPresenter : MonoBehaviour
|
||||
//sets the textual contents of the ui
|
||||
public void setModal(string title, string content, string ActionText)
|
||||
{
|
||||
titletext.GetComponent<Text>().text = title;
|
||||
titletext.GetComponent<TMP_Text>().text = title;
|
||||
contenttext.GetComponent<TMP_Text>().text = content;
|
||||
if (actionText != null)
|
||||
{
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace Raindrop.Presenters
|
||||
|
||||
private void OnCloseBtnClick()
|
||||
{
|
||||
instance.MainCanvas.canvasManager.popCanvas();
|
||||
instance.UI.canvasManager.popCanvas();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -92,13 +92,13 @@ namespace Raindrop.Presenters
|
||||
|
||||
public void OnChatBtnClick()
|
||||
{
|
||||
instance.MainCanvas.canvasManager.pushCanvas(CanvasType.Chat);
|
||||
instance.UI.canvasManager.pushCanvas(CanvasType.Chat);
|
||||
|
||||
|
||||
}
|
||||
public void OnMapBtnClick()
|
||||
{
|
||||
instance.MainCanvas.canvasManager.pushCanvas(CanvasType.Map);
|
||||
instance.UI.canvasManager.pushCanvas(CanvasType.Map);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -40,19 +40,19 @@ namespace Raindrop.Presenters
|
||||
public Toggle TOSCheckbox;
|
||||
public Toggle RememberCheckbox;
|
||||
|
||||
public Modal loginStatusModal;
|
||||
//public Modal loginStatusModal;
|
||||
|
||||
//extragrid seclections
|
||||
public GameObject GridDropdownGO; //required.
|
||||
public GenericDropdown genericDropdown;
|
||||
//public GameObject GridDropdownGO; //required.
|
||||
//public GenericDropdown genericDropdown;
|
||||
//public TMP_InputField customURL;
|
||||
//public Toggle customURLCheckbox;
|
||||
#endregion
|
||||
|
||||
#region internal representations
|
||||
|
||||
private string username;
|
||||
private string password;
|
||||
//private string Username;
|
||||
//private string Password;
|
||||
private readonly string INIT_USERNAME = "username";
|
||||
private readonly string INIT_PASSWORD = "password";
|
||||
private Settings s;
|
||||
@@ -68,6 +68,9 @@ namespace Raindrop.Presenters
|
||||
}
|
||||
|
||||
public ReactiveProperty<string> Login_msg { get; private set; }
|
||||
private ReactiveProperty<bool> btnLoginEnabled;
|
||||
|
||||
public string uninitialised = "(unknown)";
|
||||
|
||||
//private List<string> gridDropdownOptions = new List<string> //type is grid
|
||||
//{
|
||||
@@ -76,15 +79,14 @@ namespace Raindrop.Presenters
|
||||
private int gridSelectedItem;
|
||||
|
||||
private object lblLoginStatus;
|
||||
private string login_msg;
|
||||
//private string login_msg;
|
||||
|
||||
private bool btnLoginEnabled;
|
||||
|
||||
private bool cbTOStrue = true;
|
||||
private bool cbCustomURL = false;
|
||||
private bool cbRememberBool;
|
||||
private DropdownMenuWithEntry usernameDropdownMenuWithEntry;
|
||||
private GameObject UserDropdownMenu;
|
||||
//private DropdownMenuWithEntry usernameDropdownMenuWithEntry;
|
||||
//private GameObject UserDropdownMenu;
|
||||
|
||||
|
||||
#endregion
|
||||
@@ -94,31 +96,45 @@ namespace Raindrop.Presenters
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
//1 load deafult UI fields.
|
||||
initialiseFields();
|
||||
|
||||
//2 load various loginInformation from the settings.
|
||||
InitializeConfig();
|
||||
|
||||
|
||||
//GridDropdownGO = this.gameObject.GetComponent<GenericDropdown>().gameObject;
|
||||
genericDropdown = GridDropdownGO.GetComponent<GenericDropdown>();
|
||||
//genericDropdown = GridDropdownGO.GetComponent<GenericDropdown>();
|
||||
//GridDropdownView.DropdownSelectionChanged += GenericDropdown_DropdownSelectionChanged;
|
||||
|
||||
//3 hookup reactive UIs.
|
||||
LoginButton.onClick.AsObservable().Subscribe(_ => OnLoginBtnClick()); //when clicked, runs this method.
|
||||
|
||||
btnLoginEnabled = new ReactiveProperty<bool>(true);
|
||||
btnLoginEnabled.AsObservable().Subscribe(_ => LoginButton.gameObject.SetActive(_)); //update the login button availabilty according to this boolean.
|
||||
|
||||
usernameField.onValueChanged.AsObservable().Subscribe(_ => Username = _); //change username property.
|
||||
passwordField.onValueChanged.AsObservable().Subscribe(_ => Password = _); //change username property.
|
||||
passwordField.onValueChanged.AsObservable().Subscribe(_ => Password = _);
|
||||
|
||||
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?
|
||||
|
||||
//gridDropdown.OnValueChangedAsObservable().Subscribe(_ => gridSelectedItem = _);
|
||||
//customURLCheckbox.onValueChanged.AsObservable().Subscribe(_ => cbCustomURL = _); //change username property.
|
||||
|
||||
//DropdownMenuWithEntry = UserDropdownMenu.GetComponent<DropdownMenuWithEntry>();
|
||||
|
||||
//4subscribe to events.
|
||||
AddNetcomEvents();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void GenericDropdown_DropdownSelectionChanged()
|
||||
private void UpdateModalText(string _)
|
||||
{
|
||||
|
||||
throw new NotImplementedException();
|
||||
instance.UI.modalManager.setVisibleLoggingInModal(_);
|
||||
}
|
||||
|
||||
private void AddNetcomEvents()
|
||||
@@ -144,25 +160,25 @@ namespace Raindrop.Presenters
|
||||
{
|
||||
case LoginStatus.ConnectingToLogin:
|
||||
Login_msg.GetType().GetProperty("Value").SetValue(Login_msg, "Connecting to login server...");
|
||||
instance.MainCanvas.modalManager.showSimpleModalBoxWithActionBtn("Logging in process...", Login_msg.Value, "cancel");
|
||||
instance.UI.modalManager.showSimpleModalBoxWithActionBtn("Logging in process...", Login_msg.Value, "close modal");
|
||||
//lblLoginStatus.ForeColor = Color.Black;
|
||||
break;
|
||||
|
||||
case LoginStatus.ConnectingToSim:
|
||||
Login_msg.Value = ("Connecting to region...");
|
||||
instance.MainCanvas.modalManager.showSimpleModalBoxWithActionBtn("Logging in process...", Login_msg.Value, "cancel");
|
||||
instance.UI.modalManager.showSimpleModalBoxWithActionBtn("Logging in process...", Login_msg.Value, "close modal");
|
||||
//lblLoginStatus.ForeColor = Color.Black;
|
||||
break;
|
||||
|
||||
case LoginStatus.Redirecting:
|
||||
Login_msg.Value = "Redirecting...";
|
||||
instance.MainCanvas.modalManager.showSimpleModalBoxWithActionBtn("Logging in process...", Login_msg.Value, "cancel");
|
||||
instance.UI.modalManager.showSimpleModalBoxWithActionBtn("Logging in process...", Login_msg.Value, "close modal");
|
||||
//lblLoginStatus.ForeColor = Color.Black;
|
||||
break;
|
||||
|
||||
case LoginStatus.ReadingResponse:
|
||||
Login_msg.Value = "Reading response...";
|
||||
instance.MainCanvas.modalManager.showSimpleModalBoxWithActionBtn("Logging in process...", Login_msg.Value, "cancel");
|
||||
instance.UI.modalManager.showSimpleModalBoxWithActionBtn("Logging in process...", Login_msg.Value, "close modal");
|
||||
//lblLoginStatus.ForeColor = Color.Black;
|
||||
break;
|
||||
|
||||
@@ -172,10 +188,13 @@ namespace Raindrop.Presenters
|
||||
//proLogin.Visible = false;
|
||||
|
||||
//btnLogin.Text = "Logout";
|
||||
btnLoginEnabled = false;
|
||||
btnLoginEnabled.Value = false;
|
||||
instance.Client.Groups.RequestCurrentGroups();
|
||||
|
||||
instance.MainCanvas.modalManager.showSimpleModalBoxWithActionBtn("Logging in process...","Logged in !", "yay!");
|
||||
instance.UI.modalManager.showSimpleModalBoxWithActionBtn("Logging in process...","Logged in !", "yay!");
|
||||
instance.UI.canvasManager.pushCanvas("Game", true); //refactor needed: better way to schedule push and pop as we are facing some issues here.
|
||||
instance.UI.canvasManager.popCanvas();
|
||||
LoginButton.interactable = true;
|
||||
break;
|
||||
|
||||
case LoginStatus.Failed:
|
||||
@@ -183,16 +202,18 @@ namespace Raindrop.Presenters
|
||||
if (e.FailReason == "tos")
|
||||
{
|
||||
Login_msg.Value = "Must agree to Terms of Service before logging in";
|
||||
instance.MainCanvas.modalManager.showSimpleModalBoxWithActionBtn("Logging in failed",Login_msg.Value, "ok");
|
||||
instance.UI.modalManager.showSimpleModalBoxWithActionBtn("Logging in failed",Login_msg.Value, "ok");
|
||||
//pnlTos.Visible = true;
|
||||
//txtTOS.Text = e.Message.Replace("\n", "\r\n");
|
||||
btnLoginEnabled = true;
|
||||
btnLoginEnabled.Value = true;
|
||||
LoginButton.interactable = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Login_msg.Value = e.Message;
|
||||
instance.MainCanvas.modalManager.showSimpleModalBoxWithActionBtn("Logging in failed", Login_msg.Value, "ok");
|
||||
btnLoginEnabled = false;
|
||||
instance.UI.modalManager.showSimpleModalBoxWithActionBtn("Logging in failed", Login_msg.Value, "ok");
|
||||
btnLoginEnabled.Value = true;
|
||||
LoginButton.interactable = true;
|
||||
}
|
||||
//proLogin.Visible = false;
|
||||
|
||||
@@ -204,7 +225,7 @@ namespace Raindrop.Presenters
|
||||
public void netcom_ClientLoggedOut(object sender, EventArgs e)
|
||||
{
|
||||
Login_msg.Value = "logged out.";
|
||||
instance.MainCanvas.modalManager.showSimpleModalBoxWithActionBtn("Login status", Login_msg.Value, "ok");
|
||||
instance.UI.modalManager.showSimpleModalBoxWithActionBtn("Login status", Login_msg.Value, "ok");
|
||||
//pnlLoginPrompt.Visible = true;
|
||||
//pnlLoggingIn.Visible = false;
|
||||
|
||||
@@ -214,10 +235,10 @@ namespace Raindrop.Presenters
|
||||
|
||||
public void netcom_ClientLoggingOut(object sender, OverrideEventArgs e)
|
||||
{
|
||||
btnLoginEnabled = false;
|
||||
btnLoginEnabled.Value = false;
|
||||
|
||||
Login_msg.Value = "Logging out...";
|
||||
instance.MainCanvas.modalManager.showSimpleModalBoxWithActionBtn("Login status", Login_msg.Value, "ok");
|
||||
instance.UI.modalManager.showSimpleModalBoxWithActionBtn("Login status", Login_msg.Value, "ok");
|
||||
//lblLoginStatus.ForeColor = Color.FromKnownColor(KnownColor.ControlText);
|
||||
|
||||
//proLogin.Visible = true;
|
||||
@@ -226,14 +247,14 @@ namespace Raindrop.Presenters
|
||||
public void netcom_ClientLoggingIn(object sender, OverrideEventArgs e)
|
||||
{
|
||||
Login_msg.Value = "Logging in...";
|
||||
instance.MainCanvas.modalManager.showSimpleModalBoxWithActionBtn("Login status", Login_msg.Value, "ok");
|
||||
instance.UI.modalManager.showSimpleModalBoxWithActionBtn("Login status", Login_msg.Value, "ok");
|
||||
//lblLoginStatus.ForeColor = Color.FromKnownColor(KnownColor.ControlText);
|
||||
|
||||
//proLogin.Visible = true;
|
||||
//pnlLoggingIn.Visible = true;
|
||||
//pnlLoginPrompt.Visible = false;
|
||||
|
||||
btnLoginEnabled = false;
|
||||
btnLoginEnabled.Value = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -241,14 +262,13 @@ namespace Raindrop.Presenters
|
||||
private void initialiseFields()
|
||||
{
|
||||
//reset user and pw fields
|
||||
username = INIT_USERNAME;
|
||||
password = INIT_PASSWORD;
|
||||
Username = INIT_USERNAME;
|
||||
Password = INIT_PASSWORD;
|
||||
|
||||
//modal
|
||||
Login_msg = new ReactiveProperty<string>("???");
|
||||
Login_msg = new ReactiveProperty<string>(uninitialised);
|
||||
|
||||
//grids selector
|
||||
InitializeConfig();
|
||||
//location selector
|
||||
|
||||
}
|
||||
@@ -257,7 +277,7 @@ namespace Raindrop.Presenters
|
||||
private void InitializeConfig()
|
||||
{
|
||||
// Initilize grid dropdown
|
||||
int gridIx = -1;
|
||||
//int gridIx = -1;
|
||||
|
||||
//GridDropdownGO.clear();
|
||||
//GridDropdownGO.set(instance.GridManger.Grids);
|
||||
@@ -283,6 +303,7 @@ namespace Raindrop.Presenters
|
||||
string savedUsername = s["username"];
|
||||
usernameField.text = (savedUsername);
|
||||
|
||||
//try to get saved username
|
||||
try
|
||||
{
|
||||
if (s["saved_logins"] is OSDMap)
|
||||
@@ -308,7 +329,7 @@ namespace Raindrop.Presenters
|
||||
|
||||
// Fill in saved password or use one specified on the command line
|
||||
passwordField.text = s["password"].AsString();
|
||||
Debug.Log("pass cache: " + passwordField.text);
|
||||
Debug.Log("password cache: " + passwordField.text);
|
||||
|
||||
// Setup login location either from the last used or
|
||||
// override from the command line
|
||||
@@ -379,7 +400,7 @@ namespace Raindrop.Presenters
|
||||
{
|
||||
LoginButton.interactable = false;
|
||||
//sanity
|
||||
if (username == INIT_USERNAME || password == INIT_PASSWORD)
|
||||
if (Username == INIT_USERNAME || Password == INIT_PASSWORD)
|
||||
{
|
||||
Debug.LogError("Either username and password is not defined!");
|
||||
|
||||
@@ -409,6 +430,8 @@ namespace Raindrop.Presenters
|
||||
|
||||
private void BeginLogin()
|
||||
{
|
||||
|
||||
|
||||
string username = Username;
|
||||
|
||||
//if (Username.SelectedIndex > 0 && cbxUsername.SelectedItem is SavedLogin)
|
||||
@@ -436,21 +459,24 @@ namespace Raindrop.Presenters
|
||||
netcom.LoginOptions.Version = "Version"; // Version
|
||||
netcom.AgreeToTos = cbTOStrue;
|
||||
|
||||
//switch (cbxLocation.SelectedIndex)
|
||||
//{
|
||||
// case -1: //Custom
|
||||
// netcom.LoginOptions.StartLocation = StartLocationType.Custom;
|
||||
// netcom.LoginOptions.StartLocationCustom = cbxLocation.Text;
|
||||
// break;
|
||||
//placeholder
|
||||
switch (1)
|
||||
{
|
||||
case -1: //Custom
|
||||
netcom.LoginOptions.StartLocation = StartLocationType.Custom;
|
||||
netcom.LoginOptions.StartLocationCustom = "placeholder text";
|
||||
break;
|
||||
|
||||
// case 0: //Home
|
||||
// netcom.LoginOptions.StartLocation = StartLocationType.Home;
|
||||
// break;
|
||||
case 0: //Home
|
||||
netcom.LoginOptions.StartLocation = StartLocationType.Home;
|
||||
break;
|
||||
|
||||
// case 1: //Last
|
||||
// netcom.LoginOptions.StartLocation = StartLocationType.Last;
|
||||
// break;
|
||||
//}
|
||||
case 1: //Last
|
||||
netcom.LoginOptions.StartLocation = StartLocationType.Last;
|
||||
break;
|
||||
}
|
||||
|
||||
//netcom.LoginOptions.IsSaveCredentials = cbRememberBool;
|
||||
|
||||
//if (cbxGrid.SelectedIndex == cbxGrid.Items.Count - 1) // custom login uri
|
||||
//{
|
||||
@@ -468,6 +494,9 @@ namespace Raindrop.Presenters
|
||||
//netcom.LoginOptions.Grid = instance.GridManger.Grids[gridSelectedItem];
|
||||
//}
|
||||
|
||||
//placeholder to select SL as grid.
|
||||
netcom.LoginOptions.Grid = instance.GridManger.Grids[0]; //0 means sl i think
|
||||
|
||||
if (netcom.LoginOptions.Grid.Platform != "SecondLife")
|
||||
{
|
||||
instance.Client.Settings.MULTIPLE_SIMS = true;
|
||||
@@ -483,7 +512,7 @@ namespace Raindrop.Presenters
|
||||
var temp = netcom.LoginOptions;
|
||||
|
||||
netcom.Login();
|
||||
LoginUtils.SaveConfig(netcom.LoginOptions, instance.GlobalSettings);
|
||||
LoginUtils.SaveConfig(netcom.LoginOptions, instance.GlobalSettings, cbRememberBool);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -73,13 +73,13 @@ public class MapPresenter : MonoBehaviour
|
||||
|
||||
public void OnChatBtnClick()
|
||||
{
|
||||
instance.MainCanvas.canvasManager.pushCanvas(CanvasType.Chat);
|
||||
instance.UI.canvasManager.pushCanvas(CanvasType.Chat);
|
||||
|
||||
|
||||
}
|
||||
public void OnMapBtnClick()
|
||||
{
|
||||
instance.MainCanvas.canvasManager.pushCanvas(CanvasType.Map);
|
||||
instance.UI.canvasManager.pushCanvas(CanvasType.Map);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Raindrop.Presenters
|
||||
private void OnMinimapClick()
|
||||
{
|
||||
//what happend when minimap is clicked?
|
||||
instance.MainCanvas.canvasManager.pushCanvas(CanvasType.Map);
|
||||
instance.UI.canvasManager.pushCanvas(CanvasType.Map);
|
||||
Debug.Log("clicked minimap");
|
||||
}
|
||||
|
||||
|
||||
+961
-446
File diff suppressed because it is too large
Load Diff
@@ -30,6 +30,7 @@ using System.Net;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Packets;
|
||||
using NUnit.Framework;
|
||||
using UnityEngine;
|
||||
|
||||
namespace OpenMetaverse.Tests
|
||||
{
|
||||
@@ -67,8 +68,12 @@ namespace OpenMetaverse.Tests
|
||||
Console.Write($"Logging in {fullusername}...");
|
||||
// Connect to the grid
|
||||
string startLoc = NetworkManager.StartLocation("Hooper", 179, 18, 32);
|
||||
//changed:
|
||||
Debug.Log("startLoc : " + startLoc);
|
||||
Assert.IsTrue(Client.Network.Login(username[0], username[1], password, "Unit Test Framework", startLoc,
|
||||
"contact@openmetaverse.co"), "Client failed to login, reason: " + Client.Network.LoginMessage);
|
||||
//changed:
|
||||
Debug.Log("login message: " + Client.Network.LoginMessage);
|
||||
Console.WriteLine("Done");
|
||||
|
||||
Assert.IsTrue(Client.Network.Connected, "Client is not connected to the grid");
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Raindrop.Tests
|
||||
|
||||
//get viewmodel to login.
|
||||
//getCurrentForeground gives us the loginVM, which we then call onloginbtnclick from.
|
||||
GameObject temp = (GameObject)instance.MainCanvas.getCurrentForegroundPresenter();
|
||||
GameObject temp = (GameObject)instance.UI.getCurrentForegroundPresenter();
|
||||
if (temp == null)
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user