/// <summary> /// /// </summary> /// <param name="lootMoney"></param> /// <returns></returns> public GoldItem[] RandomGoldDrop() { if (m_Loots == null) { throw new Exception("BaseTreasure.RandomGoldDrop(...) - m_Loots == null error!"); } List <GoldItem> treasureList = new List <GoldItem>(DROP_CACHED_SIZE); for (int iIndex = 0; iIndex < m_Loots.Length; iIndex++) { GoldLoot lootGold = m_Loots[iIndex] as GoldLoot; if (lootGold == null) { continue; } if (lootGold.IsDrop() == true) { GoldItem goldItem = lootGold.Instance(); if (goldItem != null) { treasureList.Add(goldItem); } } } return(treasureList.ToArray()); }
public void GoldItemConstructorTest() { ulong minGold = 0; // TODO: 初始化为适当的值 ulong maxGold = 0; // TODO: 初始化为适当的值 GoldItem target = new GoldItem(minGold, maxGold); Assert.Inconclusive("TODO: 实现用来验证目标的代码"); }
public void GoldTest() { GoldItem target = new GoldItem(); // TODO: 初始化为适当的值 ulong actual; actual = target.Gold; Assert.Inconclusive("验证此测试方法的正确性。"); }
public void RandomGoldGeneratorTest() { GoldItem target = new GoldItem(); // TODO: 初始化为适当的值 ulong expected = 0; // TODO: 初始化为适当的值 ulong actual; actual = target.RandomGoldGenerator(); Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
public void MaxGoldTest() { GoldItem target = new GoldItem(); // TODO: 初始化为适当的值 ulong expected = 0; // TODO: 初始化为适当的值 ulong actual; target.MaxGold = expected; actual = target.MaxGold; Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
void OnTriggerEnter2D(Collider2D col) { if (col.tag == "Gold") { GoldItem PickUpGold = col.GetComponentInChildren <GoldItem>(); Debug.Log(PickUpGold.dropGold); MoneyInfo.plusGold(PickUpGold.dropGold); Debug.Log(MoneyInfo.gold); Destroy(col.gameObject); } }
public void AddGoldItem(GoldItem item) { if (capacity >= current + item.Value) { var goldItems = GetGoldItems(); if (goldItems.Any(gi => gi.Key == item.Key)) { goldItems.Single(gi => gi.Key == item.Key).IncreaseValue(item.Value); } else { bag.Add(item); } current += item.Value; } }
private static void InsertItem(string key, long value, Bag bag) { if (key.Length == 3) { CashItem cash = new CashItem(key, value); bag.AddCashItem(cash); } else if (key.Length >= 4 && key.ToLower().EndsWith("gem")) { GemItem gem = new GemItem(key, value); bag.AddGemItem(gem); } else if (key.ToLower().Equals("gold")) { GoldItem gold = new GoldItem(key, value); bag.AddGoldItem(gold); } }
/// <summary> /// /// </summary> /// <returns></returns> public GoldItem Instance() { GoldItem goldItem = base.Instance <GoldItem>(); if (goldItem == null) { LOGs.WriteLine(LogMessageType.MSG_ERROR, "GoldLoot.Instance(...) - goldItem == null error!"); return(null); } else { goldItem.MinGold = m_MinGold; goldItem.MaxGold = m_MaxGold; return(goldItem); } }
public override void Deserialize(ICustomDataInput reader) { this.gold = new GoldItem(); this.gold.Deserialize(reader); }
public GoldAddedMessage(GoldItem gold) { this.gold = gold; }
public GoldAddedMessage(GoldItem gold) { m_gold = gold; }
/// <summary> /// Actual method used to purchase gold /// </summary> private void BuyGold() { GoldItem gold = previewItem as GoldItem; GameManager.instance.Gold.AddCurrency(gold.amountGold); }
public GoldAddedMessage(GoldItem gold = null) { Gold = gold; }
public GoldAddedMessage(GoldItem Gold) { this.Gold = Gold; }
/// <summary> /// /// </summary> public void LoadItemData() { string slotTypeS, modTypeS; string auxId, auxSpriteId; int auxValue = -1, auxCount = -1; GoldItem auxGoldItm = null; EquipmentItem auxEquipItm = null; List <EquipmentItem.MOD_TYPE> auxMtList = new List <EquipmentItem.MOD_TYPE>(); List <float> auxModValList = new List <float>(); EquipmentItem.SLOT_TYPE auxSt = EquipmentItem.SLOT_TYPE.COLLECTOR_A; XmlReader reader = XmlReader.Create(new StringReader(_itemDataTA.text)); //XmlDocument doc = new XmlDocument(); // doc.LoadXml(_textDoc.text); if (_gameItemList == null) { _gameItemList = new List <EquipmentItem>(); } else { _gameItemList.Clear(); } if (_goldItemList == null) { _goldItemList = new List <GoldItem>(); } else { _goldItemList.Clear(); } _readingGoldItem = false; while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: if (reader.Name.CompareTo("gold_item_type") == 0) { _readingGoldItem = true; } else if (reader.Name.CompareTo("equipment_item_data") == 0) { _readingGoldItem = false; } else { //Debug.Log("Value: " + reader.Name); if (reader.Name.CompareTo("item") == 0) { if (_readingGoldItem) { auxSpriteId = reader.GetAttribute("spriteId"); //auxGoldItm = new GoldItem(reader.GetAttribute("id"), auxSpriteId, XmlConvert.ToInt32(reader.GetAttribute("value"))); auxGoldItm = new GoldItem(reader.GetAttribute("id"), auxSpriteId, XmlConvert.ToInt32(reader.GetAttribute("value"))); auxGoldItm._Sprite = Resources.Load(auxSpriteId, typeof(Sprite)) as Sprite; _goldItemList.Add(auxGoldItm /*auxGoldItm*/); } else { auxId = reader.GetAttribute("id"); auxSpriteId = reader.GetAttribute("spriteId"); auxValue = XmlConvert.ToInt32(reader.GetAttribute("value")); Debug.Log("Adding item.... " + auxId); //auxCount = XmlConvert.ToInt32(reader.GetAttribute("count")); slotTypeS = reader.GetAttribute("slotType"); if (slotTypeS.CompareTo("COLLECTOR_A") == 0) { auxSt = EquipmentItem.SLOT_TYPE.COLLECTOR_A; } else if (slotTypeS.CompareTo("COLLECTOR_B") == 0) { auxSt = EquipmentItem.SLOT_TYPE.COLLECTOR_B; } else if (slotTypeS.CompareTo("STRIKER_A") == 0) { auxSt = EquipmentItem.SLOT_TYPE.STRIKER_A; } else if (slotTypeS.CompareTo("STRIKER_B") == 0) { auxSt = EquipmentItem.SLOT_TYPE.STRIKER_B; } else if (slotTypeS.CompareTo("SHAKER_A") == 0) { auxSt = EquipmentItem.SLOT_TYPE.SHAKER_A; } else if (slotTypeS.CompareTo("SHAKER_B") == 0) { auxSt = EquipmentItem.SLOT_TYPE.SHAKER_B; } else { Debug.LogError("Error parsing slotType " + auxSt); } //Read mod list auxMtList = new List <EquipmentItem.MOD_TYPE>(); auxModValList = new List <float>(); while (reader.Read()) { if (reader.IsStartElement() && reader.Name.CompareTo("mod") == 0) { modTypeS = reader.GetAttribute("modType"); //Debug.Log("R E A D I N G: " + modTypeS); if (modTypeS.CompareTo("RELOAD_SPEED") == 0) { auxMtList.Add(EquipmentItem.MOD_TYPE.RELOAD_SPEED); } else if (modTypeS.CompareTo("SACK_SIZE") == 0) { auxMtList.Add(EquipmentItem.MOD_TYPE.SACK_SIZE); } else if (modTypeS.CompareTo("COLLECTOR_SPEED") == 0) { auxMtList.Add(EquipmentItem.MOD_TYPE.COLLECTOR_SPEED); } else if (modTypeS.CompareTo("STRIKER_HIT_SIZE") == 0) { auxMtList.Add(EquipmentItem.MOD_TYPE.STRIKER_HIT_SIZE); } else if (modTypeS.CompareTo("STRIKER_SPEED") == 0) { auxMtList.Add(EquipmentItem.MOD_TYPE.STRIKER_SPEED); } else if (modTypeS.CompareTo("ACCURACY") == 0) { auxMtList.Add(EquipmentItem.MOD_TYPE.ACURRACY); } else if (modTypeS.CompareTo("FALL_SPEED") == 0) { auxMtList.Add(EquipmentItem.MOD_TYPE.FALL_SPEED); } else if (modTypeS.CompareTo("GOLD_FIND_PROB") == 0) { auxMtList.Add(EquipmentItem.MOD_TYPE.GOLD_FIND_PROB); } else if (modTypeS.CompareTo("ITEM_FIND_PROB") == 0) { auxMtList.Add(EquipmentItem.MOD_TYPE.ITEM_FIND_PROB); } else { Debug.LogError("Error parsing slotType " + modTypeS); } auxModValList.Add(float.Parse(reader.GetAttribute("modVal"))); } else if (!reader.IsStartElement() && reader.Name.CompareTo("item") == 0) { //Debug.Log("Item read ended, break reading mod List"); break; } } auxEquipItm = new EquipmentItem(auxId, auxSpriteId, auxValue, auxSt, auxMtList, auxModValList /*,auxCount*/); //auxSt, auxMt, float.Parse(reader.GetAttribute("modVal")), 0); //Load Sprite reference auxEquipItm._Sprite = Resources.Load(auxSpriteId, typeof(Sprite)) as Sprite; _gameItemList.Add(auxEquipItm); } } } break; case XmlNodeType.EndElement: Debug.Log("End element Value: " + reader.Name); break; } } Debug.Log("Current itemlist count:" + _gameItemList.Count); }
public static object GetInstance(uint typeId) { object obj = null; switch (typeId) { case 11: obj = new Types.Version(); break; case 25: obj = new GameServerInformations(); break; case 55: obj = new EntityLook(); break; case 54: obj = new SubEntity(); break; case 110: obj = new CharacterMinimalInformations(); break; case 163: obj = new CharacterMinimalPlusLookInformations(); break; case 193: obj = new CharacterMinimalPlusLookAndGradeInformations(); break; case 45: obj = new CharacterBaseInformations(); break; case 212: obj = new CharacterToRecolorInformation(); break; case 86: obj = new CharacterHardcoreInformations(); break; case 63: obj = new EntityMovementInformations(); break; case 60: obj = new EntityDispositionInformations(); break; case 107: obj = new IdentifiedEntityDispositionInformations(); break; case 217: obj = new FightEntityDispositionInformations(); break; case 127: obj = new GuildInformations(); break; case 204: obj = new ActorRestrictionsInformations(); break; case 201: obj = new ActorAlignmentInformations(); break; case 183: obj = new PaddockContentInformations(); break; case 184: obj = new MountInformationsForPaddock(); break; case 202: obj = new ActorExtendedAlignmentInformations(); break; case 135: obj = new AlignmentBonusInformations(); break; case 142: obj = new PrismSubAreaInformation(); break; case 152: obj = new PrismConquestInformation(); break; case 187: obj = new TaxCollectorName(); break; case 96: obj = new TaxCollectorBasicInformations(); break; case 4: obj = new CharacterBaseCharacteristic(); break; case 215: obj = new CharacterSpellModification(); break; case 8: obj = new CharacterCharacteristicsInformations(); break; case 117: obj = new FightExternalInformations(); break; case 43: obj = new FightCommonInformations(); break; case 44: obj = new FightTeamMemberInformations(); break; case 13: obj = new FightTeamMemberCharacterInformations(); break; case 6: obj = new FightTeamMemberMonsterInformations(); break; case 177: obj = new FightTeamMemberTaxCollectorInformations(); break; case 20: obj = new FightOptionsInformations(); break; case 116: obj = new AbstractFightTeamInformations(); break; case 33: obj = new FightTeamInformations(); break; case 115: obj = new FightTeamLightInformations(); break; case 31: obj = new GameFightMinimalStats(); break; case 41: obj = new FightLoot(); break; case 16: obj = new FightResultListEntry(); break; case 189: obj = new FightResultFighterListEntry(); break; case 191: obj = new FightResultAdditionalData(); break; case 192: obj = new FightResultExperienceData(); break; case 190: obj = new FightResultPvpData(); break; case 24: obj = new FightResultPlayerListEntry(); break; case 216: obj = new FightResultMutantListEntry(); break; case 84: obj = new FightResultTaxCollectorListEntry(); break; case 206: obj = new AbstractFightDispellableEffect(); break; case 208: obj = new FightDispellableEffectExtendedInformations(); break; case 209: obj = new FightTemporaryBoostEffect(); break; case 210: obj = new FightTriggeredEffect(); break; case 207: obj = new FightTemporarySpellBoostEffect(); break; case 211: obj = new FightTemporaryBoostWeaponDamagesEffect(); break; case 214: obj = new FightTemporaryBoostStateEffect(); break; case 205: obj = new GameFightSpellCooldown(); break; case 7: obj = new Item(); break; case 49: obj = new SpellItem(); break; case 76: obj = new ObjectEffect(); break; case 74: obj = new ObjectEffectString(); break; case 70: obj = new ObjectEffectInteger(); break; case 82: obj = new ObjectEffectMinMax(); break; case 73: obj = new ObjectEffectDice(); break; case 72: obj = new ObjectEffectDate(); break; case 75: obj = new ObjectEffectDuration(); break; case 71: obj = new ObjectEffectCreature(); break; case 81: obj = new ObjectEffectLadder(); break; case 179: obj = new ObjectEffectMount(); break; case 178: obj = new MountClientData(); break; case 168: obj = new ItemDurability(); break; case 85: obj = new GameActionMarkedCell(); break; case 123: obj = new GoldItem(); break; case 124: obj = new ObjectItemMinimalInformation(); break; case 119: obj = new ObjectItemQuantity(); break; case 134: obj = new ObjectItemNotInContainer(); break; case 37: obj = new ObjectItem(); break; case 120: obj = new ObjectItemToSell(); break; case 164: obj = new ObjectItemToSellInBid(); break; case 198: obj = new ObjectItemInRolePlay(); break; case 197: obj = new ObjectItemWithLookInRolePlay(); break; case 199: obj = new OrientedObjectItemWithLookInRolePlay(); break; case 185: obj = new PaddockItem(); break; case 121: obj = new SellerBuyerDescriptor(); break; case 122: obj = new BidExchangerObjectInfo(); break; case 52: obj = new StartupActionAddObject(); break; case 106: obj = new IgnoredInformations(); break; case 105: obj = new IgnoredOnlineInformations(); break; case 78: obj = new FriendInformations(); break; case 92: obj = new FriendOnlineInformations(); break; case 77: obj = new FriendSpouseInformations(); break; case 93: obj = new FriendSpouseOnlineInformations(); break; case 88: obj = new GuildMember(); break; case 87: obj = new GuildEmblem(); break; case 80: obj = new InteractiveElement(); break; case 108: obj = new StatedElement(); break; case 200: obj = new MapObstacle(); break; case 213: obj = new PartyUpdateCommonsInformations(); break; case 90: obj = new PartyMemberInformations(); break; case 97: obj = new JobCrafterDirectorySettings(); break; case 194: obj = new JobCrafterDirectoryEntryPlayerInfo(); break; case 195: obj = new JobCrafterDirectoryEntryJobInfo(); break; case 196: obj = new JobCrafterDirectoryListEntry(); break; case 101: obj = new JobDescription(); break; case 102: obj = new SkillActionDescription(); break; case 103: obj = new SkillActionDescriptionTimed(); break; case 99: obj = new SkillActionDescriptionCollect(); break; case 100: obj = new SkillActionDescriptionCraft(); break; case 104: obj = new SkillActionDescriptionCraftExtended(); break; case 98: obj = new JobExperience(); break; case 111: obj = new HouseInformations(); break; case 112: obj = new HouseInformationsExtended(); break; case 170: obj = new HouseInformationsForGuild(); break; case 132: obj = new PaddockInformations(); break; case 130: obj = new PaddockBuyableInformations(); break; case 133: obj = new PaddockAbandonnedInformations(); break; case 131: obj = new PaddockPrivateInformations(); break; case 150: obj = new GameContextActorInformations(); break; case 141: obj = new GameRolePlayActorInformations(); break; case 157: obj = new HumanInformations(); break; case 153: obj = new HumanWithGuildInformations(); break; case 154: obj = new GameRolePlayNamedActorInformations(); break; case 159: obj = new GameRolePlayHumanoidInformations(); break; case 36: obj = new GameRolePlayCharacterInformations(); break; case 3: obj = new GameRolePlayMutantInformations(); break; case 129: obj = new GameRolePlayMerchantInformations(); break; case 146: obj = new GameRolePlayMerchantWithGuildInformations(); break; case 180: obj = new GameRolePlayMountInformations(); break; case 147: obj = new TaxCollectorStaticInformations(); break; case 148: obj = new GameRolePlayTaxCollectorInformations(); break; case 167: obj = new TaxCollectorInformations(); break; case 166: obj = new TaxCollectorInformationsInWaitForHelpState(); break; case 186: obj = new ProtectedEntityWaitingForHelpInfo(); break; case 169: obj = new TaxCollectorFightersInformation(); break; case 165: obj = new AdditionalTaxCollectorInformations(); break; case 144: obj = new MonsterInGroupInformations(); break; case 140: obj = new GroupMonsterStaticInformations(); break; case 160: obj = new GameRolePlayGroupMonsterInformations(); break; case 155: obj = new NpcStaticInformations(); break; case 156: obj = new GameRolePlayNpcInformations(); break; case 161: obj = new GameRolePlayPrismInformations(); break; case 143: obj = new GameFightFighterInformations(); break; case 158: obj = new GameFightFighterNamedInformations(); break; case 46: obj = new GameFightCharacterInformations(); break; case 50: obj = new GameFightMutantInformations(); break; case 151: obj = new GameFightAIInformations(); break; case 29: obj = new GameFightMonsterInformations(); break; case 203: obj = new GameFightMonsterWithAlignmentInformations(); break; case 48: obj = new GameFightTaxCollectorInformations(); break; case 174: obj = new MapCoordinates(); break; case 176: obj = new MapCoordinatesExtended(); break; case 175: obj = new AtlasPointsInformations(); break; default: throw new Exception("Type with id " + typeId + " is unknown."); } return(obj); }
public override void Deserialize(IDataReader reader) { Gold = new GoldItem(); Gold.Deserialize(reader); }
public void GoldItemConstructorTest1() { GoldItem target = new GoldItem(); Assert.Inconclusive("TODO: 实现用来验证目标的代码"); }