score board code not working

0 votes

HI.

trying to implement code to submit score, below code is from your tutorial and gives errors on the highlighted piece of code.

Assets/AddScore.cs(24,41): error CS1519: Unexpected symbol `(' in class, struct, or interface member declaration

so i am not sure if it is my mistake or the code in the tutorial.

There appears to be a lot of errors in the code snippets that are there for unity c# and the getting started instructions miss out the fact you need to use namespaces in the headers, plus there is'nt a list of services required.




scoreBoardService.SaveUserScore(gameNameuserNamegameScorenew UnityCallBack()); 

john

asked Mar 7, 2015 in App42 Cloud API-BaaS by John Wheeler (10 points)
edited Mar 7, 2015 by John Wheeler
using UnityEngine;
using UnityEngine.SocialPlatforms;
using System.Collections;
using System.Collections.Generic;
using System.Net;
using System;
using com.shephertz.app42.paas.sdk.csharp;
using com.shephertz.app42.paas.sdk.csharp.social;
using com.shephertz.app42.paas.sdk.csharp.game;
using AssemblyCSharp;


public class AddScore : MonoBehaviour {

    ServiceAPI serviceAPI = new ServiceAPI("xxxx","xxxx");  
    GameService gameService = App42API.BuildGameService();   
    ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService();   

    string gameName = "Numnuts/Level 1";  
    string userName = "Johnny";  
    double gameScore = 3500;  


//    scoreBoardService.SaveUserScore(gameName, userName, gameScore, new UnityCallBack());     

    [Serializable]
    public class UnityCallBack : App42CallBack  
    {  
       
       
       
        public void OnSuccess(object response)  
        {  
            Game game = (Game) response;       
            App42Log.Console("gameName is " + game.GetName());   
            for(int i = 0;i<game.GetScoreList().Count;i++)  
            {  
                App42Log.Console("userName is : " + game.GetScoreList()[i].GetUserName());  
                App42Log.Console("score is : " + game.GetScoreList()[i].GetValue());  
                App42Log.Console("scoreId is : " + game.GetScoreList()[i].GetScoreId());  
            }  
        }  
        public void OnException(Exception e)  
        {  
            Debug.Log("Exception : " + e);  
        }  
    }  


}

1 Answer

0 votes

Hello John,

Thanks for your feedback. We surely look into this and update as well in our tutorial. Could you please share your AddScore.Cs file with us? Because it seems like something is missing at your end. Also, please have a look at our sample project to understand all the integration steps and services which is required to build leaderboard and let me know if it helps.

Thanks,

Himanshu Sharma

answered Mar 7, 2015 by hs00105 (2,005 points)
No,already tried to run the sample , cannot get that to login to facebook, could only look at the scripts.

I have a problem with your style of callbacks, they are not easily integrated into my game because they are classes enclosed in namespace.

John
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...