Exemplo n.º 1
0
    public static bool DeleteCharacter(CharacterInformation.Character existingChar)
    {
        if (_activeConnection == null)
        {
            _activeConnection = CreateConnection();
        }

        bool success = false;

        try
        {
            SqliteCommand command = _activeConnection.CreateCommand();
            command.CommandText = "DELETE FROM Celebrities WHERE celeb_id = '" + existingChar.CharID + "'";
            command.ExecuteNonQuery();
            success = true;

            EndConnection();
        }
        catch (Exception ex)
        {
            Debug.LogWarning("Error deleting character " + existingChar.Name + ": " + ex.Message);
        }
        return(success);
    }
Exemplo n.º 2
0
    public void RegisterPhoto(string path, List <CharacterInformation.Character> celebritiesInPhoto)
    {
        Photo newPhoto = new Photo(path, GameNumber);

        newPhoto.CelebritiesInPhoto = new List <CharacterInformation.Character>(celebritiesInPhoto);
        newPhoto.RoundTakenDuring   = _gameNumber;
        newPhoto.LoadImage();

        //Record index of PhotosThisRound with their associated celebrities
        CharacterInformation[] celebsInScene = new CharacterInformation[CelebTargets.Keys.Count];
        CelebTargets.Keys.CopyTo(celebsInScene, 0);
        for (int i = 0; i < celebsInScene.Length; i++)
        {
            CharacterInformation.Character celebChar = celebsInScene[i].GetInfo();
            if (newPhoto.CelebritiesInPhoto.Contains(celebChar))
            {
                int celebPhotoIndex = PhotosThisRound.Count;
                CelebTargets[celebsInScene[i]] = celebPhotoIndex;
                //TEMP tell player that they took a picture of that celeb
                IndicateCelebColors.SetCelebFound(i);
            }
        }
        PhotosThisRound.Add(newPhoto);
    }
Exemplo n.º 3
0
    public static bool AddCharacter(CharacterInformation.Character newChar)
    {
        if (_activeConnection == null)
        {
            _activeConnection = CreateConnection();
        }

        bool success = false;

        try
        {
            SqliteCommand command = _activeConnection.CreateCommand();
            command.CommandText = "INSERT INTO Celebrities(celeb_id, name) VALUES(" + newChar.CharID + ", '" + newChar.Name + "');";
            command.ExecuteNonQuery();
            success = true;

            EndConnection();
        }
        catch (Exception ex)
        {
            Debug.LogWarning("Error inserting character " + newChar.Name + ": " + ex.Message);
        }
        return(success);
    }