private bool LoadDescriptors(string path) { _descriptors.Clear(); string obj = ""; // Check for file Existance if (!File.Exists(path)) { return false; } obj = File.ReadAllText(path); SimpleJSON.JSONNode data = SimpleJSON.JSON.Parse(obj); for (int i = 0; i < data.Count; i++) { ItemDescriptor d = new ItemDescriptor(data[i]); _descriptors.Add(d.Name, d); } Debug.Log("Found " + data.Count + " items descriptors."); return true; }
public override void init() { base.init(); itemDescriptor = Vars.gameplay.getItemDescriptor(); foreach (Shop shop in shops) { shop.init(this); shop.gameObject.SetActive(false); } }
void Awake() { Vars.gameplay = this; Hero.init(); GetComponent<Imager>().init(); WorkbenchSchemeDescriptor.fillSchemesMap(); GameObject.FindGameObjectWithTag("UserInterface").GetComponent<UserInterface>().init(); GetComponent<ItemFactory>().init(); itemDescriptor = GameObject.FindGameObjectWithTag("ItemDescriptor").GetComponent<ItemDescriptor>(); itemDescriptor.init(); potionBag = GameObject.FindGameObjectWithTag("PotionBag").GetComponent<PotionBag>(); potionBag.init(); inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent<Inventory>(); inventory.init(); GameObject[] scrs = GameObject.FindGameObjectsWithTag("GameScreen"); foreach (GameObject gameObj in scrs) { GameScreen screen = gameObj.GetComponent<GameScreen>(); switch (screen.getScreenType()) { case ScreenType.CITY: city = screen as CityScreen; break; case ScreenType.GUILD: guild = screen as GuildScreen; break; case ScreenType.BLACKSMITH: blacksmith = screen as BlacksmithScreen; break; case ScreenType.HEALER: healer = screen as HealerScreen; break; case ScreenType.HOME: home = screen as HomeScreen; break; } screens.Add(screen); screen.init(); screen.hideScreen(); } GetComponent<InputProcessor>().init(screens); fightScreen = GameObject.FindGameObjectWithTag("FightScreen").GetComponent<FightScreen>(); equipmentScreen = GameObject.FindGameObjectWithTag("EquipmentScreen").GetComponent<EquipmentScreen>(); fightScreen.init(); equipmentScreen.init(); buffShop = healer.getBuffShop(); questBoard = guild.getQuestBoard(); equipmentScreen.setBuffShop(buffShop); equipmentScreen.setQuestInformation(questBoard.getQuestInformation()); worldMap = GameObject.FindGameObjectWithTag("WorldMap").GetComponent<WorldMap>(); worldMap.init(); QuestParser.parseQuests(questsFile); showScreen(ScreenType.CITY); }
public void init (HomeScreen homeScreen) { this.homeScreen = homeScreen; backBtn = transform.Find("BackBtn").GetComponent<Button>(); craftBtn = transform.Find("CraftBtn").GetComponent<Button>(); Transform holders = transform.Find("MaterialHolders"); MaterialHolder holder; for (int i = 0; i < holders.childCount; i++) { holder = holders.GetChild(i).GetComponent<MaterialHolder>(); holder.init(); materialHolders[holder.holderIndex] = holder; } itemDescriptor = Vars.gameplay.getItemDescriptor(); gameObject.SetActive(false); }
public void init (HealerScreen healerScreen) { this.healerScreen = healerScreen; backBtn = transform.Find("BackBtn").GetComponent<Button>(); itemDescriptor = Vars.gameplay.getItemDescriptor(); Buff buff; Transform sphere = transform.Find("ShieldBuffSphere"); shieldHolder = sphere.Find("Holder").GetComponent<BuffEquipmentHolder>(); shieldHolder.init(); for (int i = 0; i < sphere.childCount; i++) { if ((buff = sphere.GetChild(i).GetComponent<Buff>()) != null) { buff.init(BuffItemType.SHIELD); buffs.Add(buff); } } sphere = transform.Find("WeaponBuffSphere"); weaponHolder = sphere.Find("Holder").GetComponent<BuffEquipmentHolder>(); weaponHolder.init(); for (int i = 0; i < sphere.childCount; i++) { if ((buff = sphere.GetChild(i).GetComponent<Buff>()) != null) { buff.init(BuffItemType.WEAPON); buffs.Add(buff); } } sphere = transform.Find("ArmorBuffSphere"); armorHolder = sphere.Find("Holder").GetComponent<BuffEquipmentHolder>(); armorHolder.init(); for (int i = 0; i < sphere.childCount; i++) { if ((buff = sphere.GetChild(i).GetComponent<Buff>()) != null) { buff.init(BuffItemType.ARMOR); buffs.Add(buff); } } }
public void init(ShopScreen parentScreen) { this.parentScreen = parentScreen; itemDescriptor = Vars.gameplay.getItemDescriptor(); backBtn = transform.Find("BackBtn").GetComponent<Button>(); ShopItem item; for (int i = 0; i < transform.childCount; i++) { item = transform.GetChild(i).GetComponent<ShopItem>(); if (item != null) { item.init(); items.Add(item); } } Transform miscItemsTrans = transform.Find("MiscItems"); if (miscItemsTrans != null) { miscItems = new List<ShopItem>(); for (int i = 0; i < miscItemsTrans.childCount; i++) { item = miscItemsTrans.GetChild(i).GetComponent<ShopItem>(); item.init(); item.gameObject.SetActive(false); miscItems.Add(item); } } }
public void init (List<EquipmentHolder> equipmentHolders) { itemDescriptor = Vars.gameplay.getItemDescriptor(); inventory = Vars.gameplay.getInventory(); this.equipmentHolders = equipmentHolders; }
public GenericLowerGarment(Guid lowerGarmentID, SimpleDescriptor abbreviated, SimpleDescriptor fullName, ItemDescriptor descriptor, SimpleDescriptor about, double defense, byte sexiness, int price, bool supportsAllLegCounts) { uniqueID = lowerGarmentID; this.abbreviated = abbreviated ?? throw new ArgumentNullException(nameof(abbreviated)); this.fullName = fullName ?? throw new ArgumentNullException(nameof(fullName)); this.descriptor = descriptor ?? throw new ArgumentNullException(nameof(descriptor)); this.about = about ?? throw new ArgumentNullException(nameof(about)); this.defense = defense; this.sexiness = sexiness; this.price = price; allowsNonBipeds = supportsAllLegCounts; }
public override void Read(IStarboundStream stream) { EntityId = stream.ReadInt32(); item = ItemDescriptor.FromStream(stream); slot = stream.ReadVLQ(); }
/// <inheritdoc /> public INpcEntity CreateNpc(IMapContext mapContext, NpcDyoElement element) { int npcModelId = element.Index; if (!_gameResources.Movers.TryGetValue(npcModelId, out MoverData moverData)) { throw new ArgumentException($"Cannot find mover with id '{npcModelId}' in game resources.", nameof(npcModelId)); } var npc = new NpcEntity { Object = new ObjectComponent { MapId = mapContext.Id, CurrentMap = mapContext as IMapInstance, ModelId = npcModelId, Name = element.CharacterKey, Angle = element.Angle, Position = element.Position.Clone(), Size = (short)(ObjectComponent.DefaultObjectSize * element.Scale.X), Spawned = true, Type = WorldObjectType.Mover, Level = 1 }, Data = moverData }; npc.Behavior = _behaviorManager.GetBehavior(BehaviorType.Npc, npc, npc.Object.ModelId); npc.Timers.LastSpeakTime = RandomHelper.Random(10, 15); npc.Quests = _gameResources.Quests.Values.Where(x => !string.IsNullOrEmpty(x.StartCharacter) && x.StartCharacter.Equals(npc.Object.Name, StringComparison.OrdinalIgnoreCase)).ToList(); npc.Hand = _itemFactory.CreateItem(11, 0, ElementType.None, 0); if (_gameResources.Npcs.TryGetValue(npc.Object.Name, out NpcData npcData)) { npc.NpcData = npcData; } if (npc.NpcData != null && npc.NpcData.HasShop) { ShopData npcShopData = npc.NpcData.Shop; npc.Shop = new ItemContainerComponent[npcShopData.Items.Length]; for (var i = 0; i < npcShopData.Items.Length; i++) { npc.Shop[i] = new ItemContainerComponent(100); for (var j = 0; j < npcShopData.Items[i].Count && j < npc.Shop[i].MaxCapacity; j++) { ItemDescriptor item = npcShopData.Items[i][j]; Item shopItem = _itemFactory.CreateItem(item.Id, item.Refine, item.Element, item.ElementRefine); shopItem.Slot = j; shopItem.Quantity = shopItem.Data.PackMax; npc.Shop[i].SetItemAtIndex(shopItem, j); } } } return(npc); }
public void IncrementItemCounter(ItemDescriptor item) { _itemCounter.text = item.consumambleUses.ToString(); _itemSlot.IncrementItemSlotCounter(item); }
public ItemChange(ItemDescriptor old, ItemDescriptor @new) { Old = old; New = @new; }
private void VerifyUpdate(ItemDescriptor item, int version, LdValue value, int?variation) { Assert.Equal(version, item.Version); Assert.Equal(value, item.Item.Value); Assert.Equal(variation, item.Item.Variation); }
private void BuildResult(RenamedBase item) { ListViewItem l = new ListViewItem(item.NameOldSimple); l.ImageIndex = TreeBuilder.GetIconForEntity(item.EntityType); lvResults.Items.Add(l); ItemDescriptor d = new ItemDescriptor(item); l.Tag = d; string tip; if (item is RenamedClass) tip = TreeBuilder.BuildHintForClass((RenamedClass)item); else tip = TreeBuilder.BuildHintForItem((RenamedItem)item); if (!mainForm.HavePdb) tip += "Unable to map to source code, no PDB files attached."; else { if (item.EntityType != EntityType.Method) tip += "Mapping to source code works only for methods."; else { string filename; int line; if (mainForm.SearchInPdb(out filename, out line, item)) { tip += "Source position:\n" + filename + ":" + line + " (Ctrl+Click to open)"; d.Filename = filename; d.Line = line; } else tip += "Unable to map to source code."; } } tip += "\nDouble-click to select in classes tree."; l.ToolTipText = tip; }
internal void DoUpdate(DataKind kind, string key, ItemDescriptor item) { _log.Debug("updating \"{0}\" in {1} to {2}", key, kind.Name, LogValues.Defer(() => kind.Serialize(item))); _updates.Upsert(kind, key, item); }
/// <inheritdoc /> public int CreateItem(IPlayerEntity player, ItemDescriptor item, int quantity, int creatorId = -1, bool sendToPlayer = true) { int createdAmount = 0; if (item.Data.IsStackable) { for (var i = 0; i < InventoryContainerComponent.InventorySize; i++) { Item inventoryItem = player.Inventory.GetItemAtIndex(i); if (inventoryItem?.Id == item.Id) { if (inventoryItem.Quantity + quantity > item.Data.PackMax) { int boughtQuantity = inventoryItem.Data.PackMax - inventoryItem.Quantity; createdAmount = boughtQuantity; quantity -= boughtQuantity; inventoryItem.Quantity = inventoryItem.Data.PackMax; } else { createdAmount = quantity; inventoryItem.Quantity += quantity; quantity = 0; } if (sendToPlayer) { _inventoryPacketFactory.SendItemUpdate(player, UpdateItemType.UI_NUM, inventoryItem.UniqueId, inventoryItem.Quantity); } } } if (quantity > 0) { int availableSlot = player.Inventory.GetAvailableSlot(); if (availableSlot == -1) { _textPacketFactory.SendDefinedText(player, DefineText.TID_GAME_LACKSPACE); } else { Item newItem = _itemFactory.CreateItem(item.Id, item.Refine, item.Element, item.ElementRefine, creatorId); if (newItem == null) { throw new ArgumentNullException(nameof(newItem)); } newItem.Quantity = quantity; newItem.Slot = availableSlot; player.Inventory.SetItemAtSlot(newItem, availableSlot); if (sendToPlayer) { _inventoryPacketFactory.SendItemCreation(player, newItem); } createdAmount += quantity; } } } else { while (quantity > 0) { int availableSlot = player.Inventory.GetAvailableSlot(); if (availableSlot == -1) { _textPacketFactory.SendDefinedText(player, DefineText.TID_GAME_LACKSPACE); break; } Item newItem = _itemFactory.CreateItem(item.Id, item.Refine, item.Element, item.ElementRefine, creatorId); if (newItem == null) { throw new ArgumentNullException(nameof(newItem)); } newItem.Quantity = 1; newItem.Slot = availableSlot; player.Inventory.SetItemAtSlot(newItem, availableSlot); if (sendToPlayer) { _inventoryPacketFactory.SendItemCreation(player, newItem); } createdAmount++; quantity--; } } return(createdAmount); }
public static FullDataSet <ItemDescriptor> MakeFullDataSet(ItemDescriptor flag, ItemDescriptor segment) { return(new FullDataSet <ItemDescriptor>( new Dictionary <DataKind, KeyedItems <ItemDescriptor> > { { DataModel.Features, new KeyedItems <ItemDescriptor>( new Dictionary <string, ItemDescriptor> { { FlagKey, flag } } ) }, { DataModel.Segments, new KeyedItems <ItemDescriptor>( new Dictionary <string, ItemDescriptor> { { SegmentKey, segment } } ) }, } )); }
public GenericWellSpringAwareLowerGarment(Guid lowerGarmentID, SimpleDescriptor abbreviated, SimpleDescriptor fullName, ItemDescriptor descriptor, SimpleDescriptor about, double defense, byte sexiness, int price, bool supportsAllLegCounts, bool hasWellspring = true) : base(lowerGarmentID, abbreviated, fullName, descriptor, about, defense, sexiness, price, supportsAllLegCounts) { hasWellspringOfLust = hasWellspring; }
public GenericUpperGarment(Guid upperGarmentID, SimpleDescriptor abbreviated, SimpleDescriptor fullName, ItemDescriptor descriptor, SimpleDescriptor about, double defense, byte sexiness, int price) { uniqueID = upperGarmentID; this.abbreviated = abbreviated ?? throw new ArgumentNullException(nameof(abbreviated)); this.fullName = fullName ?? throw new ArgumentNullException(nameof(fullName)); this.descriptor = descriptor ?? throw new ArgumentNullException(nameof(descriptor)); this.about = about ?? throw new ArgumentNullException(nameof(about)); this.defense = defense; this.sexiness = sexiness; this.price = price; }
public static void DataItemsEqual(ItemDescriptor expected, ItemDescriptor actual) { AssertJsonEqual(expected.Item is null ? null : expected.Item.ToJsonString(), actual.Item is null ? null : actual.Item.ToJsonString()); Assert.Equal(expected.Version, actual.Version); }
/// <inheritdoc /> public IItemEntity CreateItemEntity(IMapInstance currentMapContext, IMapLayer currentMapLayerContext, ItemDescriptor item, IWorldEntity owner = null) { var itemEntity = _itemEntityFactory(_serviceProvider, null) as IItemEntity; itemEntity.Object = new ObjectComponent { CurrentMap = currentMapContext, MapId = currentMapContext.Id, LayerId = currentMapLayerContext.Id, ModelId = item.Id, Name = item.Data.Name, Spawned = true, Type = WorldObjectType.Item }; itemEntity.Drop = new DropComponent { Owner = owner, Item = CreateItem(item.Id, item.Refine, item.Element, item.ElementRefine) }; return(itemEntity); }
public void LdClientEndToEndTests() { // This is a basic smoke test to verify that the data store component behaves correctly within an // SDK client instance. var flag = FlagTestData.MakeFlagThatReturnsVariationForSegmentMatch(1, FlagTestData.GoodVariation1); var segment = FlagTestData.MakeSegmentThatMatchesUserKeys(1, FlagTestData.UserKey); var data = FlagTestData.MakeFullDataSet(flag, segment); var dataSourceFactory = new TestDataSourceFactory(data); var clientConfig = LaunchDarkly.Sdk.Server.Configuration.Builder("sdk-key") .DataSource(dataSourceFactory) .Events(Components.NoEvents) .Logging(Components.Logging(_testLogging)); if (Configuration.StoreFactoryFunc != null) { clientConfig.DataStore(Components.PersistentDataStore(Configuration.StoreFactoryFunc(null))); } else if (Configuration.StoreAsyncFactoryFunc != null) { clientConfig.DataStore(Components.PersistentDataStore(Configuration.StoreAsyncFactoryFunc(null))); } else { throw new InvalidOperationException("neither StoreFactoryFunc nor StoreAsyncFactoryFunc was set"); } using (var client = new LdClient(clientConfig.Build())) { var dataSourceUpdates = dataSourceFactory._updates; Action <User, LdValue> flagShouldHaveValueForUser = (user, value) => Assert.Equal(value, client.JsonVariation(FlagTestData.FlagKey, user, LdValue.Null)); // evaluate each flag from the data store flagShouldHaveValueForUser(FlagTestData.MainUser, FlagTestData.GoodValue1); flagShouldHaveValueForUser(FlagTestData.OtherUser, FlagTestData.BadValue); // evaluate all flags var state = client.AllFlagsState(FlagTestData.MainUser); Assert.Equal(FlagTestData.GoodValue1, state.GetFlagValueJson(FlagTestData.FlagKey)); // update the flag var flagV2 = FlagTestData.MakeFlagThatReturnsVariationForSegmentMatch(2, FlagTestData.GoodVariation2); dataSourceUpdates.Upsert(DataModel.Features, FlagTestData.FlagKey, flagV2); // flag should now return new value flagShouldHaveValueForUser(FlagTestData.MainUser, FlagTestData.GoodValue2); flagShouldHaveValueForUser(FlagTestData.OtherUser, FlagTestData.BadValue); // update the segment so it now matches both users var segmentV2 = FlagTestData.MakeSegmentThatMatchesUserKeys(2, FlagTestData.UserKey, FlagTestData.OtherUserKey); dataSourceUpdates.Upsert(DataModel.Segments, FlagTestData.SegmentKey, segmentV2); flagShouldHaveValueForUser(FlagTestData.MainUser, FlagTestData.GoodValue2); flagShouldHaveValueForUser(FlagTestData.OtherUser, FlagTestData.GoodValue2); // delete the segment - should cause the flag that uses it to stop matching dataSourceUpdates.Upsert(DataModel.Segments, FlagTestData.SegmentKey, ItemDescriptor.Deleted(3)); flagShouldHaveValueForUser(FlagTestData.MainUser, FlagTestData.BadValue); flagShouldHaveValueForUser(FlagTestData.OtherUser, FlagTestData.BadValue); // delete the flag so it becomes unknown dataSourceUpdates.Upsert(DataModel.Features, FlagTestData.FlagKey, ItemDescriptor.Deleted(3)); var detail = client.JsonVariationDetail(FlagTestData.FlagKey, FlagTestData.MainUser, LdValue.Null); Assert.Equal(EvaluationReason.ErrorReason(EvaluationErrorKind.FlagNotFound), detail.Reason); } }
private void ProcessPdb(ItemDescriptor d) { if (d.Renamed == null) return; string filename; int line; if (mainForm.SearchInPdb(out filename, out line, d.Renamed)) { d.Filename = filename; d.Line = line; } }
public static void DataItemsEqual(DataKind kind, ItemDescriptor expected, ItemDescriptor actual) { AssertJsonEqual(kind.Serialize(expected), kind.Serialize(actual)); Assert.Equal(expected.Version, actual.Version); }
void OnGUI() { EditorGUILayout.BeginVertical(); //EditorGUILayout.HelpBox("Changes will take effect immediately, be careful!", MessageType.Info); int newSize = EditorGUILayout.IntField("Item List Size: ", _itemSize, GUILayout.MaxWidth(200)); if (newSize != _itemSize && newSize >= 0) { List <ItemDescriptor> newList = new List <ItemDescriptor>(new ItemDescriptor[newSize]); for (int i = 0; i < newSize; i++) { newList[i] = new ItemDescriptor(); if (i < _itemSize) { newList[i] = _items[i]; } } _itemSize = newSize; _items = newList; } _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos, GUILayout.Height(300)); // List Title EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("ID", GUILayout.MinWidth(30), GUILayout.MaxWidth(60)); EditorGUILayout.LabelField("Type", GUILayout.MinWidth(30), GUILayout.MaxWidth(60)); EditorGUILayout.LabelField("Position(Integer)"); EditorGUILayout.EndHorizontal(); for (int i = 0; i < _itemSize; i++) { EditorGUILayout.BeginHorizontal(); _items[i]._id = EditorGUILayout.IntField(_items[i]._id, GUILayout.MinWidth(30), GUILayout.MaxWidth(60)); _items[i]._type = EditorGUILayout.IntField(_items[i]._type, GUILayout.MinWidth(30), GUILayout.MaxWidth(60)); _items[i]._position = EditorGUILayout.Vector3Field("", _items[i]._position); EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndScrollView(); Separator(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Create")) { Create(); } if (GUILayout.Button("Reset Value")) { for (int i = 0; i < _itemSize; i++) { _items[i]._id = 0; _items[i]._type = 0; _items[i]._position = Vector3.zero; } } if (GUILayout.Button("Clear Scene")) { GameObject levelEditor = GameObject.Find("*LevelEditor*"); if (levelEditor != null) { DestroyImmediate(levelEditor); } } if (GUILayout.Button("Undo")) { Undo.PerformUndo(); } if (GUILayout.Button("Redo")) { Undo.PerformRedo(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); }
public FightScreen init(ScanningScreen scanningScreen, StatusScreen statusScreen, ItemDescriptor itemDescriptor) { this.scanningScreen = scanningScreen; this.playerData = statusScreen.playerData; this.itemDescriptor = itemDescriptor; this.chambersHolder = statusScreen.cabin.chambersHolder; fightProcessor = GetComponent <FightProcessor>(); itemDescriptor.fightScreen = this; elementsHolder = transform.Find("Elements Holder").GetComponent <ElementsHolder> ().init(this);; iconsHolderRender = elementsHolder.GetComponent <SpriteRenderer>(); fightEffectPlayer = transform.Find("Fight Effect Player").GetComponent <FightEffectPlayer>().init(); elementEffectPlayer = transform.Find("ElementEffectPlayer").GetComponent <ElementEffectPlayer>(); fightInterface = transform.Find("Fight Interface").GetComponent <FightInterface>().init(this); enemy = transform.Find("Enemy").GetComponent <Enemy>(); resultScreen = transform.Find("Fight Result Screen").GetComponent <FightResultScreen>().init(this, statusScreen.cabin.chambersHolder, enemy); enemyDeadAnimator = transform.Find("EnemyDeadAnim").GetComponent <Animator>(); deadStone = enemyDeadAnimator.transform.Find("DeadStone"); enemyPos = enemy.transform.localPosition; // elementsHolder.init(); enemy.init(this); elementEffectPlayer.init(this, enemy); fightProcessor.init(this, elementsHolder, enemy); elementsHolder.gameObject.SetActive(true); enemyDeadAnimator.gameObject.SetActive(false); gameObject.SetActive(false); Transform actionsHolder = transform.Find("Actions Holder"); actionsHolder.Find("Delimiter").GetComponent <StrokeText>().init("default", 5); playerActionsText = actionsHolder.Find("Player Actions").GetComponent <StrokeText>().init("default", 5); enemyActionsText = actionsHolder.Find("Enemy Actions").GetComponent <StrokeText>().init("default", 5); actionsHolder.gameObject.SetActive(true); Transform supplyHolder = transform.Find("Supply Holder"); SupplySlot slot; for (int i = 0; i < supplyHolder.childCount; i++) { slot = supplyHolder.GetChild(i).GetComponent <SupplySlot>(); slot.init(); supplySlots.Add(slot); } supplyHolder.gameObject.SetActive(true); captureBtn = transform.Find("Capture Button").GetComponent <Button> ().init(); releaseBtn = transform.Find("Release Button").GetComponent <Button> ().init(); Player.fightScreen = this; return(this); }
public IItemEntity CreateItemEntity(IMapInstance currentMapContext, IMapLayer currentMapLayerContext, ItemDescriptor item, IWorldEntity owner = null) { throw new NotImplementedException(); }
public static string ToXml(this ItemDescriptor descriptor) { return(ToXml(descriptor.ToXml)); }
private void CauseStoreError(MockCoreBase core, PersistentStoreWrapper wrapper) { core.Available = false; core.Error = FakeError; Assert.Equal(FakeError, Assert.Throws(FakeError.GetType(), () => wrapper.Upsert(TestDataKind, "irrelevant-key", ItemDescriptor.Deleted(1)))); }
private void BuildNormalNode(PineappleTreeNode node, INamedEntity entity, string originalLine) { node.ImageIndex = TreeBuilder.GetIconForEntity(entity.EntityType); ItemDescriptor descriptor = new ItemDescriptor(entity); string tooltip = descriptor.GetToolTip(); node.Tag = descriptor; RenamedItem item = entity as RenamedItem; if (item != null) node.Subitems.Add("Owner class: " + item.Owner.NameOldFull); RenamedBase renamedBase = (RenamedBase)entity; if (tbtnShort.Checked) node.Subitems.Add("New name: " + renamedBase.NameNew); if (tbtnSimple.Checked) node.Subitems.Add("New name: " + renamedBase.NameNewSimple); if (tbtnFull.Checked) node.Subitems.Add("New name: " + renamedBase.NameNewFull); if (originalLine != null && Configs.Instance.ShowOriginal) node.Subitems.Add("Original line: " + originalLine); if (!mainForm.HavePdb) tooltip += "Unable to map to source code, no PDB files attached."; else { if (entity.EntityType != EntityType.Method) tooltip += "Mapping to source code works only for methods."; else { ProcessPdb(descriptor); if (descriptor.Filename != null) { node.Subitems.Add(PathUtils.ShortenPath(descriptor.Filename, 100) + ":" + descriptor.Line); tooltip += descriptor.Filename + ":" + descriptor.Line; } else tooltip += "Unable to map to source code."; } } node.ToolTipText = tooltip; }
public bool Upsert(DataKind kind, string key, ItemDescriptor item) => WrappedStore.Upsert(kind, key, item);
public static string Serialize(ItemDescriptor item) => (item.Item is null ? "DELETED" : (item.Item as TestItem).Name) +
internal virtual PropertyDescriptorCollection GetPropertyDescriptors() { if (this.m_cache == null) { PropertyDescriptor[] properties = new PropertyDescriptor[this.m_names.Length]; for (int i = 0; i < this.m_names.Length; i++) { properties[i] = new ItemDescriptor(this.m_names[i]); } this.m_cache = new PropertyDescriptorCollection(properties); } return this.m_cache; }
public ScanningScreen init(ExploreScreen exploreScreen, StatusScreen statusScreen, ItemDescriptor itemDescriptor) { this.exploreScreen = exploreScreen; fightScreen = GameObject.Find("Fight Screen").GetComponent <FightScreen>().init(this, statusScreen, itemDescriptor); scanningDetails = transform.Find("Scanning Details").GetComponent <ScanningDetails>().init(this); statusScreen.cabin.scanningScreen = this; cursor = transform.Find("Cursor").transform; cursor.gameObject.SetActive(true); closeBtn = transform.Find("Close Button").GetComponent <Button>().init(); transform.Find("Background").gameObject.SetActive(true); markersHolder = transform.Find("Markers Holder"); holderCenter = markersHolder.localPosition; Transform barsHolder = transform.Find("Bars Holder"); barBlocks = new GameObject[barsHolder.childCount]; char[] separ = new char[] { ' ' }; int pos; for (int i = 0; i < barsHolder.childCount; i++) { pos = int.Parse(barsHolder.GetChild(i).name.Split(separ, int.MaxValue)[2]); barBlocks[i] = barsHolder.GetChild(i).gameObject; } barsHolder.gameObject.SetActive(true); // Transform blockHolder = transform.Find("Enemy Blocks"); // enemyBlocks = new EnemyBlock[blockHolder.childCount]; // EnemyBlock block; // for (int i = 0; i < blockHolder.childCount; i++) { // block = blockHolder.GetChild(i).GetComponent<EnemyBlock>().init(this); // enemyBlocks[block.index] = block; // } // blockHolder.gameObject.SetActive(true); markersHolder.gameObject.SetActive(true); foreach (EnemyType eType in Enum.GetValues(typeof(EnemyType))) { if (eType.planet() == Vars.planetType) { enemyTypes.Add(eType); } } isActive = true; close(); return(this); }
internal void DoUpdate(string key, ItemDescriptor item) { _log.Debug("updating \"{0}\" to {1}", key, LogValues.Defer(() => item.Item is null ? "<null>" : DataModelSerialization.SerializeFlag(item.Item))); _updateSink.Upsert(User, key, item); }
public ExploreScreen init(PlanetSurface planetSurface, StatusScreen statusScreen, ItemDescriptor itemDescriptor) { this.planetSurface = planetSurface; enemyImage = transform.Find("Enemy Image").GetComponent <SpriteRenderer>(); exploreBtn = transform.Find("Explore Button").GetComponent <Button>().init(); leaveBtn = transform.Find("Leave Button").GetComponent <Button>().init(); scanningScreen = GameObject.Find("Scanning Screen").GetComponent <ScanningScreen>().init(this, statusScreen, itemDescriptor); gameObject.SetActive(false); return(this); }
public GenericArmor(Guid uniqueID, ArmorType armorRating, SimpleDescriptor abbreviatedName, SimpleDescriptor fullName, ItemDescriptor description, SimpleDescriptor aboutText, double defenseRating, int price, byte seductiveModifier = 0, byte wizardModifier = 0, bool allowsUnderGarments = true) : base(armorRating) { this.id = uniqueID; this.defense = defenseRating; this.abbr = abbreviatedName ?? throw new ArgumentNullException(nameof(abbreviatedName)); this.full = fullName ?? throw new ArgumentNullException(nameof(fullName)); this.desc = description ?? throw new ArgumentNullException(nameof(description)); this.about = aboutText ?? throw new ArgumentNullException(nameof(aboutText)); this.worksWithUnderclothes = allowsUnderGarments; value = price; sluttySeduction = seductiveModifier; wizardsEndurance = wizardModifier; }
private DrinkablePotionFactory <T> GetDrinkablePotionFactory <T>(PotionDescriptor potionDescriptor, ItemDescriptor itemDescriptor) where T : DrinkablePotion, new() { return(new DrinkablePotionFactory <T>( potionDescriptor.Name, potionDescriptor.Weight, builder.ActionCombos[itemDescriptor.AttackCombo], builder.GetStorageTypes(itemDescriptor.CarryLocation), builder.RenderersSource.GetItemRenderer(ResourceProvider.Instance.Content.Load <Texture2D>(potionDescriptor.TexturePath)))); }
private static bool ItemsEqual(DataKind kind, ItemDescriptor expected, ItemDescriptor actual) => LdValue.Parse(kind.Serialize(actual)) == LdValue.Parse(kind.Serialize(expected));
public void Reset() { currentDescriptor = null; }
private void BuildNormalNode(PineappleTreeNode node, INamedEntity entity, string originalLine) { node.ImageIndex = TreeBuilder.GetIconForEntity(entity.EntityType, mainForm); ItemDescriptor descriptor = new ItemDescriptor(entity); string tooltip = descriptor.GetToolTip(); node.Tag = descriptor; RenamedItem item = entity as RenamedItem; if (item != null) { node.Text += "\nOwner class: " + item.Owner.NameOldFull; } RenamedBase renamedBase = (RenamedBase)entity; if (tbtnShort.Checked) { node.Text += "\nNew name: " + renamedBase.NameNew; } if (tbtnSimple.Checked) { node.Text += "\nNew name: " + renamedBase.NameNewSimple; } if (tbtnFull.Checked) { node.Text += "\nNew name: " + renamedBase.NameNewFull; } if (originalLine != null && Configs.Instance.ShowOriginal) { node.Text += "\nOriginal line: " + originalLine; } if (!mainForm.HavePdb) { tooltip += "Unable to map to source code, no PDB files attached."; } else { if (entity.EntityType != EntityType.Method) { tooltip += "Mapping to source code works only for methods."; } else { ProcessPdb(descriptor); if (descriptor.Filename != null) { node.Text += "\n" + PathUtils.ShortenPath(descriptor.Filename, 100) + ":" + descriptor.Line; tooltip += descriptor.Filename + ":" + descriptor.Line; } else { tooltip += "Unable to map to source code."; } } } node.ToolTipText = tooltip; }