Ejemplo n.º 1
0
        void RegisterAndroid()
        {
            m_logger.Debug("RegisterAndroid");

            if (string.IsNullOrEmpty(GoogleConsoleProjectId))
            {
                m_logger.Warning("Google project ID not configured.");

                return;
            }

            AndroidRemoteNotificationManager.Register(GoogleConsoleProjectId, (regId) =>
            {
                if (string.IsNullOrEmpty(regId))
                {
                    m_logger.Error("Failed to get registration ID");

                    //ResultText.text = string.Format("Failed to get the registration id");
                    return;
                }

                //ResultText.text = string.Format(@"Your registration Id is = {0}", regId);
                m_logger.Debug("in Register method");

                WebServices.Instance.UserManager.RegisterPushNotifications(GoogleCloud, regId, (success) =>
                {
                    m_logger.Debug("Register Android push notifications complete: success={0}", success);
                });

                WaitForUpdates();
            });
        }
Ejemplo n.º 2
0
        public void Initialize()
        {
            if (UseDynamicConfigLogin)
            {
                AppManager.Instance.LaunchFailed += Instance_LaunchFailed;
                LoadSavedState();
                DetermineCurrentState(false);

                if (CurrentState == State.LoggedInSpaceSelected || CurrentState == State.PublicSpace)
                {
                    return;
                }

                var dynLogPanel = PanelManager.Instance.Push <DynamicConfigLoginPanel>(animate: false);
                if (dynLogPanel == null)
                {
                    m_logger.Error("Cannot use DynamicConfig class without a DynamicConfigLoginPanel game object.");
                }
            }
            else
            {
                if (SpaceSelected != null)
                {
                    SpaceSelected(this, EventArgs.Empty);
                }
            }
        }
Ejemplo n.º 3
0
        public void PushSuccessPanel(IPlayerTaskDriver driver)
        {
            var panel = PanelManager.Instance.GetPanel <QuizSuccessPanel>();

            if (panel == null)
            {
                m_logger.Error(typeof(QuizSuccessPanel).ToString() + " not found.");
                return;
            }

            Action onStackClose = () =>
            {
                TaskManager.Instance.Complete(driver, false);
            };

            PanelManager.Instance.Push(k_quizStack, panel, driver, onStackClose);
        }
Ejemplo n.º 4
0
        protected virtual void Awake()
        {
            m_logger = new Logger(this);

            if (sInstance != null)
            {
                m_logger.Error("SingletonComponent.Awake: error " + name + " already initialized");
            }

            sInstance = (T)this;
        }
 protected virtual void PlayMediaContent(ResourceActivationContext context, PlayableContent playable, MediaContent media, ResourcePanelData <MediaContent> data, Action onClose)
 {
     if (IsAudioContent(playable.Content))
     {
         PushAudioPanel(context, playable, media, data, onClose);
     }
     else if (IsImageContent(playable.Content))
     {
         PushImagePanel(context, playable, media, data, onClose);
     }
     else if (IsVideoContent(media))
     {
         PushVideoPanel(context, playable, media, data, onClose);
     }
     else
     {
         m_logger.Error("Unsupported content type with route=screen: {0}",
                        playable.Content == null ? "null" : playable.Content.Type);
     }
 }
Ejemplo n.º 6
0
        void PopPanel(Panel p, bool animate = true, RuntimeAnimatorController animController = null)
        {
            if (p == CurrentPanelStack.m_homePanel)
            {
                PopStack();
                return;
            }

            PanelStack stack = null;

            if (m_pushedPanelStacks.TryGetValue(p, out stack))
            {
                PopPanel(stack, p, animate, animController);
            }
            else
            {
                m_logger.Error("Popping panel without a stack: {0}",
                               p.GetType().ToString(),
                               string.Join(",", m_pushedPanelStacks.Keys.Select(k => k.name).ToArray())
                               );
            }
        }
Ejemplo n.º 7
0
            internal IEnumerator LoadCoroutine()
            {
                Loader = new WWW(Source.AbsoluteUri);

                yield return(Loader);

                lock (this)
                {
                    if (m_isDisposed)
                    {
                        yield break;
                    }
                }

                if (Loader != null)
                {
                    // Streaming should be opt-in, driven by some
                    // setting somewhere...
                    AudioClip = Loader.GetAudioClip(false, true);
                    //AudioClip = Loader.GetAudioClip(false, false);

                    if (AudioClip)
                    {
                        m_logger.Debug("Loaded audio clip {0}", Source);

                        if (!string.IsNullOrEmpty(Loader.error))
                        {
                            OnStop();
                            yield break;
                        }

                        SetAudioClip(AudioClip);
                    }
                    else
                    {
                        m_logger.Error("Could not load audio clip {0}", Source);
                        OnStop();
                    }
                }
                else
                {
                    OnStop();
                }
            }
Ejemplo n.º 8
0
        public void LoadCatalog <T>(string spaceName, string catalogName, Action <Catalog <T> > onLoad, bool?useDevCatalogs = null)
        {
            if (string.IsNullOrEmpty(catalogName))
            {
                return;
            }

            var fileName = StorageManager.GetCatalogFileName(spaceName, catalogName + ".json");

            // If the caller has specified a preference for using dev catalogs, use that,
            // otherwise defer to the setting here | the debug setting
            bool useDev = useDevCatalogs ??
                          (ShouldUseDevCatalogs || SettingsHelper.IsDebugSet("Debug_UseDevCatalogs"));

            if (InternetReachability == NetworkReachability.NotReachable)
            {
                if (RequireNetworkConnection)
                {
                    SetDownloadError(WebServicesDownloadErrorCode.NoNetworkConnection);
                }
                else
                {
                    var catalog = CatalogLoader.LoadCatalogFromCache <T>(fileName);

                    if (catalog == null)
                    {
                        if (m_completeFailHandler != null)
                        {
                            m_completeFailHandler("Please connect to the network and re-try");
                        }
                    }
                    else
                    {
                        MediaDownloadManager.AddMediaItemProvider(catalog);

                        onLoad(catalog);
                    }
                }
            }
            else
            {
                CatalogLoader.LoadCatalog <T>(fileName, spaceName, catalogName, useDev,
                                              (status, catalog) =>
                {
                    if (status == ServiceCallLoadStatus.Success)
                    {
                        m_logger.Debug("Loaded catalog {0} with {1} item(s)",
                                       catalogName, catalog.Items == null ? 0 : catalog.Items.Length);

                        // This callback happens outside of the Unity thread,
                        // use the Thread Helper to move into the Unity context
                        ThreadHelper.Instance.CallOnMainThread(() =>
                        {
                            MediaDownloadManager.AddMediaItemProvider(catalog);

                            onLoad(catalog);

                            // Since we're in the Unity thread here we don't need
                            // to protect this in a critical section
                        });
                    }
                    else
                    {
                        m_logger.Error("Error loading catalog {0}", catalogName);

                        SetDownloadError(status);

                        if (m_completeFailHandler != null)
                        {
                            ThreadHelper.Instance.CallOnMainThread(() =>
                            {
                                m_completeFailHandler("Error loading catalog " + catalogName);
                            });
                        }
                    }
                });
            }
        }
Ejemplo n.º 9
0
 void m_videoPlayer_errorReceived(VideoPlayer source, string message)
 {
     m_logger.Error("Caught error: {0}", message);
 }