Ok this is a simple question, but the Xamarin forums are pretty much useless...
I am trying to implement Leaderboards in my game that is built in MonoGame. Unfortunately, I can't seem to find the GameHelper class and I cannot extend BaseGameActivity as described in Google's how-to, even though I have the google play services component installed (19.0.1)
The only other alternative is using the GoogleApiClient, which I tried:
public IGoogleApiClient apiClient;
GoogleApiClientBuilder builder = new GoogleApiClientBuilder(this);
builder.AddApi(GamesClass.Api)
.AddApi(PlusClass.Api)
.AddScope(GamesClass.ScopeGames)
.AddScope(PlusClass.ScopePlusLogin);
apiClient = builder.Build();
But whenever I make a call to apiClient.Connect(), I get the following error:
E/GooglePlayServicesUtil( 7989): The Google Play services resources were not found.
Check your project configuration to ensure that the resources are included.
I have cleaned and rebuilt, removed the component and added the references manually, changed the location of the project to the root of the drive, all to no avail. I'm out of ideas. Anyone have leaderboards running in MonoGame?
I recently wrote a MonoGame project for Android, which includes Leaderboard support. You can find the full source here, but I would recommend looking at Activity1.cs in particular. It is where I do most of the Google Play work.
You can also take a look at GameOver.cs to see an instance of the leaderboard getting a score submitted to it.
That error message may not be the cause of your problem. I lifted the code and resources from BaseGame Utils and integrated it with my own project. I always get that message, and the game works perfectly.
I suggest you look carefully for any subsequent errors.
Related
I managed to download audio file from a remote source, and I want to change it's metadata, like Author, Title, Album.
I save it locally so it's easily accessible and editable, but I can't find anything to edit it's metadata.
I've tried:
Android.Media.MediaMetadataEditor but the error is pretty straightforward:
This class is obsoleted in this android platform
I'm using latest SDK (28) and API, for android Pie. And it is also stated on android developer documentation
This class was deprecated in API level 21.
Use MediaMetadata instead together with MediaSession.
I really searched for some example, and I didn't found anything useful, most of cases are with playlist.
I don't get how MediaSession can replace in any manner the MediaMetadataEditor, since MediaSession
Allows interaction with media controllers, volume keys, media buttons, and transport controls.
A MediaSession should be created when an app wants to publish media playback information or handle media keys
Instead MediaMetadata seems what I need because
Contains metadata about an item, such as the title, artist, etc.
And its Builder class is promising.
I'm sure that just reading that pages I should be able to understand how to do it, but after hours of trying, it seems I'm not experienced enough to learn from that documentation.
Is there an example to understand it?
Thanks
I found a solution outside android Library.
taglib-sharp seems working on android project, and it can be installed via nuget package, the name is TagLibSharp
Really easy to use:
TagLib.File my_file = TagLib.File.Create(path_to_my_file);
string[] performers = new string[1]{"My Performer"}
my_file.Tag.Title = "The real title";
my_file.Tag.Performers = performers;
my_file.Save();
Easy.
I'm working on an online video game project using Unity3D for the clients, and C# servers.
I'm trying to use some code eval for a specific feature, but I can't get it to work.
I went with Mono, because it seemed to be one of the lightest and one of the simplest. I installed Mono and got the "Mono.CSharp.dll" for .Net 4.6 from "Mono\lib\mono\4.6-api". (Both Unity and my servers are configured to use this version of .Net). I dropped it in the Unity assets, and referenced it on my servers.
But I have errors on both Unity and the servers. In Unity there is :
Loading script assembly "Assets/Scripts/Common/References/Mono.CSharp.dll" failed!
And there is an exception on the servers (my IDE is in French so I can't really copy/paste it), but it basically tells me it can't use Reference Assemblies for build, but only for reflection.
To describe the feature I want to create (because you'll maybe have a better solution), I want to be able to create spells from an external tool. Spells are made of SpellEffects. Let's say there is a SpellEffect called DealDamage, constructor takes an int (for the damage amount). I want to be able to write "DealDamage(50)" on my external tool, then take the string, and build a new DealDamage(50) from it.
I know I could find a way to interpret some code by myself, but it would be a lot more work for a far less flexible system.
It was really hard to find any help online for this problem, so as a last hope I'm turning to you.
I'm not exactly sure why you're trying to import Mono into Unity. It's already included in the installation package. If you want to make a modular spell builder, just create a regular application with your preferred language, in your preferred IDE, and save all of your spells as a JSON or XML file, and then import those into Unity. On the Unity side, just build a class to parse the files.
To get you started, take a look at the JSON.Net library. You can serialize your files into C# classes with it.
I've been working on a small project in Unity over the past few months, using Git for source control along the way. I recently got a new laptop which is being demo my progress in different locations.
I installed Unity & all the relevant runtimes needed within the application and pulled the source down to the new machine. The project opens in Unity, but the Hierarchy view shows this where my prefabs used to be.
All of the resources (prefabs, models, scripts) are in the same directories as they were on the original development machine, but are somehow becoming "unlinked" during the process of pulling them down to a new machine.
I have tried searching but have been unable to find a solution to this particular problem shy of just recreating everything.
Thanks for the help.
There are meta files associated with all your assets inside of a Unity Project, which is why any kind of external version control / source control does not save all of those settings, because they're not being linked correctly. If available to you at all, the included Asset Server within Unity ( read source control ) is extremely easy to setup, and has worked perfectly fine for me ( with a small team ).
If you're absolutely set on using git, take a look at Unity's documentation below to see if it will clear up your problems:
https://docs.unity3d.com/Manual/ExternalVersionControlSystemSupport.html
I've recently begun work on an audio application using C#.NET. I've begun some basic implementation of the NAudio library which I intend to use throughout the project. While looking at NAudio's documentation on CodePlex I found a link to the WPF Sound Visualization Library, I was attracted by one of its features in particular which I knew I would require in my app.
So I downloaded and added it to my project References.
I've copied how it is referenced within a window's XAML document, like so:
xmlns:svl="clr-namespace:WPFSoundVisualizationLib;assembly=WPFSoundVisualizationLib"
and then tried to add a control within the library using:
<svl:WaveformTimeline x:Name="testWaveformTimeline"/>
The problem is that the designer/XMAL editor claims: "svl:WaveformTimeline" does not exist in namespace "clr-namespace:WPFSoundVisualizationLib;assembly=WPFSoundVisualizationLib".
Now I know that it does exist. I can make reference to the WaveformTimeline object in the class file, and the object shows up in Visual Studio's Object Browser.
I'm not at all sure why this is the case. If anyone knows any possible solutions to this, or things I should check any help would be appreciated.
I had the same issue and I just found the solution:
By right-clicking on the WPFSoundVisualizationLib .dll I had to 'unblock' the file which had been marked as 'unsafe' by windows because the file were coming from a WebSite. Weird but it was obviously the reason I couldn't use the WaveformTimeLine in my project. A bit late but maybe still worths to post it.
More info here: https://msdn.microsoft.com/en-us/library/dd409252(VS.100).aspx
Recently stumbled upon this post whilst trying to decide on the best way of getting a VLC player into C#.
Does VLC media player have a C# interface?
I downloaded the dll files and imported them into my project, but then realised I had no real idea of how to use them. Has anyone got a Windows Forms example of this code that works? The code have tried is shown below -
Vlc.DotNet.Core.Medias.MediaBase media = new
Vlc.DotNet.Core.Medias.PathMedia(#"C:\Users\...\SampleVideos\Wildlife.wmv");
Vlc.DotNet.Forms.VlcControl vlcControl1 = new Vlc.DotNet.Forms.VlcControl();
vlcControl1.Play(media);
I am also using the code in this link in the main program.cs of my project.
http://vlcdotnet.codeplex.com/wikipage?title=Forms
The current problem I experience is that upon starting the project it throws a NullReferenceException when it gets to ->
vlcControl1.Play(media)
The problem seems to be with the vlcControl but I am unsure why. The documentation seems to rather thin and I couldn't find any working examples on the codeplex site. If anyone has a working forms example or knows what I might have missed please let me know!
Here is the call stack present when the error occurs ->
RTSPViewer_Test.exe!RTSPViewer_Test.Form1.Form1_Load(object sender,
System.EventArgs e) Line 31 + 0xd bytes C#
RTSPViewer_Test.exe!RTSPViewer_Test.Program.Main() Line 30 + 0x1d bytes C#
When debugging it appears that the Media and Medias attribute of the VLC control are both null. When trying to set the Media of the control to the media object created above a
NullReferenceException
Checking the VLC control object Media does indeed equal null, but I am not sure why it hasn't been initialised properly.
I was unable to get the program to work using the latest version of the Vlc.dotnet libraries but instead used the alpha 2 version which was posted by Raj. I used VLC version 1.1.5 with this library to get the basic example to function properly. My end objective was to stream from an rtsp device, however this library does not appear to support this functionality yet.
For anyone looking to use a good C# wrapper for using VLC then this is a great example -
http://www.codeproject.com/Articles/109639/nVLC
Used the library files from VLC 1.1.1 with this project and works fine. Supports pretty much all the features that you would usually use in VLC but gives you much more control over what you use them for.
Many of the issues that arise when using these DLL wrappers arose from incorrect versions of the source DLL files. The VLC libraries are only 32 bit at this time, so you need to make sure to compile using x86 mode otherwise the libvlc.dll will not load properly and the application will crash. Using the above example you must also make sure that the libvlc.dll, libvlccore.dll and the plugins folder are included in the build folder.