Ejemplo n.º 1
0
 public void DrawBody()
 {
     if (PrimaryLibrary != null)
     {
         PrimaryLibrary.Draw(ImageIndex + (ArmourShape * AOffSet) + (Gender == MirGender.Male ? 0 : GOffSet), DisplayRectangle.Location, DrawColour, 1F, true);
     }
 }
Ejemplo n.º 2
0
        protected void IlsPatronLookup()
        {
            try {
                var authJson = new {
                    Id     = LibraryCard.Text.Replace(" ", ""),
                    Secret = LibraryPin.Text
                };
                string ilsUri = string.Format("{0}patron/get",
                                              ConfigurationManager.AppSettings["ILSProxyEndpoint"]);
                var webReq = (HttpWebRequest)WebRequest.Create(ilsUri);
                webReq.ContentType = "application/json; charset=utf-8";
                webReq.Method      = "POST";
                webReq.Accept      = "application/json; charset=utf-8";

                using (var writer = new StreamWriter(webReq.GetRequestStream())) {
                    string jsonInfo = new JavaScriptSerializer().Serialize(new {
                        Id     = LibraryCard.Text.Trim(),
                        Secret = LibraryPin.Text
                    });
                    writer.Write(jsonInfo);
                    writer.Flush();
                    writer.Close();

                    var resp = (HttpWebResponse)webReq.GetResponse();
                    using (var reader = new StreamReader(resp.GetResponseStream())) {
                        var patron = JObject.Parse(reader.ReadToEnd());
                        if ((bool)patron["Success"])
                        {
                            FirstName.Text    = patron["FirstName"].ToString();
                            LastName.Text     = patron["LastName"].ToString();
                            EmailAddress.Text = patron["Email"].ToString();
                            try {
                                if (PrimaryLibrary.Items.Count == 1)
                                {
                                    PrimaryLibrary.DataBind();
                                }
                                PrimaryLibrary.SelectedValue = PrimaryLibrary.Items.FindByText(patron["Library"].ToString()).Value;
                            } catch (Exception ex) {
                                this.Log().Info("Couldn't find branch {0} in drop-down: {1}",
                                                patron["Library"].ToString(),
                                                ex.Message);
                            }
                        }
                        else
                        {
                            this.Log().Error(string.Format("ILS lookup on {0} was not successful: {1}",
                                                           this.LibraryCard.Text,
                                                           patron["Response"].ToString()));
                        }
                    }
                }
            } catch (Exception ex) {
                this.Log().Error(string.Format("Couldn't perform ILS lookup on {0}: {1}",
                                               this.LibraryCard.Text.Replace(" ", ""),
                                               ex.Message));
            }
        }
Ejemplo n.º 3
0
 public override void DrawEffect()
 {
     switch (CurrentAction)
     {
     case MirAction.Die:
         switch (Effect)
         {
         case 1:         // Scarecrow
             PrimaryLibrary.DrawBlend(2860 + Frame, DisplayRectangle.Location, Color.White, true);
             break;
         }
         break;
     }
 }
Ejemplo n.º 4
0
        public void DrawName(Point OffSet)
        {
            if (NameLabel == null || NameLabel.IsDisposed)
            {
                CreateLabel();
            }

            NameLabel.BackColor = Color.FromArgb(100, 0, 24, 48);
            NameLabel.Border    = true;
            //NameLabel.OutLine = false;

            if (NameLabel != null)
            {
                Size S = PrimaryLibrary.GetSize(ImageIndex);
                NameLabel.Location = new Point(
                    DisplayRectangle.X + OffSet.X + (DisplayRectangle.Width - NameLabel.Size.Width) / 2,
                    DisplayRectangle.Y + OffSet.Y + (DisplayRectangle.Height - NameLabel.Size.Height) / 2 - 20);
                NameLabel.Draw();
            }
        }
Ejemplo n.º 5
0
        public override void DrawName()
        {
            if (NameLabel == null || NameLabel.IsDisposed)
            {
                CreateLabel();
            }

            NameLabel.BackColor = Color.Transparent;
            NameLabel.Border    = false;
            NameLabel.OutLine   = true;

            if (NameLabel != null)
            {
                Size S = PrimaryLibrary.GetSize(ImageIndex);
                NameLabel.Location = new Point(
                    DisplayRectangle.X + (DisplayRectangle.Width - NameLabel.Size.Width) / 2,
                    DisplayRectangle.Y + (DisplayRectangle.Height - NameLabel.Size.Height) / 2 - 20);
                NameLabel.Draw();
            }
        }
Ejemplo n.º 6
0
        }                                       //Sparkle?

        public override void LocationProcess()
        {
            if (PrimaryLibrary != null)
            {
                #region Display Rectangle

                DisplayRectangle.Size = PrimaryLibrary.GetSize(ImageIndex);

                DisplayRectangle.Location = new Point(
                    (Location.X - MapObject.User.MovePoint.X + Settings.PlayerOffSet.X) * Globals.CellWidth + MapObject.User.MovingOffSet.X,
                    (Location.Y - MapObject.User.MovePoint.Y + Settings.PlayerOffSet.Y) * Globals.CellHeight + MapObject.User.MovingOffSet.Y);
                #endregion

                DisplayRectangle.X += (Globals.CellWidth - DisplayRectangle.Width) / 2;
                DisplayRectangle.Y += (Globals.CellHeight - DisplayRectangle.Height) / 2;

                FinalDisplayLocation = DisplayRectangle.Location;
            }
            else
            {
                DisplayRectangle     = Rectangle.Empty;
                FinalDisplayLocation = Point.Empty;
            }
        }