Esempio n. 1
0
        public PlayerDatas(List <World> worlds = null, RankedLevel rankedLevel = null, List <Squad> squads = null, bool noAds = false, int softCurrency = 0, int hardCurrency = 0, string Country = null)
        {
            this.worlds       = worlds;
            this.rankedLevel  = rankedLevel;
            this.squads       = squads;
            this.noAds        = noAds;
            this.softCurrency = softCurrency;
            this.hardCurrency = hardCurrency;

            if (rankedLevel != null)
            {
                if (RankedLevel.GetLastStartDay() != rankedLevel.StartDay)
                {
                    AddRankedLevel(GameManager.Credentials.id);
                }
            }

            if (worlds == null || worlds.Count == 0)
            {
                this.worlds = new List <World>();
                //AddWorld(GameManager.Credentials.id, 0, WorldInfos.worldInfos[0].name);
            }


            if (squads == null || squads.Count == 0)
            {
                this.squads = new List <Squad>();
                //AddSquadInInventory(Squad.CreateSquad(SquadPattern.GetSquadPattern("forest guardian", 1), GameManager.Credentials.id));
            }

            this.country = Country == null?System.Globalization.RegionInfo.CurrentRegion.ToString() : Country;
        }
Esempio n. 2
0
        public void UpdateRankedLevelScore(int score, bool getChest)
        {
            string date = RankedLevel.GetLastStartDay();

            if (StartDay != date)
            {
                StartDay   = date;
                Score      = score;
                nbrOfChest = getChest ? 1 : 0;
            }
            else
            {
                Score      += score;
                nbrOfChest += getChest ? 1 : 0;
            }

            int DayInMonth = (int)System.DateTime.Now.Day;
            int Month      = (int)System.DateTime.Now.Month;
            int Year       = (int)System.DateTime.Now.Year;

            LastPlayedDate = string.Concat(DayInMonth, "/", Month, "/", Year);

            ServerManager.Instance.SaveRankedLevel(this);
        }
Esempio n. 3
0
 public void AddRankedLevel(string playerID)
 {
     rankedLevel = new RankedLevel(playerID, 0, 0, RankedLevel.GetLastStartDay(), "notPlayed");
     ServerManager.Instance.SaveRankedLevel(rankedLevel);
 }