public List <KeyValuePair <string, KeyBinding> > GetShownBindings() { using (TimingLogger.Track("GetShowBindings()")) { var shown = new List <KeyValuePair <string, KeyBinding> >(); foreach (var item in _bindings) { var actionName = item.Key; Command command = _commandsByName.ContainsKey(actionName) ? _commandsByName[actionName] : null; if (command == null) { continue; } if (!ActionCategory.Equals(command.Group)) { continue; } if (!ActionSubCategory.Equals(command.SubGroup)) { continue; } shown.Add(item); } return(shown); } }
/** * <summary>Gets the index of an Action within a list of all Actions that share its category.</summary> * <param name = "_action">The Action to get the index of</param> * <returns>The index of the Action within a list of all Actions that share its category</returns> */ public int GetActionSubCategory(Action _action) { string fileName = _action.GetType().ToString().Replace("AC.", ""); ActionCategory _category = _action.category; // Learn category foreach (ActionType type in AllActions) { if (type.fileName == fileName) { _category = type.category; } } // Learn subcategory int i = 0; foreach (ActionType type in AllActions) { if (type.category == _category) { if (type.fileName == fileName) { return(i); } i++; } } ACDebug.LogWarning("Error building Action " + _action); return(0); }
public static int ShowTypePopup(AC.Action action, int typeIndex) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Action type:", GUILayout.Width(80)); ActionCategory oldCategory = KickStarter.actionsManager.GetActionCategory(typeIndex); ActionCategory category = oldCategory; int subcategory = KickStarter.actionsManager.GetActionSubCategory(action); category = (ActionCategory)EditorGUILayout.EnumPopup(category); if (category != oldCategory) { subcategory = 0; } subcategory = EditorGUILayout.Popup(subcategory, KickStarter.actionsManager.GetActionSubCategories(category)); int newTypeIndex = KickStarter.actionsManager.GetActionTypeIndex(category, subcategory); EditorGUILayout.EndHorizontal(); GUILayout.Space(4f); if (newTypeIndex != typeIndex) { return(newTypeIndex); } return(-1); }
public ActionType(string _fileName, Action _action) { fileName = _fileName; category = _action.category; title = _action.title; description = _action.description; isEnabled = true; }
public PublishedActionCategory(ActionCategory actionC) { Label = actionC.Label; Description = actionC.Description; ActionTypeCode = actionC.ActionTypeCode; ActionValueCode = actionC.ActionValueCode; FileHash = actionC.Hash; }
public ActionResult DeleteConfirmed(Guid id) { ActionCategory actionCategory = db.ActionCategories.Find(id); actionCategory.Delete = true; //db.ActionCategories.Remove(actionCategory); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionType(ActionType _actionType) { fileName = _actionType.fileName; category = _actionType.category; title = _actionType.title; description = _actionType.description; isEnabled = _actionType.isEnabled; color = _actionType.color; }
public ActionResult Edit([Bind(Include = "Index,Category")] ActionCategory actionCategory) { if (ModelState.IsValid) { db.Entry(actionCategory).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(actionCategory)); }
public TrackGroupDrawer( Func <int> getActionIndex, Action repaintAction, ActionCategory category, Func <bool> isShowDesc) { m_GetActionIndex = getActionIndex; m_RepaintAction = repaintAction; DrawerConfig.Category = category; m_IsShowDesc = isShowDesc; }
public async Task <ActionResult> DeleteActionCategoryConfirmed(int id) { ActionCategory actionCategoryToBeDeleted = await _dbContext.ActionCategories.FindAsync(id); if (actionCategoryToBeDeleted != null) { _dbContext.ActionCategories.Remove(actionCategoryToBeDeleted); await _dbContext.SaveChangesAsync(); } return(RedirectToAction("ActionCategoryList")); }
public async Task <ActionResult> CreateActionCategory([Bind(Include = "ActionCategoryName,Description")] ActionCategory actionCategory) { if (ModelState.IsValid) { _dbContext.ActionCategories.Add(actionCategory); await _dbContext.SaveChangesAsync(); return(RedirectToAction("ActionCategoryList")); } return(View(actionCategory)); }
public List <SceneAnimation> Damage(Player Target, CreatureElement Element, ActionCategory Catagory, byte BaseAmount, byte AmountOfAttacks, SceneAnimation AttackAnimation, bool TriggersAttackFlags) { List <SceneAnimation> Animations = new List <SceneAnimation>(); if (TriggersAttackFlags) { Animations.AddRange( RunTriggerTypeEffect(EffectTrigger.BEFORE_ATTACKED, Target, false) ); } for (int i = 0; i < AmountOfAttacks; i++) { Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.ATTACK, new double[] { GetOpponent(Target).playerNumber, (double)Catagory }, "#ATTACK ANIMATION#")); //Animations.Add(AttackAnimation); //TODO: DONT PASS AS ARGUMENT //Animations.AddRange(Target.GiveDamage(Element, Catagory, BaseAmount, GetOpponent(Target).GetTotalStat(CreatureStats.STRENGTH), GetOpponent(Target).GetTotalStat(CreatureStats.INTELLIGENCE), Target.GetTotalStat(CreatureStats.ENDURANCE), Target.GetTotalStat(CreatureStats.WISDOM), GetOpponent(Target).HasElement(Element) ? 1.5 : 1, Target.GetElementEffectiveness(Element))); Animations.AddRange(Target.GiveDamage(Element, Catagory, BaseAmount, GetOpponent(Target))); if (Target.IsNotInArena()) { AmountOfAttacks = (byte)(i + 1); break; } } if (AmountOfAttacks > 1) { if (AmountOfAttacks == 2) { Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.ADD_MESSAGE, null, "Damage landed twice!")); } else { Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.ADD_MESSAGE, null, "Damage landed " + AmountOfAttacks + " times!")); } } if (Target.IsKilled()) { Animations.AddRange(RemoveFromArena(Target, true)); } else if (!Target.IsNotInArena()) { if (TriggersAttackFlags) { Animations.AddRange( RunTriggerTypeEffect(EffectTrigger.AFTER_ATTACKED, Target, false) ); } } return(Animations); }
public ActionResult Create([Bind(Include = "Index,Category")] ActionCategory actionCategory) { if (ModelState.IsValid) { actionCategory.Index = Guid.NewGuid(); db.ActionCategories.Add(actionCategory); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(actionCategory)); }
/** * <summary>Gets all found ActionType classes that belong in a given category</summary> * <param name = "category">The category of ActionType classes to collect</param> * <retuns>An array of all ActionType classes that belong in the given category</returns> */ public ActionType[] GetActionTypesInCategory(ActionCategory category) { List <ActionType> types = new List <ActionType>(); foreach (ActionType type in AllActions) { if (type.category == category) { types.Add(type); } } return(types.ToArray()); }
// GET: Sections/Edit/5 public async Task <ActionResult> UpdateActionCategory(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ActionCategory actionCategoryToBeUpdated = await _dbContext.ActionCategories.FindAsync(id); if (actionCategoryToBeUpdated == null) { return(HttpNotFound()); } return(View(actionCategoryToBeUpdated)); }
// GET: GroceryList/ActionCategories/Delete/5 public ActionResult Delete(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ActionCategory actionCategory = db.ActionCategories.Find(id); if (actionCategory == null) { return(HttpNotFound()); } return(View(actionCategory)); }
/** * <summary>Gets all found Action titles within a given ActionCategory.</summary> * <param name = "_category">The category of the Actions to get the titles of.</param> * <returns>A string array of all Action titles within the ActionCategory</returns> */ public string[] GetActionSubCategories(ActionCategory _category) { List <string> titles = new List <string>(); foreach (ActionType type in EnabledActions) { if (type.category == _category) { titles.Add(type.title); } } return(titles.ToArray()); }
public static int ShowTypePopup(AC.Action action, int typeIndex) { if (!KickStarter.actionsManager.IsActionTypeEnabled(typeIndex)) { EditorGUILayout.LabelField("<b>This Action type has been disabled.</b>", CustomStyles.disabledActionType); //return typeIndex; return(-1); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Action type:", GUILayout.Width(80)); ActionCategory oldCategory = KickStarter.actionsManager.GetActionCategory(typeIndex); ActionCategory category = oldCategory; category = (ActionCategory)EditorGUILayout.EnumPopup(category); int subcategory = KickStarter.actionsManager.GetActionSubCategory(action); // This is for all, needs to be converted to enabled for that category int enabledSubcategory = -1; ActionType[] categoryTypes = KickStarter.actionsManager.GetActionTypesInCategory(category); for (int i = 0; i <= subcategory; i++) { if (i < categoryTypes.Length && categoryTypes[i].isEnabled) { enabledSubcategory++; } } if (category != oldCategory) { subcategory = 0; enabledSubcategory = 0; } enabledSubcategory = EditorGUILayout.Popup(enabledSubcategory, KickStarter.actionsManager.GetActionSubCategories(category)); int newTypeIndex = KickStarter.actionsManager.GetEnabledActionTypeIndex(category, enabledSubcategory); EditorGUILayout.EndHorizontal(); GUILayout.Space(4f); if (newTypeIndex != typeIndex) { return(newTypeIndex); } return(-1); }
public List <SceneAnimation> GiveDamage(CreatureElement Element, ActionCategory Category, byte BaseActionPower, int AttackerStrength, int AttackerIntelligence, int AttackedEndurance, int AttackedWisdom, double ElementProficiency, double ElementEffectiveness) { //TODO: REMOVE THIS List <SceneAnimation> Animations = new List <SceneAnimation>(); int Damage = 0; double Bonuses = ElementEffectiveness * ElementProficiency * GetElementBuffs(Element); if (Bonuses > 0 && !(Element == CreatureElement.EARTH && NotEffectedByEarth.Evaluate())) { if (Category == ActionCategory.PHYSICAL) { Damage = (int)Math.Floor((AttackerStrength * BaseActionPower * Bonuses / AttackedEndurance) * 2.1); } else if (Category == ActionCategory.MYSTICAL) { Damage = (int)Math.Floor((AttackerIntelligence * BaseActionPower * Bonuses / AttackedWisdom) * 2.1); } int nh = ActiveCreature.Health - Damage; if (nh < 0) { nh = 0; } Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.HEALTH_BAR, new double[] { playerNumber, ActiveCreature.GetTotalStat(CreatureStats.HEALTH), nh, -1 * Damage, ElementEffectiveness, ElementProficiency }, "#DAMAGE GIVEN#")); ActiveCreature.Health -= Damage; if (ActiveCreature.Health <= 0) { ActiveCreature.Health = 0; ActiveCreature.killed = true; } } else { Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.ADD_MESSAGE, null, ActiveCreature.Nickname + " was unaffected by the damage!")); } return(Animations); }
public async Task <ActionResult> UpdateActionCategory(int id, ActionCategory actionCategory) { if (ModelState.IsValid) { ActionCategory actionCategoryToBeUpdated = await _dbContext.ActionCategories.FindAsync(id); if (TryUpdateModel(actionCategoryToBeUpdated, "", new string[] { "ActionCategoryName", "Description" })) { await _dbContext.SaveChangesAsync(); } return(RedirectToAction("ActionCategoryList")); } return(View(actionCategory)); }
public List <SceneAnimation> GiveDamage(CreatureElement Element, ActionCategory Category, byte BaseActionPower, Player Attacker) { List <SceneAnimation> Animations = new List <SceneAnimation>(); int Damage = 0; double Bonuses = GetElementEffectiveness(Element) * (Attacker.HasElement(Element) ? 1.5 : 1) * Attacker.GetElementBuffs(Element); if (Bonuses > 0 && !(Element == CreatureElement.EARTH && NotEffectedByEarth.Evaluate())) { if (Category == ActionCategory.PHYSICAL) { Damage = (int)Math.Floor(((Attacker.GetTotalStat(CreatureStats.STRENGTH) * (double)BaseActionPower * Bonuses) / (GetElementBuffs(Element) * GetTotalStat(CreatureStats.ENDURANCE))) * 2.1); } else if (Category == ActionCategory.MYSTICAL) { Damage = (int)Math.Floor(((Attacker.GetTotalStat(CreatureStats.INTELLIGENCE) * (double)BaseActionPower * Bonuses) / (GetElementBuffs(Element) * GetTotalStat(CreatureStats.WISDOM))) * 2.1); } int nh = ActiveCreature.Health - Damage; if (nh < 0) { nh = 0; } Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.HEALTH_BAR, new double[] { playerNumber, ActiveCreature.GetTotalStat(CreatureStats.HEALTH), nh, -1 * Damage, GetElementEffectiveness(Element), Attacker.HasElement(Element) ? 1.5 : 1 }, "#DAMAGE GIVEN#")); ActiveCreature.Health -= Damage; if (ActiveCreature.Health <= 0) { ActiveCreature.Health = 0; ActiveCreature.killed = true; } } else { Animations.Add(new SceneAnimation(SceneAnimation.SceneAnimationType.ADD_MESSAGE, null, ActiveCreature.Nickname + " was unaffected by the damage!")); } return(Animations); }
/** * <summary>Gets the index number of an Action within EnabledActions.</summary> * <param name = "_category">The category of the Action to search for</param> * <param name = "subCategoryIndex">The index number of the Action in a list of all Actions that share its category</param> * <returns>The index number of the Action within EnabledActions</returns> */ public int GetActionTypeIndex(ActionCategory _category, int subCategoryIndex) { List <ActionType> types = new List <ActionType>(); foreach (ActionType type in EnabledActions) { if (type.category == _category) { types.Add(type); } } if (types.Count > subCategoryIndex) { return(EnabledActions.IndexOf(types[subCategoryIndex])); } return(0); }
private void UserControl_actions_Load(object sender, EventArgs e) { tV_category.Nodes.Add(ActionCategory.GetCategories(iL_actions)); foreach (TreeNode node in tV_category.Nodes[0].Nodes) { m_actions.Add(node.Name, ActionCategory.GetActions(node.Name, iL_actions)); TreeView actionTree = new TreeView(); //actionTree.HideSelection = false; actionTree.Nodes.Add(m_actions[node.Name]); actionTree.Visible = false; actionTree.ShowPlusMinus = false; actionTree.ShowRootLines = false; actionTree.ImageList = iL_actions; actionTree.AfterSelect += new TreeViewEventHandler(tV_actions_AfterSelect); actionTree.BeforeCollapse += new TreeViewCancelEventHandler(tV_actions_BeforeCollapse); gB_action.Controls.Add(actionTree); actionTree.Dock = DockStyle.Fill; m_actionTrees.Add(node.Name, actionTree); } foreach (MyGesture gest in m_gesturesCollection.Groups) { if (gest.ID != AppGroupOptions.APP_GROUP_GLOBAL) { gest.SetActionIcon(iL_applications); cCB_groups.AddItem(gest.ID, gest.Caption); } } if (m_selectedGroups.Count == 0 || m_selectedGroups[0].ID == AppGroupOptions.APP_GROUP_GLOBAL) { rB_global.Checked = true; } else { foreach (MyGesture group in m_selectedGroups) { cCB_groups.ListItems[group.ID].Checked = true; } cCB_groups.CheckListItems(); rB_local.Checked = true; } if (cCB_groups.ListItems.Count > 0) { cCB_groups.ListItems[0].Selected = true; } }
public void CreateActions(AdsTypes type, Action inAction, ActionType actionType, EventType eventType) { if (actionType == ActionType.Success) { var addedElement = _successActions.Find(x => x.EventType.Equals(eventType)); if (inAction == null) //early exit if inAction is null { return; } //if already present if (addedElement != null) { addedElement.ActionList.SafeAdd(type, inAction); } else { var elementToAdd = new ActionCategory(eventType, type, inAction); _successActions.Add(elementToAdd); } } else { var addedElement = _failActions.Find(x => x.EventType.Equals(eventType)); if (inAction == null) //early exit if inAction is null { return; } //if already present if (addedElement != null) { addedElement.ActionList.SafeAdd(type, inAction); } else { var elementToAdd = new ActionCategory(eventType, type, inAction); _failActions.Add(elementToAdd); } } }
public BattleEffect ActionEffect; //+ effect priority //dictionary effect trigger+speed to effect script public CreatureAction(string Name, CreatureElement Element, ActionCategory Catagory, byte Speed, short Priority, byte Power, byte Usage, byte Mana, BattleEffect ActionEffect) { this.Name = Name; this.Element = Element; this.Catagory = Catagory; this.Speed = Speed; this.Priority = (byte)(4 + Priority); this.Power = Power; this.Usage = Usage; this.Mana = Mana; this.ActionEffect = ActionEffect; if (ActionEffect != null) { ActionEffect.Name = Name; ActionEffect.SetElement(Element); } Style = "attacked"; }
public int GetActionSubCategory(Action _action) { int i = 0; string fileName = _action.GetType().ToString().Replace("AC.", ""); ActionCategory _category = _action.category; foreach (ActionType type in EnabledActions) { if (type.category == _category) { if (type.fileName == fileName) { return(i); } i++; } } return(0); }
private void ShowCategoriesGUI() { EditorGUILayout.BeginVertical(CustomStyles.thinBox); showCategories = CustomGUILayout.ToggleHeader(showCategories, "Action categories"); if (showCategories) { ActionCategory[] categories = (ActionCategory[])System.Enum.GetValues(typeof(ActionCategory)); for (int i = 0; i < categories.Length; i++) { if ((i % 4) == 0) { if (i > 0) { EditorGUILayout.EndHorizontal(); } EditorGUILayout.BeginHorizontal(); } if (GUILayout.Toggle(selectedCategoryInt == i, categories[i].ToString(), "Button", GUILayout.MinWidth(70f))) { if (selectedCategoryInt != i || selectedCategory != categories[i]) { selectedCategoryInt = i; selectedCategory = categories[i]; selectedClass = null; } } } EditorGUILayout.EndHorizontal(); } CustomGUILayout.EndVertical(); if (defaultClass > AllActions.Count - 1) { defaultClass = AllActions.Count - 1; } }
//public int NewNo { get; set; } // Display Info of the RFEM Objects on Panels // Parameters are separated by ";". The component split text can be used to break the string down into a list. public override string ToString() { return(string.Format($"RFEM-LoadCase;No:{No};" + $"Description:{((Description == "") ? "-" : Description)};ActionCategory:{ActionCategory.ToString()};" + $"SelfWeightFactor:{SelfWeightFactor.ToString()};ToSolve:{ToSolve.ToString()};" + $"IsValid:{IsValid};ID:{((ID == "") ? "-" : ID)};Tag:{((Tag == "") ? "-" : Tag)};" + $"ToModify:{ToModify};ToDelete:{ToDelete};Comment:{((Comment == "") ? "-" : Comment)};")); }
protected override void OnCreate() { base.OnCreate(); itemCategory = GetActionCategory <Items>(); magicCategory = GetActionCategory <Magic>(); }
public ActionCategoryAttribute(ActionCategory category) { this.category = category.ToString(); }
/** * <summary>Gets the index number of an Action within EnabledActions.</summary> * <param name = "_category">The category of the Action to search for</param> * <param name = "subCategoryIndex">The index number of the Action in a list of all Actions that share it's category</param> * <returns>The index number of the Action within EnabledActions</returns> */ public int GetActionTypeIndex(ActionCategory _category, int subCategoryIndex) { List<ActionType> types = new List<ActionType>(); foreach (ActionType type in EnabledActions) { if (type.category == _category) { types.Add (type); } } if (types.Count > subCategoryIndex) { return EnabledActions.IndexOf (types[subCategoryIndex]); } return 0; }
/** * <summary>Gets all found Action titles within a given ActionCategory.</summary> * <param name = "_category">The category of the Actions to get the titles of.</param> * <returns>A string array of all Action titles within the ActionCategory</returns> */ public string[] GetActionSubCategories(ActionCategory _category) { List<string> titles = new List<string>(); foreach (ActionType type in EnabledActions) { if (type.category == _category) { titles.Add (type.title); } } return (titles.ToArray ()); }