/// <summary> /// Converts a given string and its arguments into a CampaignEvent; used for the online SP campaign /// </summary> /// <param name="accountID">Player's account ID</param> /// <param name="campaignID">Campaign ID</param> /// <param name="format">String to format; converted objects are inserted into the string - e.g. "Journal unlocked: {0}"</param> /// <param name="args">Objects can be <see cref="Account"/> or <see cref="CampaignPlanet"/></param> public static CampaignEvent CreateCampaignEvent(int accountID, int campaignID, string format, params object[] args) { var ev = new CampaignEvent() { AccountID = accountID, CampaignID = campaignID, Time = DateTime.UtcNow }; ev.PlainText = string.Format(format, args); var orgArgs = new List<object>(args); for (var i = 0; i < args.Length; i++) { var arg = args[i]; var url = UrlHelper(); if (arg is Account) { /* var acc = (Account)arg; args[i] = HtmlHelperExtensions.PrintAccount(null, acc); if (acc.AccountID != 0) { if (!ev.EventAccounts.Any(x => x.AccountID == acc.AccountID)) ev.EventAccounts.Add(new EventAccount() { AccountID = acc.AccountID }); } else if (!ev.EventAccounts.Any(x => x.Account == acc)) ev.EventAccounts.Add(new EventAccount() { Account = acc }); */ } else if (arg is CampaignPlanet) { var planet = (CampaignPlanet)arg; args[i] = HtmlHelperExtensions.PrintCampaignPlanet(null, planet); ev.PlanetID = planet.PlanetID; } } ev.Text = string.Format(format, args); return ev; }
public IActionResult Add() { var model = new CampaignEvent(); return(View(model)); }
public void LoadCampaignSaveMenu() { currentCampaignEvent = CampaignEvent.SaveMenu; SceneLoader.instance.GoToCampaignSaveMenu(); }
public void LoadCampaignChapterMenu() { currentCampaignEvent = CampaignEvent.ChapterMenu; SceneLoader.instance.GoToCampaignChapterMenu(); }
/// <summary> /// /// </summary> /// <returns></returns> public Message ToMessage() { var message = new Message() { MessageId = Id.ToString() }; message.UserProperties.Add(Constants.ServiceBus.MessageProperties.Type, AppMessageType.ToString()); message.UserProperties.Add(Constants.ServiceBus.MessageProperties.CampaignManagement.CampaignIdentifier, CampaignIdentifier.ToString()); message.UserProperties.Add(Constants.ServiceBus.MessageProperties.CampaignManagement.EventType, CampaignEvent.ToString()); if (AdditionalProperties != null && AdditionalProperties.Any()) { AdditionalProperties.ToList().ForEach(x => { message.UserProperties.Add(x.Key, x.Value); }); } return(message); }
private static void CopyEvents(Interaction source, Interaction target) { foreach (Event e in source.Events) { Event result; if (e is CampaignEvent ce) { CampaignEvent newEvent = new CampaignEvent(ce.CampaignDefinitionId, ce.Timestamp); result = newEvent; } else if (e is DownloadEvent de) { DownloadEvent newEvent = new DownloadEvent(de.Timestamp, de.ItemId); result = newEvent; } else if (e is Goal g) { Goal newEvent = new Goal(g.DefinitionId, g.Timestamp); result = newEvent; } else if (e is MVTestTriggered mvt) { MVTestTriggered newEvent = new MVTestTriggered(mvt.Timestamp); newEvent.Combination = mvt.Combination; newEvent.EligibleRules = mvt.EligibleRules; newEvent.ExposureTime = mvt.ExposureTime; newEvent.FirstExposure = mvt.FirstExposure; newEvent.IsSuspended = mvt.IsSuspended; newEvent.ValueAtExposure = mvt.ValueAtExposure; result = newEvent; } else if (e is Outcome o) { Outcome newEvent = new Outcome(o.DefinitionId, o.Timestamp, o.CurrencyCode, o.MonetaryValue); result = newEvent; } else if (e is PageViewEvent pve) { PageViewEvent newEvent = new PageViewEvent( pve.Timestamp, pve.ItemId, pve.ItemVersion, pve.ItemLanguage); newEvent.SitecoreRenderingDevice = pve.SitecoreRenderingDevice; newEvent.Url = pve.Url; result = newEvent; } else if (e is PersonalizationEvent pe) { PersonalizationEvent newEvent = new PersonalizationEvent(pe.Timestamp); newEvent.ExposedRules = pe.ExposedRules; result = newEvent; } else if (e is SearchEvent se) { SearchEvent newEvent = new SearchEvent(se.Timestamp); newEvent.Keywords = se.Keywords; result = newEvent; } else if (e is BounceEvent be) { BounceEvent newEvent = new BounceEvent(be.Timestamp); newEvent.BounceReason = be.BounceReason; newEvent.BounceType = be.BounceType; result = newEvent; } else if (e is DispatchFailedEvent dfe) { DispatchFailedEvent newEvent = new DispatchFailedEvent(dfe.Timestamp); newEvent.FailureReason = dfe.FailureReason; result = newEvent; } else if (e is EmailClickedEvent ece) { EmailClickedEvent newEvent = new EmailClickedEvent(ece.Timestamp); newEvent.Url = ece.Url; result = newEvent; } else if (e is EmailOpenedEvent eoe) { EmailOpenedEvent newEvent = new EmailOpenedEvent(eoe.Timestamp); result = newEvent; } else if (e is EmailSentEvent ese) { EmailSentEvent newEvent = new EmailSentEvent(ese.Timestamp); result = newEvent; } else if (e is SpamComplaintEvent sce) { SpamComplaintEvent newEvent = new SpamComplaintEvent(sce.Timestamp); result = newEvent; } else if (e is UnsubscribedFromEmailEvent uee) { UnsubscribedFromEmailEvent newEvent = new UnsubscribedFromEmailEvent(uee.Timestamp); result = newEvent; } else { result = new Event(e.DefinitionId, e.Timestamp); } // Many of the above are derived from EmailEvent, so only copy relevant properties once if (e is EmailEvent ee && result is EmailEvent nee) { nee.EmailAddressHistoryEntryId = ee.EmailAddressHistoryEntryId; nee.InstanceId = ee.InstanceId; nee.ManagerRootId = ee.ManagerRootId; nee.MessageId = ee.MessageId; nee.MessageLanguage = ee.MessageLanguage; nee.TestValueIndex = ee.TestValueIndex; } result.Data = e.Data; result.DataKey = e.DataKey; result.Duration = e.Duration; result.EngagementValue = e.EngagementValue; result.Id = e.Id; result.ParentEventId = e.ParentEventId; result.Text = e.Text; foreach (KeyValuePair <string, string> customValue in e.CustomValues) { result.CustomValues.Add(customValue.Key, customValue.Value); } if (result != null) { target.Events.Add(result); } } }