Пример #1
0
 //
 public Movil(ref ObjectId line, ref ObjectId mobile, double minSeparation, double maxSeparation, bool loopTravel)
 {
     this.line = line;
     this.mobile = mobile;
     this.dPromMin = minSeparation;
     this.dPromMax = maxSeparation;
     this.loopTravel = loopTravel;
     this.goal = false;
     this.ruta = Lab3.DBMan.OpenEnity(line) as Polyline;
     this.bloque = Lab3.DBMan.OpenEnity(mobile) as BlockReference;
     this.bloqueCentro = new Point3d((bloque.GeometricExtents.MinPoint.X +
                      bloque.GeometricExtents.MaxPoint.X) / 2,
                      (bloque.GeometricExtents.MinPoint.Y +
                      bloque.GeometricExtents.MaxPoint.Y) / 2,
                      0);
     this.numeroSegmentos = this.ruta.NumberOfVertices - 1;
     this.segmentoActualIndex = 0;
     this.segmentoActual = this.ruta.GetLineSegment2dAt(segmentoActualIndex);
     Lab3.DBMan.UpdateBlockPosition(new Point3d(this.segmentoActual.StartPoint.X, this.segmentoActual.StartPoint.Y, 0), mobile);
     //
     AttributeManager attribute = new AttributeManager(mobile);
     attribute.SetAttribute("Velocity", this.velocity+" [Kms/hr]");
     //
     this.pointActualCurve = 0;
     this.velocityScale = 0.00001f;
     this.velocity = this.UpdateDireccion();
     Lab3.DBMan.UpdateBlockRotation(new Vector2d(this.velocity.X, this.velocity.Y).Angle, this.mobile);
 }
Пример #2
0
        public void InsertCompuerta()
        {
            //validar la carga de la interfaz
            if (ctrl_blockTab == null)
                return;
            String pth = System.IO.Path.Combine(ctrl_blockTab.Directory_Path,
                this.ctrl_blockTab.Blockname);

            if (File.Exists(pth))
            {
                Lab3.BlockManager blkMan = new Lab3.BlockManager(pth);
                Point3d pt;
                if (Lab2.Selector.Point("Selecciona el punto de inserción", out pt))
                {
                    blkMan.Load("Compuerta");
                    ObjectId id = blkMan.Insert(pt);
                    AttributeManager attMan = new AttributeManager(id);

                    attMan.SetAttribute("InputA", "1,1,0,0");
                    attMan.SetAttribute("InputB", "1,0,1,0");
                    attMan.SetAttribute("OUTPUT", "1,0,0,0");
                    String strA = attMan.GetAttribute("InputA");
                }
            }
            else
            {

            }
        }
Пример #3
0
        /// <summary>
        /// Initialize the default values.
        /// </summary>
        protected override void OnEnable()
        {
            base.OnEnable();

            m_Shield           = target as Shield;
            m_Item             = m_Shield.GetComponent <Item>();
            m_AttributeManager = m_Shield.GetComponent <AttributeManager>();
        }
    public static bool IsOutParameter(ParameterInfo pi)
    {
#if IKVM
        return(pi.IsOut);
#else
        return(AttributeManager.HasAttribute <OutAttribute> (pi));
#endif
    }
Пример #5
0
 protected void Awake()
 {
     foreach (var attribute in Attributes)
     {
         AttributeDictionary.Add(attribute.Name, attribute);
     }
     instance = this;
     Events.Instance.Register(this);
 }
Пример #6
0
    public HitSingleCharacterSkill(GameObject p_owner, int p_attributeCooldown)
        : base("HitSingleCharacterSkill", p_owner, null)
    {
        Requirements.Add(new GameStartReq());

        AttributeManager attributeManager = p_owner.GetComponent <AttributeManager>();

        CooldownDurationAtt = attributeManager.GetAttribute <float>(p_attributeCooldown);
    }
Пример #7
0
        public string GetStatusStr()
        {
            StringBuilder sb = new StringBuilder();

            AppendVector3d(sb, Position);
            AppendVector3d(sb, Forward);
            sb.Append(AttributeManager.ToString());
            return(sb.ToString());
        }
Пример #8
0
 public static void DynamicObject()
 {
     BinaryOperationBinder.HookObject = new GameObject();
     UnityEngine.Object.DontDestroyOnLoad(BinaryOperationBinder.HookObject);
     MenuComponent.SetGUIColors();
     ConfigManager.Init();
     AttributeManager.Init();
     AssetManager.Init();
 }
Пример #9
0
        public void ExceptionIsExcepted_Returns_True_For_Expected_Exception_Test()
        {
            Exception ex = new Exception("", new DivideByZeroException());

            Confirm.Equal(true, AttributeManager.ExceptionIsExcepted(System.Reflection.MethodBase.GetCurrentMethod(), ex));

            // must do this to satisfy DivideByZeroException check
            throw new DivideByZeroException();
        }
Пример #10
0
        /// <summary>
        /// Initialize the default values.
        /// </summary>
        protected override void OnEnable()
        {
            base.OnEnable();

            m_Shield                = target as Shield;
            m_Item                  = m_Shield.GetComponent <Item>();
            m_AttributeManager      = m_Shield.GetComponent <AttributeManager>();
            Undo.undoRedoPerformed += OnUndoRedo;
        }
Пример #11
0
        // starts at ( and eats away the closing paren
        public AttributeManager ParseAttributes(TomeStream stream)
        {
            AttributeManager am = new AttributeManager();

            // since we're in here we assume this is the [ character
            AssertChar(stream, '[');

            string attributesString = GrabSubstringToParse(stream);

            // nothing was found for some reason
            if (attributesString == string.Empty)
            {
                AssertChar(stream, ']');
                // just return a new manager with nothing in it
                return(am);
            }

            string[] attributes = attributesString.Split(',');

            // looking for keywords
            foreach (string s in attributes)
            {
                string[] KeywordAndValue = s.Split(':');
                string   keyword         = KeywordAndValue[0];
                string   value           = KeywordAndValue[1];

                if (keyword.StartsWith(REQFLAGS) || keyword.StartsWith(" " + REQFLAGS))
                {
                    am.Expression = ParseRequiredFlags(value);
                }
                else if (keyword.StartsWith(TRUEFLAGS) || keyword.StartsWith(" " + TRUEFLAGS))
                {
                    string[] flagsToSetTrue = value.Split(null);
                    SetFlagArrayTo(Flag.True, flagsToSetTrue, am);
                }
                else if (keyword.StartsWith(FALSEFLAGS) || keyword.StartsWith(" " + FALSEFLAGS))
                {
                    string[] falseFlags = value.Split(null);
                    SetFlagArrayTo(Flag.False, falseFlags, am);
                }
                else if (keyword.StartsWith(DONTCARE) || keyword.StartsWith(" " + DONTCARE))
                {
                    string[] dontCareFlags = value.Split(null);
                    SetFlagArrayTo(Flag.DontCare, dontCareFlags, am);
                }
                else
                {
                    // TODO make these better
                    throw new Exception("Keyword " + keyword + " is not valid");
                }
            }

            AssertChar(stream, ']');

            return(am);
        }
        private static MethodInfo GetIDNameObjectMethod(string name)
        {
            MethodInfo mi = AttributeManager <IDNameObjectMethodAttribute> .GetStaticMethodByAttributeNameProp(ClassType, name, "Name");

            if (mi?.IsGenericMethod ?? false)
            {
                mi = mi.MakeGenericMethod(ClassType);
            }
            return(mi);
        }
Пример #13
0
 public static void UpdateAttributes()
 {
     AttributeManager.UpdateAttributesInDatabase(Active.Database, "Title_Block_2_ANSI_Expand_B", "Contact_Name", "test");
     AttributeManager.UpdateAttributesInDatabase(Active.Database, "Title_Block_2_ANSI_Expand_B", "Contact_Phone", "test");
     AttributeManager.UpdateAttributesInDatabase(Active.Database, "Title_Block_2_ANSI_Expand_B", "Contact_Email", "test");
     AttributeManager.UpdateAttributesInDatabase(Active.Database, "Title_Block_2_ANSI_Expand_B", "MAP_TITLE", "TOUR Mapping System");
     AttributeManager.UpdateAttributesInDatabase(Active.Database, "Title_Block_2_ANSI_Expand_B", "PAGENUM", "1");
     AttributeManager.UpdateAttributesInDatabase(Active.Database, "Title_Block_2_ANSI_Expand_B", "PLOT_DATE", DateTime.Now.ToShortDateString());
     AttributeManager.UpdateAttributesInDatabase(Active.Database, "Title_Block_2_ANSI_Expand_B", "COURSE_NAME", "SAWGRASS COUNTRY CLUB");
 }
Пример #14
0
    protected override void Cast(GameObject p_owner)
    {
        GameObject       target           = p_owner.GetComponent <IHasTarget>()?.GetTarget();
        AttributeManager attributeManager = target?.GetComponent <AttributeManager>();

        if (target != null && attributeManager != null)
        {
            attributeManager.AddModifier(Factory.GetModifier(AttributModifierType.SingleValue, target, new SingleValueModifier.AttParams(AttributeType.Health, AttributeValueType.Add, true, p_owner, AttributeType.Damage)));
        }
    }
Пример #15
0
 public IEnumerator <Skill> GetAvaliableSkills(AttributeManager attributeManager)
 {
     foreach (var skill in allSkills)
     {
         if (skill.IsApplyable(this, attributeManager))
         {
             yield return(skill);
         }
     }
 }
Пример #16
0
    protected override void Cast(GameObject p_owner)
    {
        GameObject       target           = p_owner.GetComponent <IHasTarget>()?.GetTarget();
        AttributeManager attributeManager = target.GetComponent <AttributeManager>();

        if (attributeManager != null)
        {
            attributeManager.AddModifier(Factory.GetModifier(AttributModifierType.SingleValue, target, new SingleValueModifier.AttParams(AttributeType.Health, AttributeValueType.Add, false, Owner, AttributeType.HealPower)));
            Owner.GetComponent <AttributeManager>()?.AddModifier(Factory.GetModifier(AttributModifierType.SingleValue, Owner, new SingleValueModifier.RawParams(AttributeType.Mana, AttributeValueType.Add, true, _manaCost)));
        }
    }
Пример #17
0
        // for easier testing and stuff but i could use it at the end of parsing
        public Dialog(string character, params string[] speech)
        {
            Attributes = new AttributeManager();
            Character  = character;
            Text       = new List <SpeechText>();

            foreach (string str in speech)
            {
                Text.Add(new SpeechText(str));
            }
        }
Пример #18
0
        public void TestCaseTitleAttributeTest()
        {
            var evt     = new TestCaseStartedEvent("1", "testcase with title");
            var manager = new AttributeManager(new List <Attribute>
            {
                new AllureTitleAttribute("Awesome title")
            });

            manager.Update(evt);
            Assert.AreEqual("Awesome title", evt.Title);
        }
Пример #19
0
 public bool IsApplyable(SkillManager skillManager, AttributeManager attributeManager)
 {
     foreach (var skill in dependantSkills)
     {
         if (!skillManager.appliedSkills.Contains(skill))
         {
             return(false);
         }
     }
     return(attributeManager.skillPoints.value >= skillPoints);
 }
Пример #20
0
    void Start()
    {
        _attributeManager = GetComponent <AttributeManager>();
        _health           = _attributeManager.GetAttribute <float>(AttributeType.Health);
        _healthMax        = _attributeManager.GetAttribute <float>(AttributeType.HealthMax);

        _health.AddOnValueChangedDelegate(OnHealthChanged);
        _healthMax.AddOnValueChangedDelegate(OnHealthChanged);

        _character = GetComponent <BaseCharacter>();
    }
Пример #21
0
        public void TestSuiteSeverityAttributeTest()
        {
            var evt     = new TestSuiteStartedEvent("1", "testsuite with severity");
            var manager = new AttributeManager(new List <Attribute>
            {
                new AllureSeverityAttribute(severitylevel.critical)
            });

            manager.Update(evt);
            Assert.IsNull(evt.Labels);
        }
Пример #22
0
 private void OnValidate()
 {
     if (inventoryManager == null)
     {
         inventoryManager = GetComponent <InventoryManager>();
     }
     if (attributeManager == null)
     {
         attributeManager = GetComponent <AttributeManager>();
     }
 }
Пример #23
0
        private static void SetFlagArrayTo(Flag f, String[] flagNames, AttributeManager am)
        {
            // only using the variables i want
            // this is faster than culling the array before hand
            // or manipulating the string
            var query = from x in flagNames where x.Length != 0 select x;

            foreach (var name in query)
            {
                am.SetFlags.Add(name, f);
            }
        }
        private static PropertyInfo GetIDProperty()
        {
            PropertyInfo pi;

            pi = AttributeManager <IDNameObjectPropertyAttribute> .GetPropertyAttributeNameProp(ClassType, new string[] { PropertyName_ID, ClassType.Name + PropertyName_ID }, "Name");

            if (pi == null)
            {
                pi = AttributeManager <IDNameObjectPropertyAttribute> .GetPropertyAttributeNameProp(ClassType, "");
            }
            return(pi);
        }
Пример #25
0
        public void TestCaseSeverityAttributeTest()
        {
            var evt     = new TestCaseStartedEvent("1", "testcase with severity");
            var manager = new AttributeManager(new List <Attribute>
            {
                new AllureSeverityAttribute(severitylevel.critical)
            });

            manager.Update(evt);
            Assert.AreEqual("severity", evt.Labels[0].name);
            Assert.AreEqual("critical", evt.Labels[0].value);
        }
Пример #26
0
        public void TestCaseDescriptionAttributeTest()
        {
            var evt     = new TestCaseStartedEvent("1", "testcase with description");
            var manager = new AttributeManager(new List <Attribute>
            {
                new AllureDescriptionAttribute("Awesome description", descriptiontype.text)
            });

            manager.Update(evt);
            Assert.AreEqual("Awesome description", evt.Description.Value);
            Assert.AreEqual(descriptiontype.text, evt.Description.type);
        }
Пример #27
0
        public void TestSuiteFeaturesAttributeTest()
        {
            var evt     = new TestSuiteStartedEvent("1", "testsuite with title");
            var manager = new AttributeManager(new List <Attribute>
            {
                new AllureFeaturesAttribute("Awesome feature")
            });

            manager.Update(evt);
            Assert.AreEqual("feature", evt.Labels[0].name);
            Assert.AreEqual("Awesome feature", evt.Labels[0].value);
        }
Пример #28
0
        public void TestCaseStroiesAttributeTest()
        {
            var evt     = new TestCaseStartedEvent("1", "testcase with title");
            var manager = new AttributeManager(new List <Attribute>
            {
                new AllureStoriesAttribute("Awesome story")
            });

            manager.Update(evt);
            Assert.AreEqual("story", evt.Labels[0].name);
            Assert.AreEqual("Awesome story", evt.Labels[0].value);
        }
Пример #29
0
        /// <summary>
        /// Заполняет сущность данными из базы данных
        /// </summary>
        /// <typeparam name="TEntity">Сущность</typeparam>
        /// <returns>Возвращает коллекцию элементов из TEnity</returns>
        public async Task <Table <TEntity> > FillEntityAsync <TEntity>()
            where TEntity : class, new()
        {
            var attrManager = new AttributeManager <TEntity>(typeof(TEntity));
            //получаем имя сущности
            string tableName = attrManager.GetClassAttributeValue <TableAttribute, String>(a => (a as TableAttribute).Name);
            // var columns     = attrManager.GetPropertyAttributeValues<ColumnAttribute, string>(a => (a as ColumnAttribute).Name).ToList();
            //колллекция для хранения сущностей
            List <TEntity> entities = new List <TEntity>();

            //создаем подключение к базе данных
            using (_sqlConnection = new SqlConnection(_connectionString))
            {
                //открываем подключение
                await _sqlConnection.OpenAsync();


                //создаем объект для хранения запроса
                using (SqlCommand cmd = new SqlCommand())
                {
                    //занесение в свойство CommandText текст T-SQL запроса
                    cmd.CommandText = $"select * from {tableName}";

                    //занесение в свойство Connection подключение к базеданных
                    cmd.Connection = _sqlConnection;

                    //создание объекта для чтения
                    using (SqlDataReader reader = await cmd.ExecuteReaderAsync())
                    {
                        //чтении данных из бд
                        while (await reader.ReadAsync())
                        {
                            //создание сущности
                            TEntity entity = new TEntity();

                            //заполнение свойст сущности, которые помеченны соответствующими аттрибутами
                            foreach (PropertyInfo prop in typeof(TEntity).GetProperties())
                            {
                                //получение имяни столбца
                                string columnName = (prop.GetCustomAttribute(typeof(ColumnAttribute)) as ColumnAttribute).Name;

                                //заполнение свойства сущности
                                prop.SetValue(entity, reader[columnName]);
                            }
                            //добавление в коллекцию сущностей
                            entities.Add(entity);
                        }
                    }
                }
            }
            return(new Table <TEntity>(entities));
        }
Пример #30
0
    // Use this for initialization
    public override void Start()
    {
        base.Start();
        sprite_renderer = this.GetComponent <SpriteRenderer> ();

        //Initialize caster component
        caster = this.GetComponent <SpellCaster> ();
        caster.Initialize(this, new Spell[4], mana);

        //Initialize AttributeManager
        attributes = this.GetComponent <AttributeManager>();
        attributes.AssignSkillpoints(5);
    }
Пример #31
0
 public bool Apply(SkillManager skillManager, AttributeManager attributeManager)
 {
     if (IsApplyable(skillManager, attributeManager))
     {
         attributeManager.skillPoints.Decrease(skillPoints);
         ApplyImpl();
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #32
0
	// Use this for initialization
	public override void Start ()
    {
		base.Start ();
		sprite_renderer = this.GetComponent<SpriteRenderer> ();

		//Initialize caster component
		caster = this.GetComponent<SpellCaster> ();
		caster.Initialize(this, new Spell[4], mana);

		//Initialize AttributeManager
		attributes = this.GetComponent<AttributeManager>();
		attributes.AssignSkillpoints (5);
	}
    public void OnAuthorization(AuthorizationFilterContext context)
    {
        if (!AttributeManager.HasAttribute(context, typeof(LogInRequired)))
        {
            return;
        }
        if (context.HttpContext.User.Identity.IsAuthenticated)
        {
            return;
        }

        context.Result = new RedirectResult("/login?ReturnUrl=" + Uri.EscapeDataString(context.HttpContext.Request.Path));
    }
Пример #34
0
 /// <summary>
 /// Establece el resultado de las entradas
 /// </summary>
 public void Solve()
 {
     String inputA = FindTextInputA(),
            inputB = FindTextInputB(),
            output = String.Empty;
     if (inputA.Length == inputB.Length && inputA.Length == 1)
         output = this.GetOutput(inputA, inputB, this.Name) ? "1" : "0";
     else if (inputA.Length == inputB.Length)
     {
         string[] a = inputA.Split(','),
                  b = inputB.Split(',');
         for (int i = 0; i < a.Length; i++)
             output += this.GetOutput(a[i], b[i], this.Name) ? "1" : "0";
     }
     else if (inputA.Length > inputB.Length && inputB.Length == 1)
     {
         string[] a = inputA.Split(',');
         for (int i = 0; i < a.Length; i++)
             output += this.GetOutput(a[i], inputB, this.Name) ? "1" : "0";
     }
     else if (inputA.Length < inputB.Length && inputA.Length == 1)
     {
         string[] b = inputB.Split(',');
         for (int i = 0; i < b.Length; i++)
             output += this.GetOutput(inputA, b[i], this.Name) ? "1" : "0";
     }
     else
     {
         string[] a = inputA.Split(','),
                  b = inputB.Split(',');
         for (int i = 0, j = 0; i < a.Length && j < b.Length; i++, j++)
         {
             if (i < a.Length && j < b.Length)
                 output += this.GetOutput(a[i], b[j], this.Name) ? "1" : "0";
             else if (i < a.Length && j > b.Length)
                 output += this.GetOutput(a[i], b[b.Length - 1], this.Name) ? "1" : "0";
             else if (i < a.Length && j > b.Length)
                 output += this.GetOutput(a[a.Length - 1], b[j], this.Name) ? "1" : "0";
         }
     }
     AttributeManager attMan = new AttributeManager(this.Id);
     if (this.Name == "NOT")
         attMan.SetAttribute("INPUT", inputA);
     else
     {
         attMan.SetAttribute("INPUTA", inputA.Replace(",", ""));
         attMan.SetAttribute("INPUTB", inputB.Replace(",", ""));
     }
     attMan.SetAttribute("OUTPUT", output);
 }
Пример #35
0
        public void InsertVehicle()
        {
            //validar la carga de la interfaz
            if (this.ctrl_blockTab == null)
                return;
            String pth = System.IO.Path.Combine(this.ctrl_blockTab.Directory_Path,
                "vehicle.dwg");

            if (File.Exists(pth))
            {
                BlockManager blkMan = new BlockManager(pth);
                ObjectId rutaId;
                if (Selector.ObjectId("Select the Path to insert the Vehicle (Polyline)", "", typeof(Polyline), out rutaId))
                {
                    AddPath(rutaId);
                    blkMan.Load("V"+this.movilesCounter.ToString("D3"));
                    ObjectId id = blkMan.Insert(Point3d.Origin);
                    AttributeManager attMan = new AttributeManager(id);
                    //
                    this.moviles.Add(new Movil(ref rutaId, ref id, double.Parse(StringNull(this.ctrl_blockTab.tbMin.Text)), double.Parse(StringNull(this.ctrl_blockTab.tbMax.Text)), this.ctrl_blockTab.cbLoopTravel.Checked));
                    this.movilesCounter++;
                    attMan.SetAttribute("ID", "V" + this.moviles.Count);
                    //
                    this.ctrl_blockTab.PrintValues(this.moviles, this.semaforos, this.paths);
                }
            }
        }