Esempio n. 1
0
        protected override void OnInit(object userData)
        {
            base.OnInit(userData);
            GUILink link = GetComponent <GUILink>();

            link.SetEvent("ButtonClose", UIEventType.Click, OnClickExit);

            historyTextList = new List <HistoryText>();

            Text delta = link.Get <Text>("Text1");

            for (int i = 0; i < 6; i += 2)
            {
                HistoryText temp = new HistoryText();
                temp.count = link.Get <Text>("Text" + (i + 1));
                temp.score = link.Get <Text>("Text" + (i + 2));
                historyTextList.Add(temp);
            }

            historyItem = link.Get <HistoryItem>("HistoryItem");
            historyItem.SetActive(false);
            itemList = new List <HistoryItem>();

            link.SetEvent("ButtonLeft", UIEventType.Click, _ => ChangeHistoryPage(-1));
            link.SetEvent("ButtonRight", UIEventType.Click, _ => ChangeHistoryPage(1));

            pageHistoryList = new Dictionary <int, List <HistorySingleBaseData> >();
        }
Esempio n. 2
0
        void RefreshHistoryAll()
        {
            RoleData         role        = GameManager.Instance.GetRoleData();
            Recv_Get_History historyData = NetWorkManager.Instance.CreateGetMsg <Recv_Get_History>(GameConst._mainPage,
                                                                                                   GameManager.Instance.GetSendInfoStringList <Send_SearchHistoryAll>(role.id.Value, role.token.Value));

            //string jsonStr = File.ReadAllText("JsonTest/history_1.txt");
            //Recv_Get_History historyData = LitJson.JsonMapper.ToObject<Recv_Get_History>(jsonStr);
            //Debug.Log(jsonStr);

            if (historyData != null)
            {
                int curIndex = 0;
                if (historyData.data.list != null)
                {
                    foreach (var item in historyData.data.list)
                    {
                        HistoryText temp = historyTextList[curIndex];
                        temp.count.text           = item.games_count.ToString();
                        temp.score.text           = item.profit.ToString();
                        historyTextList[curIndex] = temp;

                        curIndex++;
                    }
                }
                else
                {
                    foreach (var textitem in historyTextList)
                    {
                        textitem.count.text = "0";
                        textitem.score.text = "0";
                    }
                }
            }
        }