void Awake() { if (instance != null) { return; } instance = this; DontDestroyOnLoad(transform.gameObject); _deviceNotificationManager = new DeviceNotificationManager(); Interface = new ServiceInterface(); }
void rpcConnection_OnConnect(RPCConnection RpcConnection) { Debug.Log("Connected..."); AttractionDeviceManager.instance.DeviceConnected = true; MainGame = new Juniverse.ClientLibrary.MainGame(RpcConnection); MainGame.OnLoggedOut += LoggedOutNoTification; DeviceNotificationManager.BindNotifications(); Debug.Log("Fetching game data..."); AttractionDeviceManager.instance.MainGame.GetGameDataAsync((gameData) => { Debug.Log("Fetching game data. Done!"); GameData = gameData; if (GameData.SubAttractions.ContainsKey(_subAttractionId)) { MultiPlayerGame = GameData.SubAttractions[_subAttractionId].MultiplayerGame; } if (ARGame) { if (CurrentARSession != null) { CacheCurrentSession(CurrentARSession.AttractionSessionId); AttractionDeviceManager.instance.SetCurrentSessionData(CurrentARSession.SubSessionId, CurrentARSession.PlayerId, CurrentARSession.ObjectiveId, CurrentARSession.AssignmentId, AttractionDeviceManager.instance.GameData.Quests[CurrentARSession.QuestId].Objectives.Find(x => x.Id == CurrentARSession.ObjectiveId)); } if (CurrentAutoTerminalSession != null) { CacheCurrentSession(CurrentAutoTerminalSession.AttractionSessionId); AttractionDeviceManager.instance.SetCurrentSessionData(CurrentAutoTerminalSession.SubSessionId, CurrentAutoTerminalSession.PlayerId, CurrentAutoTerminalSession.ObjectiveId, CurrentAutoTerminalSession.AssignmentId, AttractionDeviceManager.instance.GameData.Quests[CurrentAutoTerminalSession.QuestId].Objectives.Find(x => x.Id == CurrentAutoTerminalSession.ObjectiveId)); } } }, (ex) => AttractionDeviceManager.instance.ShowException(ex)); Debug.Log("rpcConnection_OnConnect"); StartTerminalSession(); }