public async Task <ActionResult <HighscoreItem> > PostHighscoreItem(HighscoreItem highscoreItem)
        {
            _context.HighscoreItems.Add(highscoreItem);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetHighscoreItem), new { id = highscoreItem.Id }, highscoreItem));
        }
        public async Task <IActionResult> PutHighscoreItem(int id, HighscoreItem highscoreItem)
        {
            if (id != highscoreItem.Id)
            {
                return(BadRequest());
            }

            _context.Entry(highscoreItem).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!HighscoreItemExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemplo n.º 3
0
    public void Add(HighscoreItem Itm)
    {
        Items.Add(Itm);
        SortList();

        if (Items.Count > 10)
        {
            Items = new List <HighscoreItem>(Items.Take(10));
        }

        ValueSerializer.SetValue(nameof(Highscore), this);
    }
Exemplo n.º 4
0
    protected override void Start()
    {
        base.Start();

        List <ScoreData> scores = GameData.Instance.scores;

        for (int i = 0; i < scores.Count; i++)
        {
            ScoreData     data = scores[i];
            HighscoreItem item = Instantiate(itemPrefab, itemContainer, false).GetComponent <HighscoreItem>();
            item.SetValues(data.name, data.score);
        }
    }
Exemplo n.º 5
0
    public void Deserialize(BinaryReader BR)
    {
        Items.Clear();
        int Count = BR.ReadInt32();

        for (int i = 0; i < Count; i++)
        {
            HighscoreItem Itm = new HighscoreItem();
            Itm.Deserialize(BR);
            Items.Add(Itm);
        }

        SortList();
    }
        public void ImportVirtoolsArray(List <VirtoolsArray> data)
        {
            foreach (var item in data)
            {
                if (item.SheetName == "DB_Levelfreischaltung")
                {
                    item.ResetCellPos();
                    for (int i = 0; i < 12; i++)
                    {
                        LevelOpened.Add(ConvertIntToBool(item.PopCell().Value_Int32));
                    }
                }
                else if (item.SheetName == "DB_Options")
                {
                    item.ResetCellPos();

                    Settings.MusicVolume   = item.PopCell().Value_Float;
                    Settings.SynchToScreen = ConvertIntToBool(item.PopCell().Value_Int32);

                    Settings.BallUpKeys    = ConvertIntToKey(item.PopCell().Value_Int32);
                    Settings.BallDownKeys  = ConvertIntToKey(item.PopCell().Value_Int32);
                    Settings.BallLeftKeys  = ConvertIntToKey(item.PopCell().Value_Int32);
                    Settings.BallRightKeys = ConvertIntToKey(item.PopCell().Value_Int32);

                    Settings.CameraRotateKeys = ConvertIntToKey(item.PopCell().Value_Int32);
                    Settings.CameraLiftKeys   = ConvertIntToKey(item.PopCell().Value_Int32);

                    Settings.InventCameraRotation = ConvertIntToBool(item.PopCell().Value_Int32);
                    Settings.RecentPlayer         = item.PopCell().Value_String;
                    Settings.Cloud = ConvertIntToBool(item.PopCell().Value_Int32);
                }
                else
                {
                    item.ResetCellPos();

                    var cache      = new HighscoreList();
                    var levelIndex = int.Parse(item.SheetName.Substring(15, 2));

                    for (int i = 0; i < 10; i++)
                    {
                        var cache2 = new HighscoreItem();
                        cache2.Name = item.PopCell().Value_String;
                        cache.HighscoreItems.Add(cache2);
                    }

                    for (int i = 0; i < 10; i++)
                    {
                        cache.HighscoreItems[i].Score = item.PopCell().Value_Int32;
                    }

                    HighscoreLists.Add(levelIndex, cache);
                }
            }

            //conclusion
            if (HighscoreLists.Count == 12)
            {
                Version = BallanceVersion.Origin;
            }
            else if (HighscoreLists.Count == 20)
            {
                Version = BallanceVersion.SuDu;
            }
            else
            {
                Version = BallanceVersion.Undefined;
            }
        }