GroupBuilderRuleCollection class

From Catglobe Wiki
Revision as of 04:54, 19 April 2017 by Nguyenduyan (talk | contribs)
Jump to: navigation, search

GroupBuilderRuleCollection



Represents a level of group builder rules.


Methods

Properties

  • int Count { get; } - Number of rules at this level
  • string ObjectTypeName { get; } - The name of the type of object.
  • TypeInformation TypeInformation { get; } - Get information about this class.

Examples

Example: Add new rules

//Create a new group
string groupName = "Test Group Builder: GroupBuilderRuleCollection";
number groupTemplateResourceId=2066;
number parentResourceId = 11088827;
array group = Group_new(groupName, groupTemplateResourceId, parentResourceId);
Group_save(group);
number groupRId = group[GROUP_RESOURCE_ID ]; 
//Create rule for the group
GroupBuilderRoot root = new GroupBuilderRoot (groupRId);
GroupBuilderRule rule1 = new GroupBuilderRule (root);
GroupBuilderRule rule2 = new GroupBuilderRule (root);
GroupBuilderRule rule3 = new GroupBuilderRule (root);
GroupBuilderRuleCollection ruleColection = root.RootRules;
ruleColection.Add(rule1);
ruleColection.Add(rule2);
ruleColection.Add(rule3);
root.Save();


Example: Remove rule

GroupBuilderRoot root = new GroupBuilderRoot (15560827);
GroupBuilderRuleCollection ruleColection = root.RootRules;
print(ruleColection.Count);//3
GroupBuilderRule rule2 = ruleColection[1];
ruleColection.Remove(rule2);
print(ruleColection.Count);//2
root.Save();