public ScreenMap (ScreenController ctrl, Thing t) { this.ctrl = ctrl; this.engine = ctrl.Engine; this.thing = t; // OS specific details if (new Version (UIDevice.CurrentDevice.SystemVersion) >= new Version(7,0)) { // Code that uses features from Xamarin.iOS 7.0 this.EdgesForExtendedLayout = UIRectEdge.None; } // Create URLTileLayers osmLayer = UrlTileLayer.FromUrlConstructor ( (uint x, uint y, uint zoom) => { string url = String.Format("http://a.tile.openstreetmap.org/{0}/{1}/{2}.png", zoom, x, y); return NSUrl.FromString(url); } ); osmLayer.ZIndex = 0; ocmLayer = UrlTileLayer.FromUrlConstructor ( (uint x, uint y, uint zoom) => { string url = String.Format("http://c.tile.opencyclemap.org/cycle/{0}/{1}/{2}.png", zoom, x, y); return NSUrl.FromString(url); } ); ocmLayer.ZIndex = 0; }
private void OnWherigoObjectChanged(WF.Player.Core.Thing wherigoObject) { // Updates the vector. LocationVector vector = null; if (wherigoObject != null) { vector = wherigoObject.VectorFromPlayer; } bool vectorChanged = Vector != vector; Vector = vector; if (!vectorChanged) { RefreshFromVector(vector); } }
/// <summary> /// Executes this command on an optional target. /// </summary> /// <param name="target">The thing to execute this command on. If null, the command /// is executed without target. This parameter is mandatory if <code>CmdWith</code> /// is true.</param> public void Execute(Thing target = null) { //if (target == null) // engine.LuaExecQueue.BeginCallSelf(this, "exec"); //else // engine.LuaExecQueue.BeginCallSelf(this, "exec", target.WIGTable); _executeCommand(target); }
/// <summary> /// Sets the result of this request event. /// </summary> /// <param name="commandTarget"></param> public void GiveResult(Thing commandTarget) { _GotTargetCallback(this.Command, commandTarget); }
private void ExecuteWherigoCommandOnTarget(Command command, Thing target) { command.Execute(target); }
void CreateThing (Thing t) { Marker marker; // If the thing don't have a ObjectLocation, than don't draw it if (t.ObjectLocation == null) return; if (!markers.TryGetValue (t.ObjIndex, out marker)) { marker = new Marker () { Tappable = true, Map = mapView }; if (thing is Character) { marker.Icon = t.Icon != null && t.Icon == null ? UIImage.LoadFromData (NSData.FromArray (t.Icon.Data)) : Images.IconMapCharacter; marker.GroundAnchor = t.Icon != null && t.Icon == null ? new PointF (0.5f, 0.5f) : new PointF (0.3f, 0.92f); marker.InfoWindowAnchor = t.Icon != null && t.Icon == null ? new PointF (0.5f, 0.0f) : new PointF (0.3f, 0.0f); } else { marker.Icon = t.Icon != null && t.Icon == null ? UIImage.LoadFromData (NSData.FromArray (t.Icon.Data)) : Images.IconMapItem; marker.GroundAnchor = t.Icon != null && t.Icon == null ? new PointF (0.5f, 0.5f) : new PointF (0.2f, 0.92f); marker.InfoWindowAnchor = t.Icon != null && t.Icon == null ? new PointF (0.5f, 0.0f) : new PointF (0.2f, 0.0f); } markers.Add(t.ObjIndex, marker); } marker.Title = (t.Name == null ? "" : t.Name); var inventory = (WherigoCollection<Thing>)t.Inventory; if (inventory.Count > 0) { StringBuilder s = new StringBuilder (); foreach (Thing thing in inventory) { s.Append ((s.Length > 0 ? ", " : "") + (thing.Name == null ? "" : thing.Name)); } marker.Snippet = Catalog.Format(Catalog.GetString("Contains {0}"), s.ToString()); } marker.ZIndex = 100; ((Marker)marker).Position = new CLLocationCoordinate2D(t.ObjectLocation.Latitude, t.ObjectLocation.Longitude); }
public void Refresh(Thing refreshThing = null) { if (refreshThing != null) { // Only one thing needs an update } else { // All things must be updated // All zones WherigoCollection<Zone> zones = ctrl.Engine.ActiveVisibleZones; foreach (Zone z in zones) CreateZone (z); // All items WherigoCollection<Thing> things = ctrl.Engine.VisibleObjects; foreach (Thing t in things) CreateThing(t);// createThing (t); } if (thing != null) NavigationItem.Title = thing.Name; }
/// <summary> /// Navigates the app to the view that best fits a Thing object. /// </summary> /// <param name="wherigoObj"></param> public void NavigateToView(Thing wherigoObj) { // If the thing is the player, navigates to device and player info view. if (WherigoObject.AreSameEntities(wherigoObj, _parent.Model.Core.Player)) { NavigateToPlayerInfo(); } else { NavigateCore(new Uri("/Views/ThingPage.xaml?wid=" + wherigoObj.ObjIndex, UriKind.Relative), cancelIfAlreadyActive: true); } }
private void ShowThingDetails(Thing thing) { // Navigates to the details of this thing. App.Current.ViewModel.NavigationManager.NavigateToView(thing); }
private void map (Thing thing) { ScreenMap mapScreen = new ScreenMap(this,thing); mapScreen.NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem(Catalog.GetString("Back"),UIBarButtonItemStyle.Plain, (sender,args) => { back (); }), true); mapScreen.Title = thing.Name; PushViewController (mapScreen,animation); }
/// <summary> /// Navigates the app to the view that best fits a Thing object. /// </summary> /// <param name="wherigoObj"></param> public void NavigateToView(Thing wherigoObj) { NavigateCore(new Uri("/Views/ThingPage.xaml?wid=" + wherigoObj.ObjIndex, UriKind.Relative)); }
/// <summary> /// Navigates the app to the view that best fits a Thing object. /// </summary> /// <param name="wherigoObj"></param> public void NavigateToView(Thing wherigoObj) { App.Current.RootFrame.Navigate(new Uri("/Views/ThingPage.xaml?wid=" + wherigoObj.ObjIndex, UriKind.Relative)); }