protected void SelectTrait(TraitGroup group, string trait) { if (!group.traits.ContainsKey(trait)) { return; } group.traits[trait].selected = !group.traits[trait].selected; group.traits[trait].excluded = false; Update(); }
protected void ExcludeTrait(TraitGroup group, string trait, bool update) { if (!group.traits.ContainsKey(trait)) { return; } group.traits[trait].excluded = !group.traits[trait].excluded; group.traits[trait].selected = false; if (update) { Update(); } }
override public void Draw() { foreach (SelectionItem item in items) { SelectionItemTraits itemT = item as SelectionItemTraits; if (itemT == null) { traitItems.Add(new SelectionItemTraits(item)); } else { traitItems.Add(itemT); } } foreach (SelectionItemTraits item in traitItems) { foreach (string category in item.GetTraits().Keys) { bool found = false; foreach (TraitGroup tg in traitData) { if (tg.GetName().Equals(category)) { found = true; tg.AddTraits(item); } } if (!found) { TraitGroup tg = new TraitGroup(category); tg.AddTraits(item); traitData.Add(tg); } } } foreach (SelectionItemTraits item in traitItems) { foreach (TraitGroup tg in traitData) { tg.AddItem(item); } } Update(); }
override public void Draw() { foreach (SelectionItemTraits item in traitItems.Values) { foreach (string category in item.GetTraits().Keys) { bool found = false; foreach (TraitGroup tg in traitData) { if (tg.GetName().Equals(category)) { found = true; tg.AddTraits(item); } } if (!found) { TraitGroup tg = new TraitGroup(category); tg.AddTraits(item); traitData.Add(tg); } } } foreach (SelectionItemTraits item in traitItems.Values) { foreach (TraitGroup tg in traitData) { tg.AddItem(item); } } foreach (var exclusion in initialExclusions) { foreach (string item in exclusion.Value) { ExcludeTrait(exclusion.Key, item); } } Update(); }
public Trait CreateTrait(string id, string name, string description, string group_name, bool should_save, ChoreGroup[] disabled_chore_groups, bool positive_trait, bool is_valid_starter_trait) { Trait trait = new Trait(id, name, description, 0f, should_save, disabled_chore_groups, positive_trait, is_valid_starter_trait); traits.Add(trait); if (group_name == string.Empty || group_name == null) { group_name = "Default"; } TraitGroup traitGroup = traitGroups.TryGet(group_name); if (traitGroup == null) { traitGroup = new TraitGroup(group_name, group_name, group_name != "Default"); traitGroups.Add(traitGroup); } traitGroup.Add(trait); return(trait); }
public ActionResult OnPost(MajorType major, int id) { IsPartial = true; Hero = GetHeroFromCookies(major); var response = _traitService.AssignTraitToHero(Hero, id); if (!response.Successful()) { IsPartial = true; Status = new StatusResult(response.Errors); Traits = _traitService.GetForHero(Hero); return(Page()); } Hero = response.Object; SaveHeroToCookies(Hero); Traits = _traitService.GetForHero(Hero); return(Page()); }
override public void Update() { bool resetScroll = false; if (traitScrollArea == null) { resetScroll = true; } else { scrollPos = traitScrollArea.GetScrollPosition(); } // Border UIElement ui = new UIElement(); ui.SetLocation(UIScaler.GetHCenter(-18), 0, 36, 30); new UIElementBorder(ui); // Title ui = new UIElement(); ui.SetLocation(UIScaler.GetHCenter(-10), 0, 20, 1); ui.SetText(_title); // Sort Buttons ui = new UIElement(); ui.SetLocation(UIScaler.GetHCenter(15.5f), 1, 1, 1); ui.SetTextPadding(0); if (alphaSort) { ui.SetText("1", Color.white); ui.SetBGColor(Color.black); } else { if (reverseSort) { ui.SetText("9", Color.black); } else { ui.SetText("1", Color.black); } ui.SetBGColor(Color.white); } ui.SetButton(SortNumerical); new UIElementBorder(ui); ui = new UIElement(); ui.SetLocation(UIScaler.GetHCenter(16.5f), 1, 1, 1); ui.SetTextPadding(0); if (alphaSort) { if (reverseSort) { ui.SetText("Z", Color.black); } else { ui.SetText("A", Color.black); } ui.SetBGColor(Color.white); } else { ui.SetText("A", Color.white); ui.SetBGColor(Color.black); } ui.SetButton(SortAlpha); new UIElementBorder(ui); traitScrollArea = new UIElementScrollVertical(); traitScrollArea.SetLocation(UIScaler.GetHCenter(-17.5f), 2, 13, 25); new UIElementBorder(traitScrollArea); float offset = 0; foreach (TraitGroup tg in traitData) { ui = new UIElement(traitScrollArea.GetScrollTransform()); ui.SetLocation(0, offset, 12, 1); ui.SetText(tg.GetName(), Color.black); ui.SetTextAlignment(TextAnchor.MiddleLeft); ui.SetBGColor(new Color(0.5f, 1, 0.5f)); offset += 1.05f; bool noneSelected = tg.NoneSelected(); foreach (string s in tg.traits.Keys) { TraitGroup tmpGroup = tg; string tmpTrait = s; ui = new UIElement(traitScrollArea.GetScrollTransform()); ui.SetLocation(0, offset, 11, 1); if (tg.traits[s].selected) { ui.SetBGColor(Color.white); ui.SetButton(delegate { SelectTrait(tmpGroup, tmpTrait); }); } else { int itemCount = 0; foreach (SelectionItemTraits item in tg.traits[s].items) { bool display = true; foreach (TraitGroup g in traitData) { display &= g.ActiveItem(item); } if (display) { itemCount++; } } if (itemCount > 0) { if (noneSelected) { ui.SetBGColor(Color.white); } else { ui.SetBGColor(Color.grey); } ui.SetButton(delegate { SelectTrait(tmpGroup, tmpTrait); }); } else { ui.SetBGColor(new Color(0.5f, 0, 0)); } } ui.SetText(s, Color.black); // Strikethrough if (tg.traits[s].excluded) { ui = new UIElement(traitScrollArea.GetScrollTransform()); ui.SetLocation(0.2f, offset + 0.5f, 10.6f, 0.06f); ui.SetBGColor(Color.black); ui.SetButton(delegate { SelectTrait(tmpGroup, tmpTrait); }); } // Exclude ui = new UIElement(traitScrollArea.GetScrollTransform()); ui.SetLocation(11, offset, 1, 1); ui.SetBGColor(Color.red); ui.SetTextPadding(0); ui.SetText("X", Color.black); ui.SetButton(delegate { ExcludeTrait(tmpGroup, tmpTrait, true); }); offset += 1.05f; } offset += 1.05f; } traitScrollArea.SetScrollSize(offset); if (!resetScroll) { traitScrollArea.SetScrollPosition(scrollPos); } DrawItemList(); // Cancel button ui = new UIElement(); ui.SetLocation(UIScaler.GetHCenter(-4.5f), 28, 9, 1); ui.SetBGColor(new Color(0.03f, 0.0f, 0f)); ui.SetText(CommonStringKeys.CANCEL); ui.SetButton(delegate { Destroyer.Dialog(); }); new UIElementBorder(ui); }
private async Task SetPivotData(CharacterSheet sheet) { TraitGroup summaryInfo = new TraitGroup { groupName = "skills" }; await Task.Factory.StartNew<bool>(() => { sheet.skill_groups.ForEach(x => { x.groupName = x.First().category; }); summaryInfo.Add(new Trait { title = "Name", value = sheet.name }); summaryInfo.Add(new Trait { title = "Queue", value = sheet.queue_length_short_description }); summaryInfo.Add(new Trait { title = "Skillpoints", value = "" + sheet.skillpoints.ToString("#,##0") }); summaryInfo.Add(new Trait { title = "Clone Skillpoints", value = sheet.clone_skillpoints.ToString("#,##0") }); //summaryInfo.Add(new Trait { title = "Clone Type", value = sheet.cloneType }); summaryInfo.Add(new Trait { title = "Wealth", value = sheet.wealth.ToString("##,###.##") + " ISK" }); summaryInfo.Add(new Trait { title = "Active Ship", value = "" + sheet.active_ship }); summaryInfo.Add(new Trait { title = "Location", value = "" + sheet.location }); summaryInfo.Add(new Trait { title = "Corporation", value = "" + sheet.corporation }); summaryInfo.Add(new Trait { title = "Joined", value = "" + sheet.joined.Substring(0, 10) }); summaryInfo.Add(new Trait { title = "Security Status", value = sheet.security_status.ToString("#.#") }); summaryInfo.Add(new Trait { title = "Race", value = "" + sheet.race }); summaryInfo.Add(new Trait { title = "Gender", value = "" + sheet.gender }); summaryInfo.Add(new Trait { title = "Date of Birth", value = "" + sheet.date_of_birth.Substring(0, 10) }); summaryInfo.Add(new Trait { title = "Intelligence", value = "" + sheet.intelligence }); summaryInfo.Add(new Trait { title = "Memory", value = "" + sheet.memory }); summaryInfo.Add(new Trait { title = "Charisma", value = "" + sheet.charisma }); summaryInfo.Add(new Trait { title = "Perception", value = "" + sheet.perception }); summaryInfo.Add(new Trait { title = "Willpower", value = "" + sheet.willpower }); return true; }); skillListHeaderText.Text = sheet.skill_groups.Sum(x => x.SkillPointCount).ToString("#,##0") + " Skill Points in " + sheet.skill_groups.Sum(x => x.Count).ToString("#,##0") + " Skills. "; queueHeaderText.Text = sheet.queue_length_description; queueFooterText.Text = "Updated " + sheet.updated; traitList.ItemsSource = summaryInfo; trainingQueueList.ItemsSource = sheet.queue; currentSkillsList.ItemsSource = sheet.skill_groups; }
protected void SelectTrait(TraitGroup group, string trait) { group.traits[trait].selected = !group.traits[trait].selected; Update(); }