Exemplo n.º 1
0
 public static void IfTrue(this IThrow validatR, bool value, string message)
 {
     if (value == true)
     {
         throw new ArgumentException(message);
     }
 }
Exemplo n.º 2
0
 public static void IfZero(this IThrow validatR, int value, string property)
 {
     if (value == 0)
     {
         throw new ArgumentException($"This Property {property} Cannot be Zero");
     }
 }
Exemplo n.º 3
0
 public static void IfNull <T>(this IThrow validatR, T value, string propertyName, string message)
 {
     if (value == null)
     {
         throw new ArgumentNullException($"{propertyName} is NULL. {message}");
     }
 }
Exemplo n.º 4
0
 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.");
     }
 }
Exemplo n.º 5
0
 public static void IfNull <T>(this IThrow validatR, T value, Func <Exception> exceptionFactory)
 {
     if (value == null)
     {
         throw exceptionFactory();
     }
 }
Exemplo n.º 6
0
 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.");
     }
 }
Exemplo n.º 7
0
 public static void IfNotNull <T>(this IThrow validatR, T value, string message)
 {
     if (value != null)
     {
         throw new ArgumentException(message);
     }
 }
Exemplo n.º 8
0
 public static void IfNull <T>(this IThrow validatR, T value, string propertyName)
 {
     if (value == null)
     {
         throw new ArgumentNullException(propertyName);
     }
 }
Exemplo n.º 9
0
 public static void IfTrue(this IThrow validatR, bool value, Func <Exception> exceptionFactory)
 {
     if (value == true)
     {
         throw exceptionFactory();
     }
 }
Exemplo n.º 10
0
 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.");
     }
 }
Exemplo n.º 11
0
        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);
        }
Exemplo n.º 12
0
    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 + "%";
        }
    }
Exemplo n.º 13
0
    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);
    }
Exemplo n.º 14
0
    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();
    }
Exemplo n.º 15
0
    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;
    }
Exemplo n.º 16
0
    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 + "%";
        }
    }
Exemplo n.º 17
0
    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();
    }
Exemplo n.º 18
0
 public static IThrow <T> Using <T>(this IThrow <T> throws, IContainer container)
 {
     Container = container;
     return(throws);
 }
Exemplo n.º 19
0
 public static IThrow <T> Before <T>(this IThrow <T> throws, string methodName)
 {
     return(throws.Before(methodName, contex => true));
 }
Exemplo n.º 20
0
 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)));
 }
Exemplo n.º 21
0
 public static IThrow <T> After <T>(this IThrow <T> throws, string methodName)
 {
     return(throws.After(methodName, contex => true));
 }
Exemplo n.º 22
0
 public static IThrow <T> Reset <T>(this IThrow <T> throws)
 {
     Container = null;
     Predicate = null;
     return(throws);
 }
Exemplo n.º 23
0
 public ThrowDown(IThrow throwOne, IThrow throwTwo)
 {
     throwDownAdjudicator = new ThrowDownAdjudicator(throwOne, throwTwo);
 }
Exemplo n.º 24
0
 public bool Beats(IThrow aThrow)
 {
     return IsDifferentThrowTo(aThrow) && !beatenBy(aThrow);
 }
Exemplo n.º 25
0
 public bool IsDifferentThrowTo(IThrow aThrow)
 {
     return GetType() != aThrow.GetType();
 }
Exemplo n.º 26
0
 public static ThrowDownResult WithWinner(IThrow winner)
 {
     return new ThrowDownResult(winner);
 }
Exemplo n.º 27
0
 private ThrowDownResult(IThrow winner)
 {
     this.winner = winner;
 }
Exemplo n.º 28
0
    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;
 }