示例#1
0
        public override GameSupportResult OnUpdate(GameState state)
        {
            if (_onceFlag)
            {
                return(GameSupportResult.DoNothing);
            }

            if (FirstMap.Contains(state.CurrentMap.ToLower()) && this._introIndex != -1)
            {
                var newIntro = state.GetEntInfoByIndex(_introIndex);

                if (newIntro.EntityPtr == IntPtr.Zero)
                {
                    _introIndex = -1;
                    _onceFlag   = true;
                    Debug.WriteLine("deepdown start");
                    return(GameSupportResult.PlayerGainedControl);
                }
            }
            else if (LastMap.Contains(state.CurrentMap.ToLower()))
            {
                float splitTime = state.FindOutputFireTime("AlyxWakeUp1", 7);

                if (_splitTime == 0f && splitTime != 0f)
                {
                    Debug.WriteLine("deepdown end");
                    _onceFlag  = true;
                    _splitTime = splitTime;
                    return(GameSupportResult.PlayerLostControl);
                }

                _splitTime = splitTime;
            }
            return(GameSupportResult.DoNothing);
        }
示例#2
0
        // called on the first tick when player is fully in the game (according to demos)
        /// <summary>
        /// Actions to do when a new session starts and the player is fully in the game
        /// </summary>
        /// <param name="state">GameState</param>
        public virtual void OnSessionStart(GameState state)
        {
            _onceFlag = false;

            string map = _mapsLowercase ? state.CurrentMap.ToLower() : state.CurrentMap;

            this.IsFirstMap = FirstMap.Contains(map);
            this.IsLastMap  = LastMap.Contains(map);
        }
示例#3
0
        private async Task OnRefresh()
        {
            if (string.IsNullOrWhiteSpace(CurrentServer))
            {
                return;
            }
            ServerInfo si = ServerInfo.Parse(CurrentServer);

            if (LastServer == null || !LastServer.Equals(si))
            {
                LastServer = si;
                LastMaps.Clear();
            }

            CurrentGame = await Game.Download(si);

            if (CurrentGame != null)
            {
                var lastMap = LastMaps.FirstOrDefault();
                if (lastMap == null || (lastMap.Name != CurrentGame.Map.Name || lastMap.Type != CurrentGame.Map.Type))
                {
                    var newMap = new LastMap
                    {
                        DateTime  = DateTime.Now,
                        Name      = CurrentGame.Map.Name,
                        Type      = CurrentGame.Map.Type,
                        ShortType = CurrentGame.Map.ShortType
                    };
                    OnNewMap();
                    LastMaps.Insert(0, newMap);
                    LastMapsComboBox.SelectedIndex = 0;
                }
            }
            else
            {
                LastServer = null;
            }

            while (LastMaps.Count > 8)
            {
                LastMaps.RemoveAt(LastMaps.Count - 1);
            }
        }