public static void IfTrue(this IThrow validatR, bool value, string message) { if (value == true) { throw new ArgumentException(message); } }
public static void IfZero(this IThrow validatR, int value, string property) { if (value == 0) { throw new ArgumentException($"This Property {property} Cannot be Zero"); } }
public static void IfNull <T>(this IThrow validatR, T value, string propertyName, string message) { if (value == null) { throw new ArgumentNullException($"{propertyName} is NULL. {message}"); } }
public static void IfEntityNotFound <T>(this IThrow validatR, int entityId, T value, string entityName) { if (value == null) { throw new EntityNotFoundException($"{entityName} Entity with Id {entityId} not found."); } }
public static void IfNull <T>(this IThrow validatR, T value, Func <Exception> exceptionFactory) { if (value == null) { throw exceptionFactory(); } }
public static void IfNotEqual <T>(this IThrow validatR, int valueOne, int valueTwo, string property) { if (valueOne != valueTwo) { throw new ArgumentException($"Supplied {property} Values are not equal."); } }
public static void IfNotNull <T>(this IThrow validatR, T value, string message) { if (value != null) { throw new ArgumentException(message); } }
public static void IfNull <T>(this IThrow validatR, T value, string propertyName) { if (value == null) { throw new ArgumentNullException(propertyName); } }
public static void IfTrue(this IThrow validatR, bool value, Func <Exception> exceptionFactory) { if (value == true) { throw exceptionFactory(); } }
public static void IfNullOrWhiteSpace(this IThrow validatR, string value, string propertyName) { Throw.Exception.IfNull(value, propertyName); if (string.IsNullOrEmpty(value)) { throw new ArgumentException($"Paramater {propertyName} cannot be empty."); } }
public static IThrow <T> When <T>(this IThrow <T> throws, Func <ThrowContext, bool> predicate) { Predicate = predicate; var type = Container?.Resolve <T>().GetType() ?? typeof(T); Aspect.Weave <Throw>(type); return(throws); }
void PartAttackThrow(IThrow item) { var obj = Instantiate(PartsInfo.PanelList, this.transform, true); obj.GetComponent <InfoList>().Text[0].text = "Zasięg: " + item.Battle.range + "m"; for (int i = 0; i < item.AtkState.Count; i++) { obj.GetComponent <InfoList>().Text[0].text += "\n" + StaticValues.States.States[item.AtkState[i].IDState]; obj.GetComponent <InfoList>().Text[0].text += " " + item.AtkState[i].rate + "%"; } }
public void Enter(PlayerMachine.Data playerControll) { result = null; data = playerControll; item = (IThrow)data.character.Equipment.ItemSlots.Items[data.slotIndex].item; data.cost = 1; data.lineRender[0].enabled = false; data.lineRender[1].enabled = false; data.lineRender[2].enabled = false; var gui = Object.FindObjectOfType <GUIControll>(); gui.GUIEnabled.mission.Distance.SetActive(false); ColorLine(Color.white); IPS_RangeFunction.DrawRange(data, item.Battle.range, data.agent.transform.position); }
void ThrowSwitch() { IThrow item = (IThrow)selected; GUILayout.BeginVertical("box"); GUILayout.Label("Attack", center); item.AttackElement = (Elements)EditorGUILayout.EnumPopup("Attack Element", item.AttackElement); item.MissileFlight = (MissileFlight)EditorGUILayout.EnumPopup("Missile Flight", item.MissileFlight); item.Piercing = EditorGUILayout.IntField("Armor piercing", item.Piercing); item.Piercing_Precent = EditorGUILayout.IntSlider("Armor piercing %", item.Piercing_Precent, 0, 100); item.Battle.dmg = EditorGUILayout.IntField("Dmg", item.Battle.dmg); if (item.Battle.dmg < 0) { item.Battle.dmg = 0; } item.Battle.dmg_dice = EditorGUILayout.IntField("Dmg dice", item.Battle.dmg_dice); if (item.Battle.dmg_dice < 0) { item.Battle.dmg_dice = 0; } GUILayout.Label(item.Battle.dmg + " - " + (item.Battle.dmg + item.Battle.dmg_dice)); item.Battle.crit_multiply = EditorGUILayout.FloatField("Crit multiply", item.Battle.crit_multiply); item.Battle.range = EditorGUILayout.FloatField("Range", item.Battle.range); item.AreaAttack = EditorGUILayout.Toggle("Area Attack", item.AreaAttack); if (item.AreaAttack) { item.AreaRange = EditorGUILayout.FloatField("Range", item.AreaRange); item.IgnoreObstacle = EditorGUILayout.Toggle("Ignore Obstacle", item.IgnoreObstacle); } else { item.AreaRange = 0; item.IgnoreObstacle = false; } GUILayout.EndVertical(); GUILayout.Space(20); GUILayout.BeginVertical("box"); EditorFunctions.ViewState(item.AtkState, "Attack State"); GUILayout.EndVertical(); GUILayout.Space(20); item.RemoveAllState = (TypeState)EditorGUILayout.EnumPopup("Remove All type state", item.RemoveAllState); GUILayout.Space(20); GUILayout.BeginVertical("box"); StatePanel(item.RemoveState, "State Remove"); GUILayout.EndVertical(); }
public IThrow(IThrow item) { Battle = item.Battle; Piercing = item.Piercing; Piercing_Precent = item.Piercing_Precent; AttackElement = item.AttackElement; AtkState = item.AtkState; RemoveState = item.RemoveState; RemoveAllState = item.RemoveAllState; MissileFlight = item.MissileFlight; AreaRange = item.AreaRange; AreaAttack = item.AreaAttack; IgnoreObstacle = item.IgnoreObstacle; Name = item.Name; Icon = item.Icon; Category = item.Category; Description = item.Description; Value = item.Value; Stack = item.Stack; }
void PartDamage(IThrow item, Battle_Stats s_throw) { var obj = Instantiate(PartsInfo.Panel, this.transform, true); var Damage = Instantiate(PartsInfo.PanelList, obj.transform, true); Damage.GetComponent <InfoList>().Text[0].text = "" + s_throw.dmg + " - " + (s_throw.dmg + s_throw.dmg_dice); Damage.GetComponent <InfoList>().Text[0].text += " " + item.AttackElement; var Crit = Instantiate(PartsInfo.PanelList, obj.transform, true); Crit.GetComponent <InfoList>().Text[0].text = "x" + s_throw.crit_multiply; if (item.Piercing > 0) { var Piercing = Instantiate(PartsInfo.PanelList, obj.transform, true); Piercing.GetComponent <InfoList>().Text[0].text = "" + item.Piercing; } if (item.Piercing_Precent > 0) { var Piercing = Instantiate(PartsInfo.PanelList, obj.transform, true); Piercing.GetComponent <InfoList>().Text[0].text = "" + item.Piercing + "%"; } }
void ActionMenu() { GUILayout.BeginHorizontal("box", GUILayout.ExpandWidth(true)); if (GUILayout.Button("Add", GUILayout.Width(100))) { //my.States.Add(new State()); switch (ICategory) { case ItemCategory.Weapon: IWeapon weapon = new IWeapon(); weapon.Category = ItemCategory.Weapon; my.Weapons.Add(weapon); break; case ItemCategory.Armor: IArmor armor = new IArmor(); armor.Category = ItemCategory.Armor; my.Armors.Add(armor); break; case ItemCategory.Consume: IConsume consume = new IConsume(); consume.Category = ItemCategory.Consume; my.Consumes.Add(consume); break; case ItemCategory.Throw: IThrow itemThrow = new IThrow(); itemThrow.Category = ItemCategory.Throw; my.Throws.Add(itemThrow); break; case ItemCategory.Component: IComponent component = new IComponent(); component.Category = ItemCategory.Component; my.Components.Add(component); break; case ItemCategory.Recipe: IRecipe recipe = new IRecipe(); recipe.Category = ItemCategory.Recipe; my.Recipes.Add(recipe); break; case ItemCategory.KeyItem: IKey key = new IKey(); key.Category = ItemCategory.KeyItem; my.KeyItems.Add(key); break; case ItemCategory.Rune: IRune rune = new IRune(); rune.Category = ItemCategory.Rune; my.Runes.Add(rune); break; case ItemCategory.Accessories: IAccessories accessories = new IAccessories(); accessories.Category = ItemCategory.Accessories; my.Accessories.Add(accessories); break; } } if (GUILayout.Button("Remove", GUILayout.Width(100))) { switch (ICategory) { case ItemCategory.Weapon: if (my.Weapons.Count > 0) { selected = null; index = 0; my.Weapons.RemoveAt(my.Weapons.Count - 1); } break; case ItemCategory.Armor: if (my.Armors.Count > 0) { selected = null; index = 0; my.Armors.RemoveAt(my.Armors.Count - 1); } break; case ItemCategory.Consume: if (my.Consumes.Count > 0) { selected = null; index = 0; my.Consumes.RemoveAt(my.Consumes.Count - 1); } break; case ItemCategory.Throw: if (my.Throws.Count > 0) { selected = null; index = 0; my.Throws.RemoveAt(my.Throws.Count - 1); } break; case ItemCategory.Component: if (my.Components.Count > 0) { selected = null; index = 0; my.Components.RemoveAt(my.Components.Count - 1); } break; case ItemCategory.Recipe: if (my.Recipes.Count > 0) { selected = null; index = 0; my.Recipes.RemoveAt(my.Recipes.Count - 1); } break; case ItemCategory.KeyItem: if (my.KeyItems.Count > 0) { selected = null; index = 0; my.KeyItems.RemoveAt(my.KeyItems.Count - 1); } break; case ItemCategory.Rune: if (my.Runes.Count > 0) { selected = null; index = 0; my.Runes.RemoveAt(my.Runes.Count - 1); } break; case ItemCategory.Accessories: if (my.Accessories.Count > 0) { selected = null; index = 0; my.Accessories.RemoveAt(my.Accessories.Count - 1); } break; } } GUILayout.EndHorizontal(); }
public static IThrow <T> Using <T>(this IThrow <T> throws, IContainer container) { Container = container; return(throws); }
public static IThrow <T> Before <T>(this IThrow <T> throws, string methodName) { return(throws.Before(methodName, contex => true)); }
public static IThrow <T> After <T>(this IThrow <T> throws, string methodName, Func <ThrowContext, bool> predicate) { return(throws.When(context => context.Method.Name == methodName && context.IsAfter && predicate(context))); }
public static IThrow <T> After <T>(this IThrow <T> throws, string methodName) { return(throws.After(methodName, contex => true)); }
public static IThrow <T> Reset <T>(this IThrow <T> throws) { Container = null; Predicate = null; return(throws); }
public ThrowDown(IThrow throwOne, IThrow throwTwo) { throwDownAdjudicator = new ThrowDownAdjudicator(throwOne, throwTwo); }
public bool Beats(IThrow aThrow) { return IsDifferentThrowTo(aThrow) && !beatenBy(aThrow); }
public bool IsDifferentThrowTo(IThrow aThrow) { return GetType() != aThrow.GetType(); }
public static ThrowDownResult WithWinner(IThrow winner) { return new ThrowDownResult(winner); }
private ThrowDownResult(IThrow winner) { this.winner = winner; }
public void SpawnSlots() { Clear(); for (int i = 0; i < StaticValues.Recipe.Count; i++) { GameObject obj = null; bool canSpawn = false; switch (GetComponentInParent <WorkshopPanel>().SelectWorkshop) { case WorkshopPanel.e_SelectWorkshop.Blacksmith: Highlights.SetActive(true); switch (Category) { case MarketplacePanel.Item_Category.All: switch (StaticValues.Recipe[i].Reward.Category) { case ItemCategory.Weapon: case ItemCategory.Rune: case ItemCategory.Armor: case ItemCategory.Accessories: case ItemCategory.Component: canSpawn = true; break; case ItemCategory.Throw: IThrow iThrow = StaticValues.Items.Throws[StaticValues.Recipe[i].Reward.ID]; if (iThrow.AttackElement == Elements.Physical) { canSpawn = true; } break; } break; case MarketplacePanel.Item_Category.Equipments: switch (StaticValues.Recipe[i].Reward.Category) { case ItemCategory.Weapon: case ItemCategory.Rune: case ItemCategory.Armor: case ItemCategory.Accessories: canSpawn = true; break; case ItemCategory.Throw: IThrow iThrow = StaticValues.Items.Throws[StaticValues.Recipe[i].Reward.ID]; if (iThrow.AttackElement == Elements.Physical) { canSpawn = true; } break; } break; case MarketplacePanel.Item_Category.Materials: if (StaticValues.Recipe[i].Reward.Category == ItemCategory.Component) { canSpawn = true; } break; } break; case WorkshopPanel.e_SelectWorkshop.Herbalist: Highlights.SetActive(false); if (StaticValues.Recipe[i].Reward.Category == ItemCategory.Consume) { canSpawn = true; } if (StaticValues.Recipe[i].Reward.Category == ItemCategory.Throw) { IThrow iThrow = StaticValues.Items.Throws[StaticValues.Recipe[i].Reward.ID]; if (iThrow.AttackElement != Elements.Physical) { canSpawn = true; } } break; } if (canSpawn) { obj = Instantiate(PrefabSlot, Destiny.transform, true); obj.GetComponent <Slot>().Type = SlotType.Workshop; Item item = SetItem(StaticValues.Recipe[i].Reward); SlotItem slot = new SlotItem(item, StaticValues.Recipe[i].Reward.amount); obj.GetComponent <Slot>().SetSlot(slot); obj.GetComponent <Workshop_SlotRecipe>().Recipe = StaticValues.Recipe[i]; Slots.Add(obj); } } }
protected ThrowDownResult ThrowDownBetween(IThrow throwOne, IThrow throwTwo) { return new ThrowDown(throwOne, throwTwo).Commence(); }
public ThrowDownAdjudicator(IThrow throwOne, IThrow throwTwo) { this.throwOne = throwOne; this.throwTwo = throwTwo; }