public DependencyResolverContext Register(Type type, IFactory factory, LifeType life)
        {
            typeInfoMap[type] = new TypeResolveInfo
            {
                Factory  = factory,
                LifeType = life,
            };

            return(this);
        }
Esempio n. 2
0
 public bool Search(string str)
 {
     if (LifeType.ToString().Contains(str) || NPCID.Value.ToString().Contains(str) || NPCIDType.ToString().Contains(str) ||
         Range.ToString().Contains(str) || Life.ToString().Contains(str) || PathID.ToString().Contains(str) ||
         PathIDType.ToString().Contains(str) || NPCNum.ToString().Contains(str) || NPCNumType.ToString().Contains(str))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 3
0
    //몬스터
    public void SetData(MonsterState ms)
    {
        hp     = ms.m.hp;
        maxHp  = hp;
        Power  = ms.m.power;
        Speed  = ms.m.speed;
        stress = ms.m.stress;
        uni    = ms.m.uni;

        LifeType = LifeType.M;

        powerMultiple = 1;
        speedMultiple = 1;
    }
Esempio n. 4
0
    public void SetData(KnightState ks)
    {
        hp     = ks.k.hp;
        maxHp  = ks.k.maxHp;
        Power  = ks.k.power;
        Speed  = ks.k.speed;
        stress = ks.k.stress;
        uni    = ks.k.uni;

        LifeType = LifeType.K;

        powerMultiple = 1;
        speedMultiple = 1;
    }
Esempio n. 5
0
 public void Register(Type @interface, Type implementation, LifeType lifeType = LifeType.InstancePerDependency, object name = null)
 {
     if (@interface == null)
     {
         throw new ArgumentNullException(nameof(@interface));
     }
     if (implementation == null)
     {
         throw new ArgumentNullException(nameof(implementation));
     }
     if (!implementation.IsClass)
     {
         throw new ArgumentException($"{implementation} must be a reference type");
     }
     if (implementation.IsAbstract || implementation.IsInterface)
     {
         throw new ArgumentException($"{implementation} must be non abstract");
     }
     if (@interface.IsAssignableFrom(implementation) ||
         implementation.IsGenericTypeDefinition && @interface.IsGenericTypeDefinition &&
         IsAssignableFromGeneric(implementation, @interface))
     {
         var dependency = new Dependency(implementation, lifeType, name);
         if (_dependencies.ContainsKey(@interface))
         {
             _dependencies[@interface].Add(dependency);
         }
         else
         {
             _dependencies.Add(@interface, new List <Dependency> {
                 dependency
             });
         }
     }
     else
     {
         throw new ArgumentException($"{implementation} must be non abstract and must subtype of {@interface}");
     }
 }
Esempio n. 6
0
        public Property AddLife(LifeType type, Direction direction, string value = null, string initial = null, string limit = null, string warning = null)
        {
            Property item = new Property("ToolLife", (string[])null, null)
            {
                Value = value
            };

            item.AddAttribute(new Property.Attribute("type", type.ToString()));
            item.AddAttribute(new Property.Attribute("countDirection", direction.ToString()));
            if (initial != null)
            {
                item.AddAttribute(new Property.Attribute("initial", initial));
            }
            if (limit != null)
            {
                item.AddAttribute(new Property.Attribute("limit", limit));
            }
            if (warning != null)
            {
                item.AddAttribute(new Property.Attribute("warning", warning));
            }
            this.mProperties.Add(item);
            return(item);
        }
Esempio n. 7
0
        /// <summary>
        /// Add the tool life
        /// </summary>
        /// <param name="type">MINUTES, PART_COUNT, or WEAR</param>
        /// <param name="direction">UP or DOWN</param>
        /// <param name="value">The current value</param>
        /// <param name="initial">The initial value for the range</param>
        /// <param name="limit">The limit</param>
        /// <param name="warning">A point where there will be a warning</param>
        /// <returns>The life property</returns>
        public Property AddLife(LifeType type, Direction direction, string value = null,
                                string initial = null,
                                string limit   = null, string warning = null)
        {
            Property life = new Property("ToolLife");

            life.Value = value;
            life.AddAttribute(new Property.Attribute("type", type.ToString()));
            life.AddAttribute(new Property.Attribute("countDirection", direction.ToString()));
            if (initial != null)
            {
                life.AddAttribute(new Property.Attribute("initial", initial));
            }
            if (limit != null)
            {
                life.AddAttribute(new Property.Attribute("limit", limit));
            }
            if (warning != null)
            {
                life.AddAttribute(new Property.Attribute("warning", warning));
            }
            mProperties.Add(life);
            return(life);
        }
Esempio n. 8
0
 public Dependency(Type type, LifeType lifeType, object key)
 {
     Key      = key;
     Type     = type;
     LifeType = lifeType;
 }
 public Property AddLife(LifeType type, Direction direction, string value = null,
     string initial = null,
     string limit = null, string warning = null)
 {
     Property life = new Property("ItemLife");
     life.Value = value;
     life.AddAttribute(new Property.Attribute("type", type.ToString()));
     life.AddAttribute(new Property.Attribute("countDirection", direction.ToString()));
     if (initial != null)
         life.AddAttribute(new Property.Attribute("initial", initial));
     if (limit != null)
         life.AddAttribute(new Property.Attribute("limit", limit));
     if (warning != null)
         life.AddAttribute(new Property.Attribute("warning", warning));
     mProperties.Add(life);
     return life;
 }
Esempio n. 10
0
 public void Register <TInterface, TImplementation>(LifeType lifeType, object name)
     where TInterface : class
     where TImplementation : class, TInterface
 {
     Register(typeof(TInterface), typeof(TImplementation), lifeType, name);
 }
Esempio n. 11
0
 public void Register <TInterface, TImplementation>(LifeType lifeType = LifeType.InstancePerDependency)
     where TInterface : class
     where TImplementation : class, TInterface
 {
     Register(typeof(TInterface), typeof(TImplementation), lifeType);
 }
 public DependencyResolverContext Register(Type service, Type implementation, LifeType life)
 {
     return(Register(service, new ActivatorFactory(implementation), life));
 }
 public DependencyResolverContext Register <T, I>(LifeType life)
 {
     return(Register(typeof(T), new ActivatorFactory(typeof(I)), life));
 }
 public DependencyResolverContext Register <T>(Func <IServiceProvider, T> function, LifeType lifeType)
 {
     return(Register(typeof(T), new DelegateFactory2 <T>(function), lifeType));
 }