public void OnHistoryLogsRequested(Participant participant, string serializedIndex)
        {
            int index = int.Parse(serializedIndex);

            string[] ids = LoadUserLogs(participant.Id);


            int count = Mathf.Clamp(Mathf.Min(ChunkSize, ids.Length - index), 0, int.MaxValue);

            SerializedHistory serializedHistory = new SerializedHistory()
            {
                Index = index,
                SerializedHistoryLogs = new string[count]
            };

            for (int i = index; i < count; i++)
            {
                string id   = ids[i];
                string name = string.Format(CompleteEvaluationName.Value, id);
                SaveLoad.Load(name, out string log);

                if (log == null)
                {
                    Debug.LogWarning("Missing Evaluation Entry: " + id);
                    break;
                }

                CompleteCaseEvaluation caseEvaluation = JsonUtility.FromJson <CompleteCaseEvaluation>(log);

                char c = (char)124;

                string serializedCase = caseEvaluation.RoleplayDescription.Case.Module.ToString() + c
                                        + caseEvaluation.EvaluationUserA.User.Name + c
                                        + caseEvaluation.EvaluationUserB.User.Name + c
                                        + caseEvaluation.TimeStamp + c
                                        + caseEvaluation.RoleplayDescription.Id;

                serializedHistory.SerializedHistoryLogs[i - index] = serializedCase;
            }

            string         json    = JsonUtility.ToJson(serializedHistory);
            NetworkMessage message = new NetworkMessage(NetworkMessageType.RequestHistoryLogs, "", participant.Id, json);

            Manager.SendMessage(message, participant.IP);
        }
Ejemplo n.º 2
0
        public void OnHistoryLogsAcquired(string serializedLogs)
        {
            SerializedHistory serializedHistory = JsonUtility.FromJson <SerializedHistory>(serializedLogs);

            for (int i = 0; i < serializedHistory.SerializedHistoryLogs.Length; i++)
            {
                string log = serializedHistory.SerializedHistoryLogs[i];

                if (log == null || log == "")
                {
                    break;
                }

                HistoryButton button = Instantiate(ButtonPrefab, ButtonContainer);
                button.Set(log);
            }

            LoadMoreButton.SetAsLastSibling();
        }