void _Packet(ScMazePropChange p) { if (m_labyrinthPropDic == null) { m_labyrinthPropDic = new Dictionary <ushort, PItem2>(); } if (!m_labyrinthPropDic.ContainsKey(p.propId)) { PItem2 newItem = PacketObject.Create <PItem2>(); newItem.itemTypeId = p.propId; newItem.num = p.num; m_labyrinthPropDic.Add(newItem.itemTypeId, newItem); } else { m_labyrinthPropDic[p.propId].num = p.num; //移除使用完了的道具 if (m_labyrinthPropDic[p.propId].num <= 0) { m_labyrinthPropDic.Remove(p.propId); } } DispatchModuleEvent(EventPropChange, m_labyrinthPropDic); }
private void OnSetItems(RectTransform node, PItem2 data) { if (data == null) { return; } var prop = ConfigManager.Get <PropItemInfo>(data.itemTypeId); if (prop == null) { Logger.LogError("propItemInfo do not have prop id={0}", data.itemTypeId); return; } if (!prop.IsValidVocation(modulePlayer.proto)) { return; } if (prop.itemType == PropType.Rune) { Util.SetItemInfo(node, prop, data.level, (int)data.num, false); } else { Util.SetItemInfo(node, prop, 0, (int)data.num, false); } }
public void Bind(Transform rRoot, PItem2 rItem) { if (rItem == null) { return; } var prop = ConfigManager.Get <PropItemInfo>(rItem.itemTypeId); var isPet = prop?.itemType == PropType.Pet; var petNode = rRoot.Find("pet"); var propNode = rRoot.Find("prop"); propNode?.SafeSetActive(!isPet); petNode?.SafeSetActive(isPet); if (!isPet) { Util.SetItemInfo(propNode, prop, rItem.level, (int)rItem.num, true, rItem.star); } else { var petInfo = Module_Pet.instance.GetPet(rItem.itemTypeId); if (petInfo == null) { return; } Util.SetPetInfo(petNode, petInfo); } }
private void RefreshRewardList(PReward reward, bool isWin) { if (reward == null) { return; } if (moduleGlobal.targetMatrial.isProcess) { target.Init(reward, moduleGlobal.targetMatrial); } List <PItem2> rewards = new List <PItem2>(); if (reward.diamond > 0) { PItem2 item = PacketObject.Create <PItem2>(); item.itemTypeId = (ushort)CurrencySubType.Diamond; item.num = (uint)reward.diamond; rewards.Add(item); } if (reward.rewardList != null && reward.rewardList.Length > 0) { rewards.AddRange(reward.rewardList); } if (isWin) { winReward.SetItems(rewards); } else { loseReward.SetItems(rewards); } }
private void OnDetectBtnClick(GameObject sender) { if (moduleBordlands.isHasAnyBoss) { moduleGlobal.ShowMessage(ConfigText.GetDefalutString(TextForMatType.BorderlandUIText, 34)); return; } PItem2 cost = moduleBordlands.detectCostDic.Get(moduleBordlands.currentDetectTimes); //次数满了 if (cost == null) { moduleGlobal.ShowMessage(ConfigText.GetDefalutString(TextForMatType.BorderlandUIText, 35)); return; } PropItemInfo prop = ConfigManager.Get <PropItemInfo>(cost.itemTypeId); if (prop == null) { Logger.LogError("detect cost type error,id = {0}", cost.itemTypeId); return; } uint remian = modulePlayer.GetMoneyCount((CurrencySubType)prop.subType); if (cost.num > remian) { moduleGlobal.ShowMessage(ConfigText.GetDefalutString(TextForMatType.BorderlandUIText, 36)); return; } moduleBordlands.SendRefreshBoss(); }
private void OnClickRewardItem(RectTransform node, PItem2 data) { if (data == null) { return; } moduleGlobal.UpdateGlobalTip(data.itemTypeId, true, false); }
private void SetFirstClick(RectTransform rt, PItem2 info) { if (info == null) { return; } moduleGlobal.UpdateGlobalTip(info, true, false); }
private void OnAddRewards() { if (m_allMails == null || m_allMails.Count < 1) { return; } m_allNoGetRewards.Clear(); noGetMailNum = 0; for (int i = 0; i < m_allMails.Count; i++) { if (m_allMails[i].attachment == null || m_allMails[i].attachment.Length < 1 || m_allMails[i].isGet == 1) { continue; } var items = m_allMails[i].attachment; for (int k = 0; k < items.Length; k++) { var prop = ConfigManager.Get <PropItemInfo>(items[k].itemTypeId); if (!prop || !prop.IsValidVocation(modulePlayer.proto)) { continue; } var m = m_allNoGetRewards.Find(p => p.itemTypeId == items[k].itemTypeId); if (m == null) { PItem2 newItme = null; items[k].CopyTo(ref newItme); m_allNoGetRewards.Add(newItme); } else { m.num += items[k].num; } } noGetMailNum++; } m_allNoGetRewards.Sort((a, b) => { var propA = ConfigManager.Get <PropItemInfo>(a.itemTypeId); var propB = ConfigManager.Get <PropItemInfo>(b.itemTypeId); if (propA == null || propB == null) { return(-1); } int result = propB.quality.CompareTo(propA.quality); if (result == 0) { result = a.itemTypeId.CompareTo(b.itemTypeId); } return(result); }); }
public void Bind(Transform rRoot, PItem2 rItem) { if (rItem == null) { return; } var prop = ConfigManager.Get <PropItemInfo>(rItem.itemTypeId); Util.SetItemInfo(rRoot, prop, rItem.level, (int)rItem.num, true, rItem.star); }
protected virtual void Awake() { if (m_item == null) { m_item = emptyItem.Clone(); } UpdateTexts(); UpdateItemInfo(); }
public void RefreshTip(PItem2 item, Action <PItem2> jump, bool drop)//普通 { IniteCompent(); m_item = item; _itemTypeId = item.itemTypeId; m_normalJump = jump; expRemainTime = -1; Refresh(item, drop); }
private bool ItemIsPet(PItem2 rItem) { if (rItem == null) { return(false); } var prop = ConfigManager.Get <PropItemInfo>(rItem.source != 0 ? rItem.source : rItem.itemTypeId); return(prop.itemType == PropType.Pet); }
private PItem2 GetMoneyPitem(int money, CurrencySubType currency) { if (money <= 0) { return(null); } PItem2 moneyItem = PacketObject.Create <PItem2>(); moneyItem.num = (uint)money; moneyItem.itemTypeId = (ushort)currency; return(moneyItem); }
private void Refresh(PItem2 item, bool drop) { Refresh(item.itemTypeId, drop, null, -1, true); var prop = ConfigManager.Get <PropItemInfo>(item.itemTypeId); Util.SetItemInfo(wupin, prop, item.level, Module_Cangku.instance.GetItemCount(item.itemTypeId), true, item.star); var ct = wupin.GetComponent <Text>("numberdi/count"); Util.SetText(ct, ConfigText.GetDefalutString(204, 30), Module_Cangku.instance.GetItemCount(item.itemTypeId)); }
public void Show(PItem2 rItem) { itemCache = rItem; gameObject.SetActive(true); var levelHome = Level.current as Level_Home; var pet = PetInfo.Create(ConfigManager.Get <PropItemInfo>(rItem.source != 0 ? rItem.source : rItem.itemTypeId)); if (pet != null) { levelHome?.CreatePet(pet); Util.SetText(NameText, pet.CPetInfo.itemNameId); } }
private void SetFirstReward(RectTransform rt, PItem2 info) { if (info == null) { return; } PropItemInfo prop = ConfigManager.Get <PropItemInfo>(info.itemTypeId); Util.SetItemInfo(rt, prop, info.level, (int)info.num, false, info.star); GameObject get = rt.Find("get").gameObject; GameObject light = rt.Find("light").gameObject; light.SafeSetActive(false); get.SafeSetActive(false); }
private void InitData() { currentReviveCostCount = 0; restReviveTip = ConfigText.GetDefalutString(TextForMatType.CombatUIText, 4); restCountTip = ConfigText.GetDefalutString(TextForMatType.CombatUIText, 6); var reviveCoin = ConfigManager.Find <PropItemInfo>( o => o.itemType == PropType.Sundries && o.subType == (int)SundriesSubType.Revive); if (reviveCoin) { m_reviveCoinItem = PacketObject.Create <PItem2>(); m_reviveCoinItem.itemTypeId = (ushort)reviveCoin.ID; m_reviveCoinItem.num = 1; } }
private void RefreshText() { m_detectBtn.interactable = false; m_restNumText.text = Util.Format(m_restNumTip, moduleBordlands.detectCostDic.Count - moduleBordlands.currentDetectTimes); uint remian = modulePlayer.GetMoneyCount(CurrencySubType.Diamond); m_remainText.text = Util.Format(m_remainTip, remian); PItem2 cost = moduleBordlands.detectCostDic.Get(moduleBordlands.currentDetectTimes); //次数满了 if (cost == null) { //读取上一条数据 PItem2 lastCost = moduleBordlands.detectCostDic.Get(moduleBordlands.currentDetectTimes - 1); if (lastCost != null) { string ss = Util.Format(ConfigText.GetDefalutString(TextForMatType.BorderlandUIText, 13), lastCost.num); Util.SetText(m_costNumText, lastCost.num <= remian ? ss : GeneralConfigInfo.GetNoEnoughColorString(ss)); m_detectBtn.interactable = false; } return; } PropItemInfo prop = ConfigManager.Get <PropItemInfo>(cost.itemTypeId); if (prop == null) { Logger.LogError("detect cost type error,id = {0}", cost.itemTypeId); return; } AtlasHelper.SetCurrencyIcon(m_costImage, (CurrencySubType)prop.subType); remian = modulePlayer.GetMoneyCount((CurrencySubType)prop.subType); Util.SetText(m_remainText, m_remainTip, remian); bool detectBtnVisible = cost.num <= remian && !moduleBordlands.isHasAnyBoss; m_detectBtn.interactable = detectBtnVisible; string str = Util.Format(ConfigText.GetDefalutString(TextForMatType.BorderlandUIText, 13), cost.num); Util.SetText(m_costNumText, cost.num <= remian ? str : GeneralConfigInfo.GetNoEnoughColorString(str)); }
private void ShowItem(PItem2 item) { AudioManager.PlaySound(AudioInLogicInfo.audioConst.cardOpen); currentShowItem = item; isPlaying = true; foreach (var tupe in handler) { if (tupe.Item1(currentShowItem)) { if (tupe.Item2 != null) { tupe.Item2.Show(currentShowItem); tupe.Item2.OnBack = ItemShowEnd; return; } } } ItemShowEnd(); }
private void OnSetRewardItem(RectTransform node, PItem2 data) { if (data == null) { return; } var prop = ConfigManager.Get <PropItemInfo>(data.itemTypeId); if (prop == null) { return; } else if (prop.itemType == PropType.Rune) { Util.SetItemInfo(node, prop, data.level, (int)data.num, true, data.star); } else { Util.SetItemInfo(node, prop, 0, (int)data.num, false); } Util.SetText(node.Find("name")?.GetComponent <Text>(), ""); }
private void OnSetData(RectTransform node, PItem2 data) { Util.SetItemInfo(node, ConfigManager.Get <PropItemInfo>(data.itemTypeId), 0, (int)data.num, false); }
private void OnItemClick(RectTransform node, PItem2 data) { Module_Global.instance.UpdateGlobalTip(data, false); }
public void Show(PItem2 i) { item = i; Show(); }
public bool OpenRevivePanel() { if (modulePVE.isStandalonePVE && (modulePVE.rebornItemDic == null || !modulePVE.canRevive || modulePVE.rebornItemDic.Count <= 0)) { return(false); } PItem2 reviveItem = null; int reviveCoin = m_reviveCoinItem != null?moduleEquip.GetPropCount(m_reviveCoinItem.itemTypeId) : 0; if (reviveCoin > 0) { reviveItem = m_reviveCoinItem; } if (reviveItem == null) { reviveItem = modulePVE.rebornItemDic.Get(modulePVE.currentReviveTimes); } if (reviveItem == null) { return(false); } currentReviveCostCount = (int)reviveItem.num; SetPanelVisible(true); //替换公共图片 var info = ConfigManager.Get <PropItemInfo>(reviveItem.itemTypeId); if (info.itemType == PropType.Currency) { AtlasHelper.SetCurrencyIcon(m_costIcon, (CurrencySubType)info.subType); } else { AtlasHelper.SetIcons(m_costIcon, info.icon); } Util.SetText(m_contentText, (int)TextForMatType.CombatUIText, 3, info.itemName); int hasReviveCostCount = 0; if (info.itemType == PropType.Currency) { hasReviveCostCount = info.subType == (byte)CurrencySubType.Diamond ? (int)modulePlayer.roleInfo.diamond : (int)modulePlayer.roleInfo.coin; } else if (info.itemType == PropType.Sundries && info.subType == (int)SundriesSubType.Revive) { hasReviveCostCount = reviveCoin; } else { hasReviveCostCount = moduleEquip.GetPropCount(info.ID); } m_restReviveText.text = string.Format(restReviveTip, (modulePVE.maxReviveTimes - modulePVE.currentReviveTimes)); m_costCountText.text = string.Format(restCountTip, currentReviveCostCount, hasReviveCostCount); bool isReviveBtnEnable = hasReviveCostCount >= currentReviveCostCount && modulePVE.canRevive; m_reviveBtn.SetInteractable(isReviveBtnEnable); //组队模式不暂停AI if (!modulePVE.isTeamMode) { moduleAI.SetAllAIPauseState(true); } return(true); }
private bool IsSSS(PItem2 arg) { var item = m_msgCache.items.Find(p => p.item.itemTypeId.Equals(arg?.itemTypeId)); return(item != null && item.sss); }
private void SetLevelReward(RectTransform rt, PWeflareAward info) { if (info == null) { return; } Text upTitleTxt = rt.transform.Find("title_Txt").GetComponent <Text>(); Text upDesc = rt.transform.Find("des_Txt").GetComponent <Text>(); GameObject upContent = rt.transform.Find("content").gameObject; GameObject upProp = rt.transform.Find("content/0").gameObject; Button getBtn = rt.transform.Find("get_Btn").GetComponent <Button>(); Text getBtnTxt = rt.transform.Find("get_Btn/get_Txt").GetComponent <Text>(); upDesc.text = info.desc; upDesc.SafeSetActive(true); upTitleTxt.text = info.rewardname; getBtn.onClick.RemoveAllListeners(); getBtn.onClick.AddListener(delegate { parentWindow.GetAward(info, info.index); }); parentWindow.SetBtnState(info.state, getBtn, getBtnTxt); List <Transform> contList = new List <Transform>(); contList.Clear(); foreach (Transform item in upContent.transform) { item.SafeSetActive(false); contList.Add(item); } if (info.reward.Length <= 0) { return; } var index = 0; for (int i = 0; i < info.reward.Length; i++) { if (index >= contList.Count || info.reward[i] == null) { continue; } PItem2 award = info.reward[i]; PropItemInfo prop = ConfigManager.Get <PropItemInfo>(award.itemTypeId); if (!prop || !prop.IsValidVocation(modulePlayer.proto)) { continue; } Util.SetItemInfo(contList[index], prop, award.level, (int)award.num, false, award.star); contList[index].SafeSetActive(true); if (moduleWelfare.chooseInfo?.type == (int)WelfareType.VictoryTimes) { PWeflareData dataProgress = null; if (info.reachnum != null && info.reachnum.Length > 0) { dataProgress = moduleWelfare.GetProgress(moduleWelfare.chooseInfo, info.reachnum[0].type); } if (dataProgress == null || info.reachnum[0] == null) { Util.SetText(upDesc, ConfigText.GetDefalutString(211, 21), "0"); } else { Util.SetText(upDesc, ConfigText.GetDefalutString(211, 21), moduleWelfare.ShowTxt(dataProgress, 3, info.reachnum[0].days)); } } else if (moduleWelfare.chooseInfo?.type == (int)WelfareType.WaitTime) { if (info.time < 0 || info.state != 0) { upDesc.SafeSetActive(false); } Util.SetText(upDesc, ConfigText.GetDefalutString(211, 22), Util.GetTimeMarkedFromSec(info.time)); } Button upBtn = contList[index].transform.GetComponentDefault <Button>(); upBtn.onClick.RemoveAllListeners(); upBtn.onClick.AddListener(delegate { moduleGlobal.UpdateGlobalTip(award, true, false); }); index++; } parentWindow.SetPostion(index, contList); }