private void SyncInterestedMarks(string name, ListKind listKind, bool isAdd, bool isTemporary) { lock (Locker) { var isInteresting = listKind == ListKind.Interested; var oppositeList = isInteresting ? notInterested : interested; var sameList = isInteresting ? interested : notInterested; Action <CollectionPair> addRemove = c => { if (isAdd) { c.Add(name, isTemporary); } else { c.Remove(name, isTemporary); } }; if (isAdd) // if we're adding to one, then we have to remove from the other { oppositeList.Remove(name, isTemporary); } // now we do the actual action on the list specified addRemove(sameList); ICharacter toModify; if (CharacterDictionary.TryGetValue(name, out toModify)) { toModify.IsInteresting = (isInteresting && isAdd) || IsOfInterest(name, false); } } }
//public EquipmentList list; void Awake() { charDict = GameObject.FindObjectOfType <CharacterDictionary>(); charStats = charDict.dictionary[id]; equipped = GameObject.FindObjectOfType <EquipDictionary>().dictionary[id]; equipmentDict = GameObject.FindObjectOfType <EquipmentDictionary>(); }
private string ConvertToValidName(string OriginalName) { HashSet <string> invalidCharacter = RegularExpression.GetMatchData(OriginalName, SystemConfiguration.GetValue("InvalidCharacter")); string newFileName = OriginalName; if (invalidCharacter.Count > 0) { //find invalid character foreach (string key in invalidCharacter) { string replacement = CharacterDictionary.GetValue(key); if (replacement == null) { //Others invalid character newFileName = RegularExpression.Replace(newFileName, "[" + key + "]", CharacterDictionary.OthersReplacement); } else { newFileName = RegularExpression.Replace(newFileName, "[" + key + "]", CharacterDictionary.GetValue(key)); } } } return(newFileName); }
private void BtnAddRule_Click(object sender, EventArgs e) { if (this.txtOriText.Text.Trim() == "") { System.Windows.Forms.MessageBox.Show("Original Character is not allowed none", "Infomation"); return; } else { string key = this.txtOriText.Text.Trim(); if (CharacterDictionary.Keys.Contains <string>(key)) { System.Windows.Forms.MessageBox.Show("Original Character[" + key + "] has been added,please add another one!", "Infomation"); return; } } if (this.txtReplacement.Text.Trim() == "") { System.Windows.Forms.MessageBox.Show("Replacement Character is not allowed none", "Infomation"); return; } CharacterDictionary.Add(this.txtOriText.Text.Trim(), this.txtReplacement.Text.Trim()); ListViewItem item = new ListViewItem(); item.Text = (lstvReplacement.Items.Count + 1).ToString(); item.SubItems.Add(this.txtOriText.Text.Trim()); item.SubItems.Add("->"); item.SubItems.Add(this.txtReplacement.Text.Trim()); this.lstvReplacement.Items.Add(item); }
private void UpdateIgnoreUpdatesMark(string name, bool isAdd) { ICharacter toModify; if (CharacterDictionary.TryGetValue(name, out toModify)) { toModify.IgnoreUpdates = isAdd; } }
void Start() { CharacterScript target = GameObject.Find(targetName).GetComponent <CharacterScript>(); dict = FindObjectOfType <CharacterDictionary>(); exp = dict.dictionary[target.id].exp; expToLevel = dict.dictionary[target.id].expToLevel; gameObject.transform.GetChild(0).GetComponent <Image>().fillAmount = (float)exp / (float)expToLevel; gameObject.transform.GetChild(1).GetComponent <Text>().text = "<b>" + exp + " / " + expToLevel + "</b>"; }
void setDefeat() { defeated = true; enemyTeam.victorious = true; GameObject victoryMenu = Instantiate(Resources.Load("Menus/VictoryMenu"), GameObject.FindGameObjectWithTag("CombatCanvas").transform) as GameObject; victoryMenu.GetComponent <VictoryMenuScript>().setGoldGained(goldValue); victoryMenu.GetComponent <VictoryMenuScript>().setEXPGained(expValue); victoryMenu.GetComponent <VictoryMenuScript>().dropItems(charPos[0].id, charPos[1].id, charPos[2].id); GameObject.FindGameObjectWithTag("ActionMenu").SetActive(false); CharacterDictionary dict = GameObject.FindObjectOfType <CharacterDictionary>(); HealthDictionary HPDict = GameObject.FindObjectOfType <HealthDictionary>(); for (int i = 0; i < enemyTeam.charPos.Length; i++) { CharacterStats charStats = dict.dictionary[enemyTeam.charPos[i].id]; charStats.addEXP(expValue); dict.dictionary[enemyTeam.charPos[i].id] = charStats; HPDict.dictionary[enemyTeam.charPos[i].id] = enemyTeam.charPos[i].HP; //Debug.Log("EXP for " + enemyTeam.charPos[i].id + ": " + dict.dictionary[enemyTeam.charPos[i].id].exp); //Debug.Log("Level for " + enemyTeam.charPos[i].id + ": " + dict.dictionary[enemyTeam.charPos[i].id].level); } CharacterScript[] chars = GameObject.FindObjectsOfType <CharacterScript>(); for (int i = 0; i < chars.Length; i++) { chars[i].stopActionBar(); } ActionBarScript[] actionBars = GameObject.FindObjectsOfType <ActionBarScript>(); for (int i = 0; i < actionBars.Length; i++) { actionBars[i].gameObject.SetActive(false); } Destroy(gameObject); /* * charPos[0].gameObject.SetActive(false); * charPos[1].gameObject.SetActive(false); * charPos[2].gameObject.SetActive(false); */ }
/// <summary> /// Initial form objects /// </summary> public void Initial() { //Initial Global System Configuration SystemConfiguration.Initial(System.Windows.Forms.Application.ExecutablePath); //Inital Global LogClass LoggerHelper.Initial(this.rtxtLog, SystemConfiguration.LoggerClassName); LoggerHelper.Clear(); // LoadConfigurations(); // RegexRegularClass.Initial(SystemConfiguration.GetValue("RegexRegular_Invalid")); //Clear TextBox.Text this.txtOriginalDir.Clear(); //this.txtOriginalDir.Text = @"c:\test"; this.textBox1.Visible = false; this.textBox2.Visible = false; //this.button1.Visible = false; //rtn.SetFileNameRegexRegular(SystemConfiguration.GetValue("NavigationSourceFileNameRegex")); //rtn.SetFileNameRegexReplacement(SystemConfiguration.GetValue("NavigationReplacementFileNameRegex")); this.txtFileNameSearchReg.Text = SystemConfiguration.GetValue("NavigationSourceFileNameRegex"); this.txtFileNameReplacementReg.Text = SystemConfiguration.GetValue("NavigationReplacementFileNameRegex"); this.txtHTMSearchReg.Text = SystemConfiguration.GetValue("NavigationSourceHTMLRegex"); this.txtHTMLReplacementReg.Text = SystemConfiguration.GetValue("NavigationReplacementHTMLRegex"); //Initial CharacterDictionay CharacterDictionary.Initial(lstvReplacement.Items[0].SubItems[3].Text.Trim()); foreach (ListViewItem item in lstvReplacement.Items) { if (item.Text == "1") { continue; } CharacterDictionary.Add(item.SubItems[1].Text, item.SubItems[3].Text); } foreach (var item in CharacterDictionary.Keys) { LoggerHelper.Debug("key=" + item + ";value=" + CharacterDictionary.GetValue(item).ToString() + "\r\n"); } }
public async Task LocateX(IDialogContext context, LuisResult result) { var entitiesArray = result.Entities; var actions = result.Query; var reply = context.MakeMessage(); if (actions.ToString() == "where is clarke?") { reply.Text = "Clarke's was last located in Tondc."; } if (entitiesArray.Count >= 1) { foreach (var entityItem in result.Entities) { if (entityItem.Type == "Character") { if (LocationDictionary.locationDictionary.Count < 3) { DataBuilder.BuildLocations(); } if (CharacterDictionary.characterDictionary.Count < 3) { //build dictionary DataBuilder.BuildCharacters(); } if (CharacterDictionary.characterDictionary.ContainsKey(entityItem.Entity)) { Character currentCharacterInfo = CharacterDictionary.GetCharacter(entityItem.Entity); reply.Text = currentCharacterInfo.Name + "'s last known location was " + currentCharacterInfo.Location; } } } } await context.PostAsync(reply); context.Wait(MessageReceived); }
private void DeleteCurrentRowToolStripMenuItem_Click(object sender, EventArgs e) { if (lstvReplacement.SelectedItems.Count <= 0) { System.Windows.Forms.MessageBox.Show("Please choose one row first!", "Infomation"); return; } bool IsNeedSorting = false; foreach (ListViewItem item in lstvReplacement.SelectedItems) { if (item.Text == "1") { System.Windows.Forms.MessageBox.Show("Others row isn't allow to be delete!", "Infomation"); //return; } else { if (CharacterDictionary.Remove(item.SubItems[1].Text.ToString())) { lstvReplacement.Items.Remove(item); LoggerHelper.Info(item.SubItems[1].ToString() + " was deleted\r\n"); IsNeedSorting = true; } } } if (IsNeedSorting) { int Index = 1; foreach (ListViewItem item in lstvReplacement.Items) { item.Text = Index.ToString(); Index++; } } }
void Awake() { dict = GameObject.FindObjectOfType <CharacterDictionary>(); charStats = dict.dictionary[id]; }
public async Task GetInformationOnX(IDialogContext context, LuisResult result) { var entitiesArray = result.Entities; var reply = context.MakeMessage(); if (entitiesArray.Count >= 1) { foreach (var entityItem in result.Entities) { if (entityItem.Type == "Character") { if (CharacterDictionary.characterDictionary.Count < 3) { //build dictionary DataBuilder.BuildCharacters(); } // If entityItem.Entity isn't in Dictionary default text if (CharacterDictionary.characterDictionary.ContainsKey(entityItem.Entity)) { Character currentCharacterInfo = CharacterDictionary.GetCharacter(entityItem.Entity); reply.Text = currentCharacterInfo.Description + " \n\n" + "* Age: " + currentCharacterInfo.Age + " \n" + "* Living Family: " + currentCharacterInfo.LivingRelatives + " \n" + "* Skills: " + currentCharacterInfo.Skills + " \n" + "* Kills: " + currentCharacterInfo.Kills + " \n"; reply.Attachments = new List <Attachment>(); List <CardImage> cardImages = new List <CardImage>(); cardImages.Add(new CardImage(url: currentCharacterInfo.ImageLink)); HeroCard plCard = new HeroCard() { Title = "Name: " + currentCharacterInfo.Name, Subtitle = currentCharacterInfo.Quote, Images = cardImages }; reply.Attachments.Add(plCard.ToAttachment()); } else { reply.Text = ("I have no information about that person. " + "Tell me who you would like to know about. " + "Or if you would like to join the City of Light."); } //switch (entityItem.Entity) //{ // case "raven": // reply.Text = "Raven was trained as a zero-g mechanic. Out of the Arkers Raven has the most powerful mind of the group. Her exit from the City of Light was a loss to be sure. \n\n" + // "* Age: 19 \n" + // "* Living Family: none \n" + // "* Skills: Genius, Mechanic, Electronics Expert. \n" + // "* Kills: -- \n"; // reply.Attachments = new List<Attachment>(); // List<CardImage> cardImages = new List<CardImage>(); // cardImages.Add(new CardImage(url: "http://vignette4.wikia.nocookie.net/thehundred/images/2/2b/RavenS2Promo.png/revision/latest?cb=20160401040926")); // HeroCard plCard = new HeroCard() // { // Title = "Name: Raven Reyes", // Subtitle = "It won't survive me", // Images = cardImages // }; // reply.Attachments.Add(plCard.ToAttachment()); // break; // case "clarke": // reply.Text = "Clarke is strong and determined. Her friends and family are her weakness. She is not as clever as Raven, though she is resourceful. \n\n " + // "* Age: 18 \n\n " + // "* Living Family: Dr. Abigail Griffin \n\n" + // "* Kills: 900+ \n\n" + // "* Skills: Politics, Medical Knowledge"; // reply.Attachments = new List<Attachment>(); // break; // case "lexa": // reply.Text = "Lexa was the commander of the grounders, an avid warrior, who sought peace with the people from the Ark. She was the host for part 2 of my code until her consciousness was integrated into the second A.I. \n\n " + // "* Age: around 20 \n" + // "* Living Family: unkown \n" + // "* Skills: Politics, Hand to Hand, Sword Fighting, Knife Throwing \n" + // "* Kills: Unknown \n"; // reply.Attachments = new List<Attachment>(); // break; // case "jaha": // reply.Text = "Theloneous Jaha. Former Chancellor of the Ark. Instrumental in gainning follwers for the City of Light. \n\n" + // "* Age: 55 \n" + // "* Living Family: none \n" + // "* Skills: Leadership, Manipulation \n" + // "* Kills: 327 \n"; // reply.Attachments = new List<Attachment>(); // break; // case "kane": // reply.Text = "Marcus Kane. Kane, former head of security on the Ark and temporary Chancellor. Kane is strategic but his weakness is his love for Abby. \n\n" + // "* Age: 42 \n" + // "* Living Family: none \n" + // "* Skills: Weapons Expert, Military Tactics \n" + // "* Kills: 320 \n"; // reply.Attachments = new List<Attachment>(); // break; // case "bellamy": // reply.Text = "Bellamy Blake. His weakness is his love for his sister. He can be a great ralier of his people but is also easily manipulated. \n\n" + // "* Age: 23 \n" + // "* Living Family: Octavia Blake \n" + // "* Skills: Tacticial knowledge, weapons expert \n" + // "* Kills: 400+ \n"; // reply.Attachments = new List<Attachment>(); // break; // case "octavia": // reply.Text = "Octavia Blake. Okteivia kom Skaikru. A warrior for the Trikru as Indra's second, she is a skilled fighter in hand to hand combat and sword play. \n\n" + // "* Age: 17 \n" + // "* Living Family: Bellamy Blake \n" + // "* Skills: Weapons expert, tracking, culture expert \n" + // "* Kills: 5 \n"; // reply.Attachments = new List<Attachment>(); // break; // default: // reply.Text = ("I have no information about that person. " + // "Tell me who you would like to know about. " + // "Or if you would like to join the City of Light."); // break; // } } if (entityItem.Type == "Places") { if (LocationDictionary.locationDictionary.Count < 3) { DataBuilder.BuildLocations(); } if (LocationDictionary.locationDictionary.ContainsKey(entityItem.Entity)) { Location currentLocationInfo = LocationDictionary.GetLocation(entityItem.Entity); reply.Text = currentLocationInfo.Description + " \n\n"; reply.Attachments = new List <Attachment>(); List <CardImage> cardImages = new List <CardImage>(); cardImages.Add(new CardImage(url: currentLocationInfo.ImageLink)); HeroCard plCard = new HeroCard() { Title = "Name: " + currentLocationInfo.Name, Images = cardImages }; reply.Attachments.Add(plCard.ToAttachment()); } else { reply.Text = ("I'm sorry, I have no information about that place. " + "Tell me who you would like to know about; " + "or if you would like to join the City of Light."); } } } } await context.PostAsync(reply); context.Wait(MessageReceived); }
private void Awake() { _characterRenderers = GetComponentsInChildren <SpriteRenderer>(); _characterDictionary = FindObjectOfType <CharacterDictionary>(); }