Exemple #1
0
 //----------------------------------------------------------------------------
 private void OnShowUI(string strCtrl)
 {
     if (m_layerUI != null)
     {
         m_layerUI.Show(strCtrl);
     }
 }
Exemple #2
0
 private void Start()
 {
     cameraModel = new CameraControlModel(OnFieldClick);
     gameUI      = UILayer.Show <GameUI>();
     gameUI.OnCancelUnitClick += CancelUnitSelectionHandler;
     gameUI.OnEndTurnClick    += OnEndTurnClickHandler;
 }
Exemple #3
0
 public static T ShowModal <T>(System.Action showingDelegate = null) where T : UILayer
 {
     if (registeredUI.ContainsKey(typeof(T)))
     {
         UILayer layer = registeredUI[typeof(T)];
         if (!displayedUILayers.Contains(layer))
         {
             layer.gameObject.SetActive(true);
             displayedUILayers.Add(layer);
             layer.Show(() => {
                 if (showingDelegate != null)
                 {
                     showingDelegate();
                 }
                 layer.OnShow();
             });
         }
         else
         {
             layer.Show(() => {
                 if (showingDelegate != null)
                 {
                     showingDelegate();
                 }
                 layer.OnShow();
             });
         }
         SortLayers();
         return((T)layer);
     }
     else
     {
         Create <T>();
         return(UILayer.ShowModal <T>(showingDelegate));
     }
 }
Exemple #4
0
    static IEnumerator LoadingUIEnumerator <T>(System.Action loadingDelegate = null, string sceneName = "") where T : UILayer
    {
        if (sceneName != "" && SceneManager.GetActiveScene().name != sceneName)
        {
            List <System.Type> deleteUI = new List <System.Type>();
            foreach (var currentUI in registeredUI)
            {
                if (currentUI.Value.isNeedDestroyUIBetweenScenes)
                {
                    deleteUI.Add(currentUI.Key);
                }
            }

            foreach (var deleteKey in deleteUI)
            {
                if (registeredUI.ContainsKey(deleteKey))
                {
                    if (displayedUILayers.Contains(registeredUI[deleteKey]))
                    {
                        displayedUILayers.Remove(registeredUI[deleteKey]);
                    }
                    DestroyImmediate(registeredUI[deleteKey].gameObject);
                    registeredUI.Remove(deleteKey);
                }
            }

            AsyncOperation async = SceneManager.LoadSceneAsync(sceneName);
            yield return(async);
        }

        //		if (registeredUI.ContainsKey (typeof(T)))
        //		{
        //			if (loadingDelegate != null)
        //			{
        //				loadingDelegate();
        //			}
        //			yield break;
        //		}
        //
        //		ResourceRequest UIrequest = Resources.LoadAsync (pathToUIPrefabs + typeof(T).Name);
        //		yield return UIrequest;
        //
        //		InitializeUIGameObject<T> ((GameObject)UIrequest.asset);
        UILayer.Show <T>(loadingDelegate);
    }
 private void Awake()
 {
     gameUI      = UILayer.Show <GameUI>();
     moveMarkers = FindObjectOfType <TitanMoveMarkers>();
 }
Exemple #6
0
    public static void ShowCityUI(City city, Game game)
    {
        var cityUI = UILayer.Show <CityUI>();

        cityUI.Init(city, game);
    }