void Update() { if (count % 200 == 0) { List <MainData.MessageBody> messages = getRecentlyMessage(friend); UILabel content = transform.FindChild("content").GetComponent <UILabel>(); MyUtilTools.insertStr(content, messages.Count > 0 ? messages[0].content : "暂时没有消息", 470); UILabel time = transform.FindChild("time").GetComponent <UILabel>(); if (messages.Count > 0) { string[] ss = messages[0].time.Split(" "[0]); string[] ssy = ss[0].Split("-"[0]); time.text = ssy[0] + "年" + ssy[1] + "月" + ssy[2] + "日"; if (messages[0].look == 0) { transform.FindChild("newFlag").gameObject.SetActive(true); } } else { time.gameObject.SetActive(false); } } count++; }
void backFromShowAddresses() { Transform address_trans = needshow[0].transform.FindChild("address-body"); Transform list_trans = address_trans.FindChild("list"); if (list_trans.gameObject.activeSelf) { show(curShow, false); show(preShow, true); clears(); title.GetComponentInChildren <UILabel>().text = "个人中心"; callback = null; UILabel address_label = needshow[0].transform.FindChild("scroll").FindChild("body").FindChild("container").FindChild("address").FindChild("value").GetComponent <UILabel>(); if (MainData.instance.user.addresses.Count > 0) { MyUtilTools.insertStr(address_label, MainData.instance.user.addresses[0], 300); } else { address_label.text = "未绑定收货地址"; } } else { address_trans.FindChild("add").gameObject.SetActive(false); list_trans.gameObject.SetActive(true); UILabel label = title.GetComponentInChildren <UILabel>(); label.text = "我的收货地址"; refreshAddressList(); } }
void refreshTitle() { List <MainData.EmailBody> emails = MainData.instance.user.emails; for (int i = 0; i < emails.Count; i++) { MainData.EmailBody email = emails[i]; Transform summary = list_container.transform.FindChild("email-" + email.id); UILabel label_title = summary.FindChild("title").GetComponent <UILabel>(); MyUtilTools.insertStr(label_title, email.theme, 400, email.isNew == 0 ? "(未阅读)" : "(已阅读)"); } }
public void check() { if (target == null) { target = transform.parent.FindChild("show").GetComponent <UILabel>(); } allStr = target.text; if (flag) { MyUtilTools.insertStr(target, allStr, target.width / 2); transform.parent.GetComponent <UIInput>().value = target.text; } }
void refreshList() { if (pref_list_summary == null) { pref_list_summary = Resources.Load <GameObject>("prefabs/email-summary"); } if (list_container == null) { list_container = transform.FindChild("list").FindChild("body").FindChild("container").gameObject; } MyUtilTools.clearChild(list_container.transform); list_container.transform.parent.GetComponent <UIPanel>().clipOffset = Vector2.zero; list_container.transform.parent.localPosition = new Vector3(0, 50, 0); List <MainData.EmailBody> emails = MainData.instance.user.emails; int len = 160; float starty = 420; for (int i = 0; i < emails.Count; i++) { MainData.EmailBody email = emails[i]; GameObject summary = NGUITools.AddChild(list_container, pref_list_summary); summary.name = "email-" + email.id; summary.transform.localPosition = new Vector3(0, starty, 0); UILabel label_title = summary.transform.FindChild("title").GetComponent <UILabel>(); MyUtilTools.insertStr(label_title, email.theme, 400, email.isNew == 0 ? "(未阅读)" : "(已阅读)"); UILabel label_time = summary.transform.FindChild("time").GetComponent <UILabel>(); label_time.text = email.time; UISprite face = summary.transform.FindChild("icon").GetComponent <UISprite>(); face.spriteName = email.senderIcon; UILabel label_sender = summary.transform.FindChild("sender").GetComponent <UILabel>(); label_sender.text = email.senderName; UILabel label_content = summary.transform.FindChild("content").GetComponent <UILabel>(); MyUtilTools.insertStr(label_content, email.content, 500); UIButton delete_button = summary.transform.FindChild("delete").GetComponent <UIButton>(); EventDelegate deleteEvent = new EventDelegate(this, "delete"); deleteEvent.parameters[0] = new EventDelegate.Parameter(); deleteEvent.parameters[0].obj = email; delete_button.onClick.Add(deleteEvent); UIButton content_button = summary.transform.FindChild("detail").GetComponent <UIButton>(); EventDelegate contentEvent = new EventDelegate(this, "gotoDetailFrame"); contentEvent.parameters[0] = new EventDelegate.Parameter(); contentEvent.parameters[0].obj = email; content_button.onClick.Add(contentEvent); starty -= len; } transform.FindChild("list").FindChild("moreDelete").GetComponent <UIToggle>().value = false; }
void backFromSignature() { show(curShow, false); show(preShow, true); clears(); title.GetComponentInChildren <UILabel>().text = "个人中心"; callback = null; UIInput input = needshow[0].transform.FindChild("signature-body").FindChild("inputer").GetComponent <UIInput>(); if (!MyUtilTools.stringIsNull(input.value)) { UILabel signature = needshow[0].transform.FindChild("scroll").FindChild("body").FindChild("container").FindChild("signature").GetComponent <UILabel>(); UILabel signature_save = signature.transform.FindChild("save").GetComponent <UILabel>(); MyUtilTools.insertStr(signature, input.value, 300); signature_save.text = input.value; } }
void refreshNew() { List <MainData.FriendBody> friends = getListByType(0); passContainer.parent.GetComponent <UIPanel>().clipOffset = Vector2.zero; passContainer.parent.localPosition = Vector3.zero; MyUtilTools.clearChild(passContainer); float starty = 520, len = 100; for (int i = 0; i < friends.Count; i++) { MainData.FriendBody friend = friends[i]; GameObject pass_obj = NGUITools.AddChild(passContainer.gameObject, pref_pass); pass_obj.name = "pass" + i; UISprite icon = pass_obj.transform.FindChild("icon").GetComponent <UISprite>(); icon.spriteName = friend.fFace; UILabel name = pass_obj.transform.FindChild("name").GetComponent <UILabel>(); name.text = friend.fName; UILabel other = pass_obj.transform.FindChild("other").GetComponent <UILabel>(); MyUtilTools.insertStr(other, friend.other, 250); UIButton other_button = other.GetComponent <UIButton>(); EventDelegate other_event = new EventDelegate(this, "doOpenOther"); other_event.parameters[0] = new EventDelegate.Parameter(); other_event.parameters[0].obj = friend; other_button.onClick.Add(other_event); UIButton sure = pass_obj.transform.FindChild("sure").GetComponent <UIButton>(); EventDelegate sure_event = new EventDelegate(this, "doFriendPass"); sure_event.parameters[0] = new EventDelegate.Parameter(); sure_event.parameters[0].obj = friend; sure.onClick.Add(sure_event); UIButton cancle = pass_obj.transform.FindChild("cancle").GetComponent <UIButton>(); EventDelegate cancle_event = new EventDelegate(this, "doFriendRefuse"); cancle_event.parameters[0] = new EventDelegate.Parameter(); cancle_event.parameters[0].obj = friend; cancle.onClick.Add(cancle_event); UILabel time = pass_obj.transform.FindChild("time").GetComponent <UILabel>(); time.text = friend.time; pass_obj.transform.localPosition = new Vector3(0, starty, 0); starty -= len; } }
public void refreshInfo() { //填充数据 Transform container = needshow[0].transform.FindChild("scroll").FindChild("body").FindChild("container"); container.parent.GetComponent <UIPanel>().clipOffset = Vector2.zero; container.parent.localPosition = new Vector3(0, 0, 0); UISprite icon = container.FindChild("icon").GetComponent <UISprite>(); icon.spriteName = MainData.instance.user.face; UILabel signature = container.FindChild("signature").GetComponent <UILabel>(); UILabel signature_save = signature.transform.FindChild("save").GetComponent <UILabel>(); MyUtilTools.insertStr(signature, MainData.instance.user.signature, signature.width / 2); signature_save.text = MainData.instance.user.signature; UILabel account = container.FindChild("account").GetComponent <UILabel>(); account.text = MainData.instance.user.account; UILabel nikeName = container.FindChild("nikeName").GetComponent <UILabel>(); nikeName.text = MainData.instance.user.nikeName; UILabel title = container.FindChild("title").FindChild("value").GetComponent <UILabel>(); title.text = MainData.instance.user.title; UILabel registTime = container.FindChild("registTime").FindChild("value").GetComponent <UILabel>(); string[] ss = MainData.instance.user.registTime.Split(" "[0]); string[] ssy = ss[0].Split("-"[0]); registTime.text = ssy[0] + "年" + ssy[1] + "月" + ssy[2] + "日"; UILabel bank_list = container.FindChild("bank").FindChild("value").GetComponent <UILabel>(); if (MainData.instance.user.bacnkAccount.names.Count > 0) { bank_list.text = MainData.instance.user.bacnkAccount.accounts[0]; } else { bank_list.text = "未绑定"; } UIButton button = bank_list.transform.GetComponent <UIButton>(); button.onClick.Clear(); button.onClick.Add(new EventDelegate(showBankAccount)); UILabel address_label = container.FindChild("address").FindChild("value").GetComponent <UILabel>(); if (MainData.instance.user.addresses.Count > 0) { MyUtilTools.insertStr(address_label, MainData.instance.user.addresses[0], 300); } else { address_label.text = "未设置收货地址"; } UIInput name = container.FindChild("name").FindChild("inputer").GetComponent <UIInput>(); name.value = MainData.instance.user.realyName; if (!MyUtilTools.stringIsNull(MainData.instance.user.realyName)) { name.transform.parent.FindChild("arraw").gameObject.SetActive(false); } UIInput indent = container.FindChild("indent").FindChild("inputer").GetComponent <UIInput>(); indent.value = MainData.instance.user.indentity; if (!MyUtilTools.stringIsNull(MainData.instance.user.indentity)) { indent.transform.parent.FindChild("arraw").gameObject.SetActive(false); } UIToggle toggle = container.FindChild("push-flag").FindChild("toggle").GetComponent <UIToggle>(); toggle.value = MainData.instance.user.pushFlag; //信用 refreshCredit(container.FindChild("credit").FindChild("suns")); //财富 Transform credit_recharge = container.FindChild("recharge").FindChild("suns"); UILabel cur_value = credit_recharge.FindChild("cur-value").FindChild("Label").GetComponent <UILabel>(); cur_value.text = MainData.instance.user.recharge.curMoney + "邮游币"; UILabel history_value = credit_recharge.FindChild("history-value").FindChild("Label").GetComponent <UILabel>(); history_value.text = MainData.instance.user.recharge.historyMoney + "邮游币"; //认证中心 refreshRZ(container.FindChild("rzzx").FindChild("suns")); }
void updateEvent(int year, int month, int day) { Transform trans = list_container.FindChild("events"); MyUtilTools.clearChild(trans); GameObject events = trans.gameObject; Dictionary <byte, List <TimeLine> > maps = search(year, month, day); if (maps.Count > 0) { if (timeEvent == null) { timeEvent = Resources.Load <GameObject>("prefabs/time-list"); } int count = 0; float staty = 0; for (byte i = 1; i < 5; i++) { if (maps.ContainsKey(i)) { List <TimeLine> lis = maps[i]; foreach (TimeLine timeLine in lis) { GameObject time_event = NGUITools.AddChild(events, timeEvent); GameObject time_obj = time_event.transform.FindChild("time").gameObject; if (count == 0) { time_obj.GetComponent <UILabel>().text = timeLine.time; } else { time_obj.SetActive(false); } UILabel label_value = time_event.transform.FindChild("value").GetComponent <UILabel>(); MyUtilTools.insertStr(label_value, timeLine.title, 400); string title_str = ""; Color color = Color.black; if (timeLine.type == 1) { title_str = "【申购】"; color = Color.red; label_value.transform.localPosition = new Vector3(50, 50, 0); } else if (timeLine.type == 2) { title_str = "【托管预约】"; color = new Color(32f / 255f, 172f / 255f, 131f / 255f); label_value.transform.localPosition = new Vector3(100, 50, 0); } else if (timeLine.type == 3) { title_str = "【托管入库】"; color = new Color(121f / 255f, 170f / 255f, 217f / 255f); label_value.transform.localPosition = new Vector3(100, 50, 0); } else if (timeLine.type == 4) { title_str = "【重要提示】"; color = new Color(1f, 96f / 255f, 0); label_value.transform.localPosition = new Vector3(100, 50, 0); } UILabel label_title = time_event.transform.FindChild("title").GetComponent <UILabel>(); label_title.text = title_str; label_title.color = color; UIButton detail_button = label_value.transform.GetComponent <UIButton>(); EventDelegate detail_event = new EventDelegate(this, "goToDetail"); detail_event.parameters[0] = new EventDelegate.Parameter(); detail_event.parameters[0].obj = timeLine; detail_button.onClick.Add(detail_event); UIButton notify_button = time_event.transform.FindChild("locker").GetComponent <UIButton>(); EventDelegate notify_event = new EventDelegate(this, "doNotify"); notify_event.parameters[0] = new EventDelegate.Parameter(); notify_event.parameters[0].obj = timeLine; notify_button.onClick.Add(notify_event); time_event.transform.localPosition = new Vector3(0, staty, 0); staty -= 280; count++; } } } } }