Example #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="container">Dependency injection container</param>
        public ExplorePage(IContainer container)
        {
            InitializeComponent();
            Container       = container;
            BackgroundColor = Color.FromHex(Container.Resolve <IStyleService>().GetTemplate().GetPage(StyleType.Primary).BackgroundColor);
            BindingContext  = ViewModel = new VMExplorePage(Container, this);
#if __MOBILE__
            ItemDescriptionsExits.ItemShowDescriptions = false;
            ItemDescriptionsOther.ItemShowDescriptions = false;
#else
            ItemDescriptionsExits.ItemShowDescriptions = true;
            ItemDescriptionsOther.ItemShowDescriptions = true;
#endif
        }
Example #2
0
 /// <summary>
 /// Deconstruct an IMessage into a text message
 /// </summary>
 /// <param name="message">IMessage to deconstruct into a simple text message</param>
 /// <param name="vmGamePage">View model of explore page</param>
 public VMEventStream OnIMessage(IMessage message, VMExplorePage vmExplorePage)
 {
     if (message.IsMessageType <WorldEmoteEvent>())
     {
         var emote        = "A shiver runs through your spine as a cool and dark presence washes over your skin";
         var messageEvent = message.GetMessageAsType <WorldEmoteEvent>();
         var visible      = messageEvent.Origin?.GetProperty <VisibleItemProperty>();
         if (visible != null)
         {
             emote = $"{visible.Name} does something unexpected!";
             if (messageEvent.EmoteType == WorldEmoteType.Smile)
             {
                 emote = $"{visible.Name} smiles happily";
             }
             if (messageEvent.EmoteType == WorldEmoteType.Frown)
             {
                 emote = $"{visible.Name} frowns in consternation";
             }
             if (messageEvent.EmoteType == WorldEmoteType.Speak)
             {
                 emote = $"{visible.Name} says \"{messageEvent.Parameter}\"";
             }
             if (messageEvent.EmoteType == WorldEmoteType.Raw)
             {
                 emote = $"{messageEvent.Parameter}";
             }
         }
         Push(emote);
     }
     else if (message.IsMessageType <CoreMoveItemEvent>())
     {
         var messageEvent = message.GetMessageAsType <CoreMoveItemEvent>();
         if (messageEvent.Item.Id != vmExplorePage.Me.Id)
         {
             bool arrival = (messageEvent.NewParent.Id == vmExplorePage.VMLocation.Item.Id);
             var  what    = messageEvent.Item.GetProperty <VisibleItemProperty>()?.Name ?? "**Unknown**";
             var  text    = "";
             if (arrival)
             {
                 var who = messageEvent.OldParent.GetProperty <VisibleItemProperty>()?.Name ?? "**Unknown**";
                 text = (messageEvent.OldParent.HasProperty <CharacterItemProperty>()) ?
                        $"{who} has dropped {what}" :
                        $"{what} has arrived";
             }
             else
             {
                 var who = messageEvent.NewParent.GetProperty <VisibleItemProperty>()?.Name ?? "**Unknown**";
                 text = (messageEvent.NewParent.HasProperty <CharacterItemProperty>()) ?
                        $"{who} has taken {what}" :
                        $"{what} has departed";
             }
             Push(text);
         }
     }
     else if (message.IsMessageType <CoreUpdateItemJsonEvent>())
     {
         var messageEvent  = message.GetMessageAsType <CoreUpdateItemJsonEvent>();
         var who           = messageEvent.Origin?.GetProperty <VisibleItemProperty>()?.Name ?? "**Unknown**";
         var what          = messageEvent.Items?.First()?.GetProperty <VisibleItemProperty>()?.Name ?? "**Unknown**";
         var streamMessage = $"{who} used the magic of JSON to change {what}";
         Push(streamMessage);
     }
     else if (message.IsMessageType <CoreCreateItemCrudEvent>())
     {
         var messageEvent = message.GetMessageAsType <CoreCreateItemCrudEvent>();
         var what         = messageEvent.Item.GetProperty <VisibleItemProperty>()?.Name ??
                            "**Unknown**";
         var streamMessage = $"{what} materializes into existance";
         Push(streamMessage);
     }
     else if (message.IsMessageType <CoreDeleteItemCrudEvent>())
     {
         var messageEvent = message.GetMessageAsType <CoreDeleteItemCrudEvent>();
         var what         = messageEvent.Items.First().GetProperty <VisibleItemProperty>()?.Name ??
                            "**Unknown**";
         var streamMessage = $"{what} disintegrates into the ether";
         Push(streamMessage);
     }
     else if (message.IsMessageType <CoreReadItemJsonEvent>())
     {
         var messageEvent  = message.GetMessageAsType <CoreReadItemJsonEvent>();
         var who           = messageEvent.Origin?.GetProperty <VisibleItemProperty>()?.Name ?? "**Unknown**";
         var what          = messageEvent.Items?.First()?.GetProperty <VisibleItemProperty>()?.Name ?? "**Unknown**";
         var streamMessage = $"{who} interrogates {what} through the power of JSON magic";
         Push(streamMessage);
     }
     else if (message.IsMessageType <WorldPerformEmoteResponse>() ||
              message.IsMessageType <CoreUseItemResponse>() ||
              message.IsMessageType <CoreUpdateItemJsonResponse>() ||
              message.IsMessageType <CoreReadItemJsonResponse>() ||
              message.IsMessageType <WorldReadLocationSummaryResponse>() ||
              message.IsMessageType <PingSystemMessage>())
     {
         // Sit on it
     }
     else
     {
         Push(message.GetMessageName());
     }
     return(this);
 }