コード例 #1
0
    protected void UpdateBankRecord(JSONObject obj)
    {
        /*
         * {"page":{"total":总记录数,"pagecount":总页数,"pageindex":第几页,"pagesize":每页条数}
         * ,"data":[{"action_time":操作时间,"action_type":交易类别,"action_money":交易额
         * ,"start_money":起始钱数,"end_money":结束钱数,"remark":备注
         * ,"user_id":通常是自己的id,"to_user_id":对方id,"to_user_nickname":对方昵称},...]}
         */
        //{"body": {"data": [
        //{"action_time": "2016-04-10 20:06:29", "start_money": 801105, "action_money": 1000, "user_id": 889198535, "to_user_nickname": "", "remark": "游戏内存款", "end_money": 802105, "action_type": "存款", "to_user_id": ""},
        //{"action_time": "2016-04-10 19:46:39", "start_money": 800105, "action_money": 1000, "user_id": 889198535, "to_user_nickname": "", "remark": "游戏内存款", "end_money": 801105, "action_type": "存款", "to_user_id": ""},
        //{"action_time": "2016-04-10 19:46:34", "start_money": 800104, "action_money": 1, "user_id": 889198535, "to_user_nickname": "", "remark": "游戏内存款", "end_money": 800105, "action_type": "存款", "to_user_id": ""},
        //{"action_time": "2016-04-10 19:45:45", "start_money": 799993, "action_money": 111, "user_id": 889198535, "to_user_nickname": "", "remark": "游戏内存款", "end_money": 800104, "action_type": "存款", "to_user_id": ""},
        //{"action_time": "2016-04-10 17:15:03", "start_money": 799992, "action_money": 1, "user_id": 889198535, "to_user_nickname": "", "remark": "游戏内存款", "end_money": 799993, "action_type": "存款", "to_user_id": ""}
        //], "page": {"pageindex": 1, "total": 45, "pagesize": 5, "pagecount": 9}}, "tag": "bankrecord", "type": "account"}
        recordPage       = (int)obj["page"]["pageindex"].n;
        maxRecordPage    = (int)obj["page"]["pagecount"].n;
        kRecordPage.text = recordPage + "/" + maxRecordPage;

        EginTools.ClearChildren(vRecords);
        List <JSONObject> recordInfoList = obj["data"].list;
        int i = 0;

        foreach (JSONObject recordInfo in recordInfoList)
        {
            if (recordInfo.type == JSONObject.Type.NULL)
            {
                break;
            }

            GameObject cell = (GameObject)Instantiate(recordPrefab);
            cell.transform.parent        = vRecords;
            cell.transform.localPosition = new Vector3(0, i * -100, 0);
            cell.transform.localScale    = Vector3.one;

            string actionTime = recordInfo["action_time"].str;
            if (actionTime.Length > 10)
            {
                actionTime = actionTime.Substring(0, 10);
            }
            ((UILabel)cell.transform.Find("Label_Time").GetComponent(typeof(UILabel))).text = actionTime;
            if (PlatformGameDefine.playform.IsSocketLobby)
            {
                ((UILabel)cell.transform.Find("Label_Type").GetComponent(typeof(UILabel))).text  = Regex.Unescape(recordInfo["action_type"].str);
                ((UILabel)cell.transform.Find("Label_Money").GetComponent(typeof(UILabel))).text = recordInfo["action_money"].n + "";
                ((UILabel)cell.transform.Find("Label_Start").GetComponent(typeof(UILabel))).text = recordInfo["start_money"].n + "";
                ((UILabel)cell.transform.Find("Label_End").GetComponent(typeof(UILabel))).text   = recordInfo["end_money"].n + "";
            }
            else
            {
                ((UILabel)cell.transform.Find("Label_Type").GetComponent(typeof(UILabel))).text  = recordInfo["action_type"].str;
                ((UILabel)cell.transform.Find("Label_Money").GetComponent(typeof(UILabel))).text = recordInfo["action_money"].str;
                ((UILabel)cell.transform.Find("Label_Start").GetComponent(typeof(UILabel))).text = recordInfo["start_money"].str;
                ((UILabel)cell.transform.Find("Label_End").GetComponent(typeof(UILabel))).text   = recordInfo["end_money"].str;
            }
            i++;
        }
    }