Exemplo n.º 1
0
        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);
     }
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 public static void AddGameFlag(GameFlag f)
 {
     if (!save.gameFlags.Contains(f))
     {
         save.gameFlags.Add(f);
         PropagateFlagChange();
     }
 }
Exemplo n.º 5
0
 public static void RemoveGameFlag(GameFlag f)
 {
     if (save.gameFlags.Contains(f))
     {
         save.gameFlags.Remove(f);
         PropagateFlagChange();
     }
 }
Exemplo n.º 6
0
 public static bool HasFlag(GameFlag f)
 {
     if (save == null || f == GameFlag.None)
     {
         return(false);
     }
     return(save.gameFlags.Contains(f));
 }
Exemplo n.º 7
0
 /// <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>();
 }
Exemplo n.º 8
0
        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;
        }
Exemplo n.º 9
0
    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);
    }
Exemplo n.º 10
0
    /// <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);
    }
Exemplo n.º 11
0
    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));
        }
    }
Exemplo n.º 12
0
 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>();
 }
Exemplo n.º 13
0
    // 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));
        }
    }
Exemplo n.º 14
0
        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);
        }
Exemplo n.º 15
0
 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));
 }
Exemplo n.º 18
0
 public bool GetFlag(GameFlag flag)
 {
     return(Hook.ReadEventFlag((int)flag));
 }
Exemplo n.º 19
0
 public void GameFlag(GameFlag flag)
 {
     GlobalController.AddGameFlag(flag);
 }
Exemplo n.º 20
0
 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));
 }