/// <summary> /// 打开确认面板 /// </summary> /// <param name="type">操作类型</param> public void OpenConfim(MsgProduceConfim confim)//消耗数据 { ProduceOrder type = confim.OrderType; m_SelectProduceTid = confim.Tid; switch (type) { case ProduceOrder.Produce: //生产 m_ReturnTitle.text = string.Format(TableUtil.GetLanguageString("production_text_1025"), TableUtil.GetItemName(m_FoundryProxy.GetItemByProduceKey(m_SelectProduceTid).Id)); m_HintLabel.text = ""; break; case ProduceOrder.Canel: //取消生产 m_ReturnTitle.text = TableUtil.GetLanguageString("production_text_1026"); m_HintLabel.text = TableUtil.GetLanguageString("production_text_1041"); m_IconList.Clear(); Item[] items = m_FoundryProxy.GetEffectItem(m_SelectProduceTid); EffectElement?[] effects = m_FoundryProxy.GetEffectElementsByProduceTid(m_SelectProduceTid); for (int i = 0; i < items.Length; i++) { IconManager.Instance.LoadItemIcon <IconCommon>(IconConstName.ICON_COMMON, m_ReturnItemRoot, (icon) => { m_IconList.Add(icon); icon.SetData(TableUtil.GetItemIconTid(items[i].Id), items[i].Quality, (int)effects[i].Value.Value); }); } break; case ProduceOrder.Recevie: //领取 不要图标 m_ReturnTitle.text = TableUtil.GetLanguageString("production_text_1028"); m_HintLabel.text = ""; break; case ProduceOrder.SpeedUp: //加速 m_ReturnTitle.text = TableUtil.GetLanguageString("production_text_1027"); m_HintLabel.text = TableUtil.GetLanguageString("production_text_1040"); m_IconList.Clear(); IconManager.Instance.LoadItemIcon <IconCommon>(IconConstName.ICON_COMMON, m_ReturnItemRoot, (icon) => { m_IconList.Add(icon); icon.SetData(TableUtil.GetItemIconTid(GameConstant.CurrencyConst.RECHARGE_CURRENCY_ITEM_TID), TableUtil.GetItemQuality(GameConstant.CurrencyConst.RECHARGE_CURRENCY_ITEM_TID), (int)confim.ExpendNum); }); break; default: break; } }
/// <summary> /// 填充数据 /// </summary> public void SetData(ProduceInfoVO infoVO, ProduceType produceType, UIViewListLayout style = UIViewListLayout.Row) { if (infoVO.TID > 0) { m_Style = style; m_TID = infoVO.TID; m_ProduceType = produceType; m_CurrentItem = m_FoundryProxy.GetItemByProduceKey(m_TID); m_CurrentProduce = m_FoundryProxy.GetProduceByKey(m_TID); m_ProduceInfoVO = infoVO; RefreshData(infoVO.Progress, infoVO.BluePrintState); SetContent(); } }
/// <summary> /// 查找可以比较的数据 /// </summary> /// <param name="data">当前数据</param> /// <param name="compareableDatas">可参与比较的数据列表</param> protected override void FindCompareableData(object data, List <object> compareableDatas) { base.FindCompareableData(data, compareableDatas); if (data == null) { return; } if (!(data is ItemBase)) { return; } ItemBase item = data as ItemBase; if (item.MainType != Category.Blueprint && item.MainType != Category.Warship && item.MainType != Category.Weapon && item.MainType != Category.Reformer && item.MainType != Category.Equipment) { return; } //当前角色的包 ItemContainer container = GetPackage().GetHeroItem(); if (container == null || container.Items == null || container.Items.Count == 0) { return; } //当前出战的飞船 ItemWarShipVO ship = null; foreach (ItemBase heroItem in container.Items.Values) { if (heroItem is ItemWarShipVO) { ship = heroItem as ItemWarShipVO; break; } } //当前是飞船 if (item.MainType == Category.Warship) { if (item != ship) { compareableDatas.Add(ship); } } //当前是飞船的蓝图 else if (item.MainType == Category.Blueprint && (item as ItemDrawingVO).DrawingType == BlueprintL1.Warship) { compareableDatas.Add(ship); } else { IShip iship = (GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy).GetAppointWarShip(); Category mainType = item.MainType; Enum secondaryType = null; if (item is ItemDrawingVO) { ItemDrawingVO blueprint = item as ItemDrawingVO; switch (blueprint.DrawingType) { case BlueprintL1.Weapon: mainType = Category.Weapon; break; case BlueprintL1.Reformer: mainType = Category.Reformer; break; case BlueprintL1.Equipment: FoundryProxy foundryProxy = GameFacade.Instance.RetrieveProxy(ProxyName.FoundryProxy) as FoundryProxy; Item product = foundryProxy.GetItemByProduceKey((int)blueprint.TID); mainType = Category.Equipment; secondaryType = (Enum)ItemTypeUtil.GetItemType(product.Type).EnumList[2]; break; } } else if (item is ItemEquipmentVO) { ItemEquipmentVO equip = item as ItemEquipmentVO; mainType = equip.MainType; secondaryType = equip.EquipmentType; } //武器 if (mainType == Category.Weapon) { ItemBase[] list = new ItemBase[iship.GetWeaponContainer().GetCurrentSizeMax()]; foreach (IWeapon weapon in iship.GetWeaponContainer().GetWeapons()) { list[weapon.GetPos()] = GetPackage().GetItem <ItemWeaponVO>(weapon.GetUID()); } compareableDatas.AddRange(list); } //转化炉 else if (mainType == Category.Reformer) { IReformer reformer = iship.GetReformerContainer().GetReformer(); if (reformer != null) { compareableDatas.Add(GetPackage().GetItem <ItemReformerVO>(reformer.GetUID())); } else { compareableDatas.Add(null); } } //装备 else if (mainType == Category.Equipment) { foreach (IEquipment equip in iship.GetEquipmentContainer().GetEquipments()) { ItemEquipmentVO equipVO = GetPackage().GetItem <ItemEquipmentVO>(equip.GetUID()); Enum type = equipVO.EquipmentType; if (Enum.Equals(type, secondaryType)) { compareableDatas.Add(equipVO); } } } } }