private static void GameLoop() { int tick = 0, tick16 = 0; // Mark the game as running, and show the main window. Game.Flag = GameFlag.Running; // Continue to run the game-loop as long as our game // is not closing. while (Game.Flag != GameFlag.Closing) { tick = Environment.TickCount; // Render graphics up to 60 times a second. if (tick16 < tick) { GraphicsManager.Graphics?.Draw(); tick16 = tick + 16; } // Update the map logic. if (Game.State == GameState.Game) { DataManager.Map.UpdateLogic(); } } // The game will only be destroyed when the flag is set to closing. Game.Destroy(); }
/// <summary> /// Adds the provided game flag to the activated game flags in this InGameState. /// </summary> /// <param name="flag">Flag to add</param> public void ApplyAddGameFlag(GameFlag flag) { if (!HasGameFlag(flag)) { ActiveGameFlags.Add(flag.Name, flag); } }
public void EnableBossCategoryFlag(int category, bool abyss = false) { // These are disabled in EMEVD on run cleanup. GameFlag baseFlag = abyss ? GameFlag.AbyssBossCategoryUsedBaseFlag : GameFlag.BossCategoryUsedBaseFlag; EnableFlag(baseFlag + category); }
public static void AddGameFlag(GameFlag f) { if (!save.gameFlags.Contains(f)) { save.gameFlags.Add(f); PropagateFlagChange(); } }
public static void RemoveGameFlag(GameFlag f) { if (save.gameFlags.Contains(f)) { save.gameFlags.Remove(f); PropagateFlagChange(); } }
public static bool HasFlag(GameFlag f) { if (save == null || f == GameFlag.None) { return(false); } return(save.gameFlags.Contains(f)); }
/// <summary> /// 初始化管理类 譬如网络通信模块 /// </summary> private void InitializeMgr() { GameFlag = new GameFlag(); DOTween.Init(true, true, LogBehaviour.ErrorsOnly); gameObject.AddComponent <AsyncImageDownload>(); gameObject.AddComponent <AudioManager>(); gameObject.AddComponent <UIWindowMgr>(); gameObject.AddComponent <UIModelMgr>(); }
public static void SetGameFlag(GameFlag flag) { // Make sure we can't change the flag if we're already closing. if (Game.Flag == GameFlag.Closing) { return; } Game.Flag = flag; }
public int GetFlag(string flagName) { GameFlag flag = gameData.gameFlags.Find(XmlAnyAttributeAttribute => XmlAnyAttributeAttribute.flag == flagName); if (flag == null) { SetFlag(flagName, 0); return(0); } return(flag.value); }
/// <summary> /// Finds the value associated with the flag /// </summary> /// <param name="flagName"></param> /// <returns></returns> public int GetFlag(string flagName) { GameFlag flag = gameData.gameFlags.Find(x => x.flag == flagName); // Create Non-existant flags but default to 0 if (flag == null) { SetFlag(flagName, 0); return(0); } return(flag.value); }
public void SetFlag(string flagName, int value) { GameFlag oldFlag = gameData.gameFlags.Find(x => x.flag == flagName); if (oldFlag != null) { oldFlag.value = value; } else { gameData.gameFlags.Add(new GameFlag(flagName, value)); } }
private void InitializeMgr() { GameFlag = new GameFlag(); DOTween.Init(true, true, LogBehaviour.ErrorsOnly); gameObject.AddChild <AsyncImageDownload>(); gameObject.AddChild <AudioManager>(); gameObject.AddChild <UIWindowMgr>(); gameObject.AddChild <TimerMgr>(); gameObject.AddChild <UIModelMgr>(); gameObject.AddChild <ViSpeak>(); gameObject.AddChild <ViSpeakRecorder>(); NetWriter.SetUrl(SeverHost);//绑定服务器端口、只绑定一次 gameObject.AddChild <Net>(); }
// For flag storing and getting public void SetFlag(string flagName, int value) { // Overwrite Old Key/Values GameFlag oldFlag = gameData.gameFlags.Find(x => x.flag == flagName); // Either update the value or add a new one if it does not exist if (oldFlag != null) { oldFlag.value = value; } else { // Does not exist in list gameData.gameFlags.Add(new GameFlag(flagName, value)); } }
public List <int> GetBossCategoriesUsed(bool abyss = false) { // List of boss categories used in the current run, which will prevent the same // category appearing again. List <int> bossCategoriesUsed = new List <int>(); int maxBossCategory = EnemyGenerator.LastBossCategory; GameFlag baseFlag = abyss ? GameFlag.AbyssBossCategoryUsedBaseFlag : GameFlag.BossCategoryUsedBaseFlag; for (int category = 0; category <= maxBossCategory; category++) { if (GetFlag(baseFlag + category)) { bossCategoriesUsed.Add(category); } } return(bossCategoriesUsed); }
public void EnableFlag(GameFlag flag) { Hook.EnableEventFlag((int)flag); }
public GameFlagLogicalElement(GameFlag gameFlag) { GameFlag = gameFlag; }
public bool IsGameFlagEnabled(GameFlag gameFlag) { return(!RemovedGameFlags.Contains(gameFlag.Name)); }
public bool GetFlag(GameFlag flag) { return(Hook.ReadEventFlag((int)flag)); }
public void GameFlag(GameFlag flag) { GlobalController.AddGameFlag(flag); }
public void DisableFlag(GameFlag flag) { Hook.DisableEventFlag((int)flag); }
/// <summary> /// Returns whether the provided game flag is activated in this InGameState. /// </summary> /// <param name="flag">The game flag to check</param> /// <returns></returns> public bool HasGameFlag(GameFlag flag) { return(ActiveGameFlags.ContainsKey(flag.Name)); }