public static GameRuleMetaRule unpackFromString(GameRuleDeserializer deserializer)
 {
     byte subclassByte = deserializer.unpackByte(GAME_RULE_META_RULE_BIT_SIZE);
     if (subclassByte == GAME_RULE_PLAYER_SWAP_META_RULE_BYTE_VAL)
         return GameRulePlayerSwapMetaRule.unpackFromString(deserializer);
     else
         throw new System.Exception("Invalid GameRuleMetaRule unpacked byte " + subclassByte);
 }
Esempio n. 2
0
 public static GameRuleActionDuration unpackFromString(GameRuleDeserializer deserializer)
 {
     byte subclassByte = deserializer.unpackByte(GAME_RULE_ACTION_DURATION_BIT_SIZE);
     if (subclassByte == 0)
         return GameRuleActionFixedDuration.unpackFromString(deserializer);
     else if (subclassByte == 1)
         return GameRuleActionUntilConditionDuration.unpackFromString(deserializer);
     else
         throw new System.Exception("Invalid GameRuleActionDuration unpacked byte " + subclassByte);
 }
Esempio n. 3
0
 public static GameRuleAction unpackFromString(GameRuleDeserializer deserializer)
 {
     byte subclassByte = deserializer.unpackByte(GAME_RULE_ACTION_BIT_SIZE);
     if (subclassByte == GAME_RULE_EFFECT_ACTION_BYTE_VAL)
         return GameRuleEffectAction.unpackFromString(deserializer);
     else if (subclassByte == GAME_RULE_META_RULE_ACTION_BYTE_VAL)
         return GameRuleMetaRuleAction.unpackFromString(deserializer);
     else
         throw new System.Exception("Invalid GameRuleAction unpacked byte " + subclassByte);
 }
 public static GameRuleCondition unpackFromString(GameRuleDeserializer deserializer)
 {
     byte subclassByte = deserializer.unpackByte(GAME_RULE_CONDITION_BIT_SIZE);
     if (subclassByte == GAME_RULE_COMPARISON_CONDITION_BYTE_VAL)
         return GameRuleComparisonCondition.unpackFromString(deserializer);
     else if (subclassByte == GAME_RULE_EVENT_HAPPENED_CONDITION_BYTE_VAL)
         return GameRuleEventHappenedCondition.unpackFromString(deserializer);
     else if (subclassByte == GAME_RULE_ZONE_CONDITION_BYTE_VAL)
         return GameRuleZoneCondition.unpackFromString(deserializer);
     else
         throw new System.Exception("Invalid GameRuleCondition unpacked byte " + subclassByte);
 }
Esempio n. 5
0
 public static new GameRuleSourceSelector unpackFromString(GameRuleDeserializer deserializer)
 {
     byte subclassByte = deserializer.unpackByte(GAME_RULE_SOURCE_SELECTOR_BIT_SIZE);
     if (subclassByte == GAME_RULE_PLAYER_SOURCE_SELECTOR_BYTE_VAL)
         return GameRulePlayerSelector.instance;
     else if (subclassByte == GAME_RULE_BALL_SOURCE_SELECTOR_BYTE_VAL)
         return GameRuleBallSelector.instance;
     else
         throw new System.Exception("Invalid GameRuleSelector unpacked byte " + subclassByte);
 }
Esempio n. 6
0
 public static new GameRulePointsPlayerEffect unpackFromString(GameRuleDeserializer deserializer)
 {
     //if it's over the max value, it's actually the low bits of a negative number
     int pg = deserializer.unpackByte(POINTS_SERIALIZATION_BIT_COUNT);
     if (pg > POINTS_SERIALIZATION_MAX_VALUE)
         pg |= ~POINTS_SERIALIZATION_MASK;
     return new GameRulePointsPlayerEffect(pg);
 }
Esempio n. 7
0
 public static GameRuleEffect unpackFromString(GameRuleDeserializer deserializer)
 {
     byte subclassByte = deserializer.unpackByte(GAME_RULE_EFFECT_BIT_SIZE);
     if (subclassByte == GAME_RULE_POINTS_PLAYER_EFFECT_BYTE_VAL)
         return GameRulePointsPlayerEffect.unpackFromString(deserializer);
     else if (subclassByte == GAME_RULE_DUPLICATE_EFFECT_BYTE_VAL)
         return GameRuleDuplicateEffect.unpackFromString(deserializer);
     else if (subclassByte == GAME_RULE_FREEZE_EFFECT_BYTE_VAL)
         return GameRuleFreezeEffect.unpackFromString(deserializer);
     else if (subclassByte == GAME_RULE_DIZZY_EFFECT_BYTE_VAL)
         return GameRuleDizzyEffect.unpackFromString(deserializer);
     else if (subclassByte == GAME_RULE_BOUNCE_EFFECT_BYTE_VAL)
         return GameRuleBounceEffect.unpackFromString(deserializer);
     else
         throw new System.Exception("Invalid GameRuleEffect unpacked byte " + subclassByte);
 }
Esempio n. 8
0
 public static new GameRuleActionFixedDuration unpackFromString(GameRuleDeserializer deserializer)
 {
     //we only store non-negative values
     int d = deserializer.unpackByte(DURATION_SERIALIZATION_BIT_COUNT);
     return new GameRuleActionFixedDuration(d);
 }