public static bool DeleteLocal()
    {
        if (string.IsNullOrEmpty(LocalFilePath))
        {
            return(false);
        }

        if (!File.Exists(LocalFilePath + localFileExtension))
        {
            return(false);
        }

        try
        {
            File.Delete(LocalFilePath + localFileExtension);
            return(true);
        }
        catch (System.Exception e)
        {
            SGDebug.LogWarning("Failed to delete the saved games file in " + LocalFilePath + localFileExtension);
            SGDebug.LogWarning(e);
        }

        return(false);
    }
    public static T LoadLocal <T>() where T : new()
    {
        object dataDeserialize = new T();

        if (string.IsNullOrEmpty(LocalFilePath))
        {
            return((T)dataDeserialize);
        }

        if (!File.Exists(LocalFilePath + localFileExtension))
        {
            return((T)dataDeserialize);
        }

        BinaryFormatter bf = new BinaryFormatter();

        try
        {
            FileStream file = File.Open(LocalFilePath + localFileExtension, FileMode.Open);
            dataDeserialize = bf.Deserialize(file);
            file.Close();
            return((T)dataDeserialize);
        }
        catch (System.Exception e)
        {
            SGDebug.LogWarning("Failed to open the saved games file in " + LocalFilePath + localFileExtension);
            SGDebug.LogWarning(e);
        }

        return(new T());
    }
    private void ValueChanged(object sender, ValueChangedEventArgs args)
    {
        if (args.DatabaseError != null)
        {
            SGDebug.LogWarning("Realtime Database: " + args.DatabaseError.Message);
            return;
        }

        UpdateValues(args.Snapshot);
    }
 void CheckGenuineApp()
 {
     if (checkGenuineApp)
     {
         if (!SGSecurity.CheckGenuine())
         {
             SGDebug.LogWarning("CheckGenuine=false");
             SGDebug.SetCustomKey("CheckGenuine", "False");
             SGDebug.ForceException();
             StartCoroutine(SGEnvironment.Quit());
         }
     }
 }
    public static bool SaveLocal(object dataSerializable)
    {
        if (string.IsNullOrEmpty(LocalFilePath))
        {
            return(false);
        }

        BinaryFormatter bf = new BinaryFormatter();

        try
        {
            FileStream file = File.Create(LocalFilePath + localFileExtension); //you can call it anything you want
            bf.Serialize(file, dataSerializable);
            file.Close();
            return(true);
        }
        catch (System.Exception e)
        {
            SGDebug.LogWarning("Failed to save the saved games file in " + LocalFilePath + localFileExtension);
            SGDebug.LogWarning(e);
        }

        return(false);
    }