public ViewModelFaceStyleCustomizer(bool isMale, Action <ViewModelFaceStyleCustomizer> onStyleSet)
        {
            this.onStyleSet         = onStyleSet;
            this.faceStylesProvider = SharedCharacterFaceStylesProvider.GetForGender(isMale);

            this.settingFace = new ViewModelCharacterStyleSetting(
                TitleFace,
                maxValue: this.faceStylesProvider.GetFacesCount() - 1,
                valueChangedCallback: this.SettingFaceValueChangedCallback);

            this.settingTop = new ViewModelCharacterStyleSetting(
                TitleTop,
                maxValue: 1,
                valueChangedCallback: this.SettingValueChangedCallback);

            this.settingBottom = new ViewModelCharacterStyleSetting(
                TitleBottom,
                maxValue: 1,
                valueChangedCallback: this.SettingValueChangedCallback);

            this.settingHair = new ViewModelCharacterStyleSetting(
                TitleHair,
                maxValue: this.faceStylesProvider.GetHairCount() - 1,
                valueChangedCallback: this.SettingValueChangedCallback);

            this.StyleSettings = new ObservableCollection <ViewModelCharacterStyleSetting>();
            this.StyleSettings.Add(this.settingFace);
            this.StyleSettings.Add(this.settingTop);
            this.StyleSettings.Add(this.settingBottom);
            this.StyleSettings.Add(this.settingHair);
        }
Exemplo n.º 2
0
        protected override void ServerInitializeCharacterFirstTime(ServerInitializeData data)
        {
            base.ServerInitializeCharacterFirstTime(data);

            var character   = data.GameObject;
            var publicState = data.PublicState;

            publicState.IsMale    = true;
            publicState.FaceStyle = SharedCharacterFaceStylesProvider
                                    .GetForGender(publicState.IsMale)
                                    .GenerateRandomFace();

            ServerPlayerSpawnManager.ServerAddTorchItemIfNoItems(character);

            if (!Api.IsEditor)
            {
                return;
            }

            // the game is run as Editor
            // auto pwn in editor mode
            GetProtoEntity <ConsoleAdminPwn>().Execute(player: character);
            // add all the skills
            GetProtoEntity <ConsoleSkillsSetAll>().Execute(player: character);
            // add all the technologies
            GetProtoEntity <ConsoleTechAddAll>().Execute(player: character);
            // add all the quests (and complete them)
            GetProtoEntity <ConsoleQuestCompleteAll>().Execute(player: character);
        }
Exemplo n.º 3
0
        private void ServerRemote_ChangeStyle(CharacterHumanFaceStyle style, bool isMale)
        {
            style = style.EmptyStringsToNulls();
            if (!SharedCharacterFaceStylesProvider.GetForGender(isMale)
                .SharedIsValidFaceStyle(style))
            {
                Logger.Warning("An invalid face style received", ServerRemoteContext.Character);
                return;
            }

            var publicState = PlayerCharacter.GetPublicState(ServerRemoteContext.Character);

            publicState.IsMale    = isMale;
            publicState.FaceStyle = style;
        }
Exemplo n.º 4
0
        public static void ServerSetStyle(ICharacter character, CharacterHumanFaceStyle style, bool isMale)
        {
            style = style.EmptyStringsToNulls();
            if (!SharedCharacterFaceStylesProvider.GetForGender(isMale)
                .SharedIsValidFaceStyle(style))
            {
                Logger.Warning("An invalid face style received");
                return;
            }

            var publicState = PlayerCharacter.GetPublicState(character);

            publicState.IsMale    = isMale;
            publicState.FaceStyle = style;

            Api.SafeInvoke(() => ServerCharacterAppearanceSelected?.Invoke(character));
        }
Exemplo n.º 5
0
        protected override void ServerInitializeCharacterFirstTime(ServerInitializeData data)
        {
            base.ServerInitializeCharacterFirstTime(data);

            var character   = data.GameObject;
            var publicState = data.PublicState;

            if (!Api.IsEditor)
            {
                NewbieProtectionSystem.ServerRegisterNewbie(character);

                publicState.IsMale    = 1 == RandomHelper.Next(0, maxValueExclusive: 2); // male/female ratio: 50/50
                publicState.FaceStyle = SharedCharacterFaceStylesProvider
                                        .GetForGender(publicState.IsMale)
                                        .GenerateRandomFace();
            }
            else // if Editor
            {
                publicState.IsMale    = true;
                publicState.FaceStyle = SharedCharacterFaceStylesProvider
                                        .GetForGender(publicState.IsMale)
                                        .GetDefaultFaceInEditor();
            }

            ServerPlayerSpawnManager.ServerAddTorchItemIfNoItems(character);

            if (!Api.IsEditor)
            {
                return;
            }

            // the game is run as Editor
            // auto pwn in editor mode
            ConsoleCommandsSystem.SharedGetCommand <ConsoleAdminPwn>().Execute(player: character);
            // add all the skills
            ConsoleCommandsSystem.SharedGetCommand <ConsoleSkillsSetAll>().Execute(player: character);
            // add all the technologies
            ConsoleCommandsSystem.SharedGetCommand <ConsoleTechAddAll>().Execute(player: character);

            this.ServerRebuildFinalCacheIfNeeded(data.PrivateState, publicState);

            // add all the quests (and complete them)
            ConsoleCommandsSystem.SharedGetCommand <ConsoleQuestCompleteAll>().Execute(player: character);
        }