protected override void OnInit() { this.contentPane = UIPackage.CreateObject("UIMain", "BuildWindow").asCom; this.Center(); this.modal = true; _list = this.contentPane.GetChild("list").asList; _close = this.contentPane.GetChild("close").asLoader; _close.onClick.Add(delegate(EventContext context) { this.Hide(); }); _list.onClickItem.Add(__clickItem); //_list.itemRenderer = RenderListItem; _list.EnsureBoundsCorrect(); _detail = (BuildDetail)this.contentPane.GetChild("detail").asCom; _detail.visible = false; _confirmButton = this.contentPane.GetChild("confirm").asCom; _confirmButton.onTouchBegin.Add(buildConfirm); foreach (TowerTemplate tt in BattleManager.getInstance().buildableTowers) { BuildItem item = (BuildItem)_list.AddItemFromPool("ui://UIMain/BuildItem"); item.setTowerInfo(tt); } float interval = 300 / (_list.numChildren > 8?8:_list.numChildren); _list.columnGap = (int)interval; //_list.numItems = 3; }
protected override void OnInit() { this.contentPane = UIPackage.CreateObject("UIMain", "DialogWindow").asCom; this.Center(); this.modal = true; _branches = this.contentPane.GetChild("tabs").asList; _loader = this.contentPane.GetChild("pic").asLoader; _text = this.contentPane.GetChild("desp").asTextField; _branches.foldInvisibleItems = true; _branches.onClickItem.Add(clickItem); _branches.EnsureBoundsCorrect(); // for (int i = 0; i < MAX_BRANCH_NUM; i++) // { // SelectionBranch item = (SelectionBranch)_branches.GetChildAt (i).asButton; // item.idx = i; // } // float interval = 300/(_list.numChildren>8?8:_list.numChildren); // _list.columnGap = (int)interval; //_list.numItems = 3; }
void Start() { Application.targetFrameRate = 60; Stage.inst.onKeyDown.Add(OnKeyDown); _mainView = this.GetComponent <UIPanel>().ui; _list = _mainView.GetChild("mailList").asList; for (int i = 0; i < 10; i++) { MailItem item = (MailItem)_list.AddItemFromPool(); item.setFetched(i % 3 == 0); item.setRead(i % 2 == 0); item.setTime("5 Nov 2015 16:24:33"); item.title = "Mail title here"; } _list.EnsureBoundsCorrect(); float delay = 0f; for (int i = 0; i < 10; i++) { MailItem item = (MailItem)_list.GetChildAt(i); if (_list.IsChildInView(item)) { item.PlayEffect(delay); delay += 0.2f; } else { break; } } }
// Use this for initialization void Start() { Application.targetFrameRate = 60; _mainView = this.GetComponent <UIPanel>().ui; _list = _mainView.GetChild("n0").asList; for (int i = 0; i < 10; i++) { GButton item = (GButton)_list.AddItemFromPool(); item.title = "hi " + i; item.visible = false; } _list.EnsureBoundsCorrect(); for (int i = 0; i < 10; i++) { GButton item = (GButton)_list.GetChildAt(i); if (_list.IsChildInView(item)) { Transition trans = item.GetTransition("t0"); trans.Play(1, 2 * i, null); } } }
//导入当前列表 add by tianjinpeng 2018/03/09 15:16:56 public void listcount(int index, List <BagData> GListright) { bagDataList = GListright; baglist.numItems = index; baglist.EnsureBoundsCorrect(); lieshuxianding(); Debug.Log("导入成功" + index); showstoredown(); }
public Rect getFirstBranch() { GObject firstItem = _branches.GetChildAt(0); Rect rect = firstItem.TransformRect(new Rect(0, 0, firstItem.width, firstItem.height), GRoot.inst); _branches.EnsureBoundsCorrect(); Vector2 center = _branches.LocalToGlobal(new Vector3(firstItem.position.x + firstItem.width / 2, firstItem.position.y + firstItem.height / 2, 0)); Rect trueRect = new Rect(center.x - rect.size.x / 2 - 4, center.y - rect.size.y / 2, rect.size.x + 4, rect.size.y + 4); //GuideManager.getInstance ()._guideLayer.setMark (GuideManager.getInstance ()._guideLayer.GlobalToLocal(center)); return(trueRect); }
public void newtipsData(string iconurl, string nametext, string datacount) { GComponent gComponent = gList.AddItemFromPool().asCom; gComponent.visible = true; gComponent.alpha = 1; TipsData tipsData = new TipsData(gComponent, gComponent.GetChild("n0").asLoader, gComponent.GetChild("n1").asTextField, gComponent.GetChild("n2").asTextField); gList.ResizeToFit(gList.numChildren); gList.EnsureBoundsCorrect(); tipsData.Setdata(iconurl, nametext, datacount); tipsDatas.Add(tipsData); tipsData.starttweener(); }
protected override void OnInit() { this.contentPane = UIPackage.CreateObject("UIMain", "BattleFinishWindow").asCom; this.Center(); this.modal = true; _list = this.contentPane.GetChild("list").asList; _list.onClickItem.Add(__clickItem); _list.itemRenderer = RenderListItem; _list.EnsureBoundsCorrect(); _confirmButton = this.contentPane.GetChild("confirm").asCom; _confirmButton.onTouchBegin.Add(closePanel); }
protected override void OnInit() { this.contentPane = UIPackage.CreateObject("UIMain", "GetNewItem").asCom; this.Center(); this.modal = true; _new_item_list = this.contentPane.GetChild("list").asList; _new_item_list.EnsureBoundsCorrect(); _confirm = this.contentPane.GetChild("confirm").asButton; _confirm.onClick.Add(chooseItem); _confirm.visible = false; _skip = this.contentPane.GetChild("skip").asRichTextField; _skip.onTouchBegin.Add(skip); }
void Start() { Application.targetFrameRate = 60; GRoot.inst.SetContentScaleFactor(1136, 640); Stage.inst.onKeyDown.Add(OnKeyDown); UIPackage.AddPackage("UI/Extension"); UIObjectFactory.SetPackageItemExtension("ui://Extension/mailItem", typeof(MailItem)); _mainView = UIPackage.CreateObject("Extension", "Main").asCom; _mainView.fairyBatching = true; _mainView.SetSize(GRoot.inst.width, GRoot.inst.height); _mainView.AddRelation(GRoot.inst, RelationType.Size); GRoot.inst.AddChild(_mainView); _list = _mainView.GetChild("mailList").asList; for (int i = 0; i < 10; i++) { MailItem item = (MailItem)_list.AddItemFromPool(); item.setFetched(i % 3 == 0); item.setRead(i % 2 == 0); item.setTime("5 Nov 2015 16:24:33"); item.title = "Mail title here"; } _list.EnsureBoundsCorrect(); float delay = 0f; for (int i = 0; i < 10; i++) { MailItem item = (MailItem)_list.GetChildAt(i); if (_list.IsChildInView(item)) { item.PlayEffect(delay); delay += 0.2f; } else { break; } } }
public ListEffectScene() { UIPackage.AddPackage("UI/Extension"); UIObjectFactory.SetPackageItemExtension("ui://Extension/mailItem", typeof(MailItem)); _mainView = UIPackage.CreateObject("Extension", "Main").asCom; _mainView.MakeFullScreen(); _mainView.AddRelation(GRoot.inst, RelationType.Size); AddChild(_mainView); _list = _mainView.GetChild("mailList").asList; for (int i = 0; i < 10; i++) { MailItem item = (MailItem)_list.AddItemFromPool(); item.setFetched(i % 3 == 0); item.setRead(i % 2 == 0); item.setTime("5 Nov 2015 16:24:33"); item.title = "Mail title here"; } _list.EnsureBoundsCorrect(); float delay = 0f; for (int i = 0; i < 10; i++) { MailItem item = (MailItem)_list.GetChildAt(i); if (_list.IsChildInView(item)) { item.PlayEffect(delay); delay += 0.2f; } else { break; } } }
public void ResizeWidthMinFromItems(bool isOffsetOnRight) { _list.EnsureBoundsCorrect(); if (list.numItems <= 0) { return; } if (offsetTitle_L == -1) { var bt0 = list.GetChildAt(0).asButton; var tf0 = bt0.GetTextField(); if (tf0 == null) { return; } offsetTitle_L = tf0.x; offsetTitle_LR_Raw = bt0.width - tf0.width; offsetTitle_T = tf0.y; offsetTitle_TB = bt0.height - tf0.height; } float offsetTitle_LR = isOffsetOnRight ? offsetTitle_LR_Raw : offsetTitle_L + 5; var wMargin = _list.margin.left + _list.margin.right; var wCheck = _list.width - wMargin - offsetTitle_LR; bool isOver = false; float minW = 0; for (int i = 0; i < list.numItems; i++) { var bt = list.GetChildAt(i).asButton; var tf = bt.GetTextField(); if (tf != null) { tf.autoSize = AutoSizeType.Both; // Debug.Log(bt.width + " : " + tf.width + " : " + tf.textWidth); if (tf.textWidth > wCheck) { isOver = true; break; } if (tf.width > minW) { minW = tf.width; } } } if (isOver) { // Debug.Log("isOver = true"); for (int i = 0; i < list.numItems; i++) { var bt = list.GetChildAt(i).asButton; var tf = bt.GetTextField(); if (tf != null) { tf.autoSize = AutoSizeType.Height; tf.width = wCheck; tf.x = offsetTitle_L; bt.width = wCheck + offsetTitle_LR; tf.y = offsetTitle_T; bt.height = tf.height + offsetTitle_TB; } } } else { // Debug.Log("isOver = false; minW = " + minW); contentPane.width = minW + wMargin + offsetTitle_LR + 2; // Debug.Log("contentPane.width = " + contentPane.width); for (int i = 0; i < list.numItems; i++) { var bt = list.GetChildAt(i).asButton; var tf = bt.GetTextField(); if (tf != null) { tf.autoSize = AutoSizeType.Both; tf.width = minW; tf.x = offsetTitle_L; bt.width = minW + offsetTitle_LR; tf.y = offsetTitle_T; bt.height = tf.height + offsetTitle_TB; } } } }