예제 #1
0
        public override void DoSettingsWindowContents(Rect inRect)
        {
            base.DoSettingsWindowContents(inRect);
            Listing_Standard view = new Listing_Standard();

            view.Begin(inRect);
            view.ColumnWidth = 220f;

            view.Label("LevelUpSettingsLabel".Translate());
            view.CheckboxLabeled("LevelUpTextMessageLabel".Translate(), ref Settings.allowLevelUpTextMessage, "LevelUpTextMessageLabelTooltip".Translate());
            view.CheckboxLabeled("LevelUpLetterLabel".Translate(), ref Settings.allowLevelUpLetter, "LevelUpLetterLabelTooltip".Translate());
            view.CheckboxLabeled("LevelUpSoundEffectLabel".Translate(), ref Settings.allowLevelUpSoundEffect, "LevelUpSoundEffectLabelTooltip".Translate());
            view.CheckboxLabeled("LevelUpAnimationLabel".Translate(), ref Settings.allowLevelUpAnimation, "LevelUpAnimationLabelTooltip".Translate());
            view.CheckboxLabeled("LevelUpLevelDesc".Translate(), ref Settings.levelDescLevelUpLabel, "LevelUpLevelDescTooltip".Translate());

            view.Gap();

            List <FloatMenuOption> soundOptions = new List <FloatMenuOption>()
            {
                new FloatMenuOption(DefHandler.LevelUp.label, delegate() { Settings.LvlUpSound = DefHandler.Sound.LevelUp; }),
                new FloatMenuOption(DefHandler.LevelUp2.label, delegate() { Settings.LvlUpSound = DefHandler.Sound.LevelUp2; })
            };

            if (view.ButtonTextLabeled("SoundChooseLabel".Translate(), DefHandler.GetSound(Settings.LvlUpSound).label))
            {
                Find.WindowStack.Add(new FloatMenu(soundOptions));
            }

            if (view.ButtonText("TestPlaySound".Translate()))
            {
                DefHandler.GetSound(Settings.LvlUpSound).PlayOneShotOnCamera(null);
            }

            view.NewColumn();

            view.Label("LevelDownSettingsLabel".Translate());
            view.CheckboxLabeled("LevelDownTextMessageLabel".Translate(), ref Settings.allowLevelDownTextMessage, "LevelDownTextMessageLabelTooltip".Translate());
            view.CheckboxLabeled("LevelDownLetterLabel".Translate(), ref Settings.allowLevelDownLetter, "LevelDownLetterLabelTooltip".Translate());
            view.CheckboxLabeled("LevelDownSoundEffectLabel".Translate(), ref Settings.allowLevelDownSoundEffect, "LevelDownSoundEffectLabelTooltip".Translate());
            view.CheckboxLabeled("LevelDownAnimationLabel".Translate(), ref Settings.allowLevelDownAnimation, "LevelDownAnimationLabelTooltip".Translate());
            view.CheckboxLabeled("LevelDownLevelDesc".Translate(), ref Settings.levelDescLevelDownLabel, "LevelDownLevelDescTooltip".Translate());

            view.NewColumn();

            view.CheckboxLabeled("Ignore10To9Label".Translate(), ref Settings.ignoreLvl10To9, "Ignore10To9LabelTooltip".Translate());

            view.Gap();

            view.Label("NotificationTimerLabel".Translate(), -1, "NotificationTimerLabelTooltip".Translate());
            view.IntEntry(ref Settings.notificationTimer, ref editBuffer);

            view.End();
        }
예제 #2
0
        public void NotifyLevelUp()
        {
            // Do text message on screen on level up.
            if (Settings.allowLevelUpTextMessage)
            {
                Color  color     = Color.yellow;
                string pawn      = CurrentPawn.LabelShortCap.Bold();
                string skill     = SkillRecord.def.skillLabel.Italic();
                string level     = SkillRecord.levelInt.ToString().Bold().Colored(color);
                string levelDesc = SkillRecord.LevelDescriptor;
                string label;
                if (Settings.levelDescLevelUpLabel)
                {
                    label = "LevelUpLabelLong".Translate(pawn, level, skill, levelDesc);
                }
                else
                {
                    label = "LevelUpLabel".Translate(pawn, level, skill);
                }

                LookTargets lookTargets = new LookTargets(CurrentPawn);
                Messages.Message(label, lookTargets, MessageTypeDefOf.SilentInput);
            }

            if (Settings.allowLevelUpLetter)
            {
                string      pawn        = CurrentPawn.LabelShortCap;
                string      skill       = SkillRecord.def.skillLabel;
                string      level       = SkillRecord.levelInt.ToString();
                string      labelShort  = "LevelUpLabelShort".Translate(pawn);
                string      label       = "LevelUpLabel".Translate(pawn, level, skill);
                LookTargets lookTargets = new LookTargets(CurrentPawn);

                Find.LetterStack.ReceiveLetter(labelShort, label, LetterDefOf.PositiveEvent, lookTargets);
            }

            // Do sound effect on level up.
            if (Settings.allowLevelUpSoundEffect)
            {
                DefHandler.GetSound(Settings.LvlUpSound).PlayOneShot(SoundInfo.InMap(new TargetInfo(CurrentPawn)));
            }

            // Do animation on pawn levelling up.
            if (!Settings.allowLevelUpAnimation)
            {
                return;
            }

            // Animation motes. Using three similar ones on top of each other to achieve stretch effect.
            Vector3 pawnPosition = CurrentPawn.Drawer.DrawPos;
            Map     map          = CurrentPawn.Map;

            if (!pawnPosition.ToIntVec3().ShouldSpawnMotesAt(map) || map.moteCounter.SaturatedLowPriority)
            {
                return;
            }

            MoteThrown innerMote = MakeMote(DefHandler.Mote_LevelUpBeamInner, CurrentPawn);

            innerMote.SetVelocity(0, 0.6f);
            GenSpawn.Spawn(innerMote, pawnPosition.ToIntVec3(), map);

            MoteThrown middleMote1 = MakeMote(DefHandler.Mote_LevelUpBeamMiddle, CurrentPawn);

            middleMote1.SetVelocity(0, 0.3f);
            GenSpawn.Spawn(middleMote1, pawnPosition.ToIntVec3(), map);

            MoteThrown middleMote2 = MakeMote(DefHandler.Mote_LevelUpBeamMiddle, CurrentPawn);

            middleMote2.SetVelocity(0, 0.5f);
            GenSpawn.Spawn(middleMote2, pawnPosition.ToIntVec3(), map);

            MoteThrown outerMote1 = MakeMote(DefHandler.Mote_LevelUpBeamOuter, CurrentPawn);

            outerMote1.SetVelocity(0, 0.15f);
            GenSpawn.Spawn(outerMote1, pawnPosition.ToIntVec3(), map);

            MoteThrown outerMote2 = MakeMote(DefHandler.Mote_LevelUpBeamOuter, CurrentPawn);

            outerMote2.SetVelocity(0, 0.25f);
            GenSpawn.Spawn(outerMote2, pawnPosition.ToIntVec3(), map);
        }