コード例 #1
0
ファイル: Form1.cs プロジェクト: segfaultvicta/CSharpMCS
        internal void RegisterNewProperty(TreeNode treeNode)
        {
            //validate the node (some nodes will need a second dialog opened,
            //some may not actually lead to the registration of a new property
            //(i.e. if it would require more slots than are currently available))

            Type            propertyType = asm.GetType("Elena." + treeNode.Name);
            bool            propertyGenerated;
            MonsterProperty property;

            try
            {
                property          = (MonsterProperty)Activator.CreateInstance(propertyType);
                propertyGenerated = true;
            }
            catch
            {
                propertyGenerated = false;
                property          = new NullProperty();
            }
            if (propertyGenerated)
            {
                monster.AddProperty(property);
            }
            this.UpdateData();
        }
コード例 #2
0
        /**
         * Get the named property. If it doesn't exist, a new NullProperty object is
         * created with the same name and returned.
         */
        public NetMeterProperty getProperty(String key)
        {
            NetMeterProperty prop;

            if (!propDic.TryGetValue(key, out prop))
            {
                prop = new NullProperty(key);
            }
            return(prop);
        }
コード例 #3
0
 /**
  * Get the named property. If it doesn't exist, a new NullProperty object is
  * created with the same name and returned.
  */
 public NetMeterProperty getProperty(String key)
 {
     NetMeterProperty prop;
     if(!propDic.TryGetValue(key, out prop))
     {
         prop = new NullProperty(key);
     }
     return prop;
 }
コード例 #4
0
ファイル: Form1.cs プロジェクト: segfaultvicta/CSharpMCS
        internal void RegisterNewProperty(TreeNode treeNode)
        {
            //validate the node (some nodes will need a second dialog opened,
            //some may not actually lead to the registration of a new property
            //(i.e. if it would require more slots than are currently available))

            Type propertyType = asm.GetType("Elena." + treeNode.Name);
            bool propertyGenerated;
            MonsterProperty property;
            try
            {
                property = (MonsterProperty)Activator.CreateInstance(propertyType);
                propertyGenerated = true;
            }
            catch
            {
                propertyGenerated = false;
                property = new NullProperty();
            }
            if (propertyGenerated)
            {
                monster.AddProperty(property);
            }
            this.UpdateData();
        }