private void addItem(ClubInfo club, int tableId) { GComponent table = Tables.AddItemFromPool().asCom; var info = table.GetChild("info").asRichTextField; for (var i = 1; i <= 10; i++) { var desk = table.GetChild("desk" + i); desk.data = tableId; desk.onClick.Set(onDeskClick); } Dictionary <string, string> vars = new Dictionary <string, string>(); vars["id"] = tableId + ""; vars["current"] = "0"; vars["count"] = club.count + ""; vars["score"] = scores[club.score]; info.templateVars = vars; Tables.AddChild(table); var btnEditRoom = table.GetChild("btnEditRoom"); btnEditRoom.data = tableId; btnEditRoom.onClick.Set(editRoom); }
/// <summary> /// 更新手牌,保持与CardManager的同步 /// </summary> public void UpdateHandcards() { // TODO: 完善此方法 _handcardList.RemoveChildren(0, -1, true); foreach (string cardId in handcardList) { GObject item = UIPackage.CreateObject(pkgName, "handcardItem2"); item.icon = UIPackage.GetItemURL(handcardAssets, cardId); item.SetPivot(0.5f, 1f); _handcardList.AddChild(item); string id = string.Copy(cardId); item.onRollOver.Add(() => { // 切换当前鼠标防治上的卡牌最最上 _handcardList.apexIndex = _handcardList.GetChildIndex(item); // 获取并展示数据 JsonData data = CardManager.Instance().GetCardJsonData(id); _title.text = data["name"].ToString(); _effect.text = data["effect"].ToString(); _value.text = "冷却:" + data["cd"] + " " + "专注值:" + data["cost"] + "\n" + data["type"]; _cardDescribeWindow.Show(); }); item.onRollOut.Add(() => { _cardDescribeWindow.Hide(); }); } }
/// <summary> /// 将背包物品显示在UI中 /// </summary> /// <param name="slotList"></param> public void SetSlotToList(GList slotList) { for (int i = 0; i < slotsList.Count; i++) { slotList.AddChild(buttonList[i]); } }
/// <summary> /// 将快捷栏信息显示在快捷栏中 /// </summary> /// <param name="shortCutButtonList">快捷栏列表</param> public void SetShortCutToList(GList shortCutButtonList) { for (int i = 0; i < shortCutList.Count; i++) { shortCutButtonList.AddChild(shortCutList[i]); } }
/// <summary>展示三张卡牌, /// /// </summary> public void ShowCard() { onsalelist.RemoveChildren(); foreach (string cardID in library_list) { GObject item = UIPackage.CreateObject("Library", "CardItem"); item.icon = UIPackage.GetItemURL(cardicons, cardID); onsalelist.AddChild(item); } }
private void addClubItem(Network.Msg.Club club) { GComponent item = list.AddItemFromPool().asCom; item.GetChild("id").asTextField.text = club.id + ""; item.GetChild("score").asTextField.text = scores[club.score]; item.GetChild("pay").asTextField.text = club.pay == 0 ? "老板" : "AA"; item.GetChild("count").asTextField.text = club.count + ""; item.GetChild("boss").asTextField.text = club.boss; list.AddChild(item); }
void addUserItem(ClubUser user) { GComponent item = userList.AddItemFromPool().asCom; item.GetChild("imgAvatar").asLoader.url = Utils.Helper.GetReallyImagePath(user.avatar); item.GetChild("textId").text = "ID:" + user.id; item.GetChild("textNick").text = "昵称:" + user.nick; //var btnPayer = item.GetChild("btnPayer").asButton; var btnAdmin = item.GetChild("btnAdmin").asButton; var btnCheck = item.GetChild("btnCheck").asButton; var btnDisable = item.GetChild("btnDisable").asButton; // 是管理员或者老板 // 并且 当前列表项不是老板 // 才显示控制按钮 var b = (Data.Club.IsAdmin || Data.Club.IsBoss) && Data.Club.Info.uid != user.id; // 管理员 只有 老板可以控制 if (user.admin) { if (Data.Club.IsBoss) { b = true; } else { b = false; } } // btnPayer.visible = b; btnAdmin.visible = b; btnCheck.visible = b; btnDisable.visible = b; //btnPayer.selected = user["id"].n == Data.Club.Data["payer_uid"].n; btnAdmin.selected = user.admin; btnCheck.selected = user.status != 0; btnDisable.selected = user.status == 2; // btnPayer.onClick.Add(onBtnPayerClick); btnAdmin.onClick.Add(onBtnAdminClick); btnCheck.onClick.Add(onBtnCheckClick); btnDisable.onClick.Add(onBtnDisableClick); userList.AddChild(item); }
/// <summary> /// 更新冷却区卡牌 /// </summary> public void UpdateCooldownList() { // TODO: 完善此方法 _cooldownList.RemoveChildren(0, -1, true); foreach (cdObject cooldownCard in cooldownList) { GObject item = UIPackage.CreateObject(pkgName, "cooldownItem"); item.icon = UIPackage.GetItemURL(numsPkg, "cdNum" + cooldownCard.leftCd); item.asCom.GetChild("n2").asLoader.url = UIPackage.GetItemURL(cooldowncardAssets, cooldownCard.objectId); _cooldownList.AddChild(item); } }
void addRoomItem(Network.Msg.Room room) { GComponent item = list.AddItemFromPool().asCom; item.GetChild("id").text = room.id + ""; item.GetChild("score").text = scores[room.score]; item.GetChild("pay").text = room.pay == 0 ? "老板" : "AA"; item.GetChild("count").text = room.current + "/" + room.count + ""; item.GetChild("players").text = room.players + ""; item.GetChild("btnInvite").asButton.onClick.Add(onInviteClick); list.AddChild(item); }
/// <summary> /// 更新卡牌书内卡牌堆列表,非cardManager调用等于浪费时间 /// </summary> public void UpdateCardsSets() { // TODO: 完善此方法 // 从卡牌list中移除所有item,加入新的,虽然暴力,但很简单 _cardsSetsList.RemoveChildren(0, -1, true); foreach (string cardId in cardSetsList) { GObject item = UIPackage.CreateObject(pkgName, "cardsSetsItem"); item.icon = UIPackage.GetItemURL(cardsetsAssets, cardId); _cardsSetsList.AddChild(item); } }
/// <summary> /// 显示商品列表信息 /// </summary> /// <param name="shopList"></param> public void SetShopItemToList(GList shopList) { shopList.RemoveChildren(); if (itemType == ItemTypes.Consumable) { for (int i = 0; i < shopItemInfoList.Count; i++) { if (shopItemList[i].Item.ItemType == itemType) { shopList.AddChild(shopItemList[i]); } } } else if (itemType == ItemTypes.Equipment) { for (int i = 0; i < shopItemInfoList.Count; i++) { if (shopItemList[i].Item.ItemType == itemType && (shopItemList[i].Item.PlayerType == PlayerStatusManager.Instance.playerInfo.PlayerType || shopItemList[i].Item.PlayerType == PlayerTypes.Commom)) { shopList.AddChild(shopItemList[i]); } } } }
protected override void OnShown() { m_copyBtn = contentPane.GetChild("copy_btn").asButton; m_copyBtn.onClick.Set(OckCopy); m_closeBtn = contentPane.GetChild("close_btn").asButton; m_closeBtn.onClick.Set(Hide); m_list = contentPane.GetChild("list").asList; m_list.RemoveChildrenToPool(); m_listItem = m_list.GetFromPool("").asCom; m_list.AddChild(m_listItem); m_typeController = contentPane.GetController("type"); }
protected override void OnShown() { m_minimizeBtn = contentPane.GetChild("minimize_btn").asButton; m_minimizeBtn.onClick.Set(OckMinimize); m_minimizeBtn.selected = manager.settingConfig.defaultMinimize; m_transparentBtn = contentPane.GetChild("transparent_btn").asButton; m_transparentBtn.onClick.Set(OckTransparent); m_transparentBtn.selected = manager.settingConfig.transparent; m_touchBtn = contentPane.GetChild("touch_btn").asButton; m_touchBtn.onClick.Set(OckTouch); m_touchBtn.selected = manager.settingConfig.touch; m_singleShowBtn = contentPane.GetChild("single_btn").asButton; m_singleShowBtn.onClick.Set(OckSingle); m_singleShowBtn.selected = manager.settingConfig.single; m_btnClose = contentPane.GetChild("title").asCom.GetChild("close_btn").asButton; m_btnClose.onClick.Set(OckClose); // list color m_colorList = contentPane.GetChild("color_list").asList; m_colorList.RemoveChildrenToPool(); var colorItem = m_colorList.GetFromPool("").asCom; m_colorImage = new GImage[m_maxColorCount]; m_colorBtn = new GButton[m_maxColorCount]; for (int i = 0; i < m_maxColorCount; i++) { var index = (i + 1).ToString(); m_colorImage[i] = colorItem.GetChild("color_" + index).asImage; m_colorBtn[i] = colorItem.GetChild("color_btn_" + index).asButton; m_colorBtn[i].data = i; m_colorBtn[i].onClick.Set(OckColor); if (manager.settingConfig.listFontColorIndex == i) { m_colorBtn[i].selected = true; } else { m_colorBtn[i].selected = false; } } m_colorList.AddChild(colorItem); }
void AddBuf(Protomsg.BuffDatas data) { var clientskill = ExcelManager.Instance.GetBuffIM().GetBIByID(data.TypeID); if (clientskill == null || clientskill.IconPath.Length <= 0) { return; } GComponent view = UIPackage.CreateObject("GameUI", "buf_icon").asCom; view.scale = new Vector2(0.7f, 0.7f); Bufs.AddChild(view); BufsRes[data.TypeID] = view; SetBufData(view, data); }
protected override void OnShown() { m_minimizeBtn = contentPane.GetChild("minimize_btn").asButton; m_minimizeBtn.onClick.Set(OckMinimize); m_minimizeBtn.selected = FastConsole.options.openState == OpenState.Minimize; m_transparentBtn = contentPane.GetChild("transparent_btn").asButton; m_transparentBtn.onClick.Set(OckTransparent); m_transparentBtn.selected = FastConsole.options.transparent; m_touchBtn = contentPane.GetChild("touch_btn").asButton; m_touchBtn.onClick.Set(OckTouch); m_touchBtn.selected = FastConsole.options.touchEnable; m_singleShowBtn = contentPane.GetChild("single_btn").asButton; m_singleShowBtn.onClick.Set(OckDetail); m_singleShowBtn.selected = FastConsole.options.detailEnable; m_btnClose = contentPane.GetChild("title").asCom.GetChild("close_btn").asButton; m_btnClose.onClick.Set(Hide); // list color m_colorList = contentPane.GetChild("color_list").asList; m_colorList.RemoveChildrenToPool(); var colorItem = m_colorList.GetFromPool("").asCom; m_colorBtn = new GButton[m_maxColorCount]; for (int i = 0; i < m_maxColorCount; i++) { var index = (i + 1).ToString(); colorItem.GetChild("color_" + index).asImage.color = FastConsole.options.colors[i]; m_colorBtn[i] = colorItem.GetChild("color_btn_" + index).asButton; m_colorBtn[i].data = i; m_colorBtn[i].onClick.Set(OckColor); if (FastConsole.options.colorIndex == i) { m_colorBtn[i].selected = true; } else { m_colorBtn[i].selected = false; } } m_colorList.AddChild(colorItem); }
/// <summary>展示卡牌收藏 /// /// </summary> public void ShowCardCollect() { cardcollect_UI.Show(); Debug.Log("展示卡牌收藏"); //TODO:隐藏地格渲染 mapcamera.SetActive(false); cardcollectionlist.RemoveChildren(0, -1, true); foreach (string cardId in playercardlist) { GObject item = UIPackage.CreateObject("CardCollection", "cardsSetsItem"); item.icon = UIPackage.GetItemURL(cardicons, cardId); cardcollectionlist.AddChild(item); } GButton closebtn = cardcollect_UI.contentPane.GetChild("Close").asButton; closebtn.onClick.Add(() => CloseCardCollect()); }
// Use this for initialization void Start() { FairyGUI.UIPanel fp = GameObject.Find("UIPanel").GetComponent <FairyGUI.UIPanel>(); mainPanel = fp.ui; infoList = mainPanel.GetChild("n2") as GList; for (int i = 0; i < 9; ++i) { GComponent item = UIPackage.CreateObject("fairy", "info") as GComponent; GTextField text = item.GetChild("info_text") as GTextField; GTextField text2 = item.GetChild("info_detail") as GTextField; text.text = "信息"; text2.text = "20"; infoList.AddChild(item); //infoList.AddChild(text2); } }
/// <summary> /// 显示技能列表信息 /// </summary> /// <param name="shopList"></param> public void SetSkillItemToList(GList skillList) { for (int i = 0; i < SkillItemList.Count; i++) { if (SkillItemList[i].SkillInfo.PlayerLevel > PlayerStatusManager.Instance.playerInfo.Lv) { SkillItemList[i].GetChild("icon").enabled = false; SkillItemList[i].onDragStart.Remove(OnDragStart); SkillItemList[i].draggable = false; } else { SkillItemList[i].GetChild("icon").enabled = true; SkillItemList[i].onDragStart.Add(OnDragStart); SkillItemList[i].draggable = true; } skillList.AddChild(SkillItemList[i]); } }
protected override void OnInit() { this.contentPane = UIPackage.CreateObject("Bag", "BagWin").asCom; this.Center(); this.modal = true; _list = this.contentPane.GetChild("list").asList; _list.onClickItem.Add(__clickItem); _list.itemRenderer = RenderListItem; // 设置30的时候生成了GButton对象 _list.numItems = 30; //GButton._iconObject 是一个继承了GLoader的资源加载对象,这里修改icon 等于 修改url 开始资源加载 GButton button = (GButton)_list.GetFromPool(null);// 在做UI的时候有默认的item,所以这里直接传入null Debug.Log("开始设置了i9 图标"); button.icon = "i" + 9; Debug.Log("设置了i9 图标"); button.title = "" + 101; _list.AddChild(button); }
protected override void OnShown() { m_minimizeBtn = contentPane.GetChild("minimize_btn").asButton; m_minimizeBtn.onClick.Set(OckMinimize); m_minimizeBtn.selected = FastConsole.options.openState == OpenState.Minimize; m_transparentBtn = contentPane.GetChild("transparent_btn").asButton; m_transparentBtn.onClick.Set(OckTransparent); m_transparentBtn.selected = FastConsole.options.transparent; m_touchBtn = contentPane.GetChild("touch_btn").asButton; m_touchBtn.onClick.Set(OckTouch); m_touchBtn.selected = FastConsole.options.touchEnable; m_singleShowBtn = contentPane.GetChild("single_btn").asButton; m_singleShowBtn.onClick.Set(OckDetail); m_singleShowBtn.selected = FastConsole.options.detailEnable; m_systemInfoBtn = contentPane.GetChild("systeminfo_btn").asButton; m_systemInfoBtn.onClick.Set(OckSystemInfo); m_systemInfoBtn.selected = FastConsole.options.systemInfoEnable; m_btnClose = contentPane.GetChild("title").asCom.GetChild("close_btn").asButton; m_btnClose.onClick.Set(Hide); // list color m_colorList = contentPane.GetChild("color_list").asList; m_colorList.RemoveChildrenToPool(); var colorItem = m_colorList.GetFromPool("").asCom; m_colorBtn = new GButton[m_maxColorCount]; for (int i = 0; i < m_maxColorCount; i++) { var index = (i + 1).ToString(); colorItem.GetChild("color_" + index).asImage.color = FastConsole.options.colors[i]; m_colorBtn[i] = colorItem.GetChild("color_btn_" + index).asButton; m_colorBtn[i].data = i; m_colorBtn[i].onClick.Set(OckColor); if (FastConsole.options.colorIndex == i) { m_colorBtn[i].selected = true; } else { m_colorBtn[i].selected = false; } } m_colorList.AddChild(colorItem); m_layoutController = contentPane.GetController("layout"); if (FastConsole.options.miniLayout == MiniLayout.LEFT_TOP) { m_layoutController.SetSelectedIndex(0); } else if (FastConsole.options.miniLayout == MiniLayout.RIGHT_TOP) { m_layoutController.SetSelectedIndex(1); } else if (FastConsole.options.miniLayout == MiniLayout.RIGHT_BOTTOM) { m_layoutController.SetSelectedIndex(2); } else if (FastConsole.options.miniLayout == MiniLayout.LEFT_BOTTOM) { m_layoutController.SetSelectedIndex(3); } m_layoutLeftTop = contentPane.GetChild("btn_left_top").asButton; m_layoutLeftTop.onClick.Set(OckLayoutLeftTop); m_layoutLeftBottom = contentPane.GetChild("btn_right_top").asButton; m_layoutLeftTop.onClick.Set(OckLayoutLeftBottom); m_layoutRightTop = contentPane.GetChild("btn_left_bottom").asButton; m_layoutLeftTop.onClick.Set(OckLayoutRightTop); m_layoutRightBottom = contentPane.GetChild("btn_right_bottom").asButton; m_layoutLeftTop.onClick.Set(OckLayoutRightBottom); }