void SendScoreRaw(string ID, ScoreCompare playerScore, Action <ScoreCompare[]> onSuccess, Action <PlayFabError> errorAction) { var item = new StatisticUpdate(); item.Value = playerScore.value; item.StatisticName = "Worldwide Scores"; var request = new UpdatePlayerStatisticsRequest(); request.Statistics = new List <StatisticUpdate>() { item }; PlayFabClientAPI.UpdatePlayerStatistics(request, result => { var r = new PlayFab.ServerModels.UpdateUserDataRequest(); r.Permission = PlayFab.ServerModels.UserDataPermission.Public; r.PlayFabId = uniqueID; r.Data = new Dictionary <string, string>() { { "SkinID", ((int)playerScore.usedSkin).ToString() }, { "Location", playerScore.location } }; PlayFabServerAPI.UpdateUserData(r, sucess => GetScores(onSuccess, errorAction), failure => { Debug.Log("Fail: " + failure.ErrorMessage); }); }, failure => { }); }
void Start() { _resultDirecter = FindObjectOfType <ResultDirecter>(); _returnMenu = FindObjectOfType <ReturnMenu>(); _scoreCompare = FindObjectOfType <ScoreCompare>(); // _resultDirecter.SetResult(1); }
void Start() { _resultDirecter = FindObjectOfType<ResultDirecter>(); _returnMenu = FindObjectOfType<ReturnMenu>(); _scoreCompare = FindObjectOfType<ScoreCompare>(); // _resultDirecter.SetResult(1); }
static void Main(string[] args) { CircleCalculator circleCalculator = new CircleCalculator(); CircleDelegate circleDelegate = new CircleDelegate(circleCalculator.GetArea); double circleArea = circleDelegate(10); Console.WriteLine($"circleArea : {circleArea}"); Dictionary <string, Student> students = new Dictionary <string, Student>(); students.Add("2019-000001", new Student("2019-000001", 80)); students.Add("2019-000002", new Student("2019-000002", 90)); students.Add("2019-000003", new Student("2019-000003", 75)); students.Add("2019-000004", new Student("2019-000004", 69)); students.Add("2019-000005", new Student("2019-000005", 91)); Score score = new Score(80); ScoreCompare scoreCompare = new ScoreCompare(score.PassStudent); score.GetRequiedScore(students, scoreCompare); score.PASS_SCORE = 70; scoreCompare = new ScoreCompare(score.PassStudent); score.GetRequiedScore(students, scoreCompare); scoreCompare = new ScoreCompare(score.FailStudent); score.GetRequiedScore(students, scoreCompare); }
public void SendScore(string ID, ScoreCompare playerScore, Action <ScoreCompare[]> onSuccess, Action onFailure) { CreateEntry(ID, result => { SendScoreRaw(ID, playerScore, onSuccess, error => onFailure()); }, error => onFailure()); }
void Start() { _timeCount = FindObjectOfType <TimeCount>(); _scoreCompare = FindObjectOfType <ScoreCompare>(); //_regularInterval = _drawTime / _startCountImage.Length; _time = _drawTime; foreach (var image in _startCountImage) { image.enabled = false; } }
public void GetRequireScore(Dictionary <string, Student> ss, ScoreCompare sc) { List <string> keyList = new List <string>(ss.Keys); for (int i = 0; i < keyList.Count; i++) { bool result = sc(ss[keyList[i]].Score); if (result) { Console.WriteLine($"ID: {ss[keyList[i]].Id}, SCORE: {ss[keyList[i]].Score}"); } } }
static void Main(string[] args) { // Delegate CircleCalculator circleCalculator = new CircleCalculator(); CircleDelegate circleDelegate = new CircleDelegate(circleCalculator.GetArea); double circleArea = circleDelegate(10); Console.WriteLine($"circleArea : {circleArea}"); circleDelegate = new CircleDelegate(circleCalculator.GetLength); double circleLength = Math.Round(circleDelegate(10), 2); Console.WriteLine($"circleLength : {circleLength}"); Console.WriteLine(); Dictionary <string, Student> students = new Dictionary <string, Student>(); students.Add("2019-000001", new Student("2019-000001", 80)); students.Add("2019-000002", new Student("2019-000002", 90)); students.Add("2019-000003", new Student("2019-000003", 75)); students.Add("2019-000004", new Student("2019-000004", 69)); students.Add("2019-000005", new Student("2019-000005", 91)); Score score = new Score(80); Console.WriteLine("\n-- PASS STUDENT ---"); ScoreCompare scoreCompare = new ScoreCompare(score.GetPassScore); score.GetRequireScore(students, scoreCompare); Console.WriteLine("\n-- FAIL STUDENT ---"); scoreCompare = new ScoreCompare(score.GetFailScore); score.GetRequireScore(students, scoreCompare); score.PASS_SCORE = 70; Console.WriteLine("\n-- PASS STUDENT ---"); scoreCompare = new ScoreCompare(score.GetPassScore); score.GetRequireScore(students, scoreCompare); Console.WriteLine("\n-- FAIL STUDENT ---"); scoreCompare = new ScoreCompare(score.GetFailScore); score.GetRequireScore(students, scoreCompare); Console.WriteLine(); // Delegate Chain PassNoticeListener passNoticeListener = new PassNoticeListener(); passNoticeListener.postMessage += passNoticeListener.SendToSMS; passNoticeListener.postMessage += passNoticeListener.SendToBlog; passNoticeListener.postMessage += passNoticeListener.SendToKaka; passNoticeListener.postMessage += passNoticeListener.SendToARS; passNoticeListener.postMessage("Congratulations! Passed!!"); passNoticeListener.postMessage -= new PostMessage(passNoticeListener.SendToSMS); passNoticeListener.postMessage -= new PostMessage(passNoticeListener.SendToARS); passNoticeListener.postMessage("Congratulations! Passed!!"); // Event PassNoticeEventListener passNoticeEventListener = new PassNoticeEventListener(); passNoticeEventListener.postEventMessage += passNoticeEventListener.SendToSMS; passNoticeEventListener.postEventMessage += passNoticeEventListener.SendToBlog; passNoticeEventListener.postEventMessage += passNoticeEventListener.SendToKaka; passNoticeEventListener.postEventMessage += passNoticeEventListener.SendToARS; passNoticeEventListener.SendMessage("Congratulations! Passed!!"); }
void Start() { _scoreCompare = FindObjectOfType<ScoreCompare>(); _actionManager = FindObjectOfType<KeyAction>(); }
void Start() { _timeCount = FindObjectOfType<TimeCount>(); _scoreCompare = FindObjectOfType<ScoreCompare>(); //_regularInterval = _drawTime / _startCountImage.Length; _time = _drawTime; foreach (var image in _startCountImage) { image.enabled = false; } }
void Start() { _scoreCompare = FindObjectOfType <ScoreCompare>(); _actionManager = FindObjectOfType <KeyAction>(); }
void GetScores(Action <ScoreCompare[]> onSuccess, Action <PlayFabError> errorAction) { var request = new GetLeaderboardRequest(); request.MaxResultsCount = 100; request.StatisticName = "Worldwide Scores"; request.ProfileConstraints = new PlayerProfileViewConstraints(); request.ProfileConstraints.ShowLocations = true; request.ProfileConstraints.ShowDisplayName = true; var list = new List <ScoreCompare>(); var checks = new List <bool>(); ScoreCompare score; PlayFab.ClientModels.LocationModel location; PlayFabClientAPI.GetLeaderboard(request, (GetLeaderboardResult result) => { int scoreCount = result.Leaderboard.Count; for (int i = 0; i < scoreCount; i++) { score = new ScoreCompare(result.Leaderboard[i].StatValue); score.name = result.Leaderboard[i].DisplayName; score.ID = result.Leaderboard[i].PlayFabId; location = result.Leaderboard[i].Profile.Locations.Last(); score.location = useCityAsLocation ? location.City.ToString() : location.CountryCode.ToString(); list.Add(score); checks.Add(false); string name = score.name; int index = i; var infoRequest = new GetUserDataRequest(); infoRequest.PlayFabId = result.Leaderboard[i].PlayFabId; PlayFabClientAPI.GetUserData(infoRequest, infoResult => { if (infoResult.Data.ContainsKey("SkinID") && infoResult.Data.ContainsKey("Location")) { var value = infoResult.Data["SkinID"]; list[index].usedSkin = (CatSkin)(int.Parse(value.Value)); } else { var r = new PlayFab.ServerModels.UpdateUserDataRequest(); r.Permission = PlayFab.ServerModels.UserDataPermission.Public; r.Data = new Dictionary <string, string>() { { "SkinID", "0" }, { "Location", "Brazil" } }; r.PlayFabId = infoRequest.PlayFabId; PlayFabServerAPI.UpdateUserData(r, sucess => { Debug.Log("SUCCESS"); }, failure => { Debug.Log("FAILED"); }); } checks[index] = true; if (!checks.Contains(false)) { Debug.Log("List returned"); var values = list.ToArray(); onSuccess(values); } }, failure => Debug.Log("Get content fail: " + failure.ErrorMessage)); } }, errorCallback => Debug.Log("Failed to get leaderboard")); }