コード例 #1
0
        /// <summary>
        ///     Class definition for working with the current active browser page
        /// </summary>
        public void ActualizePage(RequestData requestData)
        {
            // . empty
            Page = null;

            // . match
            var result = Web.MatchService(requestData);

            if (result != null)
            {
                Page = result.Service.GetPage(requestData, result.BaseUrlInfo);
            }

            // . initialize and activate
            if (Page == null)
            {
                //Log.Debug("We are on unknown page.");
            }
            else
            {
                var initializedPage = _pagesPool.GetInitializedPage(Page);
                if (initializedPage != null)
                {
                    Page = initializedPage;
                }
                else
                {
                    Page.InitializeComponents();
                }
                Page.Activate(Browser, Log);
                Browser.ApplyPageOptions(Page);
                //Log.Debug($"We are on the {Page.GetType().Name}.");
            }
        }
コード例 #2
0
/*
 *      public IScene Activate(bool activate)
 *      {
 *          if(!SceneChange(sceneBuildId: Loading.GetIntBuildId(), isLoading: activate))
 *          {
 *              LogWarning(Label, "Activation is faild!");
 *              return null;
 *          }
 *
 *          return this;
 *      }
 *
 *      private bool SceneChange(int sceneBuildId, Action callback = null, bool isLoading = true)
 *      {
 *
 *          if(isLoading)
 *          {
 *              Stats.IsActive = SetActvie(true);
 *              //DataSceneLoad.PageActive = DataSceneLoad.PageLoading.Activate(true);
 *
 *              StopCoroutine("SceneLoadAsync");
 *              StartCoroutine(SceneLoadAsync(sceneBuildId));
 *          }
 *          else
 *          {
 *              StopCoroutine("SceneUnloadAsync");
 *              StartCoroutine(SceneUnloadAsync(sceneBuildId));
 *          }
 *
 *          return true;
 *      }
 *
 *
 *      private IEnumerator SceneLoadAsync(int sceneBuildId)
 *      {
 *          yield return new WaitForSeconds(2f);
 *
 *          var operation =  SceneManager.LoadSceneAsync(sceneBuildId, LoadSceneMode.Additive);
 *
 *          while (!operation.isDone)
 *          {
 *              yield return null;
 *          }
 *
 *          Log(Label, "[" + sceneBuildId + "] was activated.");
 *
 *          var objs = SceneManager.GetSceneByBuildIndex(sceneBuildId).GetRootGameObjects();
 *
 *          foreach (var obj in objs)
 *          {
 *              var objUI = obj.GetComponent<IUI>();
 *
 *              if(objUI!=null)
 *              {
 *                  var pages = obj.GetComponentsInChildren<IPage>();
 *                  foreach (var page in pages)
 *                  {
 *
 *                      page.Initialize();
 *                      page.Configure();
 *                      Log(Label, "Page [" + page.Label + "] was initialized and configured!.");
 *                  }
 *
 *              }
 *          }
 *      }
 *
 *      private IEnumerator SceneUnloadAsync(int sceneBuildId)
 *      {
 *          //DataSceneLoad.PageActive.Activate(false);
 *          //DataSceneLoad.PageActive = null;
 *
 *          yield return new WaitForSeconds(2f);
 *
 *          var operation = SceneManager.UnloadSceneAsync(sceneBuildId);
 *
 *          while (!operation.isDone)
 *          {
 *              yield return null;
 *          }
 *
 *          Stats.IsActive = SetActvie(false);
 *          Log(Label, " was diactivated.");
 *
 *      }
 *
 *
 #region Data
 *
 *      protected bool DataCheck<T>(T instance)
 *          where T: IData
 *      {
 *          if(instance == null)
 *          {
 *              LogWarning(Label, LogFailedInitialize("[" + typeof(T).Name + "] was not found!"));
 *              return false;
 *          }
 *
 *          return true;
 *      }
 #endregion
 *
 *
 #region Cache
 *
 *      public void GetCache(ICache<IPage> cache)
 *      {
 *          Cache = cache;
 *      }
 *
 *      public IPage SetToCache(IPage instance)
 *      {
 *          if(Cache.Add(instance)!=null)
 *              Log(Label, "Page [" + instance.Label + "] was set to cache! Hashcode is [" + instance.GetHashCode() + "]");
 *          return instance;
 *
 *      }
 *
 *      public List<IPage> SetToCache(List<IPage> instances)
 *      {
 *          foreach (var instance in instances)
 *          {
 *              SetToCache(instance);
 *          }
 *          return instances;
 *      }
 *
 #endregion
 *
 #region Logs
 *
 *      public virtual void Log(string instance, string message)
 *      {
 *          if(UseDebug)
 *          {
 *              Debug.Log("["+ instance +"]: " + message);
 *          }
 *
 *      }
 *
 *      public virtual void LogWarning(string instance, string message)
 *      {
 *          if(UseDebug)
 *          {
 *              Debug.LogWarning("["+ instance +"]: " + message);
 *          }
 *      }
 *
 *      protected string LogSuccessfulInitialize()
 *      {
 *          return "Initialization process was successfully finished!";
 *      }
 *
 *      protected string LogSuccessfulConfigure()
 *      {
 *          return "Configuration process was successfully finished!";
 *      }
 *
 *      protected string LogFailedInitialize(string reason = null)
 *      {
 *          return "Initialization process was failed! " + reason;
 *      }
 *
 *      protected string LogFailedConfigure(string reason = null)
 *      {
 *          return "Configuration process was failed! " + reason;
 *      }
 *
 #endregion
 */


        public void Activate(IPage page, bool activate)
        {
            page.Activate(activate);
        }