Пример #1
0
        public JObject Save()
        {
            ClientAvatar pl       = m_vLevel.GetPlayerAvatar();
            var          jsonData = new JObject();

            jsonData.Add("exp_ver", 1);
            jsonData.Add("android_client", pl.GetAndroid());
            jsonData.Add("active_layout", pl.GetActiveLayout());
            jsonData.Add("war_layout", pl.GetActiveLayout());
            jsonData.Add("layout_state", new JArray {
                0, 0, 0, 0, 0, 0
            });

            JArray JBuildings = new JArray();
            int    c          = 0;

            foreach (GameObject go in new List <GameObject>(m_vGameObjects[0]))
            {
                Building b = (Building)go;
                JObject  j = new JObject();
                j.Add("data", b.GetBuildingData().GetGlobalID());
                j.Add("id", 500000000 + c);
                b.Save(j);
                JBuildings.Add(j);
                c++;
            }
            jsonData.Add("buildings", JBuildings);

            JArray JTraps = new JArray();
            int    u      = 0;

            foreach (GameObject go in new List <GameObject>(m_vGameObjects[4]))
            {
                Trap    t = (Trap)go;
                JObject j = new JObject();
                j.Add("data", t.GetTrapData().GetGlobalID());
                j.Add("id", 504000000 + u);
                t.Save(j);
                JTraps.Add(j);
                u++;
            }
            jsonData.Add("traps", JTraps);

            JArray JDecos = new JArray();
            int    e      = 0;

            foreach (GameObject go in new List <GameObject>(m_vGameObjects[6]))
            {
                Deco    d = (Deco)go;
                JObject j = new JObject();
                j.Add("data", d.GetDecoData().GetGlobalID());
                j.Add("id", 506000000 + e);
                d.Save(j);
                JDecos.Add(j);
                e++;
            }
            jsonData.Add("decos", JDecos);

            JArray JObstacles = new JArray();
            int    o          = 0;

            foreach (GameObject go in new List <GameObject>(m_vGameObjects[3]))
            {
                Obstacle d = (Obstacle)go;
                JObject  j = new JObject();
                j.Add("data", d.GetObstacleData().GetGlobalID());
                j.Add("id", 503000000 + o);
                d.Save(j);
                JObstacles.Add(j);
                o++;
            }
            jsonData.Add("obstacles", JObstacles);

            m_vObstacleManager.Save(jsonData);

            var cooldowns = new JArray();

            jsonData.Add("cooldowns", cooldowns);
            var newShopBuildings = new JArray
            {
                4,
                0,
                7,
                4,
                7,
                4,
                4,
                1,
                7,
                8,
                275,
                5,
                4,
                4,
                1,
                5,
                0,
                0,
                0,
                4,
                1,
                4,
                1,
                3,
                1,
                1,
                2,
                2,
                2,
                1,
                1,
                1
            };

            jsonData.Add("newShopBuildings", newShopBuildings);
            var newShopTraps = new JArray {
                6, 6, 5, 0, 0, 5, 5, 0, 3
            };

            jsonData.Add("newShopTraps", newShopTraps);
            var newShopDecos = new JArray
            {
                1,
                4,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                1,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0
            };

            jsonData.Add("newShopDecos", newShopDecos);
            jsonData.Add("troop_req_msg", "UCS Developement Team");
            jsonData.Add("last_league_rank", m_vLevel.GetPlayerAvatar().GetLeagueId());
            jsonData.Add("last_league_shuffle", 1);
            jsonData.Add("last_season_seen", 1);
            jsonData.Add("last_news_seen", 999);
            jsonData.Add("edit_mode_shown", true);
            jsonData.Add("war_tutorials_seen", 1);
            jsonData.Add("war_base", true);
            jsonData.Add("help_opened", true);
            jsonData.Add("bool_layout_edit_shown_erase", false);


            return(jsonData);
        }