// 点击卡牌响应 void OnClickItem(object sender, EventArgs e) { GameObject obj = (GameObject)sender; Parma param = obj.GetComponent <Parma>(); Debug.Log("点击的道具的格子ID 为:" + param.m_id); // 扩容 if (-1 == param.m_id) { ExpandBag.Singleton.ShowExpandBag(); } else { if (!param.m_guid.Equals(CSItemGuid.Zero)) { m_seleteCardObj = obj; Transform seleteItem = obj.transform.Find("Item"); if (null != seleteItem) { Transform seleteTra = seleteItem.transform.Find("cardSelect"); if (null != seleteTra) { seleteTra.gameObject.SetActive(true); } } CardBag.Singleton.OnShowCardOption(param.m_guid); } } }
void OnFriendListClickLongPressCard(object sender, EventArgs e) { GameObject obj = (GameObject)sender; Parma parma = obj.transform.parent.GetComponent <Parma>(); CSItem card = new CSItem(); FriendItem tmpFriendItem; if (FriendList.Singleton.m_friendListType == FriendList.EDITTYPE.enFriendList) { if (FriendList.Singleton.m_sortFriendList != null) { tmpFriendItem = (FriendItem)FriendList.Singleton.m_sortFriendList[parma.m_id]; card = tmpFriendItem.GetItem(); } else { tmpFriendItem = (FriendItem)FriendList.Singleton.m_friendInfoList[parma.m_id]; card = tmpFriendItem.GetItem(); } } else if (FriendList.Singleton.m_friendListType == FriendList.EDITTYPE.enApplyList) { ; } FriendList.Singleton.OnShowCardDetail(card); }
void OnFriendListClickCard(object sender, EventArgs e) { GameObject obj = (GameObject)sender; Parma parma = obj.transform.parent.GetComponent <Parma>(); Debug.Log("OnClickCard---------------------" + parma.m_id); }
public override void OnInit() { base.OnInit(); m_headImage = FindChildComponent <UITexture>("CardHead"); m_param = FindChildComponent <Parma>("DragCardItemBG"); m_level = FindChildComponent <UILabel>("Level"); m_chosen = FindChild("Chosen"); m_love = FindChildComponent <UISprite>("Love"); m_defaultHead = FindChildComponent <UISprite>("defaultHead"); m_occ = FindChildComponent <UITexture>("Occupation"); m_rarity = FindChildComponent <UITexture>("Rarity"); m_bg = FindChild("DragCardItemBG"); m_tag = FindChildComponent <UISprite>("tag"); m_shadow = FindChild("Shadow"); m_break = FindChildComponent <UILabel>("Break"); m_tips = FindChild("Tips"); m_mask = FindChild("mask"); }
// 点击战友头像 void OnClickHelpPic(object obj, EventArgs e) { GameObject gameObj = (GameObject)obj; Parma param = gameObj.transform.parent.GetComponent <Parma>(); UIRepresentativeCard.GetInstance().ShowGUID(param.m_id, UIRepresentativeCard.ENOptType.enRepreType); }
void OnClickLongPressPlayer(object sender, EventArgs e) { GameObject gameObj = (GameObject)sender; Parma param = gameObj.transform.parent.GetComponent <Parma>(); UIRepresentativeCard.GetInstance().ShowGUID(param.m_id, UIRepresentativeCard.ENOptType.enFriendType); }
// 长按 响应 void OnClickLongPressItem(object sender, EventArgs e) { GameObject obj = (GameObject)sender; Parma param = obj.GetComponent <Parma>(); if (param.m_guid.Equals(CSItemGuid.Zero)) { return; } Debug.Log("OnClickLongPressItem点击的道具的格子ID 为:" + param.m_id); // 扩容 if (-1 == param.m_id) { } else { CardBag.Singleton.m_curOptinGuid = param.m_guid; UICardDetail.GetInstance().SetPreCallback(PreCardDetail); UICardDetail.GetInstance().SetNextCallback(NextCardDetail); CardBag.Singleton.OnShowCardDetail(); } }
public override void OnInit() { base.OnInit(); m_lock = FindChild("Lock"); m_frame = FindChildComponent <UITexture>("Frame"); m_button = FindChild("Button"); m_param = FindChildComponent <Parma>("Button"); }
public void SetFriendItemParamID(int index) { Parma param = this.WindowRoot.transform.GetComponent <Parma>(); param.m_id = index; string showNumStr = index.ToString("00000"); SetFriendItemName(showNumStr); SetLocalScale(Vector3.one); }
// 选择 public void OnChoose(GameObject obj) { Parma param = obj.GetComponent <Parma>(); Debug.Log("OnChoose 选择卡牌角色 :" + param.m_id); m_choose.SetActive(false); UpdateCardInfo(param.m_id); }
public void NewCard(int cardId) { HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(cardId); if (null == info) { Debug.Log("UIChooseCard NewCard HeroInfo 表数据没有 ID 为:" + cardId); return; } GameObject item = null; if (m_itemList.ContainsKey(cardId)) { item = m_itemList[cardId]; } else { item = GameObject.Instantiate(m_cardItem) as GameObject; item.gameObject.SetActive(true); // 设置 父物体 item.transform.parent = FindChildComponent <UIGrid>("Grid").transform; // 设置大小 item.transform.localScale = m_cardItem.transform.localScale; Parma param = item.transform.Find("Button").GetComponent <Parma>(); param.m_id = cardId; // 设置按钮名称 item.transform.Find("Button").name = cardId.ToString(); m_itemList.Add(cardId, item); } // 设置图片 UITexture cardBg = item.transform.Find("CardBG").GetComponent <UITexture>(); IconInfomation iconInfo = GameTable.IconInfoTableAsset.Lookup(info.ImageId); if (null != iconInfo) { cardBg.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName); } UILabel cardName = item.transform.Find("CardName").GetComponent <UILabel>(); cardName.text = info.StrName; AddChildMouseClickEvent(cardId.ToString(), OnChoose); }
//点击FriendItem人物信息回调 public void OnClickPlayer(object sender, EventArgs e) { GameObject obj = (GameObject)sender; Parma parma = obj.transform.parent.GetComponent <Parma>(); Debug.Log("OnClickIPlayer---------------------" + parma.m_id); UIFriendItem friendItem = CreateFriendItemPrefab((FriendItem)FriendList.Singleton.m_friendInfoList[parma.m_id]); UIFriendMessageBox.GetInstance().InsertUIWnd(friendItem); UIFriendMsgBoxCfg FriendboxCfg = FindChild("InnerFrame").GetComponent <UIFriendMsgBoxCfg>(); UIFriendCfgItem friendCfgItem = FriendboxCfg.ItemList[0]; UIFriendMessageBox.GetInstance().ShowMsgBox(OnButtonYes, OnButtonNo, OnButtonRefuserBtn, friendCfgItem); }
// 显示Tips void OnShowTips() { Parma param = UIEventTrigger.current.gameObject.GetComponent <Parma>(); if (null == param) { return; } m_tips.gameObject.SetActive(true); // 更新 UpdateTipsInfo(param.m_id); }
// 添加 队伍索引按钮 void AddTeamIndexItem() { for (int i = 0; i < m_teamIndexList.Count; i++) { m_teamIndexList[i].SetActive(false); } GameObject obj = null; for (int i = 0; i < Team.Singleton.TeamNum; i++) { // 如果不存在 则创建 if (false == m_teamIndexList.ContainsKey(i)) { obj = GameObject.Instantiate(m_teamIndexItem.gameObject) as GameObject; obj.transform.parent = m_teamIndexItem.transform.parent; obj.transform.localScale = m_teamIndexItem.transform.localScale; obj.transform.localRotation = m_teamIndexItem.transform.localRotation; obj.transform.localPosition = m_teamIndexItem.transform.localPosition; obj.name = obj.name + i; AddChildMouseClickEvent(obj.name, OnChangTeam); m_teamIndexList.Add(i, obj); } obj = m_teamIndexList[i].gameObject; Parma parma = obj.GetComponent <Parma>(); parma.m_id = i; obj.SetActive(true); obj.GetComponent <UIToggle>().value = Team.Singleton.m_curTeamIndex == i; // 设置职业图标 CSItem card = Team.Singleton.GetCard(i, Team.EDITTYPE.enMain); if (null != card) { HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable); if (null != info) { OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(info.Occupation); IconInfomation iconInfo = GameTable.IconInfoTableAsset.Lookup(occupationInfo.m_iconId); obj.transform.Find("OccPic").GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName); } } else { obj.transform.Find("OccPic").GetComponent <UITexture>().mainTexture = null; } } }
// 长按 显示卡牌详细界面 void OnClickLongPressItem(object sender, EventArgs e) { GameObject obj = (GameObject)sender; Parma param = obj.GetComponent <Parma>(); if (param.m_guid.Equals(CSItemGuid.Zero)) { return; } UICardDetail.GetInstance().SetPreCallback(PreCardDetail); UICardDetail.GetInstance().SetNextCallback(NextCardDetail); // 显示只显示返回按钮的 卡牌详细界面 CardBag.Singleton.OnShowCardDetail(CardBag.Singleton.GetCardByGuid(param.m_guid), true); }
// 选择helper响应 void OnChooseHelper(GameObject sender) { Parma parma = sender.GetComponent <Parma>(); Helper helper = User.Singleton.HelperList.LookupHelper(parma.m_id); if (null == helper) { return; } StageMenu.Singleton.m_curHelperGuid = helper.m_userGuid; // 更新模型相关信息 UpdateHelperModel(); }
void OnFriendListClickLongPressPlayer(object sender, EventArgs e) { GameObject gameObj = (GameObject)sender; Parma param = gameObj.transform.parent.GetComponent <Parma>(); //UIRepresentativeCard.GetInstance().ShowGUID(param.m_id, UIRepresentativeCard.ENOptType.enFriendType); FriendItem tmpFriendItem = null; if (FriendList.Singleton.m_sortFriendList != null) { tmpFriendItem = (FriendItem)FriendList.Singleton.m_sortFriendList[param.m_id]; } else { tmpFriendItem = (FriendItem)FriendList.Singleton.m_friendInfoList[param.m_id]; } UIRepresentativeCard.GetInstance().ShowFriendPlayerInfo(tmpFriendItem); }
// 材料列表中的 取消按钮 void OnCancelDataCard(object sender, EventArgs e) { GameObject obj = (GameObject)sender; GameObject parent = obj.transform.parent.gameObject; Parma param = parent.GetComponent <Parma>(); if (null == param) { return; } OperateCardList.Singleton.RemoveLevelUpDataItem(param.m_guid); UpdateInfo(); }
void OnChangTeam(GameObject obj) { Parma parma = obj.GetComponent <Parma>(); if (Team.Singleton.m_curTeamIndex == parma.m_id) { return; } Team.Singleton.m_curTeamIndex = parma.m_id; // Debug.Log("Team.Singleton.m_curTeamIndex:" + Team.Singleton.m_curTeamIndex); // 激活 删除队伍按钮 UpdateInfo(); }
void OnClickCardImage(object sender, EventArgs e) { GameObject obj = (GameObject)sender; Parma param = obj.GetComponent <Parma>(); if (param.m_type == (int)ENGainLevel.enNone) { return; } if (null == param) { return; } CSItem card = new CSItem(); card.m_id = (short)param.m_id; card.Level = 1; card.isCheckSkill = false; CardBag.Singleton.OnShowCardDetail(card, true); }
// 点击 道具的响应 void OnClickItem(object sender, EventArgs e) { GameObject obj = (GameObject)sender; int index = int.Parse(obj.transform.parent.name); if (!m_gridList.ContainsKey(index)) { return; } Parma parma = obj.GetComponent <Parma>(); OperateCardList.Singleton.m_curChooseItemGuid = parma.m_guid; // 掉相对应的点击回调函数 if (m_clickList.ContainsKey(OperateCardList.Singleton.m_curType) && m_clickList[OperateCardList.Singleton.m_curType] != null) { m_clickList[OperateCardList.Singleton.m_curType](m_gridList[index], m_cardSortUI.GetLastSortType()); } UpdateInfo(); }
void UpdateInfo() { UpdateCardInfo(); // 如果 升级卡牌 无效则 清空相关UI if (CardUpdateProp.Singleton.m_curLevelGuid.Equals(CSItemGuid.Zero)) { // 隐藏材料 列表 for (int i = 0; i < m_listMax; i++) { Parma parma = FindChildComponent <Parma>("" + i); if (null == parma) { continue; } parma.m_guid = CSItemGuid.Zero; parma.gameObject.SetActive(false); } } // 选择数 m_chosen.text = string.Format(Localization.Get("ChooeseNum"), OperateCardList.Singleton.LevelUpList.Count); // 持有数 m_hold.text = CardBag.Singleton.itemList.Count + "/" + CardBag.Singleton.GetBagCapcity(); // 升级的 基本卡牌 CSItem card = CardBag.Singleton.GetCardByGuid(CardUpdateProp.Singleton.m_curLevelGuid); if (null == card) { return; } HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable); if (null == info) { return; } IconInfomation imageInfo = GameTable.IconInfoTableAsset.Lookup(info.ImageId); if (null == imageInfo) { return; } LevelUpInfo levInfo = GameTable.LevelUpTableAsset.LookUp(card.Level); if (null == levInfo) { return; } // 记录升级前的各种数据 用于升级后的显示 CardUpdateProp.Singleton.SetOldData(); float process = (float)card.Exp / (float)levInfo.Monster_Exp; m_processBar.value = process; m_expPercent.text = card.Exp * 100 / levInfo.Monster_Exp + "%"; m_cardBG.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(imageInfo.dirName); m_levelTips.text = "LV" + card.Level; m_tupoCounts.text = "" + (info.BreakThroughCount - card.BreakCounts); // 需消耗的金币 int money = card.Level * OperateCardList.Singleton.LevelUpList.Count; m_costMoney.text = "" + money; // 持有金币 m_myMoney.text = "" + User.Singleton.GetMoney(); if (money > User.Singleton.GetMoney()) { m_costMoney.color = Color.red; } else { m_costMoney.color = Color.white; } // 基本卡牌的 int baseCardId = card.IDInTable; int index = 0; bool bBreak = false; // 是否显示突破信息 bool bWarning = false; // 是否显示提示有三星以上卡牌 作为材料 // 材料所提供的经验 int supplyExp = 0; // 将要突破的次数 int willBreakCounts = 0; // 材料卡牌列表 foreach (CSItemGuid item in OperateCardList.Singleton.LevelUpList) { // Parma parma = FindChildComponent <Parma>("" + index); if (null == parma) { continue; } GameObject obj = parma.gameObject; obj.SetActive(true); card = CardBag.Singleton.GetCardByGuid(item); if (null == card) { continue; } // 如果材料卡牌和 基本卡牌一样的 则 显示界限突破 信息 if (card.IDInTable == baseCardId) { bBreak = true; willBreakCounts++; } info = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable); if (null == info) { continue; } // 如果是三星以上卡牌 if (info.Rarity >= 3) { bWarning = true; } // guid parma.m_guid = item; imageInfo = GameTable.IconInfoTableAsset.Lookup(info.headImageId); // 提供的经验 supplyExp = supplyExp + CardUpdateProp.Singleton.GetCardExpByLevel((int)card.IDInTable, card.Level); if (null == imageInfo) { continue; } // 头像 obj.transform.Find("Image").GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(imageInfo.dirName); RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(info.Rarity); if (null != rarityInfo) { imageInfo = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId); // 星级 obj.transform.Find("Rank").GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(imageInfo.dirName); } // 名称 obj.transform.Find("Name").GetComponent <UILabel>().text = info.StrName; // 等级 obj.transform.Find("Level").GetComponent <UILabel>().text = "" + card.Level; index++; } // 三星材料卡提示 m_warning.gameObject.SetActive(bWarning); // 升级后的 等级 int afterLV = 0; // 升级后的经验 int afterExp = 0; card = CardBag.Singleton.GetCardByGuid(CardUpdateProp.Singleton.m_curLevelGuid); CardUpdateProp.Singleton.GetLevelUpLVExp(card, supplyExp, willBreakCounts, out afterLV, out afterExp); // 经验 // 只显示 当前经验 并不播放动画 if (afterLV == 0) { m_levelBefore.gameObject.SetActive(true); m_levelBefore.GetComponent <Animation>().Stop(); Color color = Color.white; color.a = 1; m_levelBefore.color = color; m_levelBefore.GetComponent <TweenAlpha>().enabled = false; m_levelAfter.gameObject.SetActive(false); } // 当前经验和 升级后的经验 同时播放动画 else { // m_levelBefore.animation.Play("ui-cardstate-00"); // m_levelAfter.animation.Play("ui-cardstate-01"); m_levelBefore.GetComponent <TweenAlpha>().enabled = true; levInfo = GameTable.LevelUpTableAsset.LookUp(afterLV); int afterMaxExp = levInfo.Monster_Exp; int per = afterExp * 100 / afterMaxExp; m_levelAfter.gameObject.transform.Find("LevelTipsAfter").GetComponent <UILabel>().text = Localization.Get("CardLevel") + afterLV; if (per >= 100) { per = 100; } m_levelAfter.gameObject.transform.Find("LevelPercentAfter").GetComponent <UILabel>().text = per + "%"; m_levelAfter.gameObject.transform.Find("ExpAfter").GetComponent <UISlider>().value = ((float)per) / 100f; m_levelAfter.gameObject.SetActive(true); } // 突破信息显示 m_break.gameObject.SetActive(bBreak); // 隐藏其余的 列表 for (; index < m_listMax; index++) { Parma parma = FindChildComponent <Parma>("" + index); if (null == parma) { continue; } parma.m_guid = CSItemGuid.Zero; parma.gameObject.SetActive(false); } // 是否激活合成按钮 条件 是 基本卡可强化 有材料 够金钱 m_levelUpBtn.isEnabled = (OperateCardList.Singleton.LevelUpList.Count > 0) /*&&(money <= User.Singleton.GetMoney())*/; // 进化合成按钮是否激活 m_evolution.isEnabled = card.IsEvlotion(); m_grid.Reposition(); // 计算消耗金钱 // 把列表位置 提到最上面 m_listPanel.transform.Find("Progress").GetComponent <UIProgressBar>().value = 0; }
void UpdateCardInfo(int cardId) { Debug.Log("UpdateCardInfo:" + cardId); m_cardDetail.SetActive(true); HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(cardId); if (null == heroInfo) { return; } Login.Singleton.m_curCardId = cardId; IconInfomation iconInfo = GameTable.IconInfoTableAsset.Lookup(heroInfo.ImageId); m_infoName.text = heroInfo.StrName; RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(heroInfo.Rarity); IconInfomation icon = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId); m_star.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName); m_cardPic.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName); OccupationInfo occInfo = GameTable.OccupationInfoAsset.LookUp(heroInfo.Occupation); RaceInfo raceInfo = GameTable.RaceInfoTableAsset.LookUp(heroInfo.Type); m_infoOp.text = occInfo.m_name; m_ocInfo.text = occInfo.m_name; m_raceInfo.text = raceInfo.m_name; m_ocDetail.text = occInfo.m_describe; int i = 0; List <int> skillIDList = heroInfo.GetAllSkillIDList(); foreach (int skillId in skillIDList) { SkillInfo skillInfo = GameTable.SkillTableAsset.Lookup(skillId); if (null == skillInfo || 0 != skillInfo.SkillType) { continue; } iconInfo = GameTable.IconInfoTableAsset.Lookup(skillInfo.Icon); if (iconInfo == null) { Debug.LogWarning("iconInfo 为空 skillId:" + skillId + ",skillInfo.Icon:" + skillInfo.Icon); continue; } if (m_skillList.ContainsKey(skillId)) { GameObject obj = m_skillList[skillId]; obj.SetActive(true); obj.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName); Parma parma = obj.GetComponent <Parma>(); parma.m_id = skillId; } else { GameObject copy = GameObject.Instantiate(m_skillItem.gameObject) as GameObject; copy.transform.parent = m_skillParent.transform; copy.transform.localScale = m_skillItem.transform.localScale; copy.gameObject.SetActive(true); copy.transform.LocalPositionX(0 + i * 90f); copy.transform.LocalPositionY(-45f); copy.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName); copy.name = copy.name + i; Parma parma = copy.GetComponent <Parma>(); parma.m_id = skillId; EventDelegate.Add(copy.GetComponent <UIEventTrigger>().onPress, OnShowTips); AddChildMouseClickEvent(copy.name, OnHideTips); m_skillList.Add(skillId, copy); } i++; } }