public static void AddContextMenuEntries(Mobile from, Item item, List <ContextMenuEntry> list, HarvestSystem system) { if (system != Mining.System) { return; } if (!item.IsChildOf(from.Backpack) && item.Parent != from) { return; } PlayerMobile pm = from as PlayerMobile; if (pm == null) { return; } ContextMenuEntry miningEntry = new ContextMenuEntry(pm.ToggleMiningStone ? 6179 : 6178); miningEntry.Color = 0x421F; list.Add(miningEntry); list.Add(new ToggleMiningStoneEntry(pm, false, 6176)); list.Add(new ToggleMiningStoneEntry(pm, true, 6177)); }
public static void AddContextMenuEntries(Mobile from, Item item, List <ContextMenuEntry> list) { if (!item.IsChildOf(from.Backpack) && item.Parent != from) { return; } PlayerMobile pm = from as PlayerMobile; if (pm == null) { return; } int typeentry = 0; if (pm.ToggleCutClippings) { typeentry = 1112282; } if (pm.ToggleCutReeds) { typeentry = 1112283; } ContextMenuEntry clippingEntry = new ContextMenuEntry(typeentry); clippingEntry.Color = 0x421F; //list.Add( clippingEntry ); list.Add(new ToggleClippings(pm, true, false, 1112282)); //set to clip plants list.Add(new ToggleClippings(pm, false, true, 1112283)); //Set to cut reeds }
public ContextMenuButton(ContextMenuEntry entry, Vector2 size, IResourceCache resourceCache) { _resourceCache = resourceCache; UserData = entry.ComponentMessage; Size = size; _iconSprite = _resourceCache.GetSprite(entry.IconName); _textLabel = new Label(entry.EntryName, "CALIBRI", _resourceCache); _textLabel.Update(0); }
public ContextMenuButton(ContextMenuEntry entry, Vector2 size, IResourceManager resourceManager) { _resourceManager = resourceManager; UserData = entry.ComponentMessage; Size = size; _currentColor = Color.Gray; _iconSprite = _resourceManager.GetSprite(entry.IconName); _textLabel = new Label(entry.EntryName, "CALIBRI", _resourceManager); _textLabel.Update(0); }
/// <inheritdoc /> public override List <ContextMenuEntry> GetContextMenuEntries(Category selectedCategory, VideoInfo selectedItem) { var ctxMenu = new ContextMenuEntry() { DisplayText = _skipPlayackOptionsDialog ? "Manual select Playback Stream" : "Directly select Playback Stream", Action = ContextMenuEntry.UIAction.Execute, }; return(new List <ContextMenuEntry>() { ctxMenu }); }
public static bool WaitForContext(object obj, string entryName, int timeout) { int serial = AliasCommands.ResolveSerial(obj); if (serial == 0) { UOC.SystemMessage(Strings.Invalid_or_unknown_object_id, true); return(false); } AutoResetEvent are = new AutoResetEvent(false); PacketFilterInfo pfi = new PacketFilterInfo(0xBF, new[] { PacketFilterConditions.ShortAtPositionCondition(0x14, 3), PacketFilterConditions.IntAtPositionCondition(serial, 7) }, (bytes, info) => { IEnumerable <ContextMenuEntry> entries = ParseContextMenuEntries(bytes); ContextMenuEntry entry = entries.FirstOrDefault(e => e.Text.Trim().ToLower().Equals(entryName.Trim().ToLower())); if (entry == null) { UOC.SystemMessage(Strings.Context_menu_entry_not_found___, (int)UOC.SystemMessageHues.Yellow, true, true); return; } Engine.SendPacketToServer(new ContextMenuClick(serial, entry.Index)); are.Set(); }); Engine.AddReceiveFilter(pfi); Engine.SendPacketToServer(new ContextMenuRequest(serial)); try { bool result = are.WaitOne(timeout); return(result); } finally { Engine.RemoveReceiveFilter(pfi); } }
public static void AddContextMenuEntries(Mobile from, Item item, List <ContextMenuEntry> list, HarvestSystem system) { if (system != Mining.System) { return; } if (!item.IsChildOf(from.Backpack) && item.Parent != from) { return; } PlayerMobile pm = from as PlayerMobile; if (pm == null) { return; } int typeentry = 0; if (pm.ToggleMiningStone) { typeentry = 6179; } if (pm.ToggleMiningGem) { typeentry = 1112239; } if (pm.ToggleStoneOnly) { typeentry = 1156865; } if (!pm.ToggleMiningStone && !pm.ToggleMiningGem && !pm.ToggleStoneOnly) { typeentry = 6178; } ContextMenuEntry miningEntry = new ContextMenuEntry(typeentry) { Color = 0x421F }; list.Add(miningEntry); list.Add(new ToggleMiningStoneEntry(pm, MiningType.OreOnly, 6176)); // Set To Ore list.Add(new ToggleMiningStoneEntry(pm, MiningType.OreAndStone, 6177)); // Set To Ore and Stone list.Add(new ToggleMiningStoneEntry(pm, MiningType.OreAndGems, 1112237)); // Set To Ore and Gems list.Add(new ToggleMiningStoneEntry(pm, MiningType.StoneOnly, 1156864)); // Set To Stone }
public override void GetContextMenuEntries(Mobile from, List <ContextMenuEntry> list) { base.GetContextMenuEntries(from, list); if (Controlled && ControlMaster == from) { PlayerMobile pm = from as PlayerMobile; if (pm == null) { return; } ContextMenuEntry miningEntry = new ContextMenuEntry(pm.ToggleMiningStone ? 6179 : 6178); miningEntry.Color = 0x421F; list.Add(miningEntry); list.Add(new BaseHarvestTool.ToggleMiningStoneEntry(pm, MiningType.OreOnly, 6176)); // Set To Ore list.Add(new BaseHarvestTool.ToggleMiningStoneEntry(pm, MiningType.OreAndStone, 6177)); // Set To Ore and Stone } }
public override void GetContextMenuEntries(Mobile from, List <ContextMenuEntry> list) { base.GetContextMenuEntries(from, list); if (!IsChildOf(from.Backpack)) { return; } PlayerMobile pm = from as PlayerMobile; if (pm.BardMastery == BardMastery.Discordance) { foreach (var element in ElementalDamages) { if (element != pm.BardElementDamage) { list.Add(new SwitchDamageEntry(pm, this, element)); } } } if (DateTime.UtcNow > pm.NextBardMasterySwitch) { ContextMenuEntry titleEntry = new ContextMenuEntry(1151948); // Switch Mastery titleEntry.Enabled = false; list.Add(titleEntry); foreach (var mastery in BardMastery.AllMasteries) { if (mastery != pm.BardMastery) { list.Add(new SwitchMasteryEntry(pm, this, mastery)); } } } }
public override ContextMenuExecutionResult ExecuteContextMenuEntry(Category selectedCategory, VideoInfo selectedItem, ContextMenuEntry choice) { if ((choice.DisplayText.StartsWith(Translate("My List Remove")) || choice.DisplayText.StartsWith(Translate("My List Add"))) && selectedCategory != null && selectedCategory is NetflixCategory) { ContextMenuExecutionResult result = new ContextMenuExecutionResult(); bool inQ = (selectedCategory as NetflixCategory).InQueue; string addRemove = inQ ? "remove" : "add"; string videoId = (selectedCategory as NetflixCategory).Url; string title = selectedCategory.Name; string data = MyGetWebData(ShaktiApi + "/" + BuildId + "/playlistop?fallbackEsn=NFCDSF-01-", postData: @"{""operation"":"""+ addRemove + @""",""videoId"":" + videoId + @",""trackId"":0,""authURL"":""" + latestAuthUrl + @"""}", contentType: "application/json"); JObject json = (JObject)JsonConvert.DeserializeObject(data); //Do something with the result json... (selectedCategory as NetflixCategory).InQueue = !inQ; result.RefreshCurrentItems = true; result.ExecutionResultMessage = title + " - OK: " + (inQ ? Translate("My List Remove") : Translate("My List Add")); return result; } return base.ExecuteContextMenuEntry(selectedCategory, selectedItem, choice); }
public override List<ContextMenuEntry> GetContextMenuEntries(Category selectedCategory, VideoInfo selectedItem) { List<ContextMenuEntry> result = new List<ContextMenuEntry>(); if (selectedCategory != null && selectedCategory is NetflixCategory) { ContextMenuEntry entry = new ContextMenuEntry() { DisplayText = (selectedCategory as NetflixCategory).InQueue ? Translate("My List Remove") : Translate("My List Add") }; result.Add(entry); } return result; }
public override List<ContextMenuEntry> GetContextMenuEntries(Category selectedCategory, VideoInfo selectedItem) { List<ContextMenuEntry> result = new List<ContextMenuEntry>(); if (selectedCategory != null && selectedCategory is NetflixCategory) { ContextMenuEntry entry = new ContextMenuEntry() { DisplayText = ((selectedCategory as NetflixCategory).InQueue ? "Remove from " : "Add to ") + "My List (" + ProfileName + ")"}; result.Add(entry); } return result; }
/// <inheritdoc /> public override ContextMenuExecutionResult ExecuteContextMenuEntry(Category selectedCategory, VideoInfo selectedItem, ContextMenuEntry choice) { _skipPlayackOptionsDialog = !_skipPlayackOptionsDialog; Log.Debug($"_skipPlayackOptionsDialog={_skipPlayackOptionsDialog}"); return(null); }
public override List<ContextMenuEntry> GetContextMenuEntries(Category selectedCategory, VideoInfo selectedItem) { List<ContextMenuEntry> result = new List<ContextMenuEntry>(); if (enableAddRemoveMylist && selectedItem == null && selectedCategory.IsTitleState()) { try { if (!string.IsNullOrEmpty(selectedCategory.GetTrackId())) { string data = MyGetWebData(string.Format(bobUrl, ShaktiApi, BuildId, (selectedCategory as RssLink).Url, selectedCategory.GetTrackId(), latestAuthUrl)); JObject json = (JObject)JsonConvert.DeserializeObject(data); if (json["isMovie"].Value<bool>() || json["isShow"].Value<bool>()) { bool inPlayList = json["inPlayList"].Value<bool>(); ContextMenuEntry entry = new ContextMenuEntry() { DisplayText = (inPlayList ? "Remove from " : "Add to ") + "My List" }; result.Add(entry); } } } catch { } } if (enableAddRemoveMylist && selectedItem != null && selectedItem.Other is SerializableDictionary<string,string>) { try { SerializableDictionary<string, string> other = selectedItem.Other as SerializableDictionary<string, string>; if (other.ContainsKey("TrackId") && other.ContainsKey("VideoId")) { string data = MyGetWebData(string.Format(bobUrl, ShaktiApi, BuildId, other["VideoId"], other["TrackId"], latestAuthUrl)); JObject json = (JObject)JsonConvert.DeserializeObject(data); if (json["isMovie"].Value<bool>() || json["isShow"].Value<bool>()) { bool inPlayList = json["inPlayList"].Value<bool>(); ContextMenuEntry entry = new ContextMenuEntry() { DisplayText = (inPlayList ? "Remove from " : "Add to ") + "My List" }; result.Add(entry); } } } catch { } } return result; }
public override ContextMenuExecutionResult ExecuteContextMenuEntry(Category selectedCategory, VideoInfo selectedItem, ContextMenuEntry choice) { if (choice.DisplayText == "Add to My List") { ContextMenuExecutionResult result = new ContextMenuExecutionResult(); //private string addRemoveMyListUrl = @"{0}/{1}/playlistop"; //private string addRemoveMyListPostData = @"{""operation"":""{0}"",""videoId"":{1},""trackId"":{2},""authURL"":""{3}""}"; string videoId; string trackId; string title; if (selectedItem == null) { videoId = (selectedCategory as RssLink).Url; trackId = selectedCategory.GetTrackId(); title = selectedCategory.Name; } else { SerializableDictionary<string, string> other = selectedItem.Other as SerializableDictionary<string, string>; videoId = other["VideoId"]; trackId = other["TrackId"]; title = selectedItem.Title; } GetWebData(string.Format(addRemoveMyListUrl, ShaktiApi, BuildId), string.Format(addRemoveMyListPostData, addMyListOperation, videoId, trackId, latestAuthUrl), cc, userAgent: UserAgent); result.RefreshCurrentItems = true; result.ExecutionResultMessage = title + " added to My List"; return result; } if (choice.DisplayText == "Remove from My List") { string videoId; string trackId; string title; if (selectedItem == null) { videoId = (selectedCategory as RssLink).Url; trackId = selectedCategory.GetTrackId(); title = selectedCategory.Name; } else { SerializableDictionary<string, string> other = selectedItem.Other as SerializableDictionary<string, string>; videoId = other["VideoId"]; trackId = other["TrackId"]; title = selectedItem.Title; } ContextMenuExecutionResult result = new ContextMenuExecutionResult(); GetWebData(string.Format(addRemoveMyListUrl, ShaktiApi, BuildId), string.Format(addRemoveMyListPostData, removeMyListOperation, videoId, trackId, latestAuthUrl), cc, userAgent: UserAgent); result.RefreshCurrentItems = true; result.ExecutionResultMessage = title + " removed from My List"; return result; } return base.ExecuteContextMenuEntry(selectedCategory, selectedItem, choice); }