private void CharacterSelection() { //var p = new Point(UI.WIDTH / 2 - 150, UI.HEIGHT - 160); //new UIRectangle(new Point(p.X, p.Y + 25), new Size(300, 20), Color.FromArgb(180, 8, 8, 8)).Draw(); //new UIText("Name: " + PlayerName, new Point(p.X + 150, p.Y + 25), 0.25f, Color.White, 0, true).Draw(); //var name = AvailablePeds[CurrentCharModel].ToString(); // //new UIRectangle(new Point(p.X, p.Y + 50), new Size(200, 20), Color.FromArgb(180, 8, 8, 8)).Draw(); //new UIText(name, new Point(p.X + 100, p.Y + 50), 0.25f, Color.White, 0, true).Draw(); if(!IsOpen(CharSelectMenu)) { if (CarModel != null) CarModel.Delete(); View.AddMenu(CharSelectMenu); } if (CharacterModel == null) { Model m = AvailablePeds[CurrentCharModel]; m.Request(1000); CharacterModel = World.CreatePed(m, new Vector3(_playerPosition.X,_playerPosition.Y, _playerPosition.Z - 0.25f),_playerHeading); RPG.WorldData.AddPed(new NpcObject("charCreation", CharacterModel)); if(CharacterModel != null && !CharacterModel.IsHuman) { CharacterModel.Delete(); CharacterModel = null; NextModel(); } if(CharacterModel != null) { View.RemoveMenu(CharSelectMenu); //Get Variations Variations = new Dictionary<int, int>(); CurVariations = new Dictionary<int, int>(); for (int i = 0; i < 25; i++) { var a = Function.Call<int>(Hash.GET_NUMBER_OF_PED_DRAWABLE_VARIATIONS, CharacterModel, i); if(a > 1) { Variations.Add(i,a); CurVariations.Add(i,0); } } //Add scrollers for each variation var items = new List<IMenuItem>() { new MenuButton("Random Character", "").WithActivate(RandomModel), new MenuEnumScroller("Character Model","",AvailablePeds.Select(x => x.ToString()).ToArray(),CurrentCharModel).WithEnumActions(SetCharModel,d=> { }), new MenuLabel("", true) }; var continuebutton = new MenuButton("Continue", "").WithActivate(() => { View.PopMenu(); State = CharCreationState.Car; }); var count = 0; foreach (var kvp in Variations) { var varCount = kvp.Value; var enumStrings = new string[varCount]; for (int i = 0; i < varCount; i++) { enumStrings[i] = i.ToString(); } items.Add(new MenuNumericScroller("Variation " + (count + 1), "", 0, varCount - 1, 1).WithNumericActions(ChangeVariation, ChangeVariation)); count++; } items.Add(new MenuLabel("", true)); items.Add(continuebutton); CharSelectMenu = new RPGMenu("Character Creation", new GTASprite("commonmenu", "interaction_bgd", Color.DodgerBlue), items.ToArray()); RPGUI.FormatMenu(CharSelectMenu); View.AddMenu(CharSelectMenu); CharSelectMenu.SelectedIndex = 1; Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, CharacterModel.Handle); Camera.Position = _camPosition; Camera.PointAt(CharacterModel.Position + CharacterModel.UpVector - new Vector3(0,0,0.2f)); } } else { CharacterModel.FreezePosition = true; CharacterModel.Task.ClearAll(); } }
//メイン処理 private void Bombat_Tick(object sender, EventArgs e) { if (AllF == true) { //ここからヘリカメラの処理 if (Game.isGameKeyPressed(GameKey.LookBehind)) { if (Game.isGameKeyPressed(GameKey.RadarZoom) || CameraFlag) { CameraFlag = true; } } if (Game.isGameKeyPressed(GameKey.LookBehind) && !Game.isGameKeyPressed(GameKey.RadarZoom)) { CameraFlag = false; } if (Player.Character.isDead || !Player.Character.isInVehicle()) { CameraFlag = false; } //ここからカオスヘリ自体の処理 if (Player.Character.isDead) { //主人公が死んだらヘリを解放 Reset(); Timer = 0; return; } else if (Exists(heli) && Player.Character.isInVehicle(heli)) { heli.PetrolTankHealth = -1.0f; if (Exists(driver)) { driver.Invincible = false; } Reset(); heli = null; } if (Timer < 0) { //40秒に1回、ヘリを再生成すべきかチェック if (Exists(heli) && (heli.Speed < 0.2f || heli.Position.DistanceTo2D(Player.Character.Position) > 150.0f)) { heli.PetrolTankHealth = -1.0f; Reset(); } if (!Exists(heli) || !heli.isAlive) { Reset(); CreateHeli(); } else { Timer = 40 * 2; } } else { if (!Exists(heli)) { Timer--; return; } if (Exists(driver)) { if (driver.isInVehicle()) { driver.Task.DriveTo(heli, Player.Character.Position + new Vector3(0, 0, 20), 100, true, true); } else { driver.NoLongerNeeded(); driver.Money = 0; driver.Invincible = false; driver = heli.CreatePedOnSeat(VehicleSeat.Driver); if (Exists(driver)) { driver.Money = 500; driver.Invincible = true; } } } if (Exists(p[0])) { if (!p[0].isInVehicle()) { p[0].NoLongerNeeded(); p[0] = heli.CreatePedOnSeat(VehicleSeat.LeftRear); } } if (Exists(p[1])) { if (!p[1].isInVehicle()) { p[1].NoLongerNeeded(); p[1] = heli.CreatePedOnSeat(VehicleSeat.RightFront); } } if (Exists(p[2])) { if (!p[2].isInVehicle()) { p[2].NoLongerNeeded(); p[2] = heli.CreatePedOnSeat(VehicleSeat.RightRear); } } } if (Exists(A)) { A.Delete(); } if (Exists(heli)) { if (Share.Nico_Engo > 0) { Share.Nico_Engo--; A = World.CreatePed(heli.Position + new Vector3(0, 0, -2.5f)); Ped[] Tlist=new Ped[0]; try { Tlist = Cacher.GetPeds(Player.Character.Position,100.0f); } catch { if (Exists(A)) { A.Delete(); } } if (Exists(A)) { //RPGを装備させる A.Weapons.FromType(Weapon.Heavy_RocketLauncher).Ammo = 999; A.Weapons.Select(Weapon.Heavy_RocketLauncher); A.Visible = false; Ped T = Tlist[rnd.Next(0,Tlist.Length)]; if (Exists(T)) { var Apos = T.Position; //真下に向かってRPGを発射させる GTA.Native.Function.Call("FIRE_PED_WEAPON", A, Apos.X, Apos.Y, Apos.Z); } } } } else { Share.Nico_Engo = 0; } Timer--; } }