Hello , I use Leade...
 
Notifications
Clear all

Hello , I use Leaderboard function Encounter problems..

8 Posts
2 Users
0 Likes
724 Views
(@freeze4266)
Posts: 6
Active Member
Topic starter
 

請原諒我使用 Google 翻譯,我的英文能力不是很好..。

Please forgive me for using GOOGLE translation, my English is not good.

我希望在排行榜中得到 UserName 的變數但是我找不到方法可以獲取..

I want to see UserName in the leaderboard, but in the LoadScores method, I can't find the method for UserName....

 

public void LoadAndShowLeaderboard()
{
leaderboardPanel.SetActive(true);
CombuManager.platform.LoadScores(leaderboardId, (IScore[] leaderboard) =>
{
foreach (var score in leaderboard)
{
Debug.Log(score.userID);
Debug.Log(score.value);
}
});
}

我只有找到從排行榜中得到 userID的方法
I only have to find a way to get the userID from the leaderboard.
然而,我看到先前的文章是有這個方法的,是否有進行變更,我想要可以使用的方法。
However, I saw that the previous article has this method. Is there a change, I want to use the method?
https://www.skaredcreations.com/wp/community/combu/problem-with-the-leaderboard/#post-1337

另外 Achievements 以及  Managing Tournaments 與 Loading Matches 的功能在文檔中不太了解是怎麼運作的..

In addition, the functions of Achievements and Managing Tournaments and Loading Matches are not well understood in the documentation.

Achievements 看起來與排行榜的功能類似,不過目前依照文檔來進行會有些錯誤,還沒深入了解。

Achievements looks similar to the leaderboards, but there are some errors in the documentation and it's not well understood.

而 Managing Tournaments 和 Loading Matches  目前還沒試過,不知道是否像網路遊戲一樣,有著創造房間並進行遊戲的功能。

The Managing Tournaments and Loading Matches haven't been tried yet. I don't know if they have the ability to create rooms and play games like online games.

Combu 的功能很多,對我來說還有很多不懂的功能..,但對於僅是開啟伺服器並儲存一些玩家訊息已經很夠用了。

Combu has a lot of features, and for me there are a lot of features that I don't understand.., but it's enough to just open the server and save some player information.

感謝看完這篇文章,再次對我的英文能力道歉..

Thanks for reading this article, once again apologizing for my English ability..

 
Posted : 18/02/2019 9:34 am
(@freeze4266)
Posts: 6
Active Member
Topic starter
 

我看了 Achievements 的文檔

I read the documentation for Achievements.

https://www.skaredcreations.com/api/combu/v3/page_achievement.html

在 Reporting Progress 中,不知道能不能和 /Combu/admin/ 中建立的 Achievements 來執行。

In Reporting Progress, I don't know if I can perform it with Achievements created in /Combu/admin/.

或是使用 CombuManager.platform.CreateAchievement(); 方法來創建一個 Achievement ,不管如何,當使用此方法時將會失敗。

Or use the CombuManager.platform.CreateAchievement(); method to create an Achievement , whichever happens, will fail when using this method.

public void ReportingProgress()
{
CombuManager.platform.CreateAchievement();

CombuManager.platform.ReportProgress(1000.ToString(), 123 , (bool success) => {
if (success)
Debug.Log("Success");
else
Debug.Log("Failed");
});

Achievement myAchievement = new Achievement();

myAchievement.percentCompleted = 0.3;
myAchievement.ReportProgress((bool success) => {
if (success)
Debug.Log("Success");
else
Debug.Log("Failed");
});
}

其實在 Unity 方面我也只能算是初學者..,懂得方法不是很多..
In fact, I can only be a beginner in Unity. I know that there are not many methods.
學習都是依照文檔說明來進行..
Learning is done according to the documentation instructions.

This post was modified 5 years ago by freeze4266
 
Posted : 18/02/2019 10:02 am
(@freeze4266)
Posts: 6
Active Member
Topic starter
 

我不知道要怎麼修改文章,但是我將 Achievement 功能試出來了。

I don't know how to modify or delete the article, but I tried the Achievement feature.
這樣貌似是正確的,我得到我需要的。
This seems to be correct, I get what I need.

public void ReportingProgress()
{
Achievement achievement = new Achievement();
achievement.id = "1";

achievement.percentCompleted = 0.3;
achievement.ReportProgress((bool success) => {
if (success)
Debug.Log("Success");
else
Debug.Log("Failed");
});
}



public void LoadAchievements()
{
CombuManager.platform.LoadAchievements((Achievement[] achievements) =>
{
foreach (var achievement in achievements)
{
Debug.Log(achievement.id);
Debug.Log(achievement.title);
Debug.Log(achievement.description);
Debug.Log(achievement.lastReportedDate);
Debug.Log(achievement.completed);
Debug.Log(achievement.points);
}
});
}

 
Posted : 18/02/2019 10:23 am
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

About leaderboards you can safely cast IScore into Score inside the callback function, also consider that the overload method that you're using (LoadScores(string, Action<IScore>)) loads the first 10 top scores updated in the last week (TimeScope.Week) instead you may want to load the scores from all time:

// Request scores from all time, page 1, with 10 results per page
CombuManager.platform.LoadScores(leaderboardId, TimeScope.AllTime, 1, 10, (IScore[] scores) =>
{
    Debug.Log("Found " + scores.Length + " scores");
    foreach (Score score in scores)
    {
        Debug.Log("#" + score.rank + " " + score.user.userName);
    }
});

 

About the Achievements, they're different from Leaderboards because they're just a % progress towards predefined goals, that usually in games/apps are rewarded with badges and/or in-game rewards. In Unity you cannot create the achievements because they're defined in your backend on server, but you can report the progress (the number you pass to the method ReportProgress is added to the current value on server).

The method CreateAchievement() of platform is not meant to actually "create" an achievement, but create an instance of Achievement class that you can use to report a progress (the code on your last post is correct). The reason why this accessory method is there is because platform is implementing the Unity built-in interface ISocialPlatform for even easier integration with Unity logic of posting leaderboard scores or achievements progress.

You can also use the shorter code:

CombuManager.platform.ReportProgress("1", 0.3, (bool success) =>
{
    Debug.Log("Success: " + success);
});

 

Last question about Matches and Tournaments: these features are meant to store the data for your matches to be stored in the database, Combu is not a networking system but the backend for your game data. That said, you can still use them together with a realtime (or turn-based) networking system and store the scores for the matches and tournaments of your games.

The matches work like this:

  • A player starts a match (for example with the method Match.QuickMatch to create a match of current user against another one, or create a Match manually and add users [except the current] like in that method), you will need to store the match created that the QuickMatch/Save methods pass to your callback
  • The other player(s) in the match can see their active matches with Match.Load (store the match that you're loading)
  • When the currently logged user needs to send a score to the match you use the method Score (you may want to reload the match object inside the callback passed here, so that you know if the game finished)

The match score web service automatically set the match as finished as soon as it receives the score from all users for all turns defined (you need to reload the Match object by passing the id to Match.Load to know if it finished, usually you may want to reload it in the callback passed to Score).

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 18/02/2019 10:45 pm
(@freeze4266)
Posts: 6
Active Member
Topic starter
 

感謝你的回覆!

Thank you for your reply!

事實上我看了一下範例場景,確實需要將 IScore 轉變為 Scroe 型態。

In fact, I looked at the sample scenario and really need to turn IScore into a Scroe type.

    public void LoadAndShowLeaderboard()
{
CombuManager.platform.LoadScores(leaderboardId, (IScore[] leaderboard) =>
{
foreach (var IScore in leaderboard)
{
Score score = (Score)IScore;
Debug.Log(score.rank);
Debug.Log(score.user.userName);
Debug.Log(score.value);
}
});
}

然後感謝你的成就說明,讓我理解這個功能。

Then thank you for your achievement description, let me understand this feature.

雖然對於 Matches 和 Tournaments 有稍微理解了,不過我正在思考是否可以和 Photon 一起使用,以達到更即時的遊戲效果。

Although there is a slight understanding of Matches and Tournaments, I am thinking about whether I can use it with Photon for a more immediate gameplay.

例如說製作一個擁有遊戲房間及大廳的遊戲,當加入遊戲房間時就等同加入了一個 Matches 或
Tournaments 的遊戲模式 ( 或只有Photon功能,再利用 Json 格式來傳送遊戲結果到 appCustomData 中) 。

For example, to make a game with a game room and a hall, when joining a game room, it is equivalent to adding a Matches or
  Tournaments' game mode (or only the Photon feature, then use the Json format to transfer game results to appCustomData).

Combu 真的值得每一分金錢,我已經向好友推薦了!

Combu really deserves every bit of money, I have already recommended it to my friends!

擁有友善的開發者以及強大的網路功能。

Have friendly developers and powerful web features. 😛  😛 

 
Posted : 19/02/2019 4:14 am
(@freeze4266)
Posts: 6
Active Member
Topic starter
 

你好,我要繼續問問題了..

Hello, I have to continue to ask questions..

其實我在思考,檔案傳輸功能是否有哪些限制,除了圖片外,可以上傳其他檔案類型嗎?例如影片檔。

In fact, I am thinking about whether there are any restrictions on the file transfer function. Can I upload other file types besides the pictures? For example, a video file.

我是使用 XAMPP 作為我的網路伺服器,但是我記得XAMPP在架設SQL的時候,好像會有上傳的限制..。

I use XAMPP as my web server, but I remember that XAMPP seems to have upload restrictions when setting up SQL..

如果可以上傳影片並取得URL對我來說是最理想的方案,不過我的技術有限,沒辦法做到這件事。所以我想要知道 Combu 伺服器可不可以做到。

If you can upload a movie and get a URL, it is the best solution for me, but my technology is limited and I can't do it. So I want to know if the Combu server can do it.

如果可以上傳比較大的檔案,是否可以為此功能製作一個進度條呢?

If you can upload a larger file, can you make a progress bar for this feature?

在這邊先感謝觀看這篇文章,並且回答了問題。

Thanks for reading this article and answering the questions here. 🙂  🙂 

 

 

 
Posted : 19/02/2019 4:43 pm
(@skaredcreations)
Posts: 805
Prominent Member Admin
 

The "real" content of UserFile is saved as physical file inside the directory /combu/upload while the data is saved in the database table 'UserFile' (the file path relative to /upload is stored in the field 'Url'). You can upload whatever file type you need, there's no limitation in file type or size (you set the max upload size in php.ini, the variable setting is upload_max_filesize).

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 19/02/2019 6:55 pm
(@freeze4266)
Posts: 6
Active Member
Topic starter
 

真的是太棒了..。

Really great...

實際上我正在研究如何將 mp4 檔案 ( 或其他檔案類型 )  轉換成 byte 類型..。

I'm actually researching how to convert an mp4 file (or other file type) to a byte type...

目前我使用 「 Simple File Browser 」 資源來抓取影片的路徑,並取得 Path 

Currently I use the "Simple File Browser" resource to capture the path of the movie and get the Path

https://assetstore.unity.com/packages/tools/input-management/simple-file-browser-98451

目前我是使用  System.IO.File.ReadAllBytes(path) 的方法來將所選取的 mp4 檔案轉為 byte 格式,不過有些問題..。

Currently I am using System.IO.File.ReadAllBytes(path) to convert the selected mp4 file to byte format, but there are some problems...

    public void UpdateloadFile(string path)
{
byte[] video = File.ReadAllBytes(path);
UserFile newfile = new UserFile();
newfile.name = "Video" + System.DateTime.Now.ToString("yyMMddT"); ;

newfile.sharing = UserFile.eShareType.Everybody;
newfile.customData["Videos"] = "Value";
newfile.Update(video, (bool success , string error) =>
{
Debug.Log("Uploading..");
if (success)
{
Debug.Log("Success");
Debug.Log(newfile.url);
}
else { Debug.Log("Fail..");
}
});
}

使用相同的程式碼,上傳 png 檔案是正確的,但是上傳  jpg 和 mp4 檔案類型後,檔案類型將會變成 dat 。

Using the same code, uploading the png file is correct, but after uploading the jpg and mp4 file types, the file type will become dat .

例如,將 Video.mp4 檔案上傳之後,將會變成 Video.dat檔案,可能需要再找方法讓他變回正確的檔案格式..。

For example, after uploading the Video.mp4 file, it will become a Video.dat file, and you may need to find a way to change it back to the correct file format...

最後 PHP.ini 中的 post_max_size 似乎也要變更,才可以上傳影片。

Finally, the post_max_size in PHP.ini seems to have to be changed before the movie can be uploaded.

This post was modified 5 years ago by freeze4266
 
Posted : 20/02/2019 5:43 am
Share: