Ejemplo n.º 1
0
    void Start()
    {
        HTTP.Client.Instance.Configure(new HTTP.Settings(TriviaService.GetHostAddress()).Protocol(HTTP.Protocol.HTTP));

        notFoundPanel.IsVisible = false;
        dfScrollPanel historyPanel = GetComponent <dfScrollPanel> ();

        //categoryPanel.Anchor = dfAnchorStyle.All;

        new HTTP.Request(TriviaService.GetHttpFolderPath() + "get_user_game_history.php?game_user_id=" + GameConstant.UserId + "&game_user_type=" + GameConstant.UserType)
        .OnReply((reply) => {
            HistoryReply hReply = JsonConvert.DeserializeObject <HistoryReply>(reply.DataAsString);
            if (hReply.success == 1)
            {
                foreach (HistoryData data in hReply.data)
                {
                    History instance = historyPanel.AddPrefab(Prefab.gameObject).GetComponent <History>();

                    instance.Data = data;
                    instance.start();
                }
                loaderPanel.IsVisible = false;
            }
            else
            {
                notFoundPanel.IsVisible = true;
                loaderPanel.IsVisible   = false;
            }
        })
        .Send();
    }
        public void Can_serialize_null_history_reply()
        {
            var historyReply = new HistoryReply();

            var serialized = JsonSerializer.Serialize(historyReply);

            serialized.Should().Be(@"{""history"":[]}");
        }
        public void Can_serialize_empty_history_reply()
        {
            var historyReply = new HistoryReply(new HistoryElement[] {});

            var serialized = JsonSerializer.Serialize(historyReply);

            serialized.Should().Be(@"{""history"":[]}");
        }
Ejemplo n.º 4
0
        public void historyRequest(KernelMessage msg, HistoryRequest content)
        {
            var reply = new HistoryReply()
            {
                history = new List <string>()
            };

            sendMessage(shellSocket, msg, "history_reply", reply);
        }
        public void Can_serialize_history_reply()
        {
            var historyReply = new HistoryReply(new HistoryElement[]
            {
                new InputHistoryElement(0, 0, "input value"),
                new InputHistoryElement(1, 0, "input value"),
                new InputOutputHistoryElement(2, 0, "input value", "output result")
            });

            var serialized = JsonSerializer.Serialize(historyReply);

            serialized.Should().Be(@"{""history"":[[0,0,""input value""],[1,0,""input value""],[2,0,[""input value"",""output result""]]]}");
        }