private void UpdateSweepInfo() { CounterPartInfo info = StageDC.GetCounterPartInfo(); int times = StageDC.GetPassStageTimes(m_type, m_stageid); bool passed = times > 0; bool hasBoss = info.isboss > 0; bool isPVE = StageDC.GetPveMode() == PVEMode.Attack; // 是否需要显示扫荡UI bool activeSweepInfo = passed && hasBoss && isPVE; MyHead.SweepGroup.SetActive(activeSweepInfo); if (!activeSweepInfo) { return; } ItemTypeInfo sweepTicketInfo = ItemDC.GetSweepTickets(); int sweepTicketCount = sweepTicketInfo == null ? 0 : sweepTicketInfo.Num; MyHead.LblSweepTicket.text = string.Format("x{0}", sweepTicketCount); int sweepOnce = 1; int currentSweepMultiple = 0; if (info.type == (int)StageType.Normal) { currentSweepMultiple = 10; } else if (info.type == (int)StageType.Hard) { currentSweepMultiple = 3; } MyHead.LblSweepMultiple.text = string.Format(NGUIUtil.GetStringByKey(70000255), currentSweepMultiple); MyHead.LblSweepOnce.text = string.Format(NGUIUtil.GetStringByKey(70000256), sweepOnce); }
void Resweep(UIButton sender) { ItemTypeInfo sweepTicketInfo = ItemDC.GetSweepTickets(); if (sweepTicketInfo == null || sweepTicketInfo.Num < mSweepCount) { WndManager.DestoryDialog <StageWipeWnd>(); NGUIUtil.ShowFreeSizeTipWnd(NGUIUtil.GetStringByKey("70000229")); return; } CounterPartInfo info = StageDC.GetCounterPartInfo(); int playerPhysical = UserDC.GetPhysical(); // ÌåÁ¦²»×ã if (playerPhysical < info.win_physical * mSweepCount) { WndManager.DestoryDialog <StageWipeWnd>(); NGUIUtil.ShowFreeSizeTipWnd(NGUIUtil.GetStringByKey("99904008")); return; } StageDC.SendStageSweepRequest(StageDC.GetCompaignStageID(), mSweepCount); Clear(); //DataCenter.RegisterHooks((int)gate.Command.CMD.CMD_718, ShowSweepResult); }
public void SetData(ItemTypeInfo info, BeiBaoWnd wnd) { m_parent = wnd; m_ItemInfo = info; m_itemcount = ItemDC.GetItemCount(m_ItemInfo.itemType); SetUI(); }
public static ItemTypeInfo GetItemInfo(s_itemtypeInfo info) { if (info == null) { return(null); } ItemTypeInfo I = new ItemTypeInfo(); I.SetType(info.type); I.m_stype = info.stype; I.m_Icon = info.icon; I.m_Quality = info.quality; I.m_Name = info.name; I.m_Supperpose_limit = info.superpose_limit; I.m_isuser = info.isuse; I.m_level = info.level; I.m_money = info.money; I.m_emoney = info.emoney; I.m_sellemoney = info.sellmoney; I.m_title = info.title; I.m_message = info.message; I.m_gtype = info.gtype; I.m_gid = info.gid; return(I); }
void Recv_ItemUseRespone(int iErrorCode) { //success if (iErrorCode == 0) { if (nSelectIndex >= 0 && nSelectIndex < m_listAllTypeInfo.Count) { ItemTypeInfo info = m_listAllTypeInfo[nSelectIndex]; if (info.m_func == "Item_AddWood") { Debug.Log("addwood" + info.m_args); string show = string.Format(NGUIUtil.GetStringByKey(10000179), NGUIUtil.GetStringByKey(10000178)) + info.m_args.ToString(); AddHudText(show); } else if (info.m_func == "Item_AddCrystal") { Debug.Log("AddCrystal" + info.m_args); string show = string.Format(NGUIUtil.GetStringByKey(10000179), NGUIUtil.GetStringByKey(10000177)) + info.m_args.ToString(); AddHudText(show); } } ItemUsed(); } }
public void ReSetUI() { m_listAllTypeInfo = ItemDC.GetItemList(m_itemType); CreateItems(); //最后一个卖掉,显示其上一个内容. if (nSelectIndex == m_listAllTypeInfo.Count) { nSelectIndex = m_listAllTypeInfo.Count - 1; } if (nSelectIndex >= 0 && nSelectIndex < m_listAllTypeInfo.Count) { ItemTypeInfo info = m_listAllTypeInfo[nSelectIndex]; if (info != null && info.Num > 0) { RefreshIntorduct(info); return; } } ItemTypeInfo defaultInfo = GetDefaultInfo(); if (defaultInfo == null) { U3DUtil.DestroyAllChild(MyHead.ItemParent); return; } RefreshIntorduct(defaultInfo); }
private void CreateAllItemsList() { m_iNumCount = 0; for (int i = 0; i < m_listAllTypeInfo.Count; i++) { ItemTypeInfo item = m_listAllTypeInfo[i]; if (item.Num < 1) { continue; } GameObject go = NGUITools.AddChild(MyHead.Parent, MyHead.BeiBaoItem); if (go) { BeiBaoItem beiBaoItem = go.GetComponent <BeiBaoItem>(); if (beiBaoItem) { beiBaoItem.SetData(item, item.Num, this); // NGUIUtil.SetItemPanelDepth(go, MyHead.Parent.transform.parent.gameObject); } if (m_iNumCount == 0 && nSelectIndex == -1) { nSelectIndex = i; beiBaoItem.MyHead.TogSelect.value = true; } else if (nSelectIndex == i) { beiBaoItem.MyHead.TogSelect.value = true; } } m_iNumCount++; } }
/// <summary> /// 填充物品信息 /// </summary> private static void FillBaseItemInfo(s_itemtypeInfo info, ref ItemTypeInfo I) { if (I == null || info == null) { return; } I.SetType(info.type); I.itemType = info.id; I.m_stype = info.stype; I.m_Icon = info.icon; I.m_Quality = info.quality; I.m_Name = info.name; I.m_Supperpose_limit = info.superpose_limit; I.m_isuser = info.isuse; I.m_level = info.level; I.m_money = info.money; I.m_emoney = info.emoney; I.m_sellemoney = info.sellmoney; I.m_title = info.title; I.m_message = info.message; I.m_gtype = info.gtype; I.m_gid = info.gid; I.m_args = info.args; I.m_func = info.func; }
/// <summary> /// 根据itemid 获取itemtypeid /// </summary> /// <param name="itemID"></param> /// <returns></returns> public static int GetItemID2ItemType(int itemID) { ItemTypeInfo info = GetItem(itemID); if (info != null) { return(info.itemType); } return(0); }
public void ItemClickCallBack(ItemTypeInfo info) { int index = m_listAllTypeInfo.IndexOf(info); if (index >= 0 && index < m_listAllTypeInfo.Count) { nSelectIndex = index; RefreshIntorduct(info); } }
/// <summary> /// 更新物品 /// </summary> /// <returns></returns> public static void UpdateItemInfo(item.ItemInfo item, ref ItemTypeInfo I) { if (item == null || I == null) { return; } // I.ID = item.id; I.Positon = item.position; I.Num = item.superpose; }
/// <summary> /// /// </summary> /// <param name="dItemID"></param> /// <param name="posIndex">装备索引 0~5</param> /// <param name="solderierInfo"></param> public void SetData(int dItemID, int posIndex, SoldierInfo solderierInfo) { m_iItemID = dItemID; m_soldierInfo = solderierInfo; m_iPosIndex = posIndex; m_itemTypeID = SoldierM.GetSoldierEquip(solderierInfo.SoldierTypeID, solderierInfo.Quality, posIndex); if (m_itemTypeID == 0) { NGUIUtil.DebugLog(string.Format(" SoldierTypeID={0},Quality={1},EquipIndex={2} 装备静态数据未配置", solderierInfo.SoldierTypeID, solderierInfo.Quality, posIndex)); return; } if (m_iItemID == 0)//当未穿装备时 { ItemTypeInfo info = ItemDC.SearchItem(m_itemTypeID); if (info != null) { m_iItemID = info.ID; m_itemTypeID = info.itemType; m_icon = info.m_Icon; } else { s_itemtypeInfo sInfo = ItemM.GetItemInfo(m_itemTypeID); if (sInfo != null) { m_icon = sInfo.icon; } else { NGUIUtil.DebugLog("itemTypeID =" + m_itemTypeID + " 未配置"); } } } else//已装备 { ItemTypeInfo info1 = ItemDC.GetItem(m_iItemID); if (info1 == null || info1.Positon == 0) { NGUIUtil.DebugLog("获取已装备的信息失败 itemID =" + m_iItemID); return; } m_icon = info1.m_Icon; if (info1 != null) { m_iEquipQuality = info1.m_Quality; } } int itemTypeid = 0; m_equipmentPutType = SoldierM.CheckCanPutEquip(solderierInfo, dItemID, posIndex, ref itemTypeid); SetUI(); }
public void SetItem(ItemTypeInfo item) { SprItemQuality.spriteName = ConfigM.GetBigQuality(item.m_Quality).ToString(); NGUIUtil.Set2DSprite(Spr2DItem, "Textures/item/", item.m_Icon.ToString()); if (item.m_func == "Item_AddWood") { LblItemName.text = string.Format(NGUIUtil.GetStringByKey(10000178) + NGUIUtil.GetStringByKey(70000182), item.m_args, item.Num); } else if (item.m_func == "Item_AddCrystal") { LblItemName.text = string.Format(NGUIUtil.GetStringByKey(10000177) + NGUIUtil.GetStringByKey(70000182), item.m_args, item.Num); } }
public static void Register(CustomBlock block) { Console.WriteLine($"Registering block: {block.GetType()} #{block.BlockID} '{block.Name}'"); int blockID = block.BlockID; CustomBlocks.Add(blockID, block); int hashCode = ItemTypeInfo.GetHashCode(ObjectTypes.Block, blockID); ManSpawn spawnManager = ManSpawn.inst; spawnManager.VisibleTypeInfo.SetDescriptor <FactionSubTypes>(hashCode, block.Faction); spawnManager.VisibleTypeInfo.SetDescriptor <BlockCategories>(hashCode, block.Category); spawnManager.AddBlockToDictionary(block.Prefab); RecipeManager.inst.m_BlockPriceLookup.Add(blockID, block.Price); }
/// <summary> /// Returns the base-data value. /// </summary> /// <param name="stream">The stream.</param> /// <returns>The base-data value.</returns> private BaseData GetBaseDataValue(Stream stream) { Byte[] buffer = new Byte[12]; stream.Read(buffer, 0, 12); Int32 numberOfRows = EndianBitConverter.ToInt32(buffer, ByteOrder.LittleEndian); Int32 numberOfColumns = EndianBitConverter.ToInt32(buffer, 4, ByteOrder.LittleEndian); Int32 itemTypeIndex = EndianBitConverter.ToUInt16(buffer, 8, ByteOrder.LittleEndian); Int32 objectType = EndianBitConverter.ToUInt16(buffer, 10, ByteOrder.LittleEndian); ItemType itemType = ItemTypeInfo.ItemTypeFromIndex(itemTypeIndex); Object[,] values = new Object[numberOfRows, numberOfColumns]; Int32 rowIndex = 0, columnIndex = 0; while (rowIndex < numberOfRows) { Object value = ReadValue(stream, ItemTypeInfo.TypeByteCount(itemType), itemType); IEnumerable <Object> enumerableValue = value as IEnumerable <Object>; if (enumerableValue != null) { foreach (Object item in enumerableValue) { values[rowIndex, columnIndex] = item; columnIndex++; if (columnIndex == numberOfColumns) { columnIndex = 0; rowIndex++; } } } else { values[rowIndex, columnIndex] = value; columnIndex++; if (columnIndex == numberOfColumns) { columnIndex = 0; rowIndex++; } } } return(new BaseData(itemType, values)); }
/// <summary> /// 802 /// </summary> private static void Recv_ItemGetResponse(object Info) { if (Info == null) { return; } item.ItemInfoResponse response = Info as item.ItemInfoResponse; foreach (item.ItemInfo itemInfo in response.item_infos) { int action = itemInfo.action; int id = itemInfo.id; //添加 if (action == 0) //新增 { if (m_lItem.ContainsKey(id) == true) { ItemTypeInfo I = m_lItem[id]; ItemM.UpdateItemInfo(itemInfo, ref I); } else { ItemTypeInfo I = ItemM.GetItemInfo(itemInfo); if (I != null) { m_lItem.Add(id, I); } } } //update else if (action == 1) { if (m_lItem.ContainsKey(id) == true) { ItemTypeInfo I = m_lItem[id]; ItemM.UpdateItemInfo(itemInfo, ref I); } } else //删除 { if (m_lItem.ContainsKey(id) == true) { m_lItem.Remove(id); } } } }
public void SetZhuangBeiList(List <int> listItemID) { bool bRedPot = false; for (int i = 0; i < listItemID.Count; i++) { int itemTypeID = 0; EquipmentPutType type = SoldierM.CheckCanPutEquip(Info, listItemID[i], i, ref itemTypeID); EquipPutType = type; if (type == EquipmentPutType.CanPut || type == EquipmentPutType.CanCombine || type == EquipmentPutType.CanCombinePut) { NGUIUtil.Set2DSprite(MyHead.SprZhuangBeiList[i], "Textures/item/", "pdbxx_002ic"); } else if (type == EquipmentPutType.HaveCannot) { NGUIUtil.Set2DSprite(MyHead.SprZhuangBeiList[i], "Textures/item/", "pdbxx_003ic"); } else if (type == EquipmentPutType.HavePut) { ItemTypeInfo info1 = ItemDC.GetItem(listItemID[i]); if (info1 == null || info1.Positon == 0) { NGUIUtil.DebugLog("获取已装备的信息失败 itemID =" + listItemID[i]); MyHead.SprZhuangBeiList[i].sprite2D = null; continue; } else { NGUIUtil.Set2DSprite(MyHead.SprZhuangBeiList[i], "Textures/item/", info1.m_Icon.ToString()); } } else { MyHead.SprZhuangBeiList[i].sprite2D = null; } if (!bRedPot) { bRedPot = (type == EquipmentPutType.CanPut) || (type == EquipmentPutType.CanCombinePut); } } MyHead.SprLittleRed.gameObject.SetActive(bRedPot); }
private void AddIntorductUI(int iSelectIndex) { if (iSelectIndex < 0 || iSelectIndex >= m_listAllTypeInfo.Count) { return; } ItemTypeInfo info = m_listAllTypeInfo[iSelectIndex]; GameObject go = NDLoad.LoadWndItem("BeiBaoItemIntorduct", MyHead.ItemParent.transform); if (go != null) { BeiBaoItemIntorduct item = go.GetComponent <BeiBaoItemIntorduct>(); if (item != null) { item.SetData(info, this); } } }
private Item GenerateItem(Item copyItem, Transform parent) { if (copyItem == null) { Debug.Log("Item not found."); return(null); } Item item = new Item(copyItem); itemsInWorld.Add(item.id, item); ItemTypeInfo info = itemTypesMap[item.type]; GameObject obj = GameObject.Instantiate(info.prefab, (parent == null ? itemParent : parent)); obj.transform.localPosition = new Vector3(info.offset.x, info.offset.y, -0.02f); obj.name = item.name; obj.SetActive(false); CityManager.Instance.BuildMesh(obj, 1, 1); MeshRenderer renderer = obj.GetComponent <MeshRenderer>(); renderer.material.mainTexture = item.icon.texture; renderer.material.shader = Shader.Find("Transparent/Diffuse"); for (int i = 0; i < item.effects.Length; i++) { GameObject objChild = obj.transform.GetChild(i).gameObject; objChild.transform.position = new Vector3(objChild.transform.position.x, objChild.transform.position.y, CityManager.EFFECTS); CityManager.Instance.BuildMesh(objChild, 1, 1); MeshRenderer childRenderer = objChild.GetComponent <MeshRenderer>(); childRenderer.material.mainTexture = item.effects[i].texture; childRenderer.material.shader = Shader.Find("Transparent/Diffuse"); } itemObjsInWorld.Add(item.id, obj); itemRenderersInWorld.Add(item.id, renderer); item.OnCreated(obj); return(item); }
/// <summary> /// 获取物品 /// </summary> /// <returns></returns> public static ItemTypeInfo GetItemInfo(item.ItemInfo item) { if (item == null) { return(null); } ItemTypeInfo I = new ItemTypeInfo(); s_itemtypeInfo info = GetItemInfo(item.itemtypeid); if (info == null) { return(null); } I.ID = item.id; I.Positon = item.position; I.Num = item.superpose; FillBaseItemInfo(info, ref I); return(I); }
/// <summary> /// 获取物品 /// </summary> /// <returns></returns> public static ItemTypeInfo GetItemInfo(stage.StageRewardGetResponse.ItemInfo item) { if (item == null) { return(null); } ItemTypeInfo I = new ItemTypeInfo(); s_itemtypeInfo info = GetItemInfo(item.sitemtypeid); if (info == null) { return(null); } // I.ID = item.did; I.Positon = 0; I.Num = item.num; FillBaseItemInfo(info, ref I); return(I); }
/// <summary> /// Reads the contents of the <see cref="EhfaObject" /> from the specified stream. /// </summary> /// <param name="stream">The stream.</param> public virtual void Read(Stream stream) { Int32 size = ItemTypeInfo.TypeByteCount(Type.ItemType); if (Type.DataPlacement == DataPlacement.Internal) { if (Type.ItemType == ItemType.UChar || Type.ItemType == ItemType.Char) { size = _type.ItemNumber; } Value = ReadValue(stream, size, Type.ItemType); } else { Byte[] temp = new Byte[8]; stream.Read(temp, 0, temp.Length); Int32 repeatCount = (Int32)EndianBitConverter.ToUInt32(temp, ByteOrder.LittleEndian); if (repeatCount <= 0) { return; } if (Type.ItemType == ItemType.UChar || Type.ItemType == ItemType.Char) { size = repeatCount; repeatCount = 1; } if (repeatCount > 1) { Value = ReadValues(stream, size, repeatCount, Type.ItemType); } else { Value = ReadValue(stream, size, Type.ItemType); } } }
/// <summary> /// 检测物品数量是否超过上限 /// </summary> /// <param name="itemTypeID"></param> /// <param name="addNum">增加的量</param> /// <returns></returns> public static bool CheckItemOverLimit(int itemTypeID, int addNum) { ItemTypeInfo iTypeInfo = SearchItem(itemTypeID); if (iTypeInfo != null) { int limit = iTypeInfo.m_Supperpose_limit; int addAfterCount = GetItemCount(itemTypeID) + addNum; if (addAfterCount <= limit) { return(false); } else { return(true); } } else { NGUIUtil.DebugLog("静态表 s_itemtype_info id=" + itemTypeID + "数据未配置"); } return(false); }
private void RefreshIntorduct(ItemTypeInfo info) { if (info == null) { return; } BeiBaoItemIntorduct item = gameObject.GetComponentInChildren <BeiBaoItemIntorduct>(); if (item != null) { item.SetData(info, this); item.RefreshUI(); } else { int index = m_listAllTypeInfo.IndexOf(info); if (index >= 0 && index < m_listAllTypeInfo.Count) { AddIntorductUI(index); } } }
void ClickSweepMultiple(UIButton sender) { // 判定是否有扫荡券 ItemTypeInfo sweepTicketInfo = ItemDC.GetSweepTickets(); if (sweepTicketInfo == null || sweepTicketInfo.Num < m_AvailableMultipleSweep) { NGUIUtil.ShowFreeSizeTipWnd(NGUIUtil.GetStringByKey("70000229")); return; } CounterPartInfo info = StageDC.GetCounterPartInfo(); // 体力不足 int playerPhysical = UserDC.GetPhysical(); if (playerPhysical < info.win_physical * m_AvailableMultipleSweep) { NGUIUtil.ShowFreeSizeTipWnd(NGUIUtil.GetStringByKey("99904008")); return; } // VIP, 解锁判定 //...... int vipLevel = UserDC.GetVIPLevel(); if (vipLevel < 4) { string tip = string.Format(NGUIUtil.GetStringByKey("70000228"), 4); NGUIUtil.ShowFreeSizeTipWnd(tip); //return; } m_ClickSweepTimes = m_AvailableMultipleSweep; StageDC.SendStageSweepRequest(StageDC.GetCompaignStageID(), m_ClickSweepTimes); DataCenter.RegisterHooks((int)gate.Command.CMD.CMD_718, ShowSweepResult); }
void ClickSweepOnce(UIButton sender) { // 判定是否有扫荡券 ItemTypeInfo sweepTicketInfo = ItemDC.GetSweepTickets(); if (sweepTicketInfo == null || sweepTicketInfo.Num == 0) { NGUIUtil.ShowFreeSizeTipWnd(NGUIUtil.GetStringByKey("70000229")); return; } CounterPartInfo info = StageDC.GetCounterPartInfo(); int playerPhysical = UserDC.GetPhysical(); // 体力不足 if (playerPhysical < info.win_physical) { NGUIUtil.ShowFreeSizeTipWnd(NGUIUtil.GetStringByKey("99904008")); return; } m_ClickSweepTimes = 1; StageDC.SendStageSweepRequest(StageDC.GetCompaignStageID(), m_ClickSweepTimes); DataCenter.RegisterHooks((int)gate.Command.CMD.CMD_718, ShowSweepResult); }
public static void GetBlocksInfos() { string infos = "";//"ID;Object name;Corp;License Level;Category;Rarity;Buy Price;Mass;Health;Gun Damage;Drill Damage;Hammer Damage;Energy Storage Capacity;Fuel Storage Capacity;Fuel Storage Refill Rate;Energy Consumption Per Sec;Energy Consumed Per Point Healed;Energy Consumed Per Damage Point;Fuel Consumed Per Sec\n"; foreach (BlockTypes type in Enum.GetValues(typeof(BlockTypes))) { TankBlock prefab = Singleton.Manager <ManSpawn> .inst.SpawnBlock(type, Vector3.zero, Quaternion.identity); if (prefab) { int hashCode = ItemTypeInfo.GetHashCode(ObjectTypes.Block, (int)type); infos += prefab.name + ";" + type.ToString() + ";" + Singleton.Manager <ManSpawn> .inst.VisibleTypeInfo.GetDescriptor <FactionSubTypes>(hashCode).ToString() + ";" + (ManLicenses.inst.GetBlockUnlockTable().GetBlockTier(type, true) + 1) + ";" + prefab.BlockCategory.ToString() + ";" + prefab.BlockRarity.ToString() + ";" + Singleton.Manager <RecipeManager> .inst.GetBlockBuyPrice(type).ToString() + ";" + prefab.CurrentMass.ToString() + ";" + prefab.visible.damageable.Health.ToString(); try { infos += ";" + prefab.GetComponentInParent <ModuleWeaponGun>().FiringData.m_BulletPrefab.m_Damage; } catch { infos += ";"; } try { infos += ";" + prefab.GetComponentInParent <ModuleDrill>().damagePerSecond;// +";"+ prefab.GetComponentInParent<ModuleDrill>().impactDamageMultiplier; } catch { infos += ";"; } try { infos += ";" + prefab.GetComponentInParent <ModuleHammer>().impactDamage; } catch { infos += ";"; } try { infos += ";" + prefab.GetComponentInParent <ModuleEnergy>().Store.m_Capacity; } catch { infos += ";"; } try { infos += ";" + prefab.GetComponentInParent <ModuleFuelTank>().Capacity + ";" + prefab.GetComponentInParent <ModuleFuelTank>().RefillRate; } catch { infos += ";"; } try { var shield = prefab.GetComponentInParent <ModuleShieldGenerator>(); infos += ";" + shield.m_EnergyConsumptionPerSec + ";" + shield.m_EnergyConsumedPerPointHealed + ";" + shield.m_EnergyConsumedPerDamagePoint; } catch { infos += ";"; } try { infos += ";" + prefab.GetComponentInParent <ModuleBooster>().FuelBurnPerSecond(); } catch { infos += ";"; } infos += "\n"; } } //infos += "ID;Object name;Corp;License Level;Category;Rarity;Buy Price;Mass;Health;Gun Damage;Drill Damage;Hammer Damage;Energy Storage Capacity;Fuel Storage Capacity;Fuel Storage Refill Rate;Energy Consumption Per Sec;Energy Consumed Per Point Healed;Energy Consumed Per Damage Point;Fuel Consumed Per Sec"; File.WriteAllText(Path.Combine(FolderStructure.DataFolder, "BlocksInfos.csv"), infos); }
public void SetData(ItemTypeInfo info) { m_ItemInfo = info; SetUI(); }
private bool IsUnspecifiedPossibility(ItemTypeInfo info) { return info.ItemGuid == m_unspecComplexFormType || info.ItemGuid == m_unspecVariantType; }
private string GetUnspecifiedItemName(ItemTypeInfo info) { return info.ItemGuid == m_unspecComplexFormType ? m_noComplexEntryTypeLabel : m_noVariantTypeLabel; }
private void FixEntryTypeList(LayoutTreeNode ltn, string parentLayoutName) { // Add any new types to our ordered list (or fill in an empty list). var setGuidsFromXml = new Set<Guid>(ltn.EntryTypeList.Select(info => info.ItemGuid)); Dictionary<Guid, ICmPossibility> mapGuidType; int index; switch (ltn.EntryType) { case "complex": // Get the canonical list from the project if needed. if (m_rgComplexFormTypes == null) m_rgComplexFormTypes = GetSortedFlattenedComplexFormTypeList(); mapGuidType = m_rgComplexFormTypes.ToDictionary(poss => poss.Guid); foreach (var info in from poss in m_rgComplexFormTypes where !setGuidsFromXml.Contains(poss.Guid) select new ItemTypeInfo(true, poss.Guid)) { ltn.EntryTypeList.Add(info); } if (!ListContainsGuid(ltn.EntryTypeList, m_unspecComplexFormType, out index)) { var unspecified = new ItemTypeInfo(true, m_unspecComplexFormType); ltn.EntryTypeList.Insert(0, unspecified); index = 0; } ltn.EntryTypeList[index].Name = m_noComplexEntryTypeLabel; break; case "variant": // Get the canonical list from the project if needed. if (m_rgVariantTypes == null) m_rgVariantTypes = GetSortedFlattenedVariantTypeList(); mapGuidType = m_rgVariantTypes.ToDictionary(poss => poss.Guid); foreach (var info in from poss in m_rgVariantTypes where !setGuidsFromXml.Contains(poss.Guid) select new ItemTypeInfo(true, poss.Guid)) { ltn.EntryTypeList.Add(info); } if (!ListContainsGuid(ltn.EntryTypeList, m_unspecVariantType, out index)) { var unspecified = new ItemTypeInfo(true, m_unspecVariantType); ltn.EntryTypeList.Insert(0, unspecified); index = 0; } ltn.EntryTypeList[index].Name = m_noVariantTypeLabel; break; //case "minor": default: // Should be 'minor', but treat any unknown entrytype as 'minor' var fstemBased = parentLayoutName.Contains(sdefaultStemBasedLayout); // Get the canonical Variant Type list from the project if needed. if (m_rgVariantTypes == null) m_rgVariantTypes = GetSortedFlattenedVariantTypeList(); mapGuidType = m_rgVariantTypes.ToDictionary(poss => poss.Guid); // Root-based views have Complex Forms as Minor Entries too. if (!fstemBased) { // Get the canonical Complex Form Type list from the project if needed. if (m_rgComplexFormTypes == null) m_rgComplexFormTypes = GetSortedFlattenedComplexFormTypeList(); // Add them to the map foreach (var poss in m_rgComplexFormTypes) mapGuidType.Add(poss.Guid, poss); } // Now make sure the LayoutTreeNode has the right entries foreach (var info in from kvp in mapGuidType where !setGuidsFromXml.Contains(kvp.Key) select new ItemTypeInfo(true, kvp.Key)) { ltn.EntryTypeList.Add(info); } AddUnspecifiedTypes(fstemBased, fstemBased ? 0 : m_rgVariantTypes.Count, ltn); break; } // Remove any obsolete types from our ordered list. var obsoleteItems = ltn.EntryTypeList.Where(info => !IsUnspecifiedPossibility(info) && !mapGuidType.ContainsKey(info.ItemGuid)).ToList(); foreach (var info in obsoleteItems) ltn.EntryTypeList.Remove(info); // Add the names to the items in the ordered list. foreach (var info in ltn.EntryTypeList) { if (IsUnspecifiedPossibility(info)) continue; var poss = mapGuidType[info.ItemGuid]; info.Name = poss.Name.BestAnalysisVernacularAlternative.Text; } }
private void AddUnspecifiedTypes(bool fstemBased, int cvarTypes, LayoutTreeNode ltn) { int index; if (!fstemBased) { if (!ListContainsGuid(ltn.EntryTypeList, m_unspecComplexFormType, out index)) { var unspecified = new ItemTypeInfo(true, m_unspecComplexFormType); ltn.EntryTypeList.Insert(cvarTypes, unspecified); index = cvarTypes; } ltn.EntryTypeList[index].Name = m_noComplexEntryTypeLabel; } if (!ListContainsGuid(ltn.EntryTypeList, m_unspecVariantType, out index)) { var unspecified = new ItemTypeInfo(true, m_unspecVariantType); ltn.EntryTypeList.Insert(0, unspecified); index = 0; } ltn.EntryTypeList[index].Name = m_noVariantTypeLabel; }
//return index protected int addType(ItemTypeInfo type) { //itemTypeList.Add(type); //FIXME_VAR_TYPE lIndex= itemTypeList.Count-1; //nameToTypeIndex[type.name]=lIndex; return itemTypeTable.addData(type.name, type); }
public void SetData(ItemTypeInfo I, int num, BeiBaoWnd wnd) { Info = I; m_num = num; m_parent = wnd; }
/// <summary> /// 检测炮弹兵是否满足进阶条件 /// </summary> public bool CheckSoldierJinJie() { Dictionary <int, int> l = new Dictionary <int, int>(); // 是否最高阶 if (ConfigM.GetNextQuality(Quality) == 0) { return(false); } int levelLimit = 0; int equipID1 = 0; int equipID2 = 0; int equipID3 = 0; int equipID4 = 0; int equipID5 = 0; int equipID6 = 0; SoldierM.GetUpQualityNeed(SoldierTypeID, Quality, ref levelLimit, ref equipID1, ref equipID2, ref equipID3, ref equipID4, ref equipID5, ref equipID6); // 等级限制 if (Level < levelLimit) { return(false); } //需要的装备 List <int> lEquipsID = new List <int>(); if (Equipment0 <= 0) { lEquipsID.Add(equipID1); } if (Equipment1 <= 0) { lEquipsID.Add(equipID2); } if (Equipment2 <= 0) { lEquipsID.Add(equipID3); } if (Equipment3 <= 0) { lEquipsID.Add(equipID4); } if (Equipment4 <= 0) { lEquipsID.Add(equipID5); } if (Equipment5 <= 0) { lEquipsID.Add(equipID6); } // 不缺装备 if (lEquipsID.Count == 0) { return(true); } //统计需要的装备 foreach (int itemid in lEquipsID) { ItemTypeInfo ItemInfo = ItemDC.SearchItem(itemid); //检测装备道具是否存在 //检测装备是否存在 if (ItemInfo == null) { return(false); } //检测等级是否满足装备要求 if (Level < ItemInfo.m_level) { return(false); } if (l.ContainsKey(itemid) == false) { l.Add(itemid, 1); } else { l[itemid] = l[itemid] + 1; } } //判断装备数量是否够 foreach (int itemid in l.Keys) { int num = ItemDC.CheckItem(itemid); if (num < l[itemid]) { return(false); } } return(true); }