void refreshListDeal(List <DealBody> items) { MyUtilTools.clearChild(list_container.transform); if (items.Count == 0) { list_container.transform.parent.parent.FindChild("no-tip").gameObject.SetActive(true); return; } list_container.transform.parent.parent.FindChild("no-tip").gameObject.SetActive(false); float starty = 450, len = 140; for (int i = 0; i < items.Count; i++) { DealBody item = items[i]; GameObject summary = NGUITools.AddChild(list_container, pref_item_summary); summary.transform.localPosition = new Vector3(0, starty, 0); summary.name = "summary" + i; GameObject flg_obj = item.seller ? summary.transform.FindChild("sell-flag").gameObject : summary.transform.FindChild("buy-flag").gameObject; flg_obj.SetActive(true); summary.AddComponent <DealUpdate>().Body = item; UIButton button_event = summary.transform.FindChild("open").GetComponent <UIButton>(); EventDelegate event_delegate = new EventDelegate(this, "deal_detail"); event_delegate.parameters[0] = new EventDelegate.Parameter(); event_delegate.parameters[0].obj = item; button_event.onClick.Add(event_delegate); UILabel label = summary.transform.FindChild("owner").GetComponent <UILabel>(); label.text = item.userName; starty -= len; } }
void refreshAddressList() { Transform container = needshow[0].transform.FindChild("address-body").FindChild("list").FindChild("body").FindChild("container"); container.parent.GetComponent <UIPanel>().clipOffset = Vector2.zero; container.parent.localPosition = new Vector3(0, 0, 0); float startY = 430, len = 110; if (pref_address_list == null) { pref_address_list = Resources.Load <GameObject>("prefabs/address-list"); } MyUtilTools.clearChild(container, new string[] { "addMore" }); for (int i = 0; i < MainData.instance.user.addresses.Count; i++) { GameObject address = NGUITools.AddChild(container.gameObject, pref_address_list); address.AddComponent <UserAddressDel>().init(i, this); address.transform.localPosition = new Vector3(0, startY, 0); address.name = "address_" + i; UILabel label = address.transform.FindChild("value").GetComponent <UILabel>(); label.text = MainData.instance.user.addresses[i]; startY -= len; } container.FindChild("addMore").transform.localPosition = new Vector3(0, startY == 430 ? 0 : startY, 0); }
void refreshMessage(MainData.FriendBody friend) { MyUtilTools.clearChild(messageDetailContainer); List <MainData.MessageBody> messages = getRecentlyMessage(friend); messageStarty = 450; for (int i = messages.Count - 1; i >= 0; i--) { MainData.MessageBody message = messages[i]; initMessage(message); } UIPanel panel = messageDetailContainer.parent.GetComponent <UIPanel>(); if (messages.Count > 0) { float y = 450 - messageStarty - panel.baseClipRegion.w + 50; panel.clipOffset = new Vector2(0, -y); messageDetailContainer.parent.localPosition = new Vector3(0, y + 50, 0); } else { panel.clipOffset = Vector2.zero; messageDetailContainer.parent.localPosition = new Vector3(0, 50, 0); } }
void refresh() { leftContainer.parent.localPosition = Vector3.zero; leftContainer.parent.GetComponent <UIPanel>().clipOffset = Vector2.zero; MyUtilTools.clearChild(leftContainer); float y = 800f; for (int i = 0; i < datas.Count; i++) { MainData.UserData user = datas[i]; GameObject user_summary = NGUITools.AddChild(leftContainer.gameObject, MemberManager.pref_user_info); user_summary.transform.localPosition = new Vector3(-180, y, 0); user_summary.name = "" + i; user_summary.transform.FindChild("icon").GetComponent <UISprite>().spriteName = user.face; user_summary.transform.FindChild("name").GetComponent <UILabel>().text = user.nikeName; Transform select_trans = user_summary.transform.FindChild("select"); select_trans.FindChild("show").gameObject.SetActive(i == selectIndex); UIButton button = select_trans.GetComponent <UIButton>(); EventDelegate event_delegate = new EventDelegate(this, "select"); event_delegate.parameters[0] = new EventDelegate.Parameter(); event_delegate.parameters[0].obj = user_summary; button.onClick.Add(event_delegate); y -= 80; } refreshRight(); }
void refresh() { 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); MyUtilTools.clearChild(container); float starty = 440; for (int i = 0; i < entitys.Count; i++) { RankEntity entity = entitys[i]; GameObject summary = NGUITools.AddChild(container.gameObject, pref_obj); summary.name = "rank_" + i; summary.transform.localPosition = new Vector3(0, starty, 0); UISprite icon = summary.transform.FindChild("icon").GetComponent <UISprite>(); icon.spriteName = entity.face; UILabel name = summary.transform.FindChild("name").GetComponent <UILabel>(); name.text = entity.nikeName; UILabel context = summary.transform.FindChild("content").GetComponent <UILabel>(); float stand = 1000000f; string worthStr = (entity.worth > stand ? (entity.worth / stand + "万") : (entity.worth + "")); context.text = "总共完成 " + entity.count + " 笔交易,成交总金额 " + worthStr + "元"; starty -= 130; } }
public void close() { gameObject.SetActive(false); panel.alpha = 1f; CameraUtil.pop(5); temp = null; MyUtilTools.clearChild(transform.FindChild("container")); }
void _refresh(DealBody item, GameObject obj_suns) { MyUtilTools.clearChild(obj_suns.transform); float y = 0; for (int i = 0; i < item.reverts.Count; i++) { DealBody.Revert revert = item.reverts[i]; GameObject obj_revert = NGUITools.AddChild(obj_suns, pref_revert_detail); obj_revert.name = "revert_" + i; obj_revert.transform.localPosition = new Vector3(0, y, 0); y -= revert.update(obj_revert); GameObject events = obj_revert.transform.FindChild("event").gameObject; for (int j = 0; j < events.transform.childCount; j++) { GameObject child = events.transform.GetChild(j).gameObject; child.SetActive(false); } if (MainData.instance.user.id == revert.uid) { Transform trans = events.transform.FindChild("revoke"); trans.localPosition = new Vector3(-50, 0, 0); UIButton button = trans.GetComponent <UIButton>(); EventDelegate event_delegat = new EventDelegate(this, "openDelRevert"); event_delegat.parameters[0] = new EventDelegate.Parameter(); event_delegat.parameters[0].obj = new RevertDel(revert, "撤销"); button.onClick.Add(event_delegat); trans.gameObject.SetActive(true); } else { Transform trans = events.transform.FindChild("look"); trans.localPosition = new Vector3(-320, 0, 0); UIButton button = trans.GetComponent <UIButton>(); EventDelegate event_delegat = new EventDelegate(this, "openLook"); event_delegat.parameters[0] = new EventDelegate.Parameter(); event_delegat.parameters[0].obj = new LongParamter(item.id); event_delegat.parameters[1] = new EventDelegate.Parameter(); event_delegat.parameters[1].obj = new LongParamter(revert.uid); button.onClick.Add(event_delegat); trans.gameObject.SetActive(true); trans = events.transform.FindChild("revert"); trans.localPosition = new Vector3(240, 0, 0); button = trans.GetComponent <UIButton>(); event_delegat = new EventDelegate(this, "openRevert"); event_delegat.parameters[0] = new EventDelegate.Parameter(); event_delegat.parameters[0].obj = item; event_delegat.parameters[1] = new EventDelegate.Parameter(); event_delegat.parameters[1].obj = new LongParamter(revert.uid); button.onClick.Add(event_delegat); trans.gameObject.SetActive(true); } } }
void _update_flags(GameObject obj, int year, int month, int day) { Transform trans = obj.transform.FindChild("flags"); if (trans != null) { MyUtilTools.clearChild(trans); } else { GameObject flags = NGUITools.AddChild(obj); flags.name = "flags"; trans = flags.transform; } Dictionary <byte, List <TimeLine> > maps = search(year, month, day); if (maps.Count > 0) { float startx = 0; if (maps.Count == 2) { startx = -10; } else if (maps.Count == 3) { startx = -20; } else if (maps.Count == 4) { startx = -30; } int count = 0; for (byte a = 1; a < 5; a++) { if (maps.ContainsKey(a)) { UITexture texture = NGUITools.AddChild <UITexture>(trans.gameObject); texture.gameObject.name = a + ""; texture.transform.localPosition = new Vector3(startx + count * 20, -70, 0); Texture tt = null; tt = a == 1 ? texture1 : tt; tt = a == 2 ? texture2 : tt; tt = a == 3 ? texture3 : tt; tt = a == 4 ? texture4 : tt; texture.mainTexture = tt; texture.width = 16; texture.height = 16; count++; } } } }
void refresh() { selectIndex = 0; mjfk_link.closeLink(); mjqr_link.closeLink(); mjfk.localPosition = new Vector3(0, 820, 0); mjqr.localPosition = new Vector3(0, 730, 0); Transform suns1 = mjfk.FindChild("suns"); Transform suns2 = mjqr.FindChild("suns"); MyUtilTools.clearChild(suns1); MyUtilTools.clearChild(suns2); float y1 = -80, y2 = -80; for (int i = 0; i < orders.Count; i++) { DealBody.Order order = orders[i]; if (order.state == 1) { GameObject order_summary = NGUITools.AddChild(suns1.gameObject, AdminDealManager.pref_deal_info); order_summary.name = "" + i; order_summary.transform.FindChild("name").GetComponent <UILabel>().text = order.item.stampName + "-" + order.id; order_summary.transform.localPosition = new Vector3(0, y1, 0); Transform select_trans = order_summary.transform.FindChild("select"); select_trans.FindChild("show").gameObject.SetActive(i == selectIndex); UIButton button = select_trans.GetComponent <UIButton>(); EventDelegate event_delegate = new EventDelegate(this, "select"); event_delegate.parameters[0] = new EventDelegate.Parameter(); event_delegate.parameters[0].obj = order_summary; button.onClick.Add(event_delegate); y1 -= 80; mjfk_link.offset += 80; } else if (order.state == 4) { GameObject order_summary = NGUITools.AddChild(suns2.gameObject, AdminDealManager.pref_deal_info); order_summary.name = "" + i; order_summary.transform.FindChild("name").GetComponent <UILabel>().text = order.item.stampName + "-" + order.id; order_summary.transform.localPosition = new Vector3(0, y2, 0); Transform select_trans = order_summary.transform.FindChild("select"); select_trans.FindChild("show").gameObject.SetActive(i == selectIndex); UIButton button = select_trans.GetComponent <UIButton>(); EventDelegate event_delegate = new EventDelegate(this, "select"); event_delegate.parameters[0] = new EventDelegate.Parameter(); event_delegate.parameters[0].obj = order_summary; button.onClick.Add(event_delegate); y2 -= 80; mjqr_link.offset += 80; } } refreshRight(); }
void refreshAccountList() { Transform container = needshow[0].transform.FindChild("account-body").FindChild("list").FindChild("body").FindChild("container"); container.parent.GetComponent <UIPanel>().clipOffset = Vector2.zero; container.parent.localPosition = new Vector3(0, 0, 0); float startY = 430, len = 160; if (pref_bank_account == null) { pref_bank_account = Resources.Load <GameObject>("prefabs/Bank-Account"); } MyUtilTools.clearChild(container, new string[] { "addMore" }); for (int i = 0; i < MainData.instance.user.bacnkAccount.names.Count; i++) { GameObject bank = NGUITools.AddChild(container.gameObject, pref_bank_account); bank.AddComponent <UserAccountDel>().init(i, this); bank.transform.localPosition = new Vector3(0, startY, 0); bank.name = "bank" + i; Transform icon_trans = bank.transform.FindChild("icon"); UISprite icon = icon_trans.GetComponent <UISprite>(); string iconName = null; GameObject iconName_obj = icon_trans.FindChild("name").gameObject; for (int j = 0; i < BANK_NAMES_DATAS.Length; j++) { if (BANK_NAMES_DATAS[j].Contains(MainData.instance.user.bacnkAccount.names[i])) { iconName = BANK_NAMES_DATAS[j].Split(":"[0])[1]; break; } } if (iconName != null) { icon.spriteName = iconName; iconName_obj.SetActive(false); } else { icon.spriteName = null; iconName_obj.SetActive(true); iconName_obj.GetComponent <UILabel>().text = MainData.instance.user.bacnkAccount.names[i]; } UILabel label = icon_trans.FindChild("value").GetComponent <UILabel>(); label.text = MainData.instance.user.bacnkAccount.accounts[i]; label = bank.transform.FindChild("openAddress").FindChild("value").GetComponent <UILabel>(); label.text = MainData.instance.user.bacnkAccount.openAddresses[i]; label = bank.transform.FindChild("openPeople").FindChild("value").GetComponent <UILabel>(); label.text = MainData.instance.user.bacnkAccount.openNames[i]; startY -= len; } container.FindChild("addMore").transform.localPosition = new Vector3(0, startY == 430 ? 0 : startY, 0); }
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 deal_detail(DealBody item) { needshow[0].transform.FindChild("detail").gameObject.SetActive(true); needshow[0].transform.FindChild("list").gameObject.SetActive(false); needshow[0].transform.FindChild("detail").FindChild("grab").gameObject.SetActive(false); MyUtilTools.clearChild(detail_container.transform); detail_container.transform.parent.GetComponent <UIPanel>().clipOffset = Vector2.zero; detail_container.transform.parent.localPosition = new Vector3(0, -70.0f, 0); GameObject obj_item = NGUITools.AddChild(detail_container, pref_detail); obj_item.name = "item"; obj_item.transform.localPosition = new Vector3(0, 520, 0); DealDetailUpdate detailUpdate = obj_item.AddComponent <DealDetailUpdate>(); detailUpdate.Body = item; detailUpdate.dealEvent = this; }
public void order_detail(DealBody.Order order) { needshow[0].transform.FindChild("detail").gameObject.SetActive(true); needshow[0].transform.FindChild("list").gameObject.SetActive(false); needshow[0].transform.FindChild("detail").FindChild("grab").gameObject.SetActive(false); needshow[0].transform.FindChild("detail").FindChild("appraise").gameObject.SetActive(false); MyUtilTools.clearChild(detail_container.transform); detail_container.transform.parent.GetComponent <UIPanel>().clipOffset = Vector2.zero; detail_container.transform.parent.localPosition = new Vector3(0, -70, 0); GameObject obj_order = NGUITools.AddChild(detail_container, order.helpflag ? pref_order_detail_help : pref_order_detail); obj_order.transform.localPosition = new Vector3(0, 560, 0); obj_order.name = "order-detail"; obj_order.GetComponent <AppraiseEvent>().Order = order; DealOrderDetailUpdate update = obj_order.AddComponent <DealOrderDetailUpdate>(); update.Order = order; update.dealEvent = this; }
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; } }
void initLook(DealBody item) { transform.FindChild("base").gameObject.SetActive(false); GameObject look = transform.FindChild("look").gameObject; look.SetActive(true); if (lookContainer == null) { lookContainer = look.transform.FindChild("scroll").FindChild("body").FindChild("container").gameObject; } MyUtilTools.clearChild(lookContainer.transform); lookContainer.transform.parent.GetComponent <UIPanel>().clipOffset = Vector2.zero; lookContainer.transform.parent.localPosition = new Vector3(0, 0, 0); if (DealEvent.pref_detail == null) { DealEvent.pref_detail = Resources.Load <GameObject>("prefabs/deal-detail"); } if (DealEvent.pref_revert_detail == null) { DealEvent.pref_revert_detail = Resources.Load <GameObject>("prefabs/revert-detail"); } GameObject deal_obj = NGUITools.AddChild(lookContainer, DealEvent.pref_detail); deal_obj.name = "deal"; deal_obj.transform.localPosition = new Vector3(0, 280, 0); item.insterItem(deal_obj, false); deal_obj.transform.FindChild("event").gameObject.SetActive(false); GameObject reverts = deal_obj.transform.FindChild("reverts").gameObject; float y = 0; for (int i = 0; i < item.reverts.Count; i++) { DealBody.Revert revert = item.reverts[i]; GameObject revert_obj = NGUITools.AddChild(reverts, DealEvent.pref_revert_detail); revert_obj.transform.localPosition = new Vector3(0, y, 0); y -= revert.update(revert_obj, false); revert_obj.name = "revert_" + i; revert_obj.transform.FindChild("event").gameObject.SetActive(false); } }
void refreshMain() { Transform list = transform.FindChild("list"); Transform body = list.FindChild("body"); Transform container = body.FindChild("container"); body.GetComponent <UIPanel>().clipOffset = Vector2.zero; body.localPosition = Vector3.zero; UILabel countLabel = container.FindChild("new").FindChild("Label").GetComponent <UILabel>(); countLabel.text = "新朋友([00ff00]" + getNewCount() + "[-])"; MyUtilTools.clearChild(messageListContainer); List <MainData.FriendBody> friends = getListByType(1); float starty = 0, len = 100; //好友数据 for (int i = 0; i < friends.Count; i++) { MainData.FriendBody friend = friends[i]; GameObject message_obj = NGUITools.AddChild(messageListContainer.gameObject, pref_message); message_obj.name = "message" + i; message_obj.AddComponent <FriendListUpdate>().friend = friend; UISprite icon = message_obj.transform.FindChild("icon").GetComponent <UISprite>(); icon.spriteName = friend.fFace; FriendListDelete delete = icon.gameObject.AddComponent <FriendListDelete>();//长安删除逻辑 delete.friendEvent = this; delete.friend = friend; UILabel name = message_obj.transform.FindChild("name").GetComponent <UILabel>(); name.text = friend.fName; Transform content = message_obj.transform.FindChild("content"); UIButton content_button = content.GetComponent <UIButton>(); EventDelegate button_delegate = new EventDelegate(this, "openMessage"); button_delegate.parameters[0] = new EventDelegate.Parameter(); button_delegate.parameters[0].obj = friend; content_button.onClick.Add(button_delegate); message_obj.transform.localPosition = new Vector3(0, starty, 0); starty -= len; } }
public void refreshListOrder(GameObject list_obj, List <DealBody.Order> orders, MonoBehaviour target_obj, string mothdName = "order_detail") { MyUtilTools.clearChild(list_obj.transform); if (orders.Count == 0) { list_obj.transform.parent.parent.FindChild("no-tip").gameObject.SetActive(true); return; } list_obj.transform.parent.parent.FindChild("no-tip").gameObject.SetActive(false); float starty = 480, len = 180; if (target_obj != this) { starty = 510; } for (int i = 0; i < orders.Count; i++) { DealBody.Order order = orders[i]; GameObject summary = NGUITools.AddChild(list_obj, pref_order_summary); summary.transform.localPosition = new Vector3(0, starty, 0); summary.name = "summary" + i; GameObject flg_obj = order.item.seller ? summary.transform.FindChild("sell-flag").gameObject : summary.transform.FindChild("buy-flag").gameObject; flg_obj.SetActive(true); summary.AddComponent <DealOrderUpdate>().Order = order; UIButton button_event = summary.transform.FindChild("open").GetComponent <UIButton>(); EventDelegate event_delegate = new EventDelegate(target_obj, mothdName); event_delegate.parameters[0] = new EventDelegate.Parameter(); event_delegate.parameters[0].obj = order; button_event.onClick.Add(event_delegate); UILabel label = summary.transform.FindChild("seller").GetComponentInChildren <UILabel>(); label.text = order.item.userName; label = summary.transform.FindChild("buyer").GetComponentInChildren <UILabel>(); label.text = order.buyerName; label = summary.transform.FindChild("validTime").GetComponentInChildren <UILabel>(); label.text = order.times[0]; starty -= len; } }
void refresh() { MyUtilTools.clearChild(transform); float len = 140, start = 180; for (int i = 0; i < MainData.instance.user.recentOrders.Count; i++) { MainData.SimpleOrderModule module = MainData.instance.user.recentOrders[i]; GameObject summary = NGUITools.AddChild(gameObject, pref_simple); summary.transform.localPosition = new Vector3(0, start, 0); summary.name = "module_" + i; UILabel content = summary.transform.FindChild("title").GetComponent <UILabel>(); content.text = module.content; UILabel time = summary.transform.FindChild("timeLable").GetComponent <UILabel>(); time.text = module.time; UIButton button = summary.transform.FindChild("open").GetComponent <UIButton>(); EventDelegate eventDelegate = new EventDelegate(this, "tryToLoadDeal"); eventDelegate.parameters[0] = new EventDelegate.Parameter(); eventDelegate.parameters[0].obj = module; button.onClick.Add(eventDelegate); start -= len; } }
public void clear() { MyUtilTools.clearChild(gameObject.transform); }
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++; } } } } }
void goToDetail(TimeLine timeLine) { needshow[0].transform.FindChild("list").gameObject.SetActive(false); Transform detail_trans = needshow[0].transform.FindChild("detail"); detail_trans.gameObject.SetActive(true); callback = new EventDelegate(backFromDetail); if (detail_container == null) { detail_container = detail_trans.FindChild("body").FindChild("container"); } MyUtilTools.clearChild(detail_container); detail_container.parent.GetComponent <UIPanel>().clipOffset = Vector2.zero; detail_container.parent.localPosition = new Vector3(0, 0, 0); GameObject newObj = new GameObject(); GameObject title_obj = NGUITools.AddChild(detail_container.gameObject, newObj); title_obj.transform.localPosition = new Vector3(0, 520, 0); title_obj.name = "title"; UILabel title_label = title_obj.AddComponent <UILabel>(); title_label.trueTypeFont = labelFont; title_label.fontSize = 50; title_label.text = timeLine.title; title_label.width = 800; title_label.height = 60; title_label.spacingX = 5; title_label.spacingY = 5; title_label.maxLineCount = 100; title_label.color = Color.black; title_label.depth = 2; float starty = 450; for (int i = 0; i < timeLine.contents.Count; i++) { GameObject sun = null; TimeContent content = timeLine.contents[i]; int height = 0; float offset = 0; if (content.type == 0) { sun = NGUITools.AddChild(detail_container.gameObject, title_obj); sun.name = "content" + i; UILabel sun_label = sun.GetComponent <UILabel>(); sun_label.fontSize = 40; sun_label.width = 750; sun_label.height = 10000; sun_label.text = content.str_value; int row = MyUtilTools.computeRow(sun_label); int total = row * (sun_label.fontSize + title_label.spacingY); sun_label.height = total; height = total; offset = total / 2; } else { sun = NGUITools.AddChild(detail_container.gameObject, newObj); sun.name = "content" + i; UITexture texture = sun.AddComponent <UITexture>(); texture.width = 512; texture.height = 512; JustRun.Instance.loadPic(content.str_value, texture); height = texture.height + 20; offset = texture.height / 2; } starty -= height; sun.transform.localPosition = new Vector3(0, starty + offset, 0); } Destroy(newObj); }
public void show(ByteBuffer buffer) { if (bank_account_pref == null) { bank_account_pref = Resources.Load <GameObject>("prefabs/look-bank-account"); } if (address_account_pref == null) { address_account_pref = Resources.Load <GameObject>("prefabs/look-address"); } gameObject.SetActive(true); string icon_str = buffer.ReadString(); string nikeName = buffer.ReadString(); string signature = buffer.ReadString(); string title = buffer.ReadString(); string registTime = buffer.ReadString(); List <string> addresses = new List <string>(); int size = buffer.ReadInt(); for (int i = 0; i < size; i++) { string address = buffer.ReadString(); addresses.Add(address); } string name = buffer.ReadString(); cur_tel_str = buffer.ReadString(); MainData.BankAccount bacnkAccount = new MainData.BankAccount(); bacnkAccount.deserialize(buffer); buffer.ReadString(); buffer.ReadString(); buffer.ReadString(); string totalDealVale = buffer.ReadString(); int hp = buffer.ReadInt(); int zp = buffer.ReadInt(); int cp = buffer.ReadInt(); Transform body = transform.FindChild("scroll").FindChild("body"); body.localPosition = Vector3.zero; body.GetComponent <UIPanel>().clipOffset = Vector2.zero; Transform container = body.FindChild("container"); UISprite icon = container.FindChild("icon").GetComponent <UISprite>(); icon.spriteName = icon_str; UILabel label = container.FindChild("nikeName").GetComponent <UILabel>(); label.text = nikeName; label = container.FindChild("signature").FindChild("value").GetComponent <UILabel>(); label.text = signature; label = container.FindChild("title").FindChild("value").GetComponent <UILabel>(); label.text = title; label = container.FindChild("registTime").FindChild("value").GetComponent <UILabel>(); string[] ss = registTime.Split(" "[0]); string[] ssy = ss[0].Split("-"[0]); label.text = ssy[0] + "年" + ssy[1] + "月" + ssy[2] + "日"; Transform address_trans = container.FindChild("address"); label = address_trans.FindChild("value").GetComponent <UILabel>(); DownOpenLink adress_open_link = address_trans.GetComponent <DownOpenLink>(); GameObject address_suns = address_trans.FindChild("suns").gameObject; address_suns.SetActive(false); if (addresses.Count == 0) { label.text = "保密"; address_trans.FindChild("down").gameObject.SetActive(false); address_trans.FindChild("up").gameObject.SetActive(false); } else { label.text = "已设置" + addresses.Count + "个地址"; address_trans.FindChild("down").gameObject.SetActive(true); address_trans.FindChild("up").gameObject.SetActive(false); MyUtilTools.clearChild(address_suns.transform); float y = 0; for (int i = 0; i < addresses.Count; i++) { GameObject look_address = NGUITools.AddChild(address_suns, address_account_pref); look_address.name = "look_address" + i; UILabel bank_value = look_address.transform.FindChild("value").GetComponent <UILabel>(); bank_value.text = addresses[i]; look_address.transform.localPosition = new Vector3(0, y, 0); y -= 100; } adress_open_link.offset = -y - 10; } label = container.FindChild("name").FindChild("value").GetComponent <UILabel>(); label.text = name; label = container.FindChild("tel").FindChild("value").GetComponent <UILabel>(); label.text = cur_tel_str; Transform tel_trans = container.FindChild("tel").FindChild("call"); if (cur_tel_str.Equals("保密")) { tel_trans.gameObject.SetActive(false); } else { tel_trans.gameObject.SetActive(true); UIButton tel_button = tel_trans.GetComponent <UIButton>(); tel_button.onClick.Clear(); tel_button.onClick.Add(new EventDelegate(telphone)); } Transform bank_trans = container.FindChild("bank"); UILabel account_label = bank_trans.FindChild("value").GetComponent <UILabel>(); GameObject bank_suns = bank_trans.FindChild("suns").gameObject; bank_suns.SetActive(false); DownOpenLink bank_open_link = bank_trans.GetComponent <DownOpenLink>(); if (bacnkAccount.names.Count == 0) { account_label.text = "未绑定银行卡"; bank_trans.FindChild("down").gameObject.SetActive(false); bank_trans.FindChild("up").gameObject.SetActive(false); } else { account_label.text = "已绑定" + bacnkAccount.names.Count + "张"; bank_trans.FindChild("down").gameObject.SetActive(true); bank_trans.FindChild("up").gameObject.SetActive(false); MyUtilTools.clearChild(bank_suns.transform); float y = 0; for (int i = 0; i < bacnkAccount.names.Count; i++) { GameObject look_account = NGUITools.AddChild(bank_suns, bank_account_pref); look_account.name = "look_account" + i; UILabel bank_value = look_account.transform.FindChild("name").FindChild("value").GetComponent <UILabel>(); bank_value.text = bacnkAccount.names[i]; bank_value = look_account.transform.FindChild("account").FindChild("value").GetComponent <UILabel>(); bank_value.text = bacnkAccount.accounts[i]; bank_value = look_account.transform.FindChild("openAddress").FindChild("value").GetComponent <UILabel>(); bank_value.text = bacnkAccount.openAddresses[i]; bank_value = look_account.transform.FindChild("openNames").FindChild("value").GetComponent <UILabel>(); bank_value.text = bacnkAccount.openNames[i]; look_account.transform.localPosition = new Vector3(0, y, 0); y -= 420; } bank_open_link.offset = -y - 30; } Transform deal_trans = container.FindChild("deal-info"); UILabel deal_value = deal_trans.FindChild("deal-value").FindChild("Label").GetComponent <UILabel>(); deal_value.text = totalDealVale; UILabel hp_value = deal_trans.FindChild("hp").FindChild("Label").GetComponent <UILabel>(); hp_value.text = hp + ""; UILabel zp_value = deal_trans.FindChild("zp").FindChild("Label").GetComponent <UILabel>(); zp_value.text = zp + ""; UILabel cp_value = deal_trans.FindChild("cp").FindChild("Label").GetComponent <UILabel>(); cp_value.text = cp + ""; }
void refreshList() { Transform body = transform.FindChild("left").FindChild("list").FindChild("body"); body.localPosition = Vector3.zero; body.GetComponent <UIPanel>().clipOffset = Vector2.zero; Transform container = body.FindChild("container"); MyUtilTools.clearChild(container); float y = 780; if (select_obj.name.Equals("mm")) { for (int i = 0; i < MainData.instance.deal_all.Count; i++) { DealBody deal = MainData.instance.deal_all[i]; GameObject deal_summary = NGUITools.AddChild(container.gameObject, pref_deal_info); deal_summary.name = "" + i; deal_summary.transform.FindChild("name").GetComponent <UILabel>().text = deal.stampName; deal_summary.transform.localPosition = new Vector3(0, y, 0); Transform select_trans = deal_summary.transform.FindChild("select"); select_trans.FindChild("show").gameObject.SetActive(i == selectIndex); UIButton button = select_trans.GetComponent <UIButton>(); EventDelegate event_delegate = new EventDelegate(this, "select"); event_delegate.parameters[0] = new EventDelegate.Parameter(); event_delegate.parameters[0].obj = deal_summary; button.onClick.Add(event_delegate); y -= 80; } } else { orders.Clear(); for (int i = 0; i < MainData.instance.deal_all.Count; i++) { DealBody deal = MainData.instance.deal_all[i]; for (int j = 0; j < deal.orders.Count; j++) { DealBody.Order order = deal.orders[j]; orders.Add(order); } } for (int i = 0; i < orders.Count; i++) { DealBody.Order order = orders[i]; GameObject deal_summary = NGUITools.AddChild(container.gameObject, pref_deal_info); deal_summary.name = "" + i; deal_summary.transform.FindChild("name").GetComponent <UILabel>().text = order.item.stampName + "-" + order.id; deal_summary.transform.localPosition = new Vector3(0, y, 0); Transform select_trans = deal_summary.transform.FindChild("select"); select_trans.FindChild("show").gameObject.SetActive(i == selectIndex); UIButton button = select_trans.GetComponent <UIButton>(); EventDelegate event_delegate = new EventDelegate(this, "select"); event_delegate.parameters[0] = new EventDelegate.Parameter(); event_delegate.parameters[0].obj = deal_summary; button.onClick.Add(event_delegate); y -= 80; } } refreshRight(); }