Esempio n. 1
0
        protected override void Setup()
        {
            CreateInputKeywordAsObservable("fulton")
            .Subscribe(_ =>
            {
                IsActive = !IsActive;
                DrawText("Fulton:" + IsActive, 3.0f);
            });

            OnAllOnCommandObservable.Subscribe(_ => IsActive = true);

            OnKeyDownAsObservable
            .Where(x => IsActive && x.KeyCode == Keys.F9 && motherbaseVeh.Count > 0)
            .Subscribe(_ => SpawnVehicle());

            OnKeyDownAsObservable
            .Where(x => IsActive && x.KeyCode == Keys.F10 && motherBasePeds.Count > 0)
            .Subscribe(_ => SpawnCitizen());

            CreateTickAsObservable(TimeSpan.FromSeconds(0.5))
            .Where(_ => IsActive && !Function.Call <bool>(Hash.IS_CUTSCENE_ACTIVE))
            .Subscribe(_ => FulutonUpdate());

            //プレイヤが死んだらリストクリア
            OnThinnedTickAsObservable
            .Select(_ => PlayerPed.IsDead)
            .DistinctUntilChanged()
            .Where(x => x)
            .Subscribe(_ => fulutonedEntityList.Clear());
            SetUpSound();
        }
        protected override void Setup()
        {
            //0.3秒間押しっぱなしなら発動
            OnThinnedTickAsObservable
            .Select(_ => !this.GetPlayerVehicle().IsSafeExist() &&
                    !_isGriped &&
                    this.IsGamePadPressed(GameKey.Reload)
                    ).Buffer(3, 1)
            .Where(x => x.All(v => v))
            .Subscribe(_ => GripAction());

            OnThinnedTickAsObservable
            .Where(_ => _isGriped)
            .Subscribe(_ =>
            {
                Grip(PlayerPed, _vehicle, _ofsetPosition);
            });

            OnThinnedTickAsObservable
            .Where(_ => _isGriped && (!this.IsGamePadPressed(GameKey.Reload) || PlayerPed.IsDead))
            .Subscribe(_ => GripRemove());

            this.OnAbortAsync.Subscribe(_ =>
            {
                SetPlayerProof(false);
            });
        }
Esempio n. 3
0
        protected override void Setup()
        {
            filePath = LoadWavFiles(@"scripts/Pichun");

            soundPlayer = new SoundPlayer();
            //音声ファイルロード完了時に再生する
            soundPlayer.LoadCompleted += (sender, args) =>
            {
                soundPlayer.Play();
            };

            //ファイルが存在した時のみ
            if (filePath.Length > 0)
            {
                //プレイヤが死亡したら再生
                OnThinnedTickAsObservable
                .Select(_ => PlayerPed)
                .Where(p => p.IsSafeExist())
                .Select(p => p.IsAlive)
                .DistinctUntilChanged()
                .Where(isAlive => !isAlive)
                .Subscribe(_ => PlayAction());
            }
        }
Esempio n. 4
0
        protected override void Setup()
        {
            IsActive  = false;
            timerText = new TimerUiTextManager(this);

            #region ParunteScripts

            //RefrectionでParupunteScriptを継承しているクラスをすべて取得する
            _parupunteScritpts =
                Assembly.GetExecutingAssembly()
                .GetTypes()
                .Where(type => type.BaseType != null && type.BaseType == typeof(ParupunteScript))
                .Where(x =>
            {
                var attribute = x.GetCustomAttribute <ParupunteDebug>();
                return(attribute == null || !attribute.IsIgnore);
            })
                .ToArray();

            _debugParuputeScripts = _parupunteScritpts.Where(x =>
            {
                var attribute = x.GetCustomAttribute <ParupunteDebug>();
                return(attribute != null && attribute.IsDebug);
            }).ToArray();


            #endregion ParunteScripts

            #region Config

            SetConfigData(_parupunteScritpts);

            #endregion

            #region EventHook

            CreateInputKeywordAsObservable("rnt")
            .Where(_ => !IsActive)
            .Subscribe(_ => ParupunteStart(ChooseParupounteScript()));

            CreateInputKeywordAsObservable("snt")
            .Where(_ => IsActive)
            .Subscribe(_ => ParupunteStop());

            OnKeyDownAsObservable.Where(x => x.KeyCode == Keys.NumPad0)
            .ThrottleFirst(TimeSpan.FromSeconds(2f), InfernoScriptScheduler)
            .Subscribe(_ =>
            {
                if (IsActive)
                {
                    ParupunteStop();
                }
                else
                {
                    ParupunteStart(ChooseParupounteScript());
                }
            });

            //パルプンテが停止したタイミングで開放
            IsActiveAsObservable
            .Where(x => !x)
            .Subscribe(_ =>
            {
                foreach (var entity in _autoReleaseEntitiesList.Where(entity => entity.IsSafeExist()))
                {
                    entity.MarkAsNoLongerNeeded();
                }
                _autoReleaseEntitiesList.Clear();
            });

            var nextIsonoTime = Time;

            OnRecievedInfernoEvent
            .OfType <IEventMessage, IsonoMessage>()
            .Where(_ => (nextIsonoTime - Time).Ticks <= 0)
            .Retry()
            .Subscribe(c =>
            {
                var r = IsonoMethod(c.Command);
                if (r)
                {
                    nextIsonoTime = Time.Add(TimeSpan.FromSeconds(4));
                }
            });

            #endregion EventHook

            #region Drawer

            var screenResolution = NativeFunctions.GetScreenResolution();
            _screenHeight        = (int)screenResolution.Y;
            _screenWidth         = (int)screenResolution.X;
            _mainTextUiContainer = new UIContainer(
                new Point(0, 0), new Size(_screenWidth, _screenHeight));
            _subTextUiContainer = new UIContainer(
                new Point(0, 0), new Size(_screenWidth, _screenHeight));

            //テキストが更新されたら詰め直す
            timerText.OnSetTextAsObservable.Subscribe(_ =>
            {
                _mainTextUiContainer.Items.Clear();
                _mainTextUiContainer.Items.Add(timerText.Text);
            });
            //テキストが時間切れしたら消す
            OnThinnedTickAsObservable.Select(_ => timerText.IsEnabled)
            .DistinctUntilChanged()
            .Where(x => !x)
            .Subscribe(_ => _mainTextUiContainer.Items.Clear());

            this.OnDrawingTickAsObservable
            .Where(_ => _mainTextUiContainer.Items.Any() || _subTextUiContainer.Items.Any())
            .Subscribe(_ =>
            {
                _mainTextUiContainer.Draw();
                _subTextUiContainer.Draw();
            });

            #endregion Drawer
        }