public void LoadScene(GameSceneType type) { if (CurrentScene == type) { return; } if (type == GameSceneType.Gameplay) { Log.Error(MessageGroup.Common, "Wrong usage of function stage should be loaded by LoadStage function"); return; } CurrentScene = type; string sceneName; if (SceneBuildNames.TryGetValue(CurrentScene, out sceneName)) { ShowLoadingStageScene(() => { _isLoadingStage = false; CurrentStage = 0; StartCoroutine(LoadSceneAsync(sceneName, OnProgress, OnSceneLoaded)); }); } }
public GameScene CreateScene(GameSceneType sceneType, Hero hero, Location location) { GameSceneFactory sceneFactory; switch (sceneType) { case GameSceneType.Town: sceneFactory = new TownSceneFactory(); return(sceneFactory.CreateScene(hero, location)); //case GameSceneType.Forest: // break; case GameSceneType.Invenotry: sceneFactory = new InventorySceneFactory(); return(sceneFactory.CreateScene(hero, location)); //case GameSceneType.Battle: // break; //case GameSceneType.Shop: // break; case GameSceneType.Travel: sceneFactory = new TravelSceneFactory(); return(sceneFactory.CreateScene(hero, location)); default: return(null); } }
GameScene GetGameScene(GameSceneType type) { GameScene gameScene; if (!m_GameScenes.TryGetValue(type, out gameScene)) { switch (type) { case GameSceneType.Combat: gameScene = new CombatScene(); break; case GameSceneType.Title: gameScene = new TitleScene(); break; case GameSceneType.PreCombat: gameScene = new PreCombatScene(); break; case GameSceneType.Practice: gameScene = new PracticeScene(); break; default: gameScene = new ExitGameScene(); break; } gameScene.onEnterComplete += OnEnterComplete; gameScene.onExitComplete += OnExitComplete; m_GameScenes.Add(type, gameScene); } return(gameScene); }
public void LoadLevel(GameSceneType level) { UIController.Instance.RemoveAllTip(); UIController.Instance.CloseAllOpendPanel(); StopAllCoroutines(); StartCoroutine(this.LoadLevelInspector(level)); }
private static IEnumerable <Type> IterateAllAssembliesWithHandlers(GameSceneType sceneType) { return(new AssemblyHandlerIterator <ClientUnitySharedHandlersMetadataMarker>(sceneType) .Concat(new AssemblyHandlerIterator <ClientUnityAuthenticationMetadataMarker>(sceneType)) .Concat(new AssemblyHandlerIterator <ClientUnityCharacterMetadataMarker>(sceneType)) .Concat(new AssemblyHandlerIterator <ClientUnityShipMetadataMarker>(sceneType)) .ToArray()); }
/// <inheritdoc /> public SceneTypeCreateAttribute(GameSceneType sceneType) { if (!Enum.IsDefined(typeof(GameSceneType), sceneType)) { throw new InvalidEnumArgumentException(nameof(sceneType), (int)sceneType, typeof(GameSceneType)); } SceneType = sceneType; }
/// <summary> /// 设置当前的场景 /// </summary> /// <param name="sceneType">场景类型</param> public void SetCurScene(GameSceneType sceneType) { // 确定玩家目前处于房间(CG式场景)还是过道(行走图场景) if (m_promptManager != null) { m_promptManager.SetCurScene(sceneType); } }
bool RegisterGameScene(GameSceneType varSceneType, GameScene varScene) { if (!mGameSceneDic.ContainsKey(varSceneType)) { mGameSceneDic.Add(varSceneType, varScene); return(true); } return(false); }
/// <inheritdoc /> public GameClientMessageHandlerAutofacModule(GameSceneType sceneType) { if (!Enum.IsDefined(typeof(GameSceneType), sceneType)) { throw new InvalidEnumArgumentException(nameof(sceneType), (int)sceneType, typeof(GameSceneType)); } SceneType = sceneType; }
public BattleScene( Location currentLocation, Hero hero, GameSceneType sceneType, IDictionary <string, GameSceneType> optionsMenuItems, IDictionary <string, BattleSceneOptions> battleOptions) : base(currentLocation, hero, sceneType, optionsMenuItems, ConsoleColor.Red) { }
/// <inheritdoc /> public AssemblyHandlerIterator(GameSceneType gameSceneTypeSearchingFor) { if (!Enum.IsDefined(typeof(GameSceneType), gameSceneTypeSearchingFor)) { throw new InvalidEnumArgumentException(nameof(gameSceneTypeSearchingFor), (int)gameSceneTypeSearchingFor, typeof(GameSceneType)); } GameSceneTypeSearchingFor = gameSceneTypeSearchingFor; }
public void Proceed() { //Debug.Log("proceed" + sceneQueue.Count); if (sceneQueue.Count == 0) { if (instance.sceneNumberIncrement) { Debug.Log("next scene setup"); Debug.Log(currentSceneNumber); currentSceneNumber++; Debug.Log(currentSceneNumber); sceneNumberIncrement = false; } Saver.SaveFile(this, 0); //Debug.Log(currentSceneNumber); var ta_kor = Resources.Load <TextAsset>(textPath + "Scene" + currentSceneNumber.ToString()); if (ta_kor == null) { StartCoroutine(DelayedSceneChange(GameSceneType.Ending)); return; } else { rawDialogue.Clear(); var raw = ta_kor.text; string[] rows = raw.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None); GameSceneType lst = GameSceneType.Clean; for (int i = 0; i < rows.Length; i++) { if (Enum.TryParse(rows[i], out GameSceneType result)) { sceneQueue.Enqueue(result); lst = result; continue; } switch (lst) { case GameSceneType.Dialogue: rawDialogue.Add(rows[i]); //Debug.Log(rows[i]); break; } } } } var s = sceneQueue.Dequeue(); Debug.Log(s); if (sceneQueue.Count == 0) { sceneNumberIncrement = true; } instance.StartCoroutine(instance.DelayedSceneChange(s)); }
//TODO: Shoudl we expose the ServiceDiscovery URL to the editor? Is there value in that? /// <inheritdoc /> public CommonGameDependencyModule(GameSceneType scene, [NotNull] string serviceDiscoveryUrl = "http://192.168.0.3:5000") { if (!Enum.IsDefined(typeof(GameSceneType), scene)) { throw new InvalidEnumArgumentException(nameof(scene), (int)scene, typeof(GameSceneType)); } Scene = scene; ServiceDiscoveryUrl = serviceDiscoveryUrl ?? throw new ArgumentNullException(nameof(serviceDiscoveryUrl)); }
public void LoadStage(int number) { CurrentScene = GameSceneType.Gameplay; ShowLoadingStageScene(() => { _isLoadingStage = true; CurrentStage = number; StartCoroutine(LoadSceneAsync(number + StagePrefix, OnProgress, OnSceneLoaded)); }); }
List <string> GetCMDListByGameState(GameSceneType type) { List <string> list = null; if (!m_CheatCodeCMDDict.TryGetValue(type, out list)) { return(null); } return(list); }
public void ReservePopup(GameSceneType type, string popupName, Intent it, bool showBackground) { PopupBunch bunch = new PopupBunch(); bunch.popupName = popupName; bunch.showBackground = showBackground; bunch.it = it; reservedPopup[type] = bunch; }
//TODO: Shoudl we expose the ServiceDiscovery URL to the editor? Is there value in that? /// <inheritdoc /> public CommonGameDependencyModule(GameSceneType scene, [NotNull] string serviceDiscoveryUrl, params Assembly[] engineInterfaceAssemblies) { if (!Enum.IsDefined(typeof(GameSceneType), scene)) { throw new InvalidEnumArgumentException(nameof(scene), (int)scene, typeof(GameSceneType)); } Scene = scene; ServiceDiscoveryUrl = serviceDiscoveryUrl ?? throw new ArgumentNullException(nameof(serviceDiscoveryUrl)); EngineInterfaceAssemblies = engineInterfaceAssemblies; }
private IEnumerator DelayOpenPanel(GameSceneType lastLevel) { yield return new WaitForSeconds(0.2f); switch (this.CurrentScene) { case GameSceneType.LoginScene: break; default: break; } }
/// <inheritdoc /> public GameClientMessageHandlerAutofacModule(GameSceneType sceneType, [JetBrains.Annotations.NotNull] Assembly assemblyToSearch) : this() { if (!Enum.IsDefined(typeof(GameSceneType), sceneType)) { throw new InvalidEnumArgumentException(nameof(sceneType), (int)sceneType, typeof(GameSceneType)); } SceneType = sceneType; AssemblyToSearch = assemblyToSearch ?? throw new ArgumentNullException(nameof(assemblyToSearch)); }
private IEnumerator<AsyncOperation> LoadLevelInspector(GameSceneType level) { AsyncOperation operation = Application.LoadLevelAsync((int)level); yield return operation; //Debug.Log("LoadLevelInspector : " + operation.isDone); if (operation.isDone) { GameSceneType lastLevel = this.CurrentScene; this.CurrentScene = level; } }
/// <summary> /// 初始化游戏场景 /// </summary> public void InitializeGameScene(GameSceneType defaultGameScene) { m_CurGameScene = GetGameScene(GameSceneType.ExitGame); state = State.Done; m_NextGameScene = null; if (defaultGameScene == GameSceneType.ExitGame) { defaultGameScene = GameSceneType.Title; } EnterGameScene(defaultGameScene); }
public void loadScene(GameSceneType l, GameSceneLoadMode m) { GameManager.instance.check(); SceneType = l; gameObject.SetActive(true); mode = m; isLoading = true; int index = SceneManager.GetActiveScene().buildIndex; GameMusicManager.instance.clearMusic(); GameUserData.instance.TownPosition = (mode == GameSceneLoadMode.BattleOver ? 0 : 1); GameTouchCenterUI.instance.unShowUI(); // release scene switch (index) { case (int)GameSceneType.Title: { } break; case (int)GameSceneType.Rpg: { } break; case (int)GameSceneType.Camp: { } break; case (int)GameSceneType.Battle: { } break; } #if UNITY_EDITOR Debug.Log("scene load " + l); #endif Resources.UnloadUnusedAssets(); loadSceneAsync((int)l); }
public GameScene( Location currentLocation, Hero hero, GameSceneType sceneType, IDictionary <string, GameSceneType> optionsMenuItems, ConsoleColor sceneColor) { this.CurrentLocation = currentLocation; this.Hero = hero; this.OptionsMenuItems = optionsMenuItems; this.UserChoiceMenu = this.CreateUserChoiceMenu(this.OptionsMenuItems); this.SceneColor = sceneColor; }
private IEnumerator <AsyncOperation> LoadLevelInspector(GameSceneType level) { AsyncOperation operation = Application.LoadLevelAsync((int)level); yield return(operation); //Debug.Log("LoadLevelInspector : " + operation.isDone); if (operation.isDone) { GameSceneType lastLevel = this.CurrentScene; this.CurrentScene = level; } }
protected static bool DetermineIfHandlerIsForSceneType(Type handlerType, GameSceneType sceneType) { //We don't want to get base attributes //devs may want to inherit from a handler and change some stuff. But not register it as a handler //for the same stuff obviously. foreach (SceneTypeCreateAttribute attris in handlerType.GetTypeInfo().GetCustomAttributes <SceneTypeCreateAttribute>(false)) { if (attris.SceneType == sceneType) { return(true); } } return(false); }
/// <inheritdoc /> public BaseHandlerRegisterationModule(GameSceneType sceneType, [JetBrains.Annotations.NotNull] Assembly assemblyForHandlerTypes, params Type[] additionalTypesToRegisterHandlersAs) { if (!Enum.IsDefined(typeof(GameSceneType), sceneType)) { throw new InvalidEnumArgumentException(nameof(sceneType), (int)sceneType, typeof(GameSceneType)); } if (additionalTypesToRegisterHandlersAs == null) { AdditionalTypesToRegisterHandlersAs = new Type[0]; } SceneType = sceneType; AssemblyForHandlerTypes = assemblyForHandlerTypes ?? throw new ArgumentNullException(nameof(assemblyForHandlerTypes)); AdditionalTypesToRegisterHandlersAs = additionalTypesToRegisterHandlersAs; }
public void Test_Only_Finds_Initializables_Specified(GameSceneType sceneType) { //arrange ContainerBuilder builder = new ContainerBuilder(); EngineInterfaceRegisterationModule module = new EngineInterfaceRegisterationModule(sceneType, typeof(SessionClaimResponseHandler).Assembly); builder.RegisterModule(module); IReadOnlyCollection <IGameInitializable> initiablizes = builder.Build().Resolve <IReadOnlyCollection <IGameInitializable> >(); //act foreach (var init in initiablizes) { //If we have an intiiablizable that doesn't have the scene then this will throw. Assert.True(init.GetType().GetAttributes <SceneTypeCreateAttribute>().Any(a => a.SceneType == sceneType)); } }
void LoadCheatCodeConfig() { TextAsset obj = Resources.Load <TextAsset>("config/CheatCode"); if (obj != null) { MemoryStream stream = new MemoryStream(obj.bytes); StreamReader streamR = new StreamReader(stream, System.Text.Encoding.UTF8); string str = streamR.ReadLine(); List <string> curCodeList = null; while (str != null) { if (str != "" && str != null && str.IndexOf('#') != 0) { if (str.IndexOf('[') == 0) { //标题 string gameStateStr = str.Remove(str.Length - 1); gameStateStr = gameStateStr.Remove(0, 1); GameSceneType newGameState = (GameSceneType)Enum.Parse(typeof(GameSceneType), gameStateStr); curCodeList = GetCMDListByGameState(newGameState); if (curCodeList == null) { curCodeList = new List <string>(); m_CheatCodeCMDDict.Add(newGameState, curCodeList); } } else { //普通内容 if (curCodeList != null) { curCodeList.Add(str); } } } str = streamR.ReadLine(); } streamR.Close(); stream.Close(); } }
public void ChangeScene(GameSceneType varSceneType) { if (!mGameSceneDic.ContainsKey(varSceneType)) { if (Debuger.ENABLELOG) { Debug.LogError("The scene " + varSceneType + " is not register."); } return; } GameScene tmpCurrentScene = mSceneStateMachine.GetCurrentState() as GameScene; GameScene tmpGotoScene = mGameSceneDic[varSceneType]; if (tmpGotoScene == tmpCurrentScene || tmpGotoScene == null) { return; } mSceneStateMachine.ChangeState(tmpGotoScene); }
public void LoadLevel(GameSceneType level) { this.ClearUI(); StopAllCoroutines(); StartCoroutine(this.LoadLevelInspector(level)); }
void Awake() { Instance = this; this.CurrentScene = GameSceneType.LoginScene; }
private void LoadLevelComplete(GameSceneType lastLevel) { //Debug.Log("LoadLevelComplete : "); StopAllCoroutines(); StartCoroutine(this.DelayOpenPanel(lastLevel)); }
public void GoToScene(GameSceneType sceneType) { if (currentSceneType == sceneType) { return; } GameScene sceneToCreate = null; switch (sceneType) { case GameSceneType.MissionScene: var missionScene = new MissionScene(); /* old code for adding actors * Team team1 = new Team("Rumbleshank"); team1.AIControlled = false; var actor1 = new ActorProperties(); actor1.SpriteName = "goodsoldier"; actor1.MovementPoints = 6; actor1.Name = "Hunkenheim1"; actor1.MaxHealth = 10; actor1.CurrentHealth = 10; actor1.Abilities.Add(new BasicMoveAbility()); actor1.Abilities.Add(new WaitAbility()); actor1.Inventory.AddItem(Weapons.AssaultRifle); actor1.Inventory.EquipItem(Weapons.AssaultRifle); team1.Members.Add(actor1); var actor2 = new ActorProperties(); actor2.SpriteName = "goodsoldier"; actor2.MovementPoints = 6; actor2.MaxHealth = 10; actor2.CurrentHealth = 10; actor2.Name = "Hunkenheim2"; actor2.Abilities.Add(new BasicMoveAbility()); actor2.Abilities.Add(new WaitAbility()); team1.Members.Add(actor2); missionScene.AddTeam(team1); Team team2 = new Team("Brown Eggz"); team2.AIControlled = true; var actor3 = new ActorProperties(); actor3.SpriteName = "evilsoldier"; actor3.MaxHealth = 10; actor3.CurrentHealth = 10; actor3.MovementPoints = 6; actor3.Name = "Scrambled Eggs"; actor3.Abilities.Add(new BasicMoveAbility()); actor3.Abilities.Add(new WaitAbility()); team2.Members.Add(actor3); missionScene.AddTeam(team2); */ var actorController = new ActorController(); foreach (Team team in actorController.teams) { missionScene.AddTeam(team); } TextAsset puzdata = (TextAsset)Resources.Load("puzzles", typeof(TextAsset)); sceneToCreate = missionScene; AwayTeam.MissionController = missionScene; break; default: break; } if (sceneToCreate != null) { currentSceneType = sceneType; if (currentScene != null) { Futile.stage.RemoveChild(currentScene); } currentScene = sceneToCreate; Futile.stage.AddChild(currentScene); currentScene.Start(); } }
/// <summary> /// 加载场景 /// </summary> /// <param name="scene">场景枚举值</param> static public void LoadScene(GameSceneType scene) { SceneManager.LoadScene((byte)scene); }
public TravelScene(Location currentLocation, Hero hero, GameSceneType sceneType, IDictionary <string, GameSceneType> optionsMenuItems, IDictionary <string, Locations> locationsOptions) : base(currentLocation, hero, sceneType, optionsMenuItems, ConsoleColor.Green) { this.LocationsOptions = locationsOptions; this.UserTravelChoiceMenu = this.CreateLocationsUserChoiceMenu(this.locationsOptions); }