コード例 #1
0
ファイル: CharCreationNew.cs プロジェクト: logicspawn/GTARPG
        private void Init()
        {
            Game.FadeScreenOut(1000);
            Wait(1000);

            _shownMotives = false;
            _shownGender = false;
            _shownClass = false;

            RPGMethods.CleanupObjects();

            if (RPG.UIHandler != null && RPG.UIHandler.View != null)
                RPG.UIHandler.View.CloseAllMenus();

            Function.Call(Hash.DISPLAY_HUD, 0);
            Function.Call(Hash.DISPLAY_RADAR, 0);

            LoadingCharCreate = true;

            Game.FadeScreenIn(100);

            PlayerName = "Player";
            CarPlate = "PLAYER01";

            if(Camera != null) Camera.Destroy();
            Game.Player.Character.Position = new Vector3(_playerPosition.X - 20, _playerPosition.Y, _playerPosition.Z);
            Wait(10000);
            State = CharCreationState.PickMotives;

            LoadingCharCreate = false;

            Game.FadeScreenIn(1000);
            Camera = World.CreateCamera(_camPosition, new Vector3(0,0,30), GameplayCamera.FieldOfView);
            Camera.MotionBlurStrength = 0.4f;
            World.RenderingCamera = Camera;
            RPG.GameHandler.InitiateNpcs = false;
            Initialised = true;
        }
コード例 #2
0
ファイル: CharCreationNew.cs プロジェクト: logicspawn/GTARPG
        public CharCreationNew()
        {
            KeyDown += OnKeyDown;
            Instance = this;
            CurrentCarModel = Random.Range(0, 50);
            CurrentCharModel = Random.Range(0, 50);
            View.MenuTransitions = false;
            View.MenuPosition = new Point(UI.WIDTH - 300, 0);
            View.MenuOffset = new Point(-300, 0);
            //Instantiate our menu
            State = CharCreationState.PickMotives;
            SetupMenu = new RPGMenu("RPG Setup", new GTASprite("commonmenu","interaction_bgd",Color.DodgerBlue), new IMenuItem[] {
                        new MenuNumericScroller("SafeArea Setting","Change the safearea setting until the RPG UI covers the bottom area of your minimap.",0,10,1,SafeArea).WithNumericActions(ChangeSafeArea,d => { }),
                        new MenuButton("Finish Setup", "").WithActivate(() => { View.PopMenu(); SetupFinished = true;
                        })
            });
            CharSelectMenu = new RPGMenu("Character Creation", new GTASprite("commonmenu","interaction_bgd",Color.DodgerBlue), new IMenuItem[] {
                        //new MenuButton("Next Character", NextModel),
                        //new MenuButton("Previous Character", "", PreviousModel),
                        new MenuButton("Random Character", "").WithActivate(RandomModel),
                        new MenuEnumScroller("Character Model","",AvailablePeds.Select(x => x.ToString()).ToArray()).WithEnumActions(SetCharModel,d=> { }),
                        //new MenuButton("Try Out New Clothes", "", RandomiseLook),
                        //new MenuButton("Switch To Car Select", "", SwitchBetweenModelAndCar),
                        //new MenuButton("Choose Name", "", ChooseName),
                        new MenuButton("Continue", "").WithActivate(() => { View.PopMenu(); State = CharCreationState.Car;})
            });
            var colors = ((VehicleColor[]) Enum.GetValues(typeof (VehicleColor))).Select(x => x.ToString()).ToArray();
            CarSelectMenu = new RPGMenu("Vehicle Selection", new GTASprite("commonmenu", "interaction_bgd", Color.Red), new IMenuItem[] {
                        //new MenuButton("Next Car", NextModel),
                        //new MenuButton("Previous Car", "", PreviousModel),
                        new MenuButton("Random Vehicle", "").WithActivate(RandomModel),
                        new MenuEnumScroller("Vehicle","",AvailableCars.Select(x => x.ToString()).ToArray()).WithEnumActions(SetCarModel,d=> { }),
                        //new MenuButton("Switch To Model Select", "", SwitchBetweenModelAndCar),
                        new MenuEnumScroller("Primary Color Group","",ColorGroups).WithEnumActions(SetPrimaryColorGroup,d=> { }),
                        new MenuEnumScroller("Primary Color","",AvailableColors.Select(x => x.ToString()).ToArray()).WithEnumActions(SetColor,d=> { }),
                        new MenuEnumScroller("Secondary Color Group","",ColorGroups).WithEnumActions(SetSecondaryColorGroup,d=> { }),
                        new MenuEnumScroller("Secondary Color","",AvailableSecondaryColors.Select(x => x.ToString()).ToArray()).WithEnumActions(SetSecondaryColor,d=> { }),
                        new MenuButton("Number Plate").WithActivate(ChooseNumberPlate),
                        new MenuButton("Continue", "").WithActivate(() => {View.PopMenu(); State = CharCreationState.Finalise;})
            });

            FinaliseMenu = new RPGMenu("Finish", new GTASprite("commonmenu", "interaction_bgd", Color.SkyBlue), new IMenuItem[] {
                        new MenuButton("Choose Name", "").WithActivate(ChooseName),
                        new MenuButton("", ""),
                        new MenuButton("Continue", "").WithActivate(() => { if(PlayerName != "") FinishCreation();})
            });
            CharSelectMenu.Width = 200;

            RPGUI.FormatMenuWithFooter(SetupMenu);
            RPGUI.FormatMenu(CharSelectMenu);
            RPGUI.FormatMenu(CarSelectMenu);
            RPGUI.FormatMenu(FinaliseMenu);
            SetupMenu.HeaderHeight = 25;
            CharSelectMenu.HeaderHeight = 25;
            CarSelectMenu.HeaderHeight = 25;
            FinaliseMenu.HeaderHeight = 25;
        }
コード例 #3
0
ファイル: CharCreationNew.cs プロジェクト: logicspawn/GTARPG
        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();
            }
        }
コード例 #4
0
ファイル: CharCreationNew.cs プロジェクト: logicspawn/GTARPG
        private void FinishCreation()
        {
            if(CharacterModel != null) CharacterModel.Delete();
            if (CarModel != null) CarModel.Delete();

            RPG.PlayerData = new PlayerData
                                 {
                                     Name = PlayerName,
                                     NumberPlate = CarPlate,
                                     ModelHash = AvailablePeds[CurrentCharModel],
                                     CarHash = AvailableCars[CurrentCarModel],
                                     Class = Class,
                                     Motive = Motive,
                                     Gender = Gender,
                                     CarColor = AvailableColors[CurrentCarColor],
                                     CarSecondaryColor = AvailableSecondaryColors[CurrentCarSecondaryColor],
                                     ModelVariations = CurVariations, Setup = {SafeArea = SafeArea}
                                 };
            RPG.SaveAllData();
            View.CloseAllMenus();
            State = CharCreationState.Intro;
        }
コード例 #5
0
ファイル: CharCreationNew.cs プロジェクト: logicspawn/GTARPG
 public static void RestartCharCreation()
 {
     State = CharCreationState.PickMotives;
        IntroState = CharIntroState.Init;
        RPG.Audio.DisposeAll();
        Initialised = false;
        Enabled = true;
 }
コード例 #6
0
ファイル: CharCreationNew.cs プロジェクト: logicspawn/GTARPG
        public void HandleBack()
        {
            if (RPGInfo.KeyboardActive) return;

            var curState = (int) State;
            var newState = curState - 1;
            if(newState >= 0)
            {

                View.CloseAllMenus();
                State = (CharCreationState) newState;
                //Resets
                _shownMotives = false;
                _shownGender = false;
                _shownClass = false;
                _setupFinalise = false;
            }
            else
            {
                Enabled = false;
                View.CloseAllMenus();
                if(CharacterModel != null) CharacterModel.Delete();
                if (CarModel != null) CarModel.Delete();
                RPG.Initialise();
            }
        }
コード例 #7
0
ファイル: CharCreationNew.cs プロジェクト: logicspawn/GTARPG
        private void SetSecondaryColorGroup(int obj)
        {
            SelectedSecondaryColorGroup = obj;
            CurrentCarSecondaryColor = 0;
            var index = CarSelectMenu.SelectedIndex;
            View.RemoveMenu(CarSelectMenu);
            CarSelectMenu = new RPGMenu("Vehicle Selection", new GTASprite("commonmenu", "interaction_bgd", Color.Red), new IMenuItem[] {
                        new MenuButton("Random Vehicle", "").WithActivate(RandomModel),
                        new MenuEnumScroller("Vehicle","",AvailableCars.Select(x => x.ToString()).ToArray()).WithEnumActions(SetCarModel,d=> { }),
                        new MenuEnumScroller("Primary Color Group","",ColorGroups,SelectedColorGroup).WithEnumActions(SetPrimaryColorGroup,d=> { }),
                        new MenuEnumScroller("Primary Color","",AvailableColors.Select(x => x.ToString()).ToArray(),CurrentCarColor).WithEnumActions(SetColor,d=> { }),
                        new MenuEnumScroller("Secondary Color Group","",ColorGroups,SelectedSecondaryColorGroup).WithEnumActions(SetSecondaryColorGroup,d=> { }),
                        new MenuEnumScroller("Secondary Color","",AvailableSecondaryColors.Select(x => x.ToString()).ToArray()).WithEnumActions(SetSecondaryColor,d=> { }),
                        new MenuButton("Number Plate").WithActivate(ChooseNumberPlate),
                        new MenuButton("Continue", "").WithActivate(() => {View.PopMenu();State = CharCreationState.Finalise;})
            });
            RPGUI.FormatMenu(CarSelectMenu);
            CarSelectMenu.HeaderHeight = 25;
            View.AddMenu(CarSelectMenu);

            CarSelectMenu.SelectedIndex = index;
            if (CarModel != null)
            {
                CarModel.PrimaryColor = AvailableColors[CurrentCarColor];
                CarModel.SecondaryColor = AvailableSecondaryColors[CurrentCarSecondaryColor];
                CarModel.NumberPlate = "";
                CarModel.NumberPlate = CarPlate;
            }
        }
コード例 #8
0
ファイル: CharCreationNew.cs プロジェクト: logicspawn/GTARPG
        private void SwitchBetweenModelAndCar()
        {
            ClearPrevModel();
            State = State == CharCreationState.Character ? CharCreationState.Car : CharCreationState.Character;
            View.CloseAllMenus();
            View.MenuPosition = State == CharCreationState.Character
                ? new Point(UI.WIDTH / 2 - 150, UI.HEIGHT - 110)
                : new Point(UI.WIDTH / 2 - 150, UI.HEIGHT - 150);

            View.AddMenu(State == CharCreationState.Character ? CharSelectMenu : CarSelectMenu);
        }
コード例 #9
0
ファイル: CharCreationNew.cs プロジェクト: logicspawn/GTARPG
 private void SelectMotive(int obj)
 {
     if(obj == 0)
     {
         Motive = PlayerMotive.Rebel;
     }
     else
     {
         Motive = PlayerMotive.Lawless;
     }
     State = CharCreationState.PickClass;
     View.PopMenu();
 }
コード例 #10
0
ファイル: CharCreationNew.cs プロジェクト: logicspawn/GTARPG
        private void SelectGender(int obj)
        {
            if(obj == 0)
            {
                Gender = Gender.Male;
                CharSelectMenu = new RPGMenu("Character Creation", new GTASprite("commonmenu", "interaction_bgd", Color.DodgerBlue), new IMenuItem[] {
                        new MenuEnumScroller("Character Model","",AvailablePeds.Select(x => x.ToString()).ToArray()).WithEnumActions(SetCharModel,d=> { }),
                        new MenuButton("Continue", "").WithActivate(() => { View.PopMenu(); State = CharCreationState.Car;})
                });
            }
            else
            {
                Gender = Gender.Female;
                CharSelectMenu = new RPGMenu("Character Creation", new GTASprite("commonmenu", "interaction_bgd", Color.DodgerBlue), new IMenuItem[] {
                        new MenuEnumScroller("Character Model","",AvailablePeds.Select(x => x.ToString()).ToArray()).WithEnumActions(SetCharModel,d=> { }),
                        new MenuButton("Continue", "").WithActivate(() => { View.PopMenu(); State = CharCreationState.Car;})
                });
            }

            State = CharCreationState.Character;
            View.PopMenu();
        }
コード例 #11
0
ファイル: CharCreationNew.cs プロジェクト: logicspawn/GTARPG
        private void SelectClass(int obj)
        {
            if(obj == 0)
            {
                Class = PlayerClass.Time_Master;
            }
            else if (obj == 1)
            {
                Class = PlayerClass.Speedster;
            }
            else if (obj == 2)
            {
                Class = PlayerClass.Berserker;
            }

            State = CharCreationState.GenderSelect;
            View.PopMenu();
        }
コード例 #12
0
 /// <summary>
 /// Create character
 /// </summary>
 /// <param name="ms">State of character making</param>
 /// <param name="playerid">ID of character that was made</param>
 /// <returns></returns>
 public static byte[] SendCreateCharacter(CharCreationState ms, int playerid)
 {
     Packet p = new Packet(500);
     p.WriteByte((byte)ms);
     if (ms == CharCreationState.Success)
         p.WriteInt(playerid);
     else
         p.WriteHexString("00 00 00 00");
     return p.GetWrittenBuffer(PacketIds.SendCreateCharacter);
 }
コード例 #13
0
        private void SelectGender(int obj)
        {
            if(obj == 0)
            {
                Gender = Gender.Male;
            }
            else
            {
                Gender = Gender.Female;
            }

            State = CharCreationState.Character;
            View.PopMenu();
        }