Esempio n. 1
0
        public override PresentationResult OnInspectorGui(PresentationParamater parameter)
        {
            FortScene  fortScene = (FortScene)parameter.Instance;
            SceneAsset oldScene  = fortScene == null?null: AssetDatabase.LoadAssetAtPath <SceneAsset>(fortScene.SceneName);

            if (fortScene == null)
            {
                fortScene = new FortScene();
            }
            EditorGUI.BeginChangeCheck();
            Object result = EditorGUILayout.ObjectField(parameter.Title, oldScene, typeof(SceneAsset), false);

            if (EditorGUI.EndChangeCheck())
            {
                var newPath = AssetDatabase.GetAssetPath(result);
                fortScene.SceneName = newPath;
                return(new PresentationResult
                {
                    Result = fortScene,
                    Change = new Change {
                        IsDataChanged = true
                    }
                });
            }
            return(new PresentationResult
            {
                Result = fortScene,
                Change = new Change {
                    IsDataChanged = false
                }
            });
        }
Esempio n. 2
0
 private string GetCategorySceneName(GameLevelCategory category)
 {
     if (!FortScene.IsNullOrEmpty(category.DefaultScene))
     {
         return(category.DefaultScene.Value.SceneName);
     }
     if (InfoResolver.Resolve <FortInfo>().GameLevel.LevelCategoriesParentMap.ContainsKey(category.Id))
     {
         return(GetCategorySceneName(InfoResolver.Resolve <FortInfo>().GameLevel.LevelCategoriesParentMap[category.Id]));
     }
     return(string.Empty);
 }
Esempio n. 3
0
        private string ResolveGameLevelSceneName(GameLevelInfo level)
        {
            if (!FortScene.IsNullOrEmpty(level.Scene))
            {
                return(level.Scene.Value.SceneName);
            }
            string categorySceneName = GetCategorySceneName(InfoResolver.Resolve <FortInfo>().GameLevel.LevelCategoriesParentMap[level.Id]);

            if (!string.IsNullOrEmpty(categorySceneName))
            {
                return(categorySceneName);
            }
            return(FortScene.IsNullOrEmpty(InfoResolver.Resolve <FortInfo>().GameLevel.DefaultScene)?null: InfoResolver.Resolve <FortInfo>().GameLevel.DefaultScene.Value.SceneName);
        }
Esempio n. 4
0
 public void LoadGameLevelAsync(GameLevelInfo level)
 {
     if (FortScene.IsNullOrEmpty(InfoResolver.Resolve <FortInfo>().GameLevel.LoaderScene.Value))
     {
         throw new Exception("No Loader Scene is defined in Game Level config");
     }
     _lastLoadGameAsync = level;
     ServiceLocator.Resolve <ISceneLoaderService>().Load(new SceneLoadParameters(InfoResolver.Resolve <FortInfo>().GameLevel.LoaderScene.Value.SceneName)
     {
         AddToSceneStack  = false,
         CaptureReturnKey = false,
         Context          = level,
         FlushSceneStack  = true
     });
 }