Compare commits
2 Commits
1.0.0-pre.
...
main
Author | SHA1 | Date | |
---|---|---|---|
afe095286b | |||
e7c0dad0d7 |
47
Inohara.DT/BatchManual.cs
Normal file
47
Inohara.DT/BatchManual.cs
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Inohara.DT;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public struct BatchManual {
|
||||||
|
public BatchManualMeta meta;
|
||||||
|
public BatchManualScore[] scores;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public struct BatchManualMeta {
|
||||||
|
public string game;
|
||||||
|
public string playtype;
|
||||||
|
public string service;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public struct BatchManualScore {
|
||||||
|
public int score;
|
||||||
|
public string difficulty;
|
||||||
|
public UInt64 timeAchieved;
|
||||||
|
public string noteLamp;
|
||||||
|
public string bellLamp;
|
||||||
|
public string matchType;
|
||||||
|
public string identifier;
|
||||||
|
public BatchManualJudgements judgements;
|
||||||
|
public BatchManualOptional optional;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public struct BatchManualJudgements {
|
||||||
|
public int cbreak;
|
||||||
|
public int breakMyBonesIWill;
|
||||||
|
public int hit;
|
||||||
|
public int miss;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public struct BatchManualOptional {
|
||||||
|
public int fast;
|
||||||
|
public int slow;
|
||||||
|
public int bellCount;
|
||||||
|
public int totalBellCount;
|
||||||
|
public int damage;
|
||||||
|
public int platScore;
|
||||||
|
}
|
34
Inohara.DT/BatchManualPB.cs
Normal file
34
Inohara.DT/BatchManualPB.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Inohara.DT;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public struct BatchManualPB {
|
||||||
|
public BatchManualPBMeta meta;
|
||||||
|
public BatchManualPBScore[] scores;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public struct BatchManualPBMeta {
|
||||||
|
public string game;
|
||||||
|
public string playtype;
|
||||||
|
public string service;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public struct BatchManualPBScore {
|
||||||
|
public int score;
|
||||||
|
public string difficulty;
|
||||||
|
public string noteLamp;
|
||||||
|
public string bellLamp;
|
||||||
|
public string matchType;
|
||||||
|
public string identifier;
|
||||||
|
public BatchManualPBJudgements judgements;
|
||||||
|
public BatchManualPBOptional optional;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public struct BatchManualPBJudgements {}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public struct BatchManualPBOptional {}
|
19
Inohara.DT/BatchResponse.cs
Normal file
19
Inohara.DT/BatchResponse.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Inohara.DT;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public struct BatchResponse {
|
||||||
|
public bool success;
|
||||||
|
public BatchResponseBody body;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public struct BatchResponseBody {
|
||||||
|
public string url;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public struct BatchResponse2 {
|
||||||
|
public bool success;
|
||||||
|
}
|
16
Inohara.DT/StatusResponse.cs
Normal file
16
Inohara.DT/StatusResponse.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Inohara.DT;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public struct StatusResponse {
|
||||||
|
public bool success;
|
||||||
|
public StatusBody body;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public struct StatusBody {
|
||||||
|
public string version;
|
||||||
|
public string whoami;
|
||||||
|
public string[] permissions;
|
||||||
|
}
|
@ -1,92 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace Inohara;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Batch manual
|
|
||||||
*/
|
|
||||||
|
|
||||||
[Serializable]
|
|
||||||
public struct BatchManual {
|
|
||||||
public BatchMeta meta;
|
|
||||||
public BatchScore[] scores;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Serializable]
|
|
||||||
public struct BatchMeta {
|
|
||||||
public string game;
|
|
||||||
public string playtype;
|
|
||||||
public string service;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Serializable]
|
|
||||||
public struct BatchScore {
|
|
||||||
public int score;
|
|
||||||
public string difficulty;
|
|
||||||
public UInt64? timeAchieved;
|
|
||||||
public string noteLamp;
|
|
||||||
public string bellLamp;
|
|
||||||
public string matchType;
|
|
||||||
public string identifier;
|
|
||||||
public BatchJudgements judgements;
|
|
||||||
public BatchOptional optional;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Serializable]
|
|
||||||
public struct BatchJudgements {
|
|
||||||
public int? cbreak;
|
|
||||||
public int? breakMyBonesIWill;
|
|
||||||
public int? hit;
|
|
||||||
public int? miss;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Serializable]
|
|
||||||
public struct BatchOptional {
|
|
||||||
public int? fast;
|
|
||||||
public int? slow;
|
|
||||||
public int? bellCount;
|
|
||||||
public int? totalBellCount;
|
|
||||||
public int? damage;
|
|
||||||
public int? platScore;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* BM response 1
|
|
||||||
*/
|
|
||||||
|
|
||||||
[Serializable]
|
|
||||||
public struct BatchResponse {
|
|
||||||
public bool success;
|
|
||||||
public BatchResponseBody body;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Serializable]
|
|
||||||
public struct BatchResponseBody {
|
|
||||||
public string url;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* BM response 2
|
|
||||||
*/
|
|
||||||
|
|
||||||
[Serializable]
|
|
||||||
public struct BatchResponse2 {
|
|
||||||
public bool success;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* API status response
|
|
||||||
*/
|
|
||||||
|
|
||||||
[Serializable]
|
|
||||||
public struct StatusResponse {
|
|
||||||
public bool success;
|
|
||||||
public StatusBody body;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Serializable]
|
|
||||||
public struct StatusBody {
|
|
||||||
public string version;
|
|
||||||
public string whoami;
|
|
||||||
public string[] permissions;
|
|
||||||
}
|
|
@ -11,6 +11,7 @@ using MU3.Util;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Networking;
|
using UnityEngine.Networking;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using Inohara.DT;
|
||||||
|
|
||||||
namespace Inohara;
|
namespace Inohara;
|
||||||
|
|
||||||
@ -31,7 +32,7 @@ public class Exporter: SingletonMonoBehaviour<Exporter> {
|
|||||||
private readonly Dictionary<string, string> _tokens = new();
|
private readonly Dictionary<string, string> _tokens = new();
|
||||||
private string _currToken = "";
|
private string _currToken = "";
|
||||||
private readonly Font _arial = Resources.GetBuiltinResource<Font>("Arial.ttf");
|
private readonly Font _arial = Resources.GetBuiltinResource<Font>("Arial.ttf");
|
||||||
private List<BatchScore> _scores = new();
|
private List<BatchManualScore> _scores = new();
|
||||||
|
|
||||||
private void Log(object o, bool drawText) {
|
private void Log(object o, bool drawText) {
|
||||||
Debug.Log("[Inohara] " + o.ToString());
|
Debug.Log("[Inohara] " + o.ToString());
|
||||||
@ -180,7 +181,7 @@ public class Exporter: SingletonMonoBehaviour<Exporter> {
|
|||||||
req.SetRequestHeader("Content-Type", "application/json");
|
req.SetRequestHeader("Content-Type", "application/json");
|
||||||
|
|
||||||
_scores.Add(Util.CreateScore(result, info));
|
_scores.Add(Util.CreateScore(result, info));
|
||||||
var batch = Util.CreateBatch(_scores, "inohara");
|
var batch = Util.CreateBatch(_scores);
|
||||||
|
|
||||||
byte[] jsonToSend = new UTF8Encoding().GetBytes(batch);
|
byte[] jsonToSend = new UTF8Encoding().GetBytes(batch);
|
||||||
req.uploadHandler = new UploadHandlerRaw(jsonToSend);
|
req.uploadHandler = new UploadHandlerRaw(jsonToSend);
|
||||||
@ -233,7 +234,7 @@ public class Exporter: SingletonMonoBehaviour<Exporter> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var userMusic = Singleton<UserManager>.instance.userMusic;
|
var userMusic = Singleton<UserManager>.instance.userMusic;
|
||||||
var scores = new List<BatchScore>();
|
var scores = new List<BatchManualPBScore>();
|
||||||
foreach(var x in userMusic.Values) {
|
foreach(var x in userMusic.Values) {
|
||||||
foreach(var y in x.UserFumen) {
|
foreach(var y in x.UserFumen) {
|
||||||
if(y != null) {
|
if(y != null) {
|
||||||
@ -241,7 +242,7 @@ public class Exporter: SingletonMonoBehaviour<Exporter> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var batch = Util.CreateBatch(scores, "inohara-pb");
|
var batch = Util.CreatePBBatch(scores);
|
||||||
using StreamWriter writer = new(Path.Combine(Application.dataPath, "../batch-manual.json"));
|
using StreamWriter writer = new(Path.Combine(Application.dataPath, "../batch-manual.json"));
|
||||||
writer.Write(batch);
|
writer.Write(batch);
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Inohara.DT;
|
||||||
using MU3.Battle;
|
using MU3.Battle;
|
||||||
using MU3.DataStudio;
|
using MU3.DataStudio;
|
||||||
using MU3.Game;
|
using MU3.Game;
|
||||||
@ -36,9 +37,9 @@ class Util {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BatchScore CreateScore(BattleResult result, SessionInfo info) {
|
public static BatchManualScore CreateScore(BattleResult result, SessionInfo info) {
|
||||||
var timestampSec = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
var timestampSec = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
||||||
return new BatchScore {
|
return new BatchManualScore {
|
||||||
score = result.technicalScore,
|
score = result.technicalScore,
|
||||||
difficulty = GetStringDiff(info.musicLevel),
|
difficulty = GetStringDiff(info.musicLevel),
|
||||||
timeAchieved = (ulong)timestampSec * 1000,
|
timeAchieved = (ulong)timestampSec * 1000,
|
||||||
@ -46,7 +47,7 @@ class Util {
|
|||||||
identifier = info.musicData.id.ToString(),
|
identifier = info.musicData.id.ToString(),
|
||||||
bellLamp = result.bellComboResult == BellComboResult.None ? "NONE" : "FULL BELL",
|
bellLamp = result.bellComboResult == BellComboResult.None ? "NONE" : "FULL BELL",
|
||||||
noteLamp = GetLamp(result),
|
noteLamp = GetLamp(result),
|
||||||
optional = new BatchOptional() {
|
optional = new BatchManualOptional() {
|
||||||
fast = result.numNotesFast,
|
fast = result.numNotesFast,
|
||||||
slow = result.numNotesLate,
|
slow = result.numNotesLate,
|
||||||
bellCount = result.numBellCatch,
|
bellCount = result.numBellCatch,
|
||||||
@ -54,7 +55,7 @@ class Util {
|
|||||||
damage = result.countDamage,
|
damage = result.countDamage,
|
||||||
platScore = result.platinumScore
|
platScore = result.platinumScore
|
||||||
},
|
},
|
||||||
judgements = new BatchJudgements() {
|
judgements = new BatchManualJudgements() {
|
||||||
cbreak = result.numNotesCBreak,
|
cbreak = result.numNotesCBreak,
|
||||||
breakMyBonesIWill = result.numNotesBreak,
|
breakMyBonesIWill = result.numNotesBreak,
|
||||||
hit = result.numNotesHit,
|
hit = result.numNotesHit,
|
||||||
@ -63,8 +64,8 @@ class Util {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BatchScore CreatePB(UserFumen fumen) {
|
public static BatchManualPBScore CreatePB(UserFumen fumen) {
|
||||||
return new BatchScore {
|
return new BatchManualPBScore {
|
||||||
score = fumen.TechScoreMax,
|
score = fumen.TechScoreMax,
|
||||||
difficulty = GetStringDiff(fumen.Level),
|
difficulty = GetStringDiff(fumen.Level),
|
||||||
matchType = "inGameID",
|
matchType = "inGameID",
|
||||||
@ -77,21 +78,34 @@ class Util {
|
|||||||
// basing this on score is ass but for the most part it will be accurate.
|
// basing this on score is ass but for the most part it will be accurate.
|
||||||
fumen.TechScoreMax >= 940000 ? "CLEAR" :
|
fumen.TechScoreMax >= 940000 ? "CLEAR" :
|
||||||
"LOSS",
|
"LOSS",
|
||||||
optional = new BatchOptional() {},
|
optional = new BatchManualPBOptional() {},
|
||||||
judgements = new BatchJudgements() {}
|
judgements = new BatchManualPBJudgements() {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string CreateBatch(List<BatchScore> scores, string name) {
|
public static string CreateBatch(List<BatchManualScore> scores) {
|
||||||
var bm = new BatchManual {
|
var bm = new BatchManual {
|
||||||
meta = new BatchMeta {
|
meta = new BatchManualMeta {
|
||||||
game = "ongeki",
|
game = "ongeki",
|
||||||
playtype = "Single",
|
playtype = "Single",
|
||||||
service = name
|
service = "inohara"
|
||||||
},
|
},
|
||||||
scores = scores.ToArray()
|
scores = scores.ToArray()
|
||||||
};
|
};
|
||||||
|
|
||||||
return JsonUtility.ToJson(bm).Replace("breakMyBonesIWill", "break");
|
return JsonUtility.ToJson(bm).Replace("breakMyBonesIWill", "break");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string CreatePBBatch(List<BatchManualPBScore> scores) {
|
||||||
|
var bm = new BatchManualPB {
|
||||||
|
meta = new BatchManualPBMeta {
|
||||||
|
game = "ongeki",
|
||||||
|
playtype = "Single",
|
||||||
|
service = "inohara-pb"
|
||||||
|
},
|
||||||
|
scores = scores.ToArray()
|
||||||
|
};
|
||||||
|
|
||||||
|
return JsonUtility.ToJson(bm);
|
||||||
|
}
|
||||||
}
|
}
|
@ -7,7 +7,7 @@ Enable = true
|
|||||||
Timeout = 3
|
Timeout = 3
|
||||||
|
|
||||||
# Tachi instance base URL
|
# Tachi instance base URL
|
||||||
BaseUrl = https://kamai.tachi.ac/
|
BaseUrl = https://kamai.tachi.ac
|
||||||
|
|
||||||
# Tachi status endpoint
|
# Tachi status endpoint
|
||||||
Status = /api/v1/status
|
Status = /api/v1/status
|
||||||
|
Loading…
Reference in New Issue
Block a user