mirror of
https://github.com/RaindropViewer/RaindropViewer.git
synced 2026-07-27 22:11:39 +00:00
71 lines
1.7 KiB
C#
71 lines
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using UnityEngine;
|
|
|
|
namespace Raindrop
|
|
{
|
|
public enum CanvasType
|
|
{
|
|
Login,
|
|
Game
|
|
}
|
|
|
|
public class RaindropViewManager
|
|
{
|
|
public CanvasManager cm;
|
|
|
|
//manages all child Viewmodels
|
|
public RaindropViewManager()
|
|
{
|
|
//Debug.Log("VM manager setup ok");
|
|
|
|
//subscribe all events from raindropclient
|
|
Global.MainRaindropInstance.LoginCompleted += MainRaindropInstance_LoginCompleted;
|
|
Global.MainRaindropInstance.LoginFailed += MainRaindropInstance_LoginFailed;
|
|
|
|
}
|
|
|
|
//register the canvas manager which is in a GO, who has the responsibility of flipping pages.
|
|
public void registerWithRaindropClient(CanvasManager canvasManager)
|
|
{
|
|
cm = canvasManager;
|
|
//start up the initial login panel
|
|
pushLoginView();
|
|
}
|
|
private void pushLoginView()
|
|
{
|
|
cm.pushCanvas(CanvasType.Login);
|
|
}
|
|
|
|
private void MainRaindropInstance_LoginFailed()
|
|
{
|
|
Debug.Log("failed login TODO: why?");
|
|
}
|
|
|
|
private void showFailedLoginModal()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
private void MainRaindropInstance_LoginCompleted()
|
|
{
|
|
cm.popCanvas();
|
|
cm.pushCanvas(CanvasType.Game);
|
|
//showSuccessLoginModal();
|
|
}
|
|
|
|
private void removeLoginView()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
private void showSuccessLoginModal()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|