12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- namespace LoyalSoftSDK
- {
- public class PayInfoPanel :BaseUIForm {
- private GameObject payItemPanel;
- private GameObject backBtn;
- private Transform content;
- private Text nohavedText;
- // Use this for initialization
- public override void Init()
- {
- curUIType = UIType.Normal;
- nohavedText = this.transform.Find("BackPanel/ScrollView/Viewport/NohavedText").gameObject.GetComponent<Text>();
- backBtn = this.transform.Find("BackPanel/BackButton").gameObject;
- EventTriggerListener.Get(backBtn).onClick = OnBackBtnClick;
- payItemPanel = this.transform.Find("BackPanel/PayItemPanel").gameObject;
- content = this.transform.Find("BackPanel/ScrollView/Viewport/Content").gameObject.transform;
-
-
-
- }
- public override void Display(BaseUIForm _parent, Dictionary<string, string> data)
- {
- for (int i = 0; i < content.childCount; i++)
- {
- Destroy(content.GetChild(i).gameObject);
- }
- string code;
- string infoStr;
- data.TryGetValue("code", out code);
- data.TryGetValue("data", out infoStr);
- if (code.Equals("err"))
- {
- nohavedText.text = "网络请求错误,请稍候再试!";
- nohavedText.gameObject.SetActive(true);
- }
- else
- {
- Dictionary<string, object> infoDic = MiniJSON.Json.Deserialize(infoStr) as Dictionary<string,object>;
- object InfoObj;
- infoDic.TryGetValue("array", out InfoObj);
- //Debug.Log((aa as List<object>).Count);
- //Debug.Log((aa as List<object>)[0] as Dictionary<string ,object>);
- if((InfoObj as List<object>).Count>0)
- {
- foreach (var info in InfoObj as List<object>)
- {
- object product_name;
- object cpOrderId;
- object amount;
- object order_ts;
- //object product_name;
- (info as Dictionary<string, object>).TryGetValue("product_name", out product_name);
- (info as Dictionary<string, object>).TryGetValue("cpOrderId", out cpOrderId);
- (info as Dictionary<string, object>).TryGetValue("amount", out amount);
- (info as Dictionary<string, object>).TryGetValue("order_ts", out order_ts);
- GameObject newitem = Instantiate(payItemPanel);
- newitem.transform.SetParent(content);
- newitem.transform.localScale = new Vector3(1f, 1f, 1f);
- PayItemPanel item = newitem.AddComponent<PayItemPanel>();
- newitem.SetActive(true);
- item.SetInfo(product_name.ToString(), cpOrderId.ToString(), order_ts.ToString(), amount.ToString());
- }
- nohavedText.gameObject.SetActive(false);
- }
- else
- {
- nohavedText.text = "暂无充值记录!";
- nohavedText.gameObject.SetActive(true);
- }
-
- }
- base.Display(_parent, data);
- }
- private void OnBackBtnClick(GameObject go)
- {
- GoBackParent();
- }
- }
- }
|