private void buildCharacterToolStripMenuItem_Click(object sender, EventArgs e) { try { if (CurrentCharacter != null) { DialogResult result = MessageBox.Show("Are you sure you want to build this Character?\n\n" + "Currently-loaded character information will be disgarded.", "Build Character and Generate GUID", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (result == DialogResult.Yes) { CurrentCharacter = BuildCreature(); LoadedGUID = CurrentCharacter.GetCreatureGUIDAsString() ?? string.Empty; tbGUID.Text = CurrentCharacter.GetCreatureGUIDAsString().ToUpper() ?? string.Empty; } } else { CurrentCharacter = BuildCreature(); LoadedGUID = CurrentCharacter.GetCreatureGUIDAsString() ?? string.Empty; tbGUID.Text = CurrentCharacter.GetCreatureGUIDAsString().ToUpper() ?? string.Empty; } } catch (Exception ex) { MessageBox.Show($"{ex.Message}\n\n" + "Note: Attempting to build a character while leaving fields other than \"Surname\" or \"Subrace\" empty " + "will result in failure. Please check all other fields then try to build the character again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Save the current empire object. /// </summary> /// <param name="characterSave">Flag to allow character saving when it is not a new player.</param> /// <param name="isNew">Flag to allow the creation of a new empire object.</param> /// <returns>True when empire object is saved.</returns> public bool Save(bool characterSave = false, bool isNew = false) { Logger.Info($"Empire::Save - Saving empire with Id {Id}"); lock (_EmpireLock) { try { if (isNew) { Database.Empires.Add(this); } else if ((characterSave) && (CurrentCharacterid > 0)) { CurrentCharacter.Save(); } XMLHelper.SerializeObjectToFile(this, $"{PathingHelper.playerDir}empires{Path.DirectorySeparatorChar}{Id}.xml"); } catch (Exception Ex) { Logger.Error($"Empire::Save - Error saving empire with Id {Id}. Error: {Ex}"); } } return(File.Exists($"{PathingHelper.playerDir}empires{Path.DirectorySeparatorChar}{Id}.xml")); }
private void cbAlignment_SelectedIndexChanged(object sender, EventArgs e) { if (CurrentCharacter != null) { CurrentCharacter.SetAlignment((Alignment)cbAlignment.SelectedValue); } ShouldSave = true; }
private void cbBackground_SelectedIndexChanged(object sender, EventArgs e) { if (CurrentCharacter != null) { CurrentCharacter.SetBackground((Background)cbBackground.SelectedValue); } ShouldSave = true; }
private void cbRelativeSize_SelectedIndexChanged(object sender, EventArgs e) { if (CurrentCharacter != null) { CurrentCharacter.SetRelativeSize((RelativeSize)cbRelativeSize.SelectedValue); } ShouldSave = true; }
private void cbCombatClass_SelectedIndexChanged(object sender, EventArgs e) { if (CurrentCharacter != null) { CurrentCharacter.SetCombatClass((CombatClass)cbCombatClass.SelectedValue); } ShouldSave = true; }
private void cbTail_SelectedIndexChanged(object sender, EventArgs e) { if (CurrentCharacter != null) { CurrentCharacter.SetTail((Tail)cbTail.SelectedValue); } ShouldSave = true; }
private void cbCreatureType_SelectedIndexChanged(object sender, EventArgs e) { if (CurrentCharacter != null) { CurrentCharacter.SetCreatureType((CreatureType)cbCreatureType.SelectedValue); } ShouldSave = true; }
private void cbGender_SelectedIndexChanged(object sender, EventArgs e) { if (CurrentCharacter != null) { CurrentCharacter.SetGender((Gender)cbGender.SelectedValue); } ShouldSave = true; }
public void End() { CurStep = Step.END; Debug.Log("Step : " + CurStep); CurrentCharacter?.InitNameUI(); StartCoroutine(NextPlayerWait()); }
private bool CurrentCharacterMatchesPhoneme(Phoneme phoneme, bool allowVowels = true) { if (allowVowels && phoneme.Letters.Length == 0 && phoneme.HasVowel() && CurrentCharacter.HasVowel()) { return(true); } return(phoneme.GetPossibleLetters().Any(each => each == CurrentCharacter)); }
//Coroutine /// <summary> /// 회피 효과 코루틴 /// </summary> /// <returns></returns> private IEnumerator AvoidCoroutine() { yield return(new WaitForSecondsRealtime(data.Rolling_MsBetweenInvincible)); CurrentCharacter.AddEffect(m_AvoidEffect, new CharacterEffectList.EffectStateStruct(null)); yield return(new WaitForSecondsRealtime(data.Rolling_InvincibleActiveTime)); CurrentCharacter.RemoveEffect(m_AvoidEffect); m_AvoidCoroutine = null; }
private void CheckEquipment() { var equimpentItems = CurrentCharacter .SharedGetPlayerContainerEquipment() .Items.Where(item => EnabledEntityList.Contains(item.ProtoItem)).ToList(); foreach (var item in equimpentItems) { if (item is null) { continue; } CheckItemDurability(item); } }
private async void enemyShot(List <Character> enemies) { foreach (Character ch in enemies) { await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () => { // Wat hebben we geraakt en wat doen we ermee? if (ch is BombNPC) { addToPointGains(ch.Position, -(CurrentCharacter.Points / 5)); CurrentCharacter.Multi.Clear(); CurrentCharacter.Points -= CurrentCharacter.Points / 5; // Lose 20% of Health } else if (ch is MovingNPC || ch is NPC) { int pointGain = CurrentCharacter.Multi.Increment(); addToPointGains(ch.Position, pointGain); CurrentCharacter.Points += pointGain; } else if (ch is Item) { if (ch is StarModeItem) { CurrentCharacter.Multi.MPBonus = Multiplyer.multiplyerBonus.MULTIPLYER_X10_BONUS; CurrentCharacter.Multi.MP = 10; } else if (ch is MultiplyerEnhancerItem) { CurrentCharacter.Multi.MPBonus = Multiplyer.multiplyerBonus.DOUBLE_POINTS; } else if (ch is ShooterItem) { BulletReleaseThread.RunWorkerAsync(); } else if (ch is SpeedBoostItem) { CurrentCharacter.speedBoost(); } // Run seperate worker to set effect for 5 minutes BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += Worker_DoWork; worker.RunWorkerAsync(); } Characters.Remove(ch); }); } }
/// <summary> /// Parses all values from the creation form to create a new Creature object. /// </summary> /// <returns>Returns an object of a class that derives from the Creature class.</returns> private Creature BuildCreature() { if (ParseEnumValues(out Dictionary <string, Enum> parsedEnums) && ParseIntValues(out Dictionary <string, int> parsedInts) && !string.IsNullOrEmpty(tbFirstName.Text)) { //do this if building a NEW character if (CurrentCharacter == null) { //create a new creature with a derived type specified by the "Race" setting CreatureBuilder cb = new CreatureBuilder((Race)parsedEnums["Race"]); Creature newCreature = cb.NewCreature; //assign parsed values to the new Creature object AssignValues(newCreature, parsedEnums, parsedInts); LoadedGUID = newCreature.GetCreatureGUIDAsString(); tbGUID.Text = newCreature.GetCreatureGUIDAsString().ToUpper(); return(newCreature); } //do this if building on an EXISTING character else { //assign parsed values to the current character //will change the values of the CurrentCharacter property AssignValues(CurrentCharacter, parsedEnums, parsedInts); Creature existingCreature = CurrentCharacter; LoadedGUID = CurrentCharacter.GetCreatureGUIDAsString(); tbGUID.Text = CurrentCharacter.GetCreatureGUIDAsString().ToUpper(); return(existingCreature); } } else { MessageBox.Show("Error: The character could not be created because a value failed to parse correctly.\n\n" + "The only two fields that can be empty are the Subrace and Surname fields.\n\n" + "Fields that are meant to contain numbers can only contain numbers, usually positive integers.\n\n" + "Please check all other fields and try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(null); } }
public IEnumerator <YieldInstruction> MakeLeader(int charIndex, ActionResult result) { if (CurrentCharacter != ActiveTeam.Leader) { GameManager.Instance.SE("Menu/Cancel"); DungeonScene.Instance.LogMsg(Text.FormatKey("MSG_LEADER_SWAP_REQ"), false, true); yield return(new WaitForFrames(GameManager.Instance.ModifyBattleSpeed(10))); } else if (charIndex >= ActiveTeam.Players.Count || ActiveTeam.LeaderIndex == charIndex) { GameManager.Instance.SE("Menu/Cancel"); yield return(new WaitForFrames(GameManager.Instance.ModifyBattleSpeed(10))); } else if (ZoneManager.Instance.CurrentMap.NoSwitching || DataManager.Instance.Save.NoSwitching) { GameManager.Instance.SE("Menu/Cancel"); DungeonScene.Instance.LogMsg(Text.FormatKey("MSG_CANT_SWAP_LEADER", CurrentCharacter.GetDisplayName(true)), false, true); yield return(new WaitForFrames(GameManager.Instance.ModifyBattleSpeed(10))); } else { if (!canSwitchToChar(charIndex)) { GameManager.Instance.SE("Menu/Cancel"); } else { result.Success = ActionResult.ResultType.Success; //change the leader index int oldLeader = ActiveTeam.LeaderIndex; ActiveTeam.LeaderIndex = charIndex; //re-order map order as well ZoneManager.Instance.CurrentMap.CurrentTurnMap.AdjustLeaderSwap(Faction.Player, 0, false, oldLeader, charIndex); focusedPlayerIndex = ZoneManager.Instance.CurrentMap.CurrentTurnMap.GetCurrentTurnChar().Char; DungeonScene.Instance.LogMsg(Text.FormatKey("MSG_LEADER_SWAP", ActiveTeam.Leader.GetDisplayName(true))); GameManager.Instance.SE(GraphicsManager.LeaderSE); yield return(new WaitForFrames(GameManager.Instance.ModifyBattleSpeed(10))); yield return(CoroutineManager.Instance.StartCoroutine(SpecialIntro(ActiveTeam.Leader))); } } }
private IToken ScanIdent(int start, Func <char, bool> extraChars) { while (Advancable()) { if (CurrentCharacter.IsAlphanumeric() || extraChars(CurrentCharacter)) { continue; } else if (CurrentCharacter.IsWhiteSpace()) { return(Add(EToken.Identifier, start, this)); } else { return(Add(EToken.Identifier, start, Formula.Substring(start - 1, CharPosition-- - start))); } } return(Add(EToken.Identifier, start, this)); }
private void TrySendDrone() { var targetsList = Api.Client.World.GetStaticWorldObjectsOfProto <IProtoStaticWorldObject>() .Where(IsValidObject) .OrderBy(o => CurrentCharacter.Position.DistanceTo(o.TilePosition.ToVector2D())) .ToList(); if (targetsList.Count == 0) { return; } int targetN = 0; int droneControlLimit = ((IProtoItemDroneControl)SelectedItem.ProtoGameObject).MaxDronesToControl; int droneNumberToSend = Math.Min( droneControlLimit - CurrentCharacter.SharedGetCurrentControlledDronesNumber(), targetsList.Count); using var tempExceptDrones = Api.Shared.GetTempList <IItem>(); for (var index = 0; index < droneNumberToSend; index++) { IItem itemDrone; do { itemDrone = CharacterDroneControlSystem.ClientSelectNextDrone(tempExceptDrones.AsList()); if (itemDrone is null) { return; } tempExceptDrones.Add(itemDrone); } while (ItemDurabilitySystem.SharedGetDurabilityFraction(itemDrone) < DroneDurabilityThreshold); if (!CharacterDroneControlSystem.ClientTryStartDrone(itemDrone, targetsList[targetN].TilePosition, showErrorNotification: false)) { return; } targetN++; } }
/// <summary> /// Sets up the main creation form based on what the user chose during startup. /// </summary> /// <param name="selection"></param> private void StartCreator(int selection) { CurrentCharacter = null; //create new character if (selection == 0) { //clear all creator controls ClearAllCreatorControls(); CurrentCharacter = null; //focus first control tbFirstName.Focus(); } //open existing character file (*.xml) else if (selection == 1) { var cXML = new CreatureXML(); try { CurrentCharacter = cXML.ReadFromXML(GetXMLToOpen()); if (CurrentCharacter != null) { //track the GUID of the loaded Creature LoadedGUID = CurrentCharacter.GetCreatureGUIDAsString(); DisplayCreature(CurrentCharacter); } } catch (Exception ex) { CurrentCharacter = null; LoadedGUID = string.Empty; MessageBox.Show($"Error: {ex.Message}", "An error occurred", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private IToken ScanStringLiteral(int start) { while (Advancable()) { if (CurrentCharacter == '"') { if (!Advancable() || CurrentCharacter.IsWhiteSpace()) { return(Add(EToken.StringLiteral, start, this)); } else if (CurrentCharacter == '"') { continue; } else { return(Add(EToken.StringLiteral, start, Formula.Substring(start - 1, CharPosition-- - start))); } } } return(Add(EToken.ScanError, start, this)); }
private void CheckItemDurability([NotNull] IItem item) { double itemDurabilityFraction = ItemDurabilitySystem.SharedGetDurabilityFraction(item); if (IsUnequipEnabled && itemDurabilityFraction <= UnequipThreshold) { if (TryToMoveItem( item: item, toContainer: CurrentCharacter.SharedGetPlayerContainerInventory())) { if (item != null) { itemAlerts.Remove(item); } return; } } if (!itemAlerts.ContainsKey(item)) { itemAlerts.Add(item, new AlertDetails()); } if (IsAlertNotificationEnabled && itemDurabilityFraction <= AlertThreshold && (itemAlerts[item].Durability - itemDurabilityFraction >= AlertStep || (AlertTimeout > 0 && itemAlerts[item].Time + AlertTimeout < Api.Client.Core.ClientRealTime))) { itemAlerts[item].Durability = itemDurabilityFraction; itemAlerts[item].Time = Api.Client.Core.ClientRealTime; NotificationSystem.ClientShowNotification( title: "Item durability low!", color: NotificationColor.Bad, icon: item.ProtoItem.Icon); } }
/// <summary> /// Advance the cursor forward given number of characters /// </summary> /// <param name="step">Value of step to MoveNext</param> private void MoveNext(int step = 1) { try { for (int i = 0; i < step; i++) { // reset position when there is a newline if (CurrentCharacter.Equals("\n")) { _position = 0; _line++; } _input = _input.Remove(0, 1); _position++; } } catch (ArgumentOutOfRangeException) { _input = ""; } }
private void cbRace_SelectedIndexChanged(object sender, EventArgs e) { //do this if an existing character file was open OR if a new character was built if (CurrentCharacter != null) { CurrentCharacter.SetRace((Race)cbRace.SelectedValue); CreatureBuilder cb = new CreatureBuilder((Race)cbRace.SelectedItem); Creature nc = cb.NewCreature; rtbRaceDescription.Text = nc.GetDescription(); ShouldSave = true; return; } //do this if CurrentCharacter is null, but the Race combobox is having its options cycled through if (cbRace.SelectedItem != null) { Race race = (Race)cbRace.SelectedItem; CreatureBuilder cb = new CreatureBuilder(race); Creature nc = cb.NewCreature; rtbRaceDescription.Text = nc.GetDescription(); ShouldSave = true; } else { return; } //if all else fails, clear the race description rtb rtbRaceDescription.Clear(); }
public IToken Scan() { if (CharPosition == 1 && CurrentCharacter == '\'') { return(Add(EToken.StringLiteral, 1, Formula)); } while (Advancable()) { if (!CurrentCharacter.IsWhiteSpace()) { var start = CharPosition; switch (CurrentCharacter) { case '!': return(Add(EToken.Bang, start, GetText(start))); case '=': return(Add(EToken.EqualsOperator, start, GetText(start))); case ',': return(Add(EToken.Comma, start, GetText(start))); case ';': return(Add(EToken.Semicolon, start, GetText(start))); case '+': case '-': case '%': return(Add(EToken.UnaryOperator, start, GetText(start))); case '*': case '/': case '&': case '^': return(Add(EToken.BinaryOperator, start, GetText(start))); case '<': case '>': if (IsEOT) { break; } if (NextCharacterIs('=')) { CharPosition++; } return(Add(EToken.BinaryOperator, start, GetText(start))); case '(': ParenDepth++; return(Add(EToken.OpenParen, start, GetText(start))); case ')': ParenDepth--; return(Add(EToken.CloseParen, start, GetText(start))); case '{': BraceDepth++; return(Add(EToken.OpenBrace, start, GetText(start))); case '}': BraceDepth--; return(Add(EToken.CloseBrace, start, GetText(start))); case '#': return(ScanErrorIdent(start)); case '"': return(ScanStringLiteral(start)); case '\'': return(ScanClosedExternalRef(start)); case '[': return(ScanOpenExternalRef(start)); default: if (CurrentCharacter.IsNumeric()) { return(ScanNumber(start)); } if (CurrentCharacter.IsAlpha()) { return(ScanIdentifier(start)); } return(Add(EToken.ScanError, start, this)); } } } return(IsEOT ? Add(EToken.EOT, CharPosition, this) : Add(EToken.ScanError, CharPosition, this)); }
public void OnSpeakerHit() { _boxingGlove.HitObject(CurrentCharacter.transform); CurrentCharacter.GetHit(); }
public void EngageDungeon(uint dgId) { CurrentCharacter.EngageDungeon(dgId); }
void Start() { currentCharacter = GameObject.FindGameObjectWithTag("CurrentCharacter").GetComponent <CurrentCharacter>(); }
/// <summary> /// Code ajouté lors de la suppression d'une action /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ListCharacters_CharacterToDelete(object sender, EventArgs e) { CurrentCharacter.Delete(); CurrentCharacter = null; }
/// <summary> /// Tokenizes the content into words and sentences. /// </summary> /// <param name="Content"></param> /// <param name="MaximumNumberOfSentences">The maximum number of sentences that should be returned</param> /// <param name="MaximumWordCount">The maximum number of words per sentence. If set to null there is no maximum.</param> /// <param name="MinimumWordCount">The minimum number of words per sentence. If set to null there is no minimum</param> /// <param name="Mode">The mode of traversing the content that should be used. By default the content is searched in sequential order.</param> /// <param name="IsCaseSensitive">If set to false all words will be converted to lower case.</param> /// <returns></returns> public static List <Sentence> Tokenize(string Content, int MaximumNumberOfSentences, int?MaximumWordCount = 9, int?MinimumWordCount = 4, TextSplitterModes Mode = TextSplitterModes.InOrder, bool IsCaseSensitive = false) { //Initialize Variables List <Sentence> Sentences = new List <Sentence>(); if (Content == null || Content.Length == 0) { return(new List <Sentence>()); } int ContentLength = Content.Length; int CurrentPosition = 0; Sentence CurrentSentence = new Sentence(); Word CurrentWord = new Word(); char CurrentCharacter; // While the number of sentence is less than the maximum and the mode is random or a different mode and not at teh end of the content. while ( ((Mode == TextSplitterModes.Random) || ((Mode == TextSplitterModes.EquallySplit || Mode == TextSplitterModes.InOrder) && CurrentPosition < ContentLength)) && Sentences.Count < MaximumNumberOfSentences ) { // Grab the character and conver to lowercase if needed. CurrentCharacter = Content[CurrentPosition]; if (!IsCaseSensitive) { CurrentCharacter = char.ToLower(CurrentCharacter); } // If the current position denotes the end of the sentence #region End Of Sentence if (AtEndOfSentence(CurrentCharacter)) { CurrentSentence.Words.Add(CurrentWord); CurrentSentence.Words.Add(new Word(CurrentCharacter.ToString())); // If the current sentence fits the criteria for sentences add it to the list of sentences. if (((MinimumWordCount == null && CurrentSentence.WordCount > 0) || CurrentSentence.WordCount > MinimumWordCount) && (MaximumWordCount == null || CurrentSentence.WordCount < MaximumWordCount)) { Sentences.Add(CurrentSentence); if (Sentences.Count > MaximumNumberOfSentences) { break; } CurrentPosition = GetNextTextSplitterIndex(CurrentPosition, ContentLength, Mode, MaximumNumberOfSentences); } // If not ignore it and move onto the next sentence CurrentSentence = new Sentence(); CurrentWord = new Word(); } #endregion End Of Sentence //If the current position is a space #region Space // If the current position is a tab, space, or newline go to the next word. else if (CurrentCharacter == ' ' || CurrentCharacter == '\n' || CurrentCharacter == '\r' || CurrentCharacter == '\t') { if (CurrentWord != null && CurrentWord.Text.Length > 0) { CurrentSentence.Words.Add(CurrentWord); CurrentWord = new Word(); } } #endregion Space // If the current position is a special character, add it as a seperate word. #region Special Characters else if (CurrentCharacter == ';' || CurrentCharacter == '(' || CurrentCharacter == ')' || CurrentCharacter == '$' || CurrentCharacter == '@' || CurrentCharacter == '#' || CurrentCharacter == '%' || CurrentCharacter == '+' || CurrentCharacter == '-' || CurrentCharacter == '/' || CurrentCharacter == '"' || CurrentCharacter == ',' || CurrentCharacter == '=' || CurrentCharacter == '|') { if (CurrentWord != null && CurrentWord.Text.Length > 0) { CurrentSentence.Words.Add(CurrentWord); CurrentSentence.Words.Add(new Word(CurrentCharacter.ToString())); CurrentWord = new Word(); } } #endregion Special Characters // If the current character is a single quote, treat it as the start of a new word. #region Single Quote else if (CurrentCharacter == '\'') { if (CurrentWord != null && CurrentWord.Text.Length > 0) { CurrentSentence.Words.Add(CurrentWord); } CurrentWord = new Word(CurrentCharacter.ToString()); } #endregion Single Quote // If it is any other character, add it to the current word. #region All Other Characters else { CurrentWord.Text += CurrentCharacter; } #endregion All Other Characters CurrentPosition++; // If the end of the content has been reached, progress based on the mode. #region If At End Of Content if (CurrentPosition >= ContentLength) { // If the current sentence has the mimum amount of words, add it as a new sentence if ((MinimumWordCount == null && CurrentSentence.WordCount > 0) || CurrentSentence.WordCount > MinimumWordCount) { Sentences.Add(CurrentSentence); if (Sentences.Count > MaximumNumberOfSentences) { break; } } // If the mode is Equally Split or In Order quit if (Mode == TextSplitterModes.EquallySplit || Mode == TextSplitterModes.InOrder) { break; } // If its random keep going else if (Mode == TextSplitterModes.Random) { CurrentSentence = new Sentence(); CurrentPosition = GetNextTextSplitterIndex(CurrentPosition, ContentLength, Mode, MaximumNumberOfSentences); } } #endregion If At End Of Content } return(Sentences); }