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() { OnKeyDownAsObservable .Where(x => x.KeyCode == Keys.F11) .Subscribe(_ => { DrawText("Citizen Invincible", 3.0f); StartCoroutine(RagdollCoroutine()); }); }
protected override void Setup() { CreateInputKeywordAsObservable("snax") .Subscribe(_ => IsActive = !IsActive); IsActiveAsObservable .Where(x => x) .Subscribe(x => { DrawText($"SpeedMax:{IsActive}[Type:{(currentSpeedType)}][Exclude:{excludeMissionVehicle}]"); vehicleHashSet.Clear(); }); IsActiveAsObservable .Skip(1) .Where(x => !x) .Subscribe(x => { DrawText($"SpeedMax:{IsActive}"); vehicleHashSet.Clear(); }); //ミッション開始直後に一瞬動作を止めるフラグ var suspednFlag = false; OnThinnedTickAsObservable .Where(_ => IsActive && !suspednFlag) .Subscribe(_ => { foreach (var v in CachedVehicles .Where(x => x.IsSafeExist() && x.IsInRangeOf(PlayerPed.Position, 100.0f) && !vehicleHashSet.Contains(x.Handle) && !(excludeMissionVehicle && x.IsPersistent) )) { vehicleHashSet.Add(v.Handle); if (currentSpeedType == SpeedType.Original) { StartCoroutine(OriginalSpeedMaxCoroutine(v)); } else { StartCoroutine(VehicleSpeedMaxCorutine(v)); } } }); var nextType = currentSpeedType; OnKeyDownAsObservable .Where(x => IsActive && x.KeyCode == Keys.F6) .Do(_ => { nextType = GetNextSpeedType(nextType); DrawText($"SpeedMax:[Type:{nextType}]", 1.0f); }) .Throttle(TimeSpan.FromSeconds(1)) .Subscribe(_ => { currentSpeedType = nextType; DrawText($"SpeedMax:[Type:{(currentSpeedType)}][OK]", 2.0f); StopAllCoroutine(); vehicleHashSet.Clear(); }); OnKeyDownAsObservable .Where(x => IsActive && x.KeyCode == Keys.F5) .Subscribe(_ => { excludeMissionVehicle = !excludeMissionVehicle; vehicleHashSet.Clear(); StopAllCoroutine(); DrawText($"SpeedMax:ExcludeMissionVehicles[{excludeMissionVehicle}]"); }); OnThinnedTickAsObservable .Where(_ => IsActive) .Select(_ => PlayerPed.IsAlive) .DistinctUntilChanged() .Where(x => x) .Subscribe(_ => vehicleHashSet.Clear()); //ミッションが始まった時にしばらく動作を止める OnThinnedTickAsObservable .Where(_ => IsActive) .Select(_ => Game.MissionFlag) .DistinctUntilChanged() .Where(x => x) .Do(_ => suspednFlag = true) .Delay(TimeSpan.FromSeconds(3)) .Subscribe(_ => suspednFlag = false); }
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 }
protected override void Setup() { //敵対関係のグループを作成 chaosRelationShipId = World.AddRelationshipGroup("Inferno:ChaosPeds"); var chaosSettingLoader = new ChaosModeSettingLoader(); chaosModeSetting = chaosSettingLoader.LoadSettingFile(@"ChaosMode_Default.conf"); chaosChecker = new CharacterChaosChecker(chaosModeSetting.DefaultMissionCharacterTreatment, chaosModeSetting.IsChangeMissionCharacterWeapon); defaultWeaponProvider = new CustomWeaponProvider(chaosModeSetting.WeaponList, chaosModeSetting.WeaponListForDriveBy); //キーワードが入力されたらON/OFFを切り替える CreateInputKeywordAsObservable(Keyword) .Subscribe(_ => { IsActive = !IsActive; chaosedPedList.Clear(); StopAllChaosCoroutine(); if (IsActive) { DrawText("ChaosMode:On/" + currentTreatType.ToString(), 3.0f); World.SetRelationshipBetweenGroups(Relationship.Hate, chaosRelationShipId, PlayerPed.RelationshipGroup); } else { DrawText("ChaosMode:Off", 3.0f); World.SetRelationshipBetweenGroups(Relationship.Neutral, chaosRelationShipId, PlayerPed.RelationshipGroup); } }); nextTreatType = currentTreatType; //F7でキャラカオスの切り替え(暫定 OnKeyDownAsObservable .Where(x => IsActive && x.KeyCode == Keys.F7) .Do(_ => { nextTreatType = (MissionCharacterTreatmentType)(((int)nextTreatType + 1) % 3); DrawText("CharacterChaos:" + nextTreatType.ToString(), 1.1f); }) .Throttle(TimeSpan.FromSeconds(1)) .Subscribe(_ => { currentTreatType = nextTreatType; chaosChecker.MissionCharacterTreatment = nextTreatType; DrawText("CharacterChaos:" + currentTreatType.ToString() + "[OK]", 3.0f); chaosedPedList.Clear(); StopAllChaosCoroutine(); }); //interval設定 Interval = chaosModeSetting.Interval; var oneSecondTich = CreateTickAsObservable(TimeSpan.FromSeconds(1)); //市民をカオス化する oneSecondTich .Where(_ => IsActive && PlayerPed.IsSafeExist() && PlayerPed.IsAlive) .Subscribe(_ => CitizenChaos()); //プレイヤが死んだらリセット oneSecondTich .Where(_ => PlayerPed.IsSafeExist()) .Select(_ => PlayerPed.IsDead) .DistinctUntilChanged() .Where(x => x) .Subscribe(_ => { chaosedPedList.Clear(); StopAllChaosCoroutine(); }); oneSecondTich .Where(_ => IsActive) .Subscribe(_ => NativeFunctions.SetAllRandomPedsFlee(Game.Player, false)); //イベントが来たら武器を変更する OnRecievedInfernoEvent .OfType <IEventMessage, ChasoModeEvent>() .Subscribe(e => { if (e is ChangeToDefaultEvent) { singleWeaponProvider = null; } else if (e is ChangeWeaponEvent) { var s = (ChangeWeaponEvent)e; singleWeaponProvider = new SingleWeaponProvider(s.Weapon); } }); }