/// <summary>Sets up the lookup.</summary> private static void Setup() { LanguageLookup = new Dictionary <string, QuoteSet>(); DefaultSet = Add("en", "\u201C \u201D \u2018 \u2019"); Add("eo", "\u201C \u201D \u201C \u201D"); Add("es", "\u00AB \u00BB \u0022 \u0022"); Add("fa", "\u00AB \u00BB \u00AB \u00BB"); Add("fi", "\u201D \u201D \u2019 \u2019"); Add("fr", "\u00AB\u00A0 \u00A0\u00BB \u2039\u00A0 \u00A0\u203A"); Add("hr", "\u00BB \u00AB \u203A \u2039"); Add("hu", "\u201E \u201D \u201E \u201D"); Add("hy", "\u00AB \u00BB \u201C \u201D"); Add("id", "\u201C \u201D \u2018 \u2019"); Add("it", "\u00BB \u00AB \u00BB \u00AB"); Add("ja", "\u300C \u300D \u300E \u300F"); Add("ko", "\u201C \u201D \u2018 \u2019"); Add("lt", "\u201E \u201C \u201E \u201C"); Add("nl", "\u201E \u201D \u201A \u2019"); Add("nb", "\u00AB \u00BB \u2018 \u2019"); Add("no", "\u00AB \u00BB \u2018 \u2019"); Add("pl", "\u201E \u201D \u00AB \u00BB"); Add("pt", "\u201C \u201D \u2018 \u2019"); Add("ro", "\u201E \u201D \u00AB \u00BB"); Add("ru", "\u00AB \u00BB \u201E \u201C"); Add("sk", "\u201E \u201C \u201A \u2018"); Add("sl", "\u201E \u201C \u201A \u2018"); Add("sv", "\u201D \u201D \u2019 \u2019"); Add("tr", "\u00AB \u00BB \u2039 \u203A"); Add("uk", "\u00AB \u00BB \u201E \u201C"); Add("zh-cn", "\u201C \u201D \u2018 \u2019"); Add("zh-hk", "\u300C \u300D \u300E \u300F"); Add("zh-tw", "\u300C \u300D \u300E \u300F"); Add("vi", "\u00AB \u00BB \u2039 \u203A"); }
/// <summary>Adds the given lang to the lookup.</summary> private static QuoteSet Add(string langCode, string quotes) { QuoteSet set = new QuoteSet(quotes); langCode = langCode.Trim().ToLower(); LanguageLookup[langCode] = set; return(set); }
public override void Load() { if (IsLoaded) { return; } IsLoaded = true; fntFinlanderFont = Content.Load <SpriteFont>("Fonts/Finlander Font"); sprBarExtraLargeBackground = Content.Load <Texture2D>("Battle/Bars/Extra Long Bar"); sprBarExtraLargeEN = Content.Load <Texture2D>("Battle/Bars/Extra Long Energy"); sprBarExtraLargeHP = Content.Load <Texture2D>("Battle/Bars/Extra Long Health"); sprInfinity = Content.Load <Texture2D>("Battle/Infinity"); foreach (KeyValuePair <string, Timeline> Timeline in LoadTimelines(typeof(CoreTimeline))) { if (Timeline.Value is AnimationOriginTimeline) { continue; } DicTimeline.Add(Timeline.Key, Timeline.Value); } foreach (KeyValuePair <string, Timeline> Timeline in LoadTimelines(typeof(DeathmatchMapTimeline), this, Content)) { DicTimeline.Add(Timeline.Key, Timeline.Value); } base.Load(); InitRessources(); Unit ActiveUnit = AttackingSquad.CurrentLeader; Unit EnemyUnit = EnemySquad.CurrentLeader; for (int L = ListAnimationLayer.Count - 1; L >= 0; --L) { #region Markers foreach (List <Timeline> ListActiveEvent in ListAnimationLayer[L].DicTimelineEvent.Values) { foreach (Timeline ActiveTimeline in ListActiveEvent) { MarkerTimeline ActiveMarkerEvent = ActiveTimeline as MarkerTimeline; if (ActiveMarkerEvent == null) { continue; } string AnimationPath = ""; switch (ActiveMarkerEvent.MarkerType) { case "Support Stand": case "Support Standing": case "Enemy Standing": case "Enemy Stand": case "Enemy Default": ActiveMarkerEvent.AnimationMarker = new AnimationClass(EnemyUnit.Animations.Default.AnimationName); break; case "Enemy Wingman A Standing": case "Enemy Wingman 1 Standing": if (EnemySquad.CurrentWingmanA != null) { ActiveMarkerEvent.AnimationMarker = new AnimationClass(EnemySquad.CurrentWingmanA.Animations.Default.AnimationName); } break; case "Enemy Wingman B Standing": case "Enemy Wingman 2 Standing": if (EnemySquad.CurrentWingmanB != null) { ActiveMarkerEvent.AnimationMarker = new AnimationClass(EnemySquad.CurrentWingmanB.Animations.Default.AnimationName); } break; case "Enemy Hit": if (BattleResult.ArrayResult[0].AttackMissed) { AnimationPath = EnemyUnit.Animations.Default.AnimationName; } else { AnimationPath = EnemyUnit.Animations.Hit.AnimationName; } if (File.Exists("Content/Animations/" + AnimationPath + ".pea")) { ActiveMarkerEvent.AnimationMarker = new AnimationClass(AnimationPath); } else { ActiveMarkerEvent.AnimationMarker = new AnimationClass(EnemyUnit.Animations.Default.AnimationName); } break; case "Player Stand": case "Player Standing": case "Player Default": ActiveMarkerEvent.AnimationMarker = new AnimationClass(ActiveUnit.Animations.Default.AnimationName); break; default: AnimationPath = EnemyUnit.Animations.Default.AnimationName; if (ActiveMarkerEvent.MarkerType.StartsWith("Player ")) { AnimationPath = ActiveMarkerEvent.MarkerType.Split(new string[] { "Player " }, StringSplitOptions.RemoveEmptyEntries)[0]; } ActiveMarkerEvent.AnimationMarker = new AnimationClass(AnimationPath); break; } ActiveMarkerEvent.AnimationMarker.DicTimeline = DicTimeline; ActiveMarkerEvent.AnimationMarker.Load(); } } #endregion #region Quotes foreach (QuoteSetTimeline.QuoteSetKeyFrame ActiveKeyFrame in ((QuoteSetTimeline)ListAnimationLayer.EngineLayer.DicTimelineEvent[0][1]).DicAnimationKeyFrame.Values) { Quote ActiveQuote = ActiveKeyFrame.QuoteSet; int QuoteSetIndex = 0; int QuoteSetCount = 0; //Once a Quote is selected, keep it, if random quotes are needed, use multiple QuoteSet. //If the number of QuoteSet changed, assume the user did something wrong and get a new index. if (ActiveQuote.ListQuoteSet.Count > 1 && QuoteSetCount != ActiveQuote.ListQuoteSet.Count) { QuoteSetCount = ActiveQuote.ListQuoteSet.Count; QuoteSetIndex = Random.Next(ActiveQuote.ListQuoteSet.Count); ActiveQuote.SelectedQuoteSet = QuoteSetIndex; } Quote.Targets ActiveTarget = ActiveQuote.Target; QuoteSet ActiveQuoteSet = ActiveQuote.ActiveQuoteSet; Character ActivePilot = ActiveUnit.Pilot; Character EnemyPilot = EnemyUnit.Pilot; if (ActiveTarget == Quote.Targets.Defender) { ActivePilot = EnemyUnit.Pilot; EnemyPilot = ActiveUnit.Pilot; } bool UseRandomIndex = !ActiveQuoteSet.QuoteSetUseLast && ActiveQuoteSet.QuoteSetChoice == QuoteSet.QuoteSetChoices.Random; QuoteSet.QuoteStyles QuoteStyle = ActiveQuoteSet.QuoteStyle; int QuoteIndex = 0; if (ActiveQuoteSet.QuoteSetChoice == QuoteSet.QuoteSetChoices.Fixed) { QuoteIndex = ActiveQuoteSet.QuoteSetChoiceValue; } Tuple <string, string> ActiveQuoteTuple; switch (QuoteStyle) { case QuoteSet.QuoteStyles.Reaction: QuoteTypes ActiveQuoteType = QuoteTypes.Damaged; ActiveQuoteTuple = GetQuote(ActiveQuoteType, ActivePilot, EnemyPilot, UseRandomIndex, ref QuoteIndex); ActiveQuote.ActiveText = ActiveQuoteTuple.Item2; ActiveQuote.PortraitPath = ActiveQuoteTuple.Item1; break; case QuoteSet.QuoteStyles.QuoteSet: ActiveQuoteTuple = GetAttackQuote(ActiveQuoteSet.QuoteSetName, ActivePilot, EnemyPilot, UseRandomIndex, ref QuoteIndex); ActiveQuote.ActiveText = ActiveQuoteTuple.Item2; ActiveQuote.PortraitPath = ActiveQuoteTuple.Item1; break; case QuoteSet.QuoteStyles.Custom: ActiveQuote.ActiveText = ActiveQuoteSet.CustomText; break; case QuoteSet.QuoteStyles.MoveIn: ActiveQuoteTuple = GetQuote(QuoteTypes.BattleStart, ActivePilot, EnemyPilot, UseRandomIndex, ref QuoteIndex); ActiveQuote.ActiveText = ActiveQuoteTuple.Item2; ActiveQuote.PortraitPath = ActiveQuoteTuple.Item1; break; } if (!string.IsNullOrEmpty(ActiveQuote.PortraitPath)) { if (ActiveQuote.PortraitPath.StartsWith("Animations")) { ActiveQuote.ActiveCharacter = new SimpleAnimation("", ActiveQuote.PortraitPath, new AnimationLooped(ActiveQuote.PortraitPath)); ActiveQuote.ActiveCharacter.ActiveAnimation.Content = Content; ActiveQuote.ActiveCharacter.ActiveAnimation.Load(); } else { ActiveQuote.ActiveCharacter = new SimpleAnimation("", ActiveQuote.PortraitPath, Content.Load <Texture2D>(ActiveQuote.PortraitPath)); } } } #endregion #region Init renderTarget ListAnimationLayer[L].renderTarget = new RenderTarget2D( GraphicsDevice, GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight); #endregion } }
public Character(string CharacterPath, ContentManager Content, Dictionary <string, BaseSkillRequirement> DicRequirement, Dictionary <string, BaseEffect> DicEffect, Dictionary <string, AutomaticSkillTargetType> DicAutomaticSkillTarget, Dictionary <string, ManualSkillTarget> DicManualSkillTarget) : this() { FileStream FS = new FileStream("Content/Characters/" + CharacterPath + ".pec", FileMode.Open, FileAccess.Read); BinaryReader BR = new BinaryReader(FS, Encoding.UTF8); BR.BaseStream.Seek(0, SeekOrigin.Begin); //Init variables. Name = BR.ReadString(); PortraitPath = BR.ReadString(); ArrayPortraitBustPath = new string[BR.ReadInt32()]; for (int B = 0; B < ArrayPortraitBustPath.Length; ++B) { ArrayPortraitBustPath[B] = BR.ReadString(); } ArrayPortraitBoxPath = new string[BR.ReadInt32()]; for (int B = 0; B < ArrayPortraitBoxPath.Length; ++B) { ArrayPortraitBoxPath[B] = BR.ReadString(); } Tags = BR.ReadString(); FullName = CharacterPath; EXPValue = BR.ReadInt32(); CanPilot = BR.ReadBoolean(); BattleThemeName = BR.ReadString(); string AceBonus = BR.ReadString(); string PersonalityName = BR.ReadString(); string SlaveName = BR.ReadString(); Personality = new CharacterPersonality(PersonalityName); if (!string.IsNullOrWhiteSpace(SlaveName) && SlaveName != "None") { Slave = new Character(SlaveName, Content, DicRequirement, DicEffect, DicAutomaticSkillTarget, DicManualSkillTarget); } Int32 SpiritListCount = BR.ReadInt32(); ArrayPilotSpirit = new ManualSkill[SpiritListCount]; for (int S = 0; S < SpiritListCount; ++S) { ArrayPilotSpirit[S] = new ManualSkill("Content/Characters/Spirits/" + BR.ReadString() + ".pecs", DicRequirement, DicEffect, DicAutomaticSkillTarget, DicManualSkillTarget); ArrayPilotSpirit[S].SPCost = BR.ReadInt32(); ArrayPilotSpirit[S].LevelRequirement = BR.ReadInt32(); } Int32 SkillListCount = BR.ReadInt32(); ArrayPilotSkill = new BaseAutomaticSkill[SkillListCount]; ArrayPilotSkillLocked = new bool[SkillListCount]; ArrayPilotSkillLevels = new SkillLevels[SkillListCount]; for (int S = 0; S < SkillListCount; ++S) { string RelativePath = BR.ReadString(); ArrayPilotSkill[S] = new BaseAutomaticSkill("Content/Characters/Skills/" + RelativePath + ".pecs", RelativePath, DicRequirement, DicEffect, DicAutomaticSkillTarget); ArrayPilotSkillLocked[S] = BR.ReadBoolean(); Int32 SkillLevelsCount = BR.ReadInt32(); ArrayPilotSkillLevels[S] = new SkillLevels(BR, SkillLevelsCount); } Int32 RelationshipBonusCount = BR.ReadInt32(); ArrayRelationshipBonus = new BaseAutomaticSkill[RelationshipBonusCount]; for (int S = 0; S < RelationshipBonusCount; ++S) { string RelationshipBonusName = BR.ReadString(); int RelationshipLevel = BR.ReadInt32(); ArrayRelationshipBonus[S] = new BaseAutomaticSkill("Content/Characters/Relationships/" + RelationshipBonusName + ".pecr", RelationshipBonusName, DicRequirement, DicEffect, DicAutomaticSkillTarget); ArrayRelationshipBonus[S].CurrentLevel = RelationshipLevel; for (int L = 0; L < ArrayRelationshipBonus[S].ListSkillLevel.Count; ++L) { BaseSkillRequirement NewSkillRequirement = BaseSkillRequirement.LoadCopy(BR, DicRequirement); ArrayRelationshipBonus[S].ListSkillLevel[L].ListActivation[0].ListRequirement.Add(NewSkillRequirement); } } //If it's a pilot, read its stats. if (CanPilot) { MaxLevel = BR.ReadInt32(); ArrayLevelMEL = new int[MaxLevel]; ArrayLevelRNG = new int[MaxLevel]; ArrayLevelDEF = new int[MaxLevel]; ArrayLevelSKL = new int[MaxLevel]; ArrayLevelEVA = new int[MaxLevel]; ArrayLevelHIT = new int[MaxLevel]; ArrayLevelMaxSP = new int[MaxLevel]; for (int L = 0; L < MaxLevel; ++L) { ArrayLevelMEL[L] = BR.ReadInt32(); ArrayLevelRNG[L] = BR.ReadInt32(); ArrayLevelDEF[L] = BR.ReadInt32(); ArrayLevelSKL[L] = BR.ReadInt32(); ArrayLevelEVA[L] = BR.ReadInt32(); ArrayLevelHIT[L] = BR.ReadInt32(); ArrayLevelMaxSP[L] = BR.ReadInt32(); } int TerrainGradeAir = BR.ReadInt32(); int TerrainGradeLand = BR.ReadInt32(); int TerrainGradeSea = BR.ReadInt32(); int TerrainGradeSpace = BR.ReadInt32(); TerrainGrade = new TerrainGrades(TerrainGradeAir, TerrainGradeLand, TerrainGradeSea, TerrainGradeSpace); } int ListQuoteSetVersusNameCount = BR.ReadInt32(); for (int Q = 0; Q < ListQuoteSetVersusNameCount; Q++) { ListQuoteSetVersusName.Add(BR.ReadString()); } //Base quotes for (int I = 0; I < 6; I++) { ArrayBaseQuoteSet[I] = new QuoteSet(); int ListQuoteCount = BR.ReadInt32(); for (int Q = 0; Q < ListQuoteCount; Q++) { ArrayBaseQuoteSet[I].ListQuote.Add(BR.ReadString()); } //Versus quotes. int ListQuoteVersusCount = BR.ReadInt32(); for (int Q = 0; Q < ListQuoteVersusCount; Q++) { ArrayBaseQuoteSet[I].ListQuoteVersus.Add(BR.ReadString()); } ArrayBaseQuoteSet[I].PortraitPath = BR.ReadString(); } int DicAttackQuoteSetCount = BR.ReadInt32(); for (int i = 0; i < DicAttackQuoteSetCount; i++) { QuoteSet NewQuoteSet = new QuoteSet(); string QuoteSetName = BR.ReadString(); int ListQuoteCount = BR.ReadInt32(); for (int Q = 0; Q < ListQuoteCount; Q++) { NewQuoteSet.ListQuote.Add(BR.ReadString()); } int ListQuoteVersusCount = BR.ReadInt32(); for (int Q = 0; Q < ListQuoteVersusCount; Q++) { NewQuoteSet.ListQuoteVersus.Add(BR.ReadString()); } NewQuoteSet.PortraitPath = BR.ReadString(); DicAttackQuoteSet.Add(QuoteSetName, NewQuoteSet); } FS.Close(); BR.Close(); if (Content != null) { string SpritePath = Path.GetFileNameWithoutExtension(CharacterPath); if (!string.IsNullOrEmpty(PortraitPath)) { SpritePath = PortraitPath; } if (File.Exists("Content\\Visual Novels\\Portraits\\" + SpritePath + ".xnb")) { this.sprPortrait = Content.Load <Texture2D>("Visual Novels\\Portraits\\" + SpritePath); } else { this.sprPortrait = Content.Load <Texture2D>("Characters\\Portraits\\Default"); } } }
public override void Load() { if (IsLoaded) { return; } IsLoaded = true; fntFinlanderFont = Content.Load <SpriteFont>("Fonts/Finlander Font"); sprBarExtraLargeBackground = Content.Load <Texture2D>("Battle/Bars/Extra Long Bar"); sprBarExtraLargeEN = Content.Load <Texture2D>("Battle/Bars/Extra Long Energy"); sprBarExtraLargeHP = Content.Load <Texture2D>("Battle/Bars/Extra Long Health"); sprInfinity = Content.Load <Texture2D>("Battle/Infinity"); foreach (KeyValuePair <string, Timeline> Timeline in LoadTimelines(typeof(CoreTimeline))) { if (Timeline.Value is AnimationOriginTimeline) { continue; } DicTimeline.Add(Timeline.Key, Timeline.Value); } foreach (KeyValuePair <string, Timeline> Timeline in LoadTimelines(typeof(DeathmatchMapTimeline), this, Content)) { DicTimeline.Add(Timeline.Key, Timeline.Value); } base.Load(); InitRessources(); Unit ActiveUnit = AttackingSquad.CurrentLeader; Unit EnemyUnit = EnemySquad.CurrentLeader; for (int L = ListAnimationLayer.Count - 1; L >= 0; --L) { InitMarkers(ListAnimationLayer[L], AttackingSquad, EnemySquad); #region Quotes foreach (QuoteSetTimeline.QuoteSetKeyFrame ActiveKeyFrame in ((QuoteSetTimeline)ListAnimationLayer.EngineLayer.DicTimelineEvent[0][1]).DicAnimationKeyFrame.Values) { Quote ActiveQuote = ActiveKeyFrame.QuoteSet; int QuoteSetIndex = 0; int QuoteSetCount = 0; //Once a Quote is selected, keep it, if random quotes are needed, use multiple QuoteSet. //If the number of QuoteSet changed, assume the user did something wrong and get a new index. if (ActiveQuote.ListQuoteSet.Count > 1 && QuoteSetCount != ActiveQuote.ListQuoteSet.Count) { QuoteSetCount = ActiveQuote.ListQuoteSet.Count; QuoteSetIndex = Random.Next(ActiveQuote.ListQuoteSet.Count); ActiveQuote.SelectedQuoteSet = QuoteSetIndex; } Quote.Targets ActiveTarget = ActiveQuote.Target; QuoteSet ActiveQuoteSet = ActiveQuote.ActiveQuoteSet; Character ActivePilot = ActiveUnit.Pilot; Character EnemyPilot = EnemyUnit.Pilot; if (ActiveTarget == Quote.Targets.Defender) { ActivePilot = EnemyUnit.Pilot; EnemyPilot = ActiveUnit.Pilot; } bool UseRandomIndex = !ActiveQuoteSet.QuoteSetUseLast && ActiveQuoteSet.QuoteSetChoice == QuoteSet.QuoteSetChoices.Random; QuoteSet.QuoteStyles QuoteStyle = ActiveQuoteSet.QuoteStyle; int QuoteIndex = 0; if (ActiveQuoteSet.QuoteSetChoice == QuoteSet.QuoteSetChoices.Fixed) { QuoteIndex = ActiveQuoteSet.QuoteSetChoiceValue; } Tuple <string, string> ActiveQuoteTuple; switch (QuoteStyle) { case QuoteSet.QuoteStyles.Reaction: QuoteTypes ActiveQuoteType = QuoteTypes.Damaged; if (BattleResult.ArrayResult[0].AttackMissed) { ActiveQuoteType = QuoteTypes.Dodge; } ActiveQuoteTuple = GetQuote(ActiveQuoteType, ActivePilot, EnemyPilot, UseRandomIndex, ref QuoteIndex); ActiveQuote.ActiveText = TextHelper.FitToWidth(fntFinlanderFont, ActiveQuoteTuple.Item2, 500); ActiveQuote.PortraitPath = ActiveQuoteTuple.Item1; ActiveQuote.ActiveCharacterName = ActivePilot.Name; break; case QuoteSet.QuoteStyles.QuoteSet: ActiveQuoteTuple = GetAttackQuote(ActiveQuoteSet.QuoteSetName, ActivePilot, EnemyPilot, UseRandomIndex, ref QuoteIndex); ActiveQuote.ActiveText = TextHelper.FitToWidth(fntFinlanderFont, ActiveQuoteTuple.Item2, 500); ActiveQuote.PortraitPath = ActiveQuoteTuple.Item1; ActiveQuote.ActiveCharacterName = ActivePilot.Name; break; case QuoteSet.QuoteStyles.Custom: ActiveQuote.ActiveText = TextHelper.FitToWidth(fntFinlanderFont, ActiveQuoteSet.CustomText, 500); break; case QuoteSet.QuoteStyles.BattleStart: ActiveQuoteTuple = GetQuote(QuoteTypes.BattleStart, ActivePilot, EnemyPilot, UseRandomIndex, ref QuoteIndex); ActiveQuote.ActiveText = TextHelper.FitToWidth(fntFinlanderFont, ActiveQuoteTuple.Item2, 500); ActiveQuote.PortraitPath = ActiveQuoteTuple.Item1; ActiveQuote.ActiveCharacterName = ActivePilot.Name; break; } if (!string.IsNullOrEmpty(ActiveQuote.PortraitPath)) { if (ActiveQuote.PortraitPath.StartsWith("Animations")) { ActiveQuote.ActiveCharacterSprite = new SimpleAnimation("", ActiveQuote.PortraitPath, new AnimationLooped(ActiveQuote.PortraitPath)); ActiveQuote.ActiveCharacterSprite.ActiveAnimation.Content = Content; ActiveQuote.ActiveCharacterSprite.ActiveAnimation.Load(); } else { ActiveQuote.ActiveCharacterSprite = new SimpleAnimation("", ActiveQuote.PortraitPath, Content.Load <Texture2D>(ActiveQuote.PortraitPath)); } } } #endregion #region Init renderTarget ListAnimationLayer[L].renderTarget = new RenderTarget2D( GraphicsDevice, ScreenWidth, ScreenHeight); #endregion } }