Difference between revisions of "GroupBuilderRuleCollection class"
Nguyenduyan (talk | contribs) |
|||
Line 1: | Line 1: | ||
{{CGscriptClass_Template | {{CGscriptClass_Template | ||
− | |Name=GroupBuilderRuleCollection | + | |Name=<nowiki>GroupBuilderRuleCollection</nowiki> |
− | |Description=Represents a level of group builder rules. | + | |Description=<nowiki>Represents a level of group builder rules.</nowiki> |
− | |Methods= | + | |InheritsFrom=object|Methods= |
− | {{CGscriptMethods_Template|ReturnType=Empty|Name=Add|Parameters= | + | {{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Add</nowiki>|Parameters= |
− | {{CGscriptParameters_Template|Type=GroupBuilderRule|Name=rule|Description=Rule to add}} | + | {{CGscriptParameters_Template|Type=GroupBuilderRule|Name=<nowiki>rule</nowiki>|Description=<nowiki>Rule to add</nowiki>}} |
− | |Description=Add a new rule}} | + | |Description=<nowiki>Add a new rule</nowiki>}} |
− | {{CGscriptMethods_Template|ReturnType= | + | {{CGscriptMethods_Template|ReturnType=object|Name=<nowiki>this[] { get; }</nowiki>|Parameters= |
− | {{CGscriptParameters_Template|Type=int|Name=index|Description=Index}} | + | {{CGscriptParameters_Template|Type=int|Name=<nowiki>index</nowiki>|Description=<nowiki>Index</nowiki>}} |
− | |Description=Get rule at index}} | + | |Description=<nowiki>Get rule at index</nowiki>}} |
− | {{CGscriptMethods_Template|ReturnType=bool|Name=Remove|Parameters= | + | {{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>Remove</nowiki>|Parameters= |
− | {{CGscriptParameters_Template|Type=GroupBuilderRule|Name=rule|Description=Rule to remove}} | + | {{CGscriptParameters_Template|Type=GroupBuilderRule|Name=<nowiki>rule</nowiki>|Description=<nowiki>Rule to remove</nowiki>}} |
− | |Description=Remove rule. Return true if removed}} | + | |Description=<nowiki>Remove rule. Return true if removed</nowiki>}} |
− | {{CGscriptMethods_Template|ReturnType=Empty|Name=this[] { set; }|Parameters= | + | {{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>this[] { set; }</nowiki>|Parameters= |
− | {{CGscriptParameters_Template|Type=int|Name=index|Description=Index|Comma=,}}{{CGscriptParameters_Template|Type= | + | {{CGscriptParameters_Template|Type=int|Name=<nowiki>index</nowiki>|Description=<nowiki>Index</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=object|Name=<nowiki>value</nowiki>|Description=<nowiki>Value to set</nowiki>}} |
− | |Description=Set rule at index}} | + | |Description=<nowiki>Set rule at index</nowiki>}} |
− | {{CGscriptMethods_Template|ReturnType=string|Name=ToString|Description=The string representation of the object.}} | + | {{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Inherited=object|Description=<nowiki>The string representation of the object.</nowiki>}} |
|Properties= | |Properties= | ||
− | {{CGscriptProperties_Template|ReturnType=int|Name=Count|HasGetter=1|Description=Number of rules at this level}} | + | {{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>Count</nowiki>|HasGetter=1|Description=<nowiki>Number of rules at this level</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=string|Name=ObjectTypeName|HasGetter=1|Description=The name of the type of object.}} | + | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=TypeInformation|Name=TypeInformation|HasGetter=1|Description=Get information about this class.}} | + | {{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Inherited=object|Description=<nowiki>Get information about this class.</nowiki>}} |
}} | }} | ||
+ | |||
=== <span style="color:#DF8621">'''Examples'''</span> === | === <span style="color:#DF8621">'''Examples'''</span> === | ||
'''Example: Add new rules''' | '''Example: Add new rules''' |
Latest revision as of 05:49, 2 July 2020
GroupBuilderRuleCollection
Represents a level of group builder rules.
Parent class
Inherits from object
Methods
- Empty Add(GroupBuilderRule rule "Rule to add") - Add a new rule
- object this[] { get; }(int index "Index") - Get rule at index
- bool Remove(GroupBuilderRule rule "Rule to remove") - Remove rule. Return true if removed
- Empty this[] { set; }(int index "Index", object value "Value to set") - Set rule at index
- (From object) string ToString() - The string representation of the object.
Properties
- int Count { get; } - Number of rules at this level
- string ObjectTypeName { get; } - The name of the type of object.
- (From 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();