public ItemBase(int id, ItemKind kind, string rcName, string jpName) { this.id = id; this.itemKind = kind; this.resourceName = rcName; this.jpName = jpName; }
// selecting by query public V341SelectMultipleItems( string dataTypeName, ItemKind itemKind, string queryExprStr, string orderExprStr, int startRow, int rowCount, string[] appScopes, long minimumUSN, bool includeDeleted, DateTimeOffset asAtTime, bool excludeDataBody) { QueryDef = new V341QueryDefinition( itemKind, dataTypeName, appScopes, null, queryExprStr, asAtTime, minimumUSN, false, true, !includeDeleted, excludeDataBody); OrderExpr = orderExprStr; StartRow = startRow; RowCount = rowCount; }
public void DropItem() { GameObject go = null; ItemKind kind = (randomDrop) ? _rndList[AntMath.RandomRangeInt(0, _rndList.Length - 1)] : dropKind; switch (kind) { case ItemKind.Bomb: go = GameObject.Instantiate((GameObject)_gameCore.bombItemPrefab); break; case ItemKind.Gun: go = GameObject.Instantiate((GameObject)_gameCore.gunItemPrefab); break; case ItemKind.Ammo: go = GameObject.Instantiate((GameObject)_gameCore.ammoItemPrefab); break; case ItemKind.Heal: go = GameObject.Instantiate((GameObject)_gameCore.healItemPrefab); break; } if (go != null) { go.GetComponent <Transform>().position = _t.position; AntEngine.Current.AddEntity(go.GetComponent <AntEntity>()); } }
/// <summary> /// コンストラクタ /// </summary> /// <param name="path">ファイルパス</param> /// <param name="isEx">展開済みか</param> /// <param name="k"></param> public TreeProjectState(string path, bool isEx, ItemKind k = ItemKind.Solution) { filePaht = path; isExpand = isEx; kind = k; nodes = new List <TreeProjectState>(); }
/// <summary> /// Adds founded collectable item to the memory. /// </summary> /// <param name="aObject">Item object.</param> /// <param name="aKind">Kind of the item.</param> public void TrackItem(CollectableItem aObject, ItemKind aKind) { // Subscribe for collection event of new item. aObject.EventCollected += CollectItemHandler; // Find item of this kind in the our memory. int index = _items.FindIndex(x => x.kind == aKind); if (index >= 0 && index < _items.Count) { // Found item with same kind in the memory, // then replace existing for new. var item = _items[index]; if (item.obj != null) { // Unsubscribe from collection event of the existing item. item.obj.EventCollected -= CollectItemHandler; } item.obj = aObject; _items[index] = item; return; } // Just add item to our memory. _items.Add(new Item { kind = aKind, obj = aObject }); }
private void DropItem(ItemKind aKind, Vector3 aPosition) { GameObject go = null; switch (aKind) { case ItemKind.Bomb: go = GameObject.Instantiate((GameObject)_gameCore.bombItemPrefab); break; case ItemKind.Gun: go = GameObject.Instantiate((GameObject)_gameCore.gunItemPrefab); break; case ItemKind.Ammo: go = GameObject.Instantiate((GameObject)_gameCore.ammoItemPrefab); break; case ItemKind.Heal: go = GameObject.Instantiate((GameObject)_gameCore.healItemPrefab); break; } if (go != null) { float angle = AntMath.DegToRad(AntMath.RandomRangeFloat(-180, 180)); Vector2 force = new Vector2(); force.x = 0.5f * Mathf.Cos(angle); force.y = 0.5f * Mathf.Sin(angle); go.GetComponent <Transform>().position = aPosition; go.GetComponent <Rigidbody2D>().AddForce(force, ForceMode2D.Impulse); Engine.AddEntity(go.GetComponent <AntEntity>()); } }
private async Task <CatalogueItemFacade> CreateItem(ItemKind itemKind, IGroup entry) { var catalogue = entry.Context.Catalogue; // ReSharper disable once SwitchStatementMissingSomeCases switch (itemKind) { case ItemKind.Entry: return(entry.Entries.AddNew().ToFacade()); case ItemKind.Group: return(entry.Groups.AddNew().ToFacade()); case ItemKind.EntryLink: if (catalogue.SharedEntries.Count < 1) { await InformLinkTargetUnavailable("shared entry"); return(null); } return(entry.EntryLinks.AddNew(catalogue.SharedEntries.First()).ToFacade()); case ItemKind.GroupLink: if (catalogue.SharedGroups.Count < 1) { await InformLinkTargetUnavailable("shared group"); return(null); } return(entry.GroupLinks.AddNew(catalogue.SharedGroups.First()).ToFacade()); default: throw new ArgumentOutOfRangeException(nameof(itemKind), itemKind, null); } }
public V341CreateSubscription( Guid subscriptionId, DateTimeOffset expiryTime, ItemKind itemKind, string dataTypeName, string queryExprStr, string[] appScopes, long minimumUSN, bool excludeDeleted, bool excludeExisting, bool waitForExisting, DateTimeOffset asAtTime, bool excludeDataBody) { QueryDef = new V341QueryDefinition( itemKind, dataTypeName, appScopes, null, queryExprStr, asAtTime, minimumUSN, excludeExisting, waitForExisting, excludeDeleted, excludeDataBody); SubscriptionId = subscriptionId; ExpiryTime = expiryTime; }
/// <summary> /// Spawn specified collectable item on the map. /// </summary> /// <param name="aPosition">Position of the item.</param> /// <param name="aKind">Kind of the item.</param> /// <param name="aParent">Parent transfrom.</param> /// <returns>CollectableItem or null.</returns> public CollectableItem SpawnItem(Vector2 aPosition, ItemKind aKind, Transform aParent = null) { int index = System.Array.FindIndex(availableItems, x => x.kind == aKind); if (index >= 0 && index < availableItems.Length) { // Create new item on the map. A.Assert(availableItems[index].prefab == null, $"Prefab for `{aKind}` collectable item is missed."); var go = GameObject.Instantiate(availableItems[index].prefab); go.transform.position = aPosition; if (aParent != null) { go.transform.SetParent(aParent, false); } // Add the item to the game and subscribe to collect event // to know when need to remove the item from list. var item = go.GetComponent <CollectableItem>(); item.EventCollected += ItemCollectHandler; collectableItems.Add(item); return(item); } A.Warning($"Can't create `{aKind}` collectable item!"); return(null); }
public V341QueryDefinition( ItemKind itemKind, string dataType, string[] appScopes, string[] itemNames, string queryExpr, DateTimeOffset asAtTime, long minimumUSN, bool excludeExisting, bool waitForExisting, bool excludeDeleted, bool excludeDataBody) { ItemKind = V341Helpers.ToV341ItemKind(itemKind); DataType = dataType; AppScopes = appScopes; ItemNames = itemNames; QueryExpr = queryExpr; AsAtTime = asAtTime; MinimumUSN = minimumUSN; ExcludeExisting = excludeExisting; WaitForExisting = waitForExisting; ExcludeDeleted = excludeDeleted; ExcludeDataBody = excludeDataBody; }
private string GetPrefix(ItemKind kind) { string prefix = BaseLocale.GetStr(fEntry.Prefix); if (GlobalVars.nwrWin.LangExt.Equals("ru")) { Gender wordGender = Gender.gUndefined; switch (kind) { case ItemKind.ik_Potion: wordGender = Gender.gNeutral; break; case ItemKind.ik_Ring: wordGender = Gender.gNeutral; break; case ItemKind.ik_Wand: wordGender = Gender.gFemale; break; case ItemKind.ik_Scroll: wordGender = Gender.gMale; break; } prefix = Grammar.morphAdjective(prefix, Case.cNominative, Number.nSingle, wordGender); } return(prefix); }
// constructors /// <summary> /// /// </summary> /// <param name="moduleInfo"></param> /// <param name="cryptoManager"></param> /// <param name="itemKind"></param> /// <param name="transient"></param> /// <param name="appScope"></param> /// <param name="name"></param> /// <param name="props"></param> /// <param name="data"></param> /// <param name="dataType"></param> /// <param name="serialFormat"></param> /// <param name="lifetime"></param> public ServerItem( IModuleInfo moduleInfo, ICryptoManager cryptoManager, ItemKind itemKind, bool transient, string appScope, string name, NamedValueSet props, object data, Type dataType, SerialFormat serialFormat, TimeSpan lifetime) : base(itemKind, transient, name, appScope) { _moduleInfo = moduleInfo ?? throw new ArgumentNullException(nameof(moduleInfo)); _cryptoManager = cryptoManager ?? throw new ArgumentNullException(nameof(cryptoManager)); if (dataType == null) { throw new ArgumentNullException(nameof(dataType)); } SysProps.Set(SysPropName.SAlg, (int)serialFormat); AppProps.Add(props); _data = data; _dataTypeType = dataType; DataTypeName = dataType.FullName; _lifetime = lifetime; }
private async Task <IReadOnlyCollection <T> > GetItemsAsync <T>(ItemKind kind, Dictionary <string, object> query) where T : IItem { // Unsafe workaround for no interface deserialization string path = $"item/{kind.ToString().ToCamelCase()}{query.AsQueryString()}"; IReadOnlyCollection <T> response; if (typeof(T) != typeof(IItem)) { var result = await _httpClient.GetFromJsonAsync <Response <T> >(path); response = result.Items; } else { var kindType = _kindMap[kind]; var responseType = typeof(Response <>).MakeGenericType(kindType); dynamic result = await _httpClient.GetFromJsonAsync(path, responseType); response = result.Items; } return(response); }
public async Task <IItem> GetItemAsync(string id, ItemKind kind) { var kindType = _kindMap[kind]; var response = await _httpClient.GetFromJsonAsync($"item/{kind.ToString().ToCamelCase()}/{id}", kindType); return(response as IItem); }
public void HitItem(ItemKind item) { ItemArgs e = new ItemArgs { itemkind = item, itemCount = 0 }; SendEvent(Const.E_HitItem, e); //switch (item) //{ // case ItemKind.InvincibleItem: // HitInvincible(); // break; // case ItemKind.MagnetItem: // HitMagnet(); // break; // case ItemKind.MultiplyItem: // HitDouble(); // break; // default: // break; //} }
private void Filter(ItemKind kind) { foreach (UIInventorySlot slot in _slots) { if (kind == ItemKind.Material) { if (slot.item.GameItem.Kind == (int)ItemKind.Material || slot.item.GameItem.Kind == (int)ItemKind.Consume) { if (!slot.gameObject.activeInHierarchy) { slot.gameObject.SetActive(true); } } } else if (kind == (int)ItemKind.None || slot.item.GameItem.Kind == (int)kind) { if (!slot.gameObject.activeInHierarchy) { slot.gameObject.SetActive(true); } } else if (slot.item.GameItem.Kind != (int)kind) { if (slot.gameObject.activeInHierarchy) { slot.gameObject.SetActive(false); } } } slotRoot.Reposition(); scrollView.ResetPosition(); }
public void DrawItem(Graphics gfx, MapRenderContext context, Rectangle itemRect, Item item) { var colorScheme = colorSchemeProvider.GetColorScheme(); itemRect = context.ApplyStandardPaddingForTiles(itemRect); Brush brush = context.ResourceCache.GetSolidBrush(colorScheme.GetItemColor(item)); gfx.FillRectangle(brush, itemRect); ItemKind kind = ItemInfo.GetItemKind(item); if (kind == ItemKind.Kind_DIYRecipe) { gfx.FillPolygon(Brushes.PaleVioletRed, new Point[] { new Point(itemRect.Left, itemRect.Bottom), new Point(itemRect.Left + itemRect.Width / 2, itemRect.Top + itemRect.Height / 2), new Point(itemRect.Right, itemRect.Bottom), }); } else if (!item.IsDropped && !item.IsBuried) { gfx.DrawLine(Pens.Black, itemRect.Left, itemRect.Top, itemRect.Right, itemRect.Bottom); gfx.DrawLine(Pens.Black, itemRect.Left, itemRect.Bottom, itemRect.Right, itemRect.Top); } }
private void OnSlot_Click(ItemKind type) { itemSlotSelected = null; _curItemTypeSelect = type; uiEquipmentRoot.SetActive(false); uiInventoryRoot.SetActive(true); List <UserItem> items; if (type == ItemKind.Consume) { items = GameManager.GameUser.UserItems.Where(p => p.GameItem.Kind == (int)type && (p.RoleUId == 0 || p.RoleUId == heroSlotSelected.userRole.Id) && p.GameItem.Kind == (int)ItemKind.Consume).ToList(); } else { items = GameManager.GameUser.UserItems.Where(p => p.GameItem.Kind == (int)type && (p.RoleUId == 0 || p.RoleUId == heroSlotSelected.userRole.Id)).ToList(); //.OrderByDescending(p => p.RoleUId == heroSlotSelected.userRole.Id).ThenByDescending(p => p.GameItem.Level).ThenByDescending(p => p.Grade).ToList(); } for (int i = 0; i < items.Count; i++) { GameObject go = NGUITools.AddChild(uiItemSlotRoot, uiItemSlotPrefab); UIHeroItemSlotManager slot = go.GetComponent <UIHeroItemSlotManager>(); slot.SetItem(items[i], this); _itemSet.Add(slot); } uiItemSlotRoot.GetComponent <UIGrid>().Reposition(); }
public void LoadMap(int[] pMap) { map = pMap; int roww = 0; for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { int mapValue = map[i * columns + j]; if (mapValue > 0 && mapValue < LevelEditorBase.THIS.items.Count) { roww = i; if (LevelData.GetTarget() == TargetType.Round) { roww = i + 6; } ItemKind itemKind = LevelEditorBase.THIS.items[mapValue]; createBall(GetSquare(roww, j).transform.position, itemKind.color, false, i, itemKind); // if (!LevelData.colorsDict.ContainsValue (b.itemKind.color) && (b.itemKind.itemType == ItemTypes.Simple || b.itemKind.itemType == ItemTypes.Pet)) { // LevelData.colorsDict.Add (key, b.itemKind.color); // key++; // } } else if (mapValue == 0 && LevelData.GetTarget() == TargetType.Top && i == 0) { Instantiate(Resources.Load("Prefabs/TargetStar"), GetSquare(i, j).transform.position, Quaternion.identity); } } } }
private void LoadItemTypeValues(ItemKind k, ushort index) { if (k == ItemKind.Kind_MessageBottle || index >= 60_000) { CHK_Wrapped.Checked = false; CHK_Wrapped.Visible = CHK_Wrapped.Checked = false; FLP_Flag1.Visible = true; return; } switch (k) { case ItemKind.Kind_FossilUnknown: CB_Fossil.SelectedValue = (int)NUD_Count.Value; break; case ItemKind.Kind_DIYRecipe: CB_Recipe.SelectedValue = (int)NUD_Count.Value; break; case ItemKind.Kind_MessageBottle: CB_Recipe.SelectedValue = (int)NUD_Count.Value; CHK_Wrapped.Visible = CHK_Wrapped.Checked = false; FLP_Flag1.Visible = true; return; } CHK_Wrapped.Visible = true; FLP_Flag1.Visible = false; }
public void Filer(ItemKind kind) { foreach (UIHeroInventorySlot slot in _slots) { if (kind == (int)ItemKind.None) { if (!slot.gameObject.activeSelf) { slot.gameObject.SetActive(true); } } else if (slot.userItem.GameItem.Kind == (int)kind) { if (!slot.gameObject.activeSelf) { slot.gameObject.SetActive(true); } } else if (slot.userItem.GameItem.Kind != (int)kind) { if (slot.gameObject.activeSelf) { slot.gameObject.SetActive(false); } } } uiInventory.scrollView.ResetPosition(); uiInventory.root.Reposition(); }
private void CB_ItemID_SelectedValueChanged(object sender, EventArgs e) { itemID = (ushort)WinFormsUtil.GetIndex(CB_ItemID); kind = ItemInfo.GetItemKind(itemID); if (kind.IsFlower()) { CB_NamedItemArgument.Visible = false; FLP_Uses.Visible = FLP_Count.Visible = FLP_Flag0.Visible = FLP_Flag1.Visible = false; FLP_FlowerFlags.Visible = FLP_Genetics.Visible = true; return; } switch (kind) { case ItemKind.Kind_DIYRecipe: CB_NamedItemArgument.SelectedValue = (int)NUD_Count.Value; CB_NamedItemArgument.Visible = true; FLP_Uses.Visible = FLP_Count.Visible = FLP_Flag0.Visible = FLP_Flag1.Visible = false; FLP_FlowerFlags.Visible = FLP_Genetics.Visible = false; break; default: CB_NamedItemArgument.Visible = false; FLP_Uses.Visible = FLP_Count.Visible = FLP_Flag0.Visible = FLP_Flag1.Visible = true; FLP_FlowerFlags.Visible = FLP_Genetics.Visible = false; break; } }
public override void LoadXML(XmlNode element, FileVersion version) { try { base.LoadXML(element, version); ImageName = ReadElement(element, "ImageName"); ItmKind = (ItemKind)Enum.Parse(typeof(ItemKind), ReadElement(element, "Kind")); string signs = ReadElement(element, "Signs"); Flags = new ItemFlags(signs); string newSigns = Flags.Signature; if (!signs.Equals(newSigns)) { throw new Exception("ItemSigns not equals (" + ImageName + ")"); } EqKind = (BodypartType)Enum.Parse(typeof(BodypartType), ReadElement(element, "eqKind")); Frequency = Convert.ToSByte(ReadElement(element, "Frequency")); Satiety = Convert.ToInt16(ReadElement(element, "Satiety")); Price = Convert.ToInt16(ReadElement(element, "Price")); Weight = (float)ConvertHelper.ParseFloat(ReadElement(element, "Weight"), 0.0f, true); XmlNode ael = element.SelectSingleNode("Attributes"); for (int i = ItemAttribute.ia_First; i <= ItemAttribute.ia_Last; i++) { string atSign = dbItemAttributes[i - 1]; Attributes[i - 1] = Convert.ToInt32(ReadElement(ael, atSign)); } XmlNodeList nl = element.SelectSingleNode("Effects").ChildNodes; Effects = new EffectEntry[nl.Count]; for (int i = 0; i < nl.Count; i++) { XmlNode n = nl[i]; Effects[i] = new EffectEntry(); Effects[i].EffID = (EffectID)Enum.Parse(typeof(EffectID), n.Attributes["EffectID"].InnerText); Effects[i].ExtData = Convert.ToInt32(n.Attributes["ExtData"].InnerText); } nl = element.SelectSingleNode("Contents").ChildNodes; Contents = new ContentsEntry[nl.Count]; for (int i = 0; i < nl.Count; i++) { XmlNode n = nl[i]; Contents[i] = new ContentsEntry(); Contents[i].ItemID = n.Attributes["ItemID"].InnerText; Contents[i].Chance = Convert.ToInt32(n.Attributes["Chance"].InnerText); } Material = (MaterialKind)Enum.Parse(typeof(MaterialKind), ReadElement(element, "Material")); FramesCount = Convert.ToSByte(ReadElement(element, "FramesCount")); BonusRange.Min = Convert.ToInt32(ReadElement(element, "BonusRange_Min")); BonusRange.Max = Convert.ToInt32(ReadElement(element, "BonusRange_Max")); } catch (Exception ex) { Logger.Write("ItemEntry.loadXML(): " + ex.Message); throw ex; } }
public MenuItem AppendWL(int id, string item, string help, ItemKind kind, EventListener listener) { MenuItem tmpitem = Append(id, item, help, kind); AddEvent(id, listener, tmpitem); return(tmpitem); }
public async Task <IReadOnlyCollection <IItem> > GetItemsAsync(ItemKind kind) { var index = await GetItemIndexAsync(); var count = index.Kinds[kind].Count; return(await GetItemsByCountAsync <IItem>(kind, count)); }
/// <summary> /// コンストラクタ /// </summary> /// <param name="k"></param> public NodeInfo(ItemKind k) { kind = k; isChildNode = false; filePath = ""; isLock = false; itemImgIndex = 0; }
public void Pickup(ItemKind aItem) { _itemKind = aItem; _targetItem = _blackboard.GetItem(_itemKind); if (_targetItem != null) { _control.MoveTo(_targetItem.Position); } }
/// <summary> /// 当前选中项目参数 /// </summary> /// <param name="kind">项目类型</param> /// <param name="code">项目代码</param> /// <param name="name">项目名称</param> /// <param name="unit">剂量单位</param> /// <param name="usage">用法</param> public OrderItemArgs(bool hadData, ItemKind kind, string code, string name, string unit, string usage) { _hadData = hadData; _kind = kind; _itemCode = code; _itemName = name; _doseUnit = unit; _usage = usage; }
public BaseItem FindAndClone(ItemKind kind) { if (ItemPrototypes.ContainsKey(kind)) { return(ItemPrototypes[kind].Clone()); } return(NullItem.Instance.Clone()); }
public Item GetAsItem(Item referenceItem) { if (CurrentItemID == -1) { return(referenceItem); } Item item = (referenceItem == null) ? new Item() : referenceItem; ushort num = Convert.ToUInt16(CurrentItemID); ItemKind itemKind = ItemInfo.GetItemKind(num); item.ItemId = num; if (itemKind.IsFlower()) { item.Genes = saveGenes(); item.DaysWatered = int.Parse(FlowerController.DaysWatered.text); item.IsWateredGold = FlowerController.GoldCanWatered.isOn; item.IsWatered = FlowerController.Watered.isOn; bool[] visitorWatered = FlowerController.GetVisitorWatered(); for (int i = 0; i < visitorWatered.Length; i++) { item.SetIsWateredByVisitor(i, visitorWatered[i]); } item.SystemParam = 0; item.AdditionalParam = 0; } else { int value = int.Parse(SetController.FCount.text); int value2 = int.Parse(SetController.FUses.text); int value3 = int.Parse(SetController.FFlagZero.text); item.Count = Convert.ToUInt16(value); item.UseCount = Convert.ToUInt16(value2); item.SystemParam = Convert.ToByte(value3); } int value4 = int.Parse(SetController.FFlagOne.text); if (itemKind == ItemKind.Kind_MessageBottle) { item.AdditionalParam = Convert.ToByte(value4); } else if (!WrapController.WrapToggle.isOn) { item.SetWrapping(ItemWrapping.Nothing, ItemWrappingPaper.Yellow); } else { ItemWrapping wrap = (ItemWrapping)WrapController.ItemWrap; ItemWrappingPaper color = (ItemWrappingPaper)WrapController.ItemColor; bool isOn = WrapController.ShowItemToggle.isOn; bool flag = WrapController.Flag80; item.SetWrapping(wrap, color, isOn, flag); } return(item); }
void CreateBullet(Vector2 speed, GameObject prefab, ItemKind bulletKind, float delay) { var go = Instantiate(prefab); go.transform.position = right ? barrelRight.position : barrelLeft.position; go.GetComponent<Rigidbody2D>().velocity = new Vector2(right ? speed.x : -speed.x + rigidbody.velocity.x, speed.y); go.GetComponent<SpriteRenderer>().flipX = !right; go.GetComponent<Bullet>().owner = this; go.GetComponent<Bullet>().bulletKind = bulletKind; allowedShootTime = Time.time + delay; }
public ResultItem (ItemKind kind, int code, string message) { _kind = kind; _code = code; _message = message; }
public void Hit(Unit owner, ItemKind bulletKind) { switch (bulletKind) { case ItemKind.Rocket: Damage(100); break; case ItemKind.mm9: Damage(5); break; case ItemKind.mm12: Damage(4); break; } }
public Item CreateItem(ItemKind kind) { Item item = null; switch (kind) { case ItemKind.KaifukuA: item = new KaifukuItem(100); break; case ItemKind.KaifukuB: item = new KaifukuItem(200); break; case ItemKind.KaifukuC: item = new KaifukuItem(300); break; case ItemKind.Kougeki: item = new KougekiItem(); break; case ItemKind.Bougyo: item = new BougyoItem(); break; } return item; }
private List<ICompletionListItem> MakeList(string raw, ItemKind kind) { string[] defs = Regex.Split(raw, "\\s+"); var list = new List<ICompletionListItem>(); foreach (string def in defs) list.Add(new CompletionItem(def, kind)); return list; }
private bool IsAllowedKind(ItemKind kind) { return ((kind & this.Kind) == kind); }