public void SetStartingValues(string objectId, string username, int slots, int currency, int experience, string fbId, string deviceId, JsonDict fbUserInfo)
    {
        ObjectId       = objectId;
        Username       = username;
        FbId           = fbId;
        Slots          = slots;
        Dollars        = currency;
        Experience     = experience;
        AvatarName     = "";
        MovesOwned     = new List <object>();
        SongsOwned     = new List <object>();
        DeviceId       = deviceId;
        Games          = 0;
        AcceptGames    = 0;
        CompleteGames  = 0;
        Enabled        = true;
        HighScore      = 0;
        HighScoreMoves = new List <object>();

        if (fbUserInfo != null)
        {
            Email       = fbId + "@danceoff.com"; // fbUserInfo.GetString ("email");
            Name        = fbUserInfo.GetString("name");
            ProfileName = fbUserInfo.GetString("name");
            Picture     = fbUserInfo.GetDict("picture").GetDict("data").GetString("url");
        }
    }
Пример #2
0
        public WdCountry(string name, WdData data, JsonDict tanks, JsonDict engines, JsonDict guns, JsonDict radios, JsonDict shells)
        {
            Name = name;

            Engines = new Dictionary <string, WdEngine>();
            foreach (var kvp in engines["shared"].GetDict())
            {
                var engine = new WdEngine(kvp.Key, kvp.Value.GetDict(), data);
                Engines.Add(kvp.Key, engine);
            }

            Radios = new Dictionary <string, WdRadio>();
            foreach (var kvp in radios["shared"].GetDict())
            {
                var radio = new WdRadio(kvp.Key, kvp.Value.GetDict(), data);
                Radios.Add(kvp.Key, radio);
            }

            Shells = new Dictionary <string, WdShell>();
            foreach (var kvp in shells.GetDict())
            {
                if (kvp.Key == "icons")
                {
                    continue;
                }
                var shell = new WdShell(kvp.Key, kvp.Value.GetDict(), data);
                Shells.Add(kvp.Key, shell);
            }

            Guns = new Dictionary <string, WdGun>();
            foreach (var kvp in guns["shared"].GetDict())
            {
                try
                {
                    var gun = new WdGun(kvp.Key, kvp.Value.GetDict(), data, this);
                    Guns.Add(kvp.Key, gun);
                }
                catch
                {
                    data.Warnings.Add("Could not load gun data for gun “{0}”".Fmt(kvp.Key));
                }
            }

            Tanks   = new Dictionary <string, WdTank>();
            Chassis = new Dictionary <string, WdChassis>();
            Turrets = new Dictionary <string, WdTurret>();
            foreach (var kvp in tanks.GetDict())
            {
                if (Name == "usa" && kvp.Key == "Sexton_I")
                {
                    continue; // this tank is weird; it's the only one which has non-"shared" modules with identical keys to another tank. Ignore it.
                }
                var tank = new WdTank(kvp.Key, kvp.Value.GetDict(), this, data);
                Tanks.Add(tank.RawId, tank);
            }
        }
Пример #3
0
        public override bool Matches(KtaneModuleInfo module, JsonDict json)
        {
            var val = GetValue(module);

            if (val == null)
            {
                return(true);
            }
            var str = val.ToString();
            var dic = json.GetDict();

            return((dic.ContainsKey(str) && dic[str].GetBool()) || dic.All(v => !v.Value.GetBool()));
        }