public PathChoice(RawNode node, IContext context) : base(node, context)
 {
     if (node.CheckKey("random"))
     {
         random = PathUtil.GetModelPath(context, node.GetString("random"), null).GetSelf <Random>();
     }
 }
 public RangeAmount(RawNode node, IContext context)
     : base(node, context)
 {
     _random = PathUtil.GetModelPath(GetContext(), node.GetString("random"), null).GetSelf <Random>();
     min     = node.GetInt("min");
     max     = node.GetInt("max");
 }
Ejemplo n.º 3
0
 public AssetBundleRepositoryItem(RawNode node)
 {
     dependencies = node.GetStringArray("dependencies");
     crc32        = node.GetUInt("crc");
     packedSize   = node.GetInt("size");
     hash         = Hash128.Parse(node.GetString("hash"));
 }
 public CriticalAmount(RawNode node, IContext context)
     : base(node, context)
 {
     probability = node.GetDouble("probability");
     critical    = node.GetInt("critical");
     regular     = node.GetInt("regular");
     _random     = PathUtil.GetModelPath(GetContext(), node.GetString("random"), null).GetSelf <Random>();
 }
        public DynamicRandomReward(RawNode node, IContext context) : base(node, context)
        {
            if (node.CheckKey("random"))
            {
                _random = PathUtil.GetModelPath(GetContext(), node.GetString("random"), null).GetSelf <Random>();
            }

            probability = node.GetDouble("probability");
        }
        public static TRet Build <TRet>(RawNode rawNode, IContext context)
        {
            Type baseType = typeof(TRet);

            if (rawNode.CheckKey("type"))
            {
                return(Build <TRet>(rawNode.GetString("type"), rawNode, context));
            }

            return((TRet)_defaultFactory.Build(baseType, rawNode, context));
        }
Ejemplo n.º 7
0
        public static ModelsPath GetModelPath(IContext context, RawNode node)
        {
            string path;
            Random random = null;

            if (node.IsDictionary() && node.CheckKey("path"))
            {
                path = node.GetString("path");

                if (node.CheckKey("random"))
                {
                    random = GetModelPath(context, node.GetString("random"), null).GetSelf <Random>();
                }
            }
            else
            {
                path = node.ToString();
            }

            return(GetResult(context, path, random));
        }
Ejemplo n.º 8
0
        public KnifeDef(string key, KnifeMode mode, RawNode config)
        {
            this.key  = key;
            this.mode = mode;

            name             = config.GetString("name");
            rarity           = KnifeUtils.GetRarity(config.GetString("rarity", "common"));
            modes            = KnifeUtils.GetSupportedModes(config);
            timeScale        = config.GetFloat("time_scale");
            minForce         = config.GetFloat("knife_min_force");
            maxForce         = config.GetFloat("knife_max_force");
            gravity          = config.GetFloat("gravity");
            bounceMultiplier = config.GetFloat("knife_bounce_multiplier");
            heightMultiplier = config.GetFloat("height_multiplier");
            rotationSpeed    = config.GetFloat("rotation_speed");
            rotationDecrease = config.GetFloat("rotation_decrease");
            rotationMinSpeed = config.GetFloat("rotation_min_speed");

            prefab = config.GetString("prefab");
            scale  = config.GetFloat("scale");
            sides  = config.GetInt("sides", 1);
            size   = config.GetFloat("size");

            price = config.CheckKey("price") ? new PriceDef(config.GetNode("price")) : PriceDef.NewNone();

            visibleInCollection   = config.GetBool("collection_visible", true);
            visibleInRoulette     = config.GetBool("roulette_visible", true);
            droppableFromRoulette = config.GetBool("roulette_drop", true);

            ReadDeflection(config, "success_deflection", out successDeflectionLeft, out successDeflectionRight);
            ReadDeflection(config, "perfect_success_deflection", out perfectDeflectionLeft, out perfectDeflectionRight);

            hasSkillSuccessDeflection = HasDeflection(config, "skill_success_deflection");
            if (hasSkillSuccessDeflection)
            {
                ReadDeflection(config, "skill_success_deflection", out skillSuccessDeflectionLeft, out skillSuccessDeflectionRight);
            }

            hasSkillPerfectDeflection = HasDeflection(config, "skill_perfect_deflection");
            if (hasSkillPerfectDeflection)
            {
                ReadDeflection(config, "skill_perfect_deflection", out skillPerfectDeflectionLeft, out skillPerfectDeflectionRight);
            }

            if (config.CheckKey("skill_pefect_flip_gold_probability"))
            {
                skillPefectFlipGoldProbability = config.GetFloat("skill_pefect_flip_gold_probability");
                skillPefectFlipGoldMin         = config.GetInt("skill_pefect_flip_gold_min", 0);
                skillPefectFlipGoldMax         = config.GetInt("skill_pefect_flip_gold_max", 0);
            }

            if (config.CheckKey("skill_ads_multiplier"))
            {
                skillAdsMultiplier = config.GetFloat("skill_ads_multiplier", 1);
            }

            skillTooltip = config.GetString("skill_tooltip", null);
            skillIcon    = config.GetString("skill_icon", null);
            skillAdsIcon = config.GetString("skill_ads_icon", null);
        }
Ejemplo n.º 9
0
        public Reward(RawNode node, IContext context) : base(node, context)
        {
            type = node.GetString("type");

            if (node.CheckKey("choice"))
            {
                choice = FactoryManager.Build <PathChoice>(node.GetNode("choice"), context);
            }
            else
            {
                if (node.CheckKey("path"))
                {
                    path = PathUtil.GetModelPath(GetContext(), node.GetNode("path"));
                }
            }
        }
        public RleSetAmount(RawNode node, IContext context)
            : base(node, context)
        {
            _random = PathUtil.GetModelPath(GetContext(), node.GetString("random"), null).GetSelf <Random>();
            var rows = node.GetNode("elements").array;

            foreach (var obj in rows)
            {
                var pair = (List <object>)obj;
                var arr  = new [] { Convert.ToInt32(pair[0]), Convert.ToInt32(pair[1]) };
                _list.Add(arr);
            }

            foreach (var pair in _list)
            {
                _length += pair[1];
            }
        }
Ejemplo n.º 11
0
 public Price(RawNode node, IContext context) : base(node, context)
 {
     type   = node.GetString("type");
     amount = node.GetInt("amount");
 }
Ejemplo n.º 12
0
 public PriceDef(RawNode config)
 {
     type   = PriceUtils.GetPriceType(config.GetString("type"));
     amount = config.GetInt("amount", 0);
 }
Ejemplo n.º 13
0
 public SetAmount(RawNode node, IContext context)
     : base(node, context)
 {
     _elements = node.GetIntArray("elements");
     _random   = PathUtil.GetModelPath(GetContext(), node.GetString("random"), null).GetSelf <Random>();
 }
Ejemplo n.º 14
0
 public Amount(RawNode node, IContext context) : base(node, context)
 {
     type = node.GetString("type");
 }
 public SimpleResourceRewardResult(RawNode node, IContext context) : base(node, context)
 {
     resource = PathUtil.GetModelPath(context, node.GetString("path"), null).GetSelf <SimpleResource>();
     amount   = node.GetInt("amount");
 }
Ejemplo n.º 16
0
 public TriggerRewardResult(RawNode node, IContext context) : base(node, context)
 {
     trigger = PathUtil.GetModelPath(context, node.GetString("path"), null).GetSelf <Trigger>();
 }
Ejemplo n.º 17
0
 public RandomDescription(RawNode node, IContext context = null) : base(node, context)
 {
     type = node.GetString("type");
 }
Ejemplo n.º 18
0
 public Requirement(RawNode node, IContext context) : base(node, context)
 {
     type = node.GetString("type");
 }
Ejemplo n.º 19
0
 public TriggerDescription(RawNode node, IContext context) : base(node, context)
 {
     type = node.GetString("type");
 }
 public DynamicPrice(RawNode node, IContext context) : base(node, context)
 {
     type = node.GetString("type");
 }
 public RewardResult(RawNode node, IContext context)
 {
     type         = node.GetString("type");
     _weakContext = new WeakRef <IContext>(context);
 }