//create a new sprite intended for a single frame animation
        public static Sprite singleFrame(string name, int width, int height, string frameLocation, int xOffset, int yOffset)
        {
            AnimationFrame animfrm = new AnimationFrame(frameLocation, xOffset, yOffset);
            Animation annie = new Animation();
            annie.AddFrame(animfrm);

            Sprite newSprite = new Sprite(name);
            newSprite.Size = new Dimension(width, height);
            newSprite.AddAnimation(annie);

            return newSprite;
        }
Exemple #2
0
        /// <summary>
        /// Show a given message, with a given icon, for the given duration.
        /// </summary>
        /// <param name="icon">The sprite to display in the notification area. </param>
        /// <param name="sender">The sender's name.</param>
        /// <param name="senderHandle">The sender's handle, codename, second name, etc.</param>
        /// <param name="message">The message to display.</param>
        /// <param name="duration">How long to show the message before hiding.</param>
        public static void Notification(Sprite icon, string sender, string senderHandle, string message, int duration)
        {
            //there should be two gui elements: an icon on the left, and a text area on the right
            GuiElement notifIcon = Game.notificationLayer.GetGuiElements()[0];
            GuiElement notifSender = Game.notificationLayer.GetGuiElements()[1];
            GuiElement notifSenderHandle = Game.notificationLayer.GetGuiElements()[2];
            GuiElement notifText = Game.notificationLayer.GetGuiElements()[3];

            notifIcon.SetSprite(icon);
            notifIcon.GetSprite().Size = new Dimension(40, 40);
            notifIcon.GetSprite().Animate();
            notifSender.SetText(sender);
            notifSenderHandle.SetText(senderHandle);
            notifText.SetText(message);

            Debug.log("Setting sender to " + sender + " and handle to " + senderHandle);

            //reposition the handle to be after the sender's name
            notifSenderHandle.SetPosition(Helpah.d2i(notifSender.GetPosition().x + (notifSender.GetText().Length * 14)), Helpah.d2i(notifSenderHandle.GetPosition().y));

            //Game.notificationLayer.Render();
            Game.notificationLayer.Show();

            //timeout hide
            notificationHideRenderId = Clock.AddRender(NotificationEnd);
            Clock.delayRender(notificationHideRenderId, duration);
        }
Exemple #3
0
 public void SetBackgroundSprite(Sprite sprite, View view)
 {
     this.backgroundSprites[view] = sprite;
 }
Exemple #4
0
        public bool SetSprite(Sprite newSprite)
        {
            try
            {
                //Debug.log("Setting sprite for " + this.GetName() + " to " + newSprite.GetName());
                this.sprGameEntitySprite = Helpah.Clone(newSprite).As<Sprite>();
                this.SetNeedsUpdate();

                return true;
            }
            catch (Exception ex)
            {
                Debug.log("Exception with SetSprite in GameEntity: " + ex.Message);
                return false;
            }
        }
        // Set the cursor to the specified sprite. If null is passed, reset the cursor to arrow.
        public void SetCursor(Sprite newCursor)
        {
            // Use custom JS & CSS.
            // http://www.w3schools.com/cssref/pr_class_cursor.asp

            //GuiLayer.GetLayerByName("CursorLayer").GetElementAt(0, 0).SetSprite(newCursor);
            //GuiLayer.GetLayerByName("CursorLayer").Show();
        }
Exemple #6
0
 public void SetWorldSprite(Sprite newSprite)
 {
 }
Exemple #7
0
 public void SetSprite(Sprite newSprite)
 {
     this.SetWorldSprite(newSprite);
     this.SetInventorySprite(newSprite);
 }
Exemple #8
0
 public void SetInventorySprite(Sprite newSprite)
 {
 }
Exemple #9
0
 public void SetSprite(Sprite newSprite)
 {
     this.sprIcon = newSprite;
     this.SetNeedsUpdate();
 }