public Request(ItemAction action, ItemList data) { this.action = action; this.data = data; this.filter = 0; this.filter_key = string.Empty; }
private void MouseDoubleClick(object arg) { if (_subItems.Count == 0) { ItemAction?.Invoke(this, UserTreeViewItemEventEnum.Open); } }
public IActionResult Update1(ItemAction item, string[] DataFieldId, string[] DataValue, string[] DataId) { ItemAction.DataId = DataId; string collectionID = ItemProcessing.ItemProcess(item, DataFieldId, DataValue, Context); return(RedirectToAction("GetCollectionItems", "Item", new { collectionID })); }
public IActionResult Create(string collectionID) { IEnumerable <CustomField> ItemFields = Context.CustomFields.Include(f => f.Collection).Where(c => c.CollectionId == collectionID); ItemAction item = new ItemAction(collectionID, ItemFields); return(View("Create", item)); }
public Request(ItemAction action,FilterType type,string filter_key) { this.action = action; this.data = null; this.filter = type; this.filter_key = filter_key; }
private IEnumerator PerformActionRoutine(ItemAction action) { yield return(StartCoroutine(action.GetTarget())); action.Perform(); OnEnable(); // Refresh the screen }
public Request(ItemAction action, FilterType type, string filter_key) { this.action = action; this.data = null; this.filter = type; this.filter_key = filter_key; }
public ItemType(string name, Texture2D itemTexture, Color drawTint, int durability = 1, ItemAction leftClickAction = null, ItemAction rightClickAction = null, ItemAction equipAction = null, ItemAction unequipAction = null, object[,,] craftingRecipe = null, int amountMadeFromCraft = 1) { this.name = name; this.leftClickAction = leftClickAction; this.rightClickAction = rightClickAction; this.itemTexture = itemTexture; this.durability = durability; this.amountMadeFromCraft = amountMadeFromCraft; this.equipAction = equipAction; this.unequipAction = unequipAction; this.drawTint = drawTint; //Not craftable if craftingRecipe is null if (craftingRecipe != null) { this.craftingRecipe = craftingRecipe; } //If craftable adds to list referencing all craftable items if (craftable) { craftableItemTypes.Add(this); } itemTypes.Add(this); }
void Iterate(bool startAtPage, ref int ypos, ItemAction action) { int curItem = 0; int startItem = 0; if (startAtPage) { startItem = curItem = Math.Max(0, (int)(ypos / rowHeight)); } if (action != null) { for (int item = startItem; item < filteredItems.Count; item++) { bool result = action(item, curItem, ypos); if (!result) { break; } ypos += rowHeight; curItem++; } } else { int itemCount = (filteredItems.Count - startItem); ypos += rowHeight * itemCount; curItem += itemCount; } }
ItemList ParseRequest(Request req) { ItemAction action = req.action; ItemList data = req.data; ItemList ret = null; FilterType type = req.filter; string f_key = req.filter_key; switch (action) { case ItemAction.EmptyAction: break; case ItemAction.Add: { _lst.mergeWith(data); break; } case ItemAction.Search: { ret = _lst.Find(type, f_key); break; } } return(ret); }
public IMenuItem AddItem(string text, object tag, IImage image, ItemAction action) { var item = new MenuItemEx(text, tag, image, action); Control.Items.Add(item); return(item); }
public static bool Prefix(ItemAction action, InventoryItem item) { bool hasLMBaction = RegisteredLMBActions.TryGetValue(item.item.GetTechType(), out ItemActionHelper LMBaction); bool hasMMBaction = RegisteredMMBActions.TryGetValue(item.item.GetTechType(), out ItemActionHelper MMBaction); if (!hasLMBaction && !hasMMBaction) { return(true); } if (hasLMBaction && action == LeftClickItemAction && (LMBaction?.Condition(item)).ToNormalBool()) { LMBaction.Callback(item); return(false); } if (hasMMBaction && action == MiddleClickItemAction && (MMBaction?.Condition(item)).ToNormalBool()) { MMBaction.Callback(item); return(false); } else { return(true); } }
public string LogTemplate(ItemAction action, ACDItem item) => $"{Environment.NewLine}" + $"{DateTime.UtcNow.ToLocalTime():f} {Environment.NewLine}" + $"{item.Name} ({item.ActorSnoId}), {item.GetRawItemType()} {Environment.NewLine}" + $"{item.ItemBaseType}: {item.GetTrinityItemType()}, {item.GetTrinityItemQuality()}" + $"{(item.Stats.IsAncient ? ", Ancient" : string.Empty)}, {item.Stats}" + $"{Environment.NewLine}";
public async Task <long> CreateAsync(ItemAction action) { var savedAction = _context.ItemActions.Add(action); await _context.SaveChangesAsync(); return(savedAction.Entity.Id); }
private void DeserializeBuild(string serialized) { foreach (string s in serialized.Split(',')) { ItemAction ac = new ItemAction(); bool flag = true; foreach (string s2 in s.Split(':')) { if (flag) { ac.item = new Item(int.Parse(s2)); flag = false; } else { ac.action = (ShopActionType)Enum.Parse(typeof(ShopActionType), s2, true); } } if (ac.item.ItemInfo.AvailableForMap && ac.item.ItemInfo.ValidForPlayer) { order.Add(ac); } else { Chat.Print("Item: " + ac.item.ItemInfo.Name + " doesn't exist in current map or not valid for player"); } } count = order.Count; }
protected virtual ActionData DetermineActionToPerform() { //prioritizes item use of attack use if (Item != null) { //check all the other enemy Units ItemAction itemAction = Item as ItemAction; if (itemAction.BuffType != BuffType.HP || itemAction.BuffAmmount < 0) { //special effect item or attack item (always use without thinking) return(itemAction); } else if (EnemySet.Units.Any(u => u.MaxHP - u.HP > ((itemAction.BuffAmmount + 1) / 2) || (u.MaxHP + 1) / u.HP > 1)) { //check to see if another unit is damaged enough to warrant use return(itemAction); } } //select which action to perform based on assigned probability weights //defaults to the last one if all previous ones do not pass for (int i = 0; i < Attacks.Actions.Count - 1; i++) { float weight = Attacks.Actions[i].Weight; if (weight >= UnityEngine.Random.Range(0, 101)) { return(Attacks.Actions[i].Action); } } return(Attacks.Actions.Last().Action); }
void Iterate(ref int xpos, ref int ypos, CategoryAction catAction, ItemAction action) { foreach (Category category in this.categories) { if (!category.IsVisible) { continue; } xpos = 0; if (this.showCategories) { layout.SetText(category.Text); int x, y; layout.GetPixelSize(out x, out y); y += CategoryTopBottomPadding * 2; if (catAction != null) { catAction(category, new Size(this.Allocation.Width, y)); } ypos += y; } if (category.IsExpanded || category.AnimatingExpand || !this.showCategories) { IterateItems(category, ref xpos, ref ypos, action); } } }
public void OnNet(t_stAddObjectListUnityUserCmdProto cmd) { foreach (var oper in cmd.userset) { ItemAction action = (ItemAction)oper.byActionType; switch (action) { case ItemAction.Add: { Informations.Instance.ItemMgr.AddItem(oper.obj); } break; case ItemAction.Update: { Informations.Instance.ItemMgr.UpdateItem(oper.obj); } break; case ItemAction.Delete: { Informations.Instance.ItemMgr.DeleteItem(oper.obj.qwThisID); } break; } } UpdateAllItems(); }
internal static bool ExecuteItemAction_Prefix(ItemAction action, InventoryItem item) { if (action != CustomLeftClickItemAction && action != CustomMiddleClickItemAction) { return(true); } TechType itemTechType = item.item.GetTechType(); if (action == CustomLeftClickItemAction) { if (LeftClickActions.TryGetValue(itemTechType, out CustomItemAction customItemAction)) { if (customItemAction.Condition(item)) { customItemAction.Action(item); } } return(false); } if (action == CustomMiddleClickItemAction) { if (MiddleClickActions.TryGetValue(itemTechType, out CustomItemAction customItemAction)) { if (customItemAction.Condition(item)) { customItemAction.Action(item); } } return(false); } return(true); }
private static Item TestConvert(ItemAction itemActionToConvert) { Item result = new Item(); result.Code = null; result.Text = itemActionToConvert.Text; result.MyAction = itemActionToConvert.MyAction; return result; }
public void Init(string title, ItemAction ia, ItemData id, ActionType t) { obj.SetActive(true); tex.text = title; data = id; action = ia; type = t; }
public void PlowField() { //if something is already there, destroy it currentPlant = null; harvestable = false; spriteRenderer.sprite = plowedTileSprite; itemActionTaken = ItemAction.Plow; }
private void OnDisable() { this.ParentItem = null; // clear parent item reference after use if (!EffectApplied) { ItemApplyCallback(); // delay was longer than item lifetime } }
/// <summary> /// Initilizes the item data for a usable item. /// </summary> /// <param name="itemID">The ID of the item.</param> /// <param name="useAction">Optional use action that describes on use functionality.</param> private void InitAction(int itemID, string useAction) { this.useAction = useAction; if (useAction != null && useAction != "") { this.action = Resources.Load <ItemAction>("Actions/ItemActions/" + useAction); this.action.itemID = itemID; } }
public LogCmdResultItem(string path, ItemAction action, string copyFromPath, uint copyFromRevision, ItemNodeKind nodeKind) { Path = path; Action = action; CopyFromPath = copyFromPath; CopyFromRevision = copyFromRevision; NodeKind = nodeKind; }
public MenuItemEx(string text, object tag, IImage image, ItemAction action) : base(text) { Click += Item_Click; Tag = tag; ImageHandler hIcon = image as ImageHandler; Image = (hIcon == null) ? null : hIcon.Handle; fAction = action; }
public MarkedItemAction(ItemAction action, float radius, float duration, InventoryItem item, InventoryManager manager) : base(item, manager) { innerAction = action; actionString = innerAction.actionString; markRadius = radius; markDuration = duration; }
private void HandleSelectedItem(ItemAction action) { if (ClipDataManager.Instance.Items.Count == 0 || ListBoxClipboardItems.SelectedIndex == -1) { return; } IClipboardItem selectedItem = ListBoxClipboardItems.SelectedItem as IClipboardItem; if (selectedItem == null) { return; } switch (action) { case ItemAction.ItemCopy: if (!ClipDataManager.Instance.CopyDataToClipboard(selectedItem)) { MessageBox.Show(ClipDataManager.Instance.Status, $"{Title}: Copy to clipboard failed", MessageBoxButton.OK, MessageBoxImage.Error); } break; case ItemAction.ItemFileCopy: if (selectedItem.Type == DataKind.PlainText && ClippySettings.Instance.UseClipboardFiles) { if (!ClipDataManager.Instance.WriteDataToFile(selectedItem.Index)) { MessageBox.Show( $"Saving failed: {Environment.NewLine}{ClipDataManager.Instance.Status}", $"{Title} - Save content to file...", MessageBoxButton.OK, MessageBoxImage.Error); } } break; case ItemAction.ItemEdit: ContentViewWindow contentViewWindow = new ContentViewWindow(selectedItem); contentViewWindow.ShowDialog(); if (contentViewWindow.ContentChanged) { ListBoxClipboardItems.Items.Refresh(); } break; case ItemAction.ItemDelete: ClipDataManager.Instance.RemoveItem(selectedItem.Index); break; default: break; } }
private static Item TestConvert(ItemAction itemActionToConvert) { Item result = new Item(); result.Code = null; result.Text = itemActionToConvert.Text; result.MyAction = itemActionToConvert.MyAction; return(result); }
void Iterate(bool startAtPage, ref int ypos, CategoryAction catAction, ItemAction action) { int curItem = 0; if (InCategoryMode) { foreach (Category category in this.categories) { if (category.CompletionCategory != null) { if (!startAtPage || curItem >= page) { if (catAction != null) { catAction(category, ypos); } ypos += rowHeight; } curItem++; } bool result = IterateItems(category, startAtPage, ref ypos, ref curItem, action); if (!result) { break; } } } else { int startItem = 0; if (startAtPage) { startItem = curItem = page; } if (action != null) { for (int item = startItem; item < filteredItems.Count; item++) { bool result = action(null, item, ypos); if (!result) { break; } ypos += rowHeight; curItem++; } } else { int itemCount = (filteredItems.Count - startItem); ypos += rowHeight * itemCount; curItem += itemCount; } } }
public bool EditItem(string feedId, string itemId, ItemTag addTag, ItemTag removeTag, ItemAction action) { Uri requestUrl = _urlBuilder.BuildUri(UrlType.ItemEdit); string token = GetToken(); Dictionary<string, string> postData = _urlBuilder.GetItemEditData(token, feedId, itemId, addTag, removeTag, action); var result = _httpService.PerformPost(requestUrl, postData); if(result.Equals("OK")) return true; return false; }
public static ItemActionPacket Create(uint _uid, uint _id, ItemAction _action) { var packet = new ItemActionPacket(); packet.UID = _uid; packet.ID = _id; packet.ActionType = _action; packet.Timestamp = (uint)Common.Clock; return(packet); }
private void FireWorldEvent(Position blockLocation, ItemAction action, Block block) { if (this.WorldEvents != null) { this.WorldEvents.Invoke(new WorldEventArgs() { action = action, block = block, blockLocation = blockLocation }); } }
public Menu(ItemAction[] itemsWithActions) { this.items = Array.ConvertAll( itemsWithActions, new Converter<ItemAction,Item>( TestConvert //(ia)=>{ return new Item { Code = null, Text = ia.Text, MyAction = ia.MyAction }; } ) ); }
private void OnItemSavedOrDeleted (object item, ItemAction action) { IOutlookId entryId = null; bool wasDeleted = action == ItemAction.Delete; var appointment = item as AppointmentItem; if (appointment != null) { //Don't add appointment if it is a meeting invite, since this can cause doubled and/or cancelled meetings if (appointment.MeetingStatus != OlMeetingStatus.olMeetingReceived) { s_logger.Debug ($"'{nameof (ItemAction)}.{action}': Appointment '{appointment.Subject}' '{appointment.EntryID}' "); entryId = new AppointmentId(new Implementation.Events.AppointmentId(appointment.EntryID, appointment.GlobalAppointmentID), appointment.LastModificationTime, wasDeleted); } } else { var task = item as TaskItem; if (task != null) { s_logger.Debug ($"'{nameof (ItemAction)}.{action}': Task '{task.Subject}' '{task.EntryID}' "); entryId = new GenericId(task.EntryID, task.LastModificationTime, wasDeleted); } else { var contact = item as ContactItem; if (contact != null) { s_logger.Debug ($"'{nameof (ItemAction)}.{action}': Contact '{contact.LastNameAndFirstName}' '{contact.EntryID}' "); entryId = new GenericId (contact.EntryID, contact.LastModificationTime, wasDeleted); } } } if (entryId != null) OnItemSavedOrDeleted (entryId); }
public void EditItem(string feedId, string itemId, ItemTag addTag, ItemTag removeTag, ItemAction action, Action<bool> onSuccess = null, Action<Exception> onError = null, Action onFinally = null) { GetToken( token => { Uri requestUrl = _urlBuilder.BuildUri(UrlType.ItemEdit); Dictionary<string, string> postData = _urlBuilder.GetItemEditData(token, feedId, itemId, addTag, removeTag, action); _httpService.PerformPostAsync(requestUrl, postData, result => { if (onSuccess != null) { if (result.Equals("OK")) onSuccess(true); else onSuccess(false); } }, onError, onFinally); } , onError, onFinally ); }
public MenuItem (char _cmdKey, string _itemTitle, ItemAction _itemHandler) { cmdKey = _cmdKey; itemTitle = _itemTitle; itemHandler = _itemHandler; }
bool IterateItems (Category category, bool startAtPage, ref int ypos, ref int curItem, ItemAction action) { foreach (int item in category.Items) { var nextYpos = ypos + rowHeight; // if (!startAtPage || nextYpos >= vadj.Value) { if (action != null) { bool result = action (category, item, curItem, ypos); if (!result) return false; } // } ypos = nextYpos; curItem++; } return true; }
void Iterate (bool startAtPage, ref int ypos, CategoryAction catAction, ItemAction action) { int curItem = 0; if (InCategoryMode) { foreach (Category category in this.categories) { var nextYPos = ypos + rowHeight; // if (!startAtPage || nextYPos >= vadj.Value) { if (catAction != null) catAction (category, ypos); // } ypos = nextYPos; curItem++; bool result = IterateItems (category, startAtPage,ref ypos, ref curItem, action); if (!result) break; } } else { int startItem = 0; if (startAtPage) startItem = curItem = Math.Max (0, (int)(ypos / rowHeight)); if (action != null) { for (int item = startItem; item < filteredItems.Count; item++) { bool result = action (null, filteredItems[item], curItem, ypos); if (!result) break; ypos += rowHeight; curItem++; } } else { int itemCount = (filteredItems.Count - startItem); ypos += rowHeight * itemCount; curItem += itemCount; } } }
bool IterateItems (Category category, bool startAtPage, ref int ypos, ref int curItem, ItemAction action) { foreach (int item in category.Items) { if (!startAtPage || curItem >= page) { if (action != null) { bool result = action (category, item, curItem, ypos); if (!result) return false; } ypos += rowHeight; } curItem++; } return true; }
void Iterate (bool startAtPage, ref int ypos, CategoryAction catAction, ItemAction action) { int curItem = 0; if (InCategoryMode) { foreach (Category category in this.categories) { if (category.CompletionCategory != null) { if (!startAtPage || curItem >= page) { if (catAction != null) catAction (category, ypos); ypos += rowHeight; } curItem++; } bool result = IterateItems (category, startAtPage,ref ypos, ref curItem, action); if (!result) break; } } else { int startItem = 0; if (startAtPage) startItem = curItem = page; if (action != null) { for (int item = startItem; item < filteredItems.Count; item++) { bool result = action (null, filteredItems[item], curItem, ypos); if (!result) break; ypos += rowHeight; curItem++; } } else { int itemCount = (filteredItems.Count - startItem); ypos += rowHeight * itemCount; curItem += itemCount; } } }
private IEnumerable<ItemAction> DeserializeBuild(string serialized) { List<ItemAction> b = new List<ItemAction>(); foreach (string s in serialized.Split(',')) { ItemAction ac = new ItemAction { item = -1 }; foreach (string s2 in s.Split(':')) { if (ac.item == -1) ac.item = int.Parse(s2); else ac.t = (ShopActionType)Enum.Parse(typeof(ShopActionType), s2, true); } b.Add(ac); } return b; }
void ApplyItem (ItemAction fa) { XmlDocument d = LoadDocument (fa.docset, fa.fileset.RealFile); XmlNode old = d.SelectSingleNode (fa.change.XPath); if (old != null) old.ParentNode.ReplaceChild (d.ImportNode (fa.change.NewNode, true), old); SaveDocument (d, fa.docset, fa.fileset); }
void DiffChangeItem (ItemAction fa) { XmlDocument d = LoadDocument (fa.docset, fa.fileset.RealFile); XmlNode orig = d.SelectSingleNode (fa.change.XPath); XmlNode newn = fa.change.NewNode; text_ondisk.Buffer.Text = orig.InnerXml; text_current.Buffer.Text = newn.InnerXml; WriteNode ("/tmp/file-1", orig.InnerXml); WriteNode ("/tmp/file-2", newn.InnerXml); Process diffp = new Process (); diffp.StartInfo.FileName = "diff"; diffp.StartInfo.Arguments = "-uw /tmp/file-1 /tmp/file-2"; diffp.StartInfo.UseShellExecute = false; diffp.StartInfo.RedirectStandardOutput = true; diffp.Start (); text_diff.Buffer.Text = "=" + diffp.StandardOutput.ReadToEnd (); diffp.WaitForExit (); }
// // Renders the id/serial representation for review by the administrator. // void RenderReview (int id, int serial) { current_id = id; current_serial = serial; notebook.Page = 1; GlobalChangeset globalset; globalset = LoadReview (id, serial); HTMLStream s = html_review.Begin ("text/html"); s.Write ("<html><body>"); if (globalset == null){ s.Write ("No data found"); html_review.End (s, HTMLStreamStatus.Ok); return; } int key = 0; action_map = new Hashtable (); // // First make sure we dont have sources that we dont know about, // so a contribution can not be flagged as done by accident // bool allow_flag_as_done = true; foreach (DocSetChangeset docset in globalset.DocSetChangesets){ if (!providers.Contains (docset.DocSet)){ s.Write (String.Format ("<font color='red'>Warning: Skipping {0}</font>", docset.DocSet)); allow_flag_as_done = false; continue; } } if (allow_flag_as_done) s.Write (String.Format ("<h1>Changes: <a href=\"flag-done:{0}${1}\">[Flag as Done]</a></h1>", id, serial)); foreach (DocSetChangeset docset in globalset.DocSetChangesets){ if (!providers.Contains (docset.DocSet)) continue; if (docset == null){ s.Write ("Null?"); continue; } string ds; ds = String.Format ("<table width='100%' bgcolor='#aabbaa'><tr><td>Docset: {0}</td></tr></table>", docset.DocSet); foreach (FileChangeset fileset in docset.FileChangesets){ string fs, es = null; fs = String.Format ("<h3><a href=\"apply-file:{0}\">[Apply]</a> File: {1} <br><blockquote>", key, fileset.RealFile); action_map [key++] = new FileAction (globalset, docset, fileset); if (fileset.RealFile == null){ s.Write (String.Format ("Warning: invalid contribution, its missing filename")); continue; } XmlDocument d = LoadDocument (docset, fileset.RealFile); foreach (Change c in fileset.Changes){ XmlNode orig = d.SelectSingleNode (c.XPath); XmlNode newn = c.NewNode; if (orig == null){ s.Write (String.Format ("Warning, node {0} does not exist", c.XPath)); continue; } if (ds != null) { s.Write (ds); ds = null; } if (fs != null) { s.Write (fs); fs = null; es = "</blockquote>"; } string original_text = orig.InnerXml; string new_text = c.NewNode.InnerXml; if (original_text == new_text){ //s.Write ("<b>Applied</b><br>"); continue; } int p = c.XPath.LastIndexOf ("/"); s.Write (String.Format ("<a href=\"diff-change:{0}\">[Diff]</a>", key)); s.Write (String.Format ("<a href=\"apply-change:{0}\">[Apply]</a>: {1} ", key, c.XPath)); if (c.FromVersion != RootTree.MonodocVersion) s.Write ("<b>FROM OLD VERSION</b>"); action_map [key++] = new ItemAction (globalset, docset, fileset, c); s.Write ("<table border=1 width=100%><tr bgcolor=grey><td width=50%>Current</td><td width=50%>New</td>"); s.Write ("<tr>"); s.Write (String.Format ("<td>{0}</td>", Htmlize (original_text))); s.Write ("<td>"); s.Write (Htmlize (new_text)); s.Write ("</td></tr>"); s.Write ("</table>"); } if (es != null) s.Write (es); } } s.Write ("</body></html>"); html_review.End (s, HTMLStreamStatus.Ok); }