Exemple #1
0
        public void Add(ObjectId id, string name, int hp, int maxHp, StatusBarType type, string namePrefix = null)
        {
            Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
            {
                var statusBar = Get(id);
                if (statusBar != null)
                {
                    StatusBars.Remove(statusBar);
                }
                else
                {
                    statusBar = new StatusBar(id, namePrefix)
                    {
                        Name          = name,
                        CurrentHealth = hp,
                        MaxHealth     = maxHp,
                        Type          = type,
                        IsDead        = false,
                        IsPoisoned    = false,
                    };
                }

                Add(statusBar);
            }));
        }
Exemple #2
0
        public void Add(Mobile mobile, StatusBarType type, string namePrefix = null)
        {
            Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
            {
                var statusBar = Get(mobile.Id);
                if (statusBar != null)
                {
                    StatusBars.Remove(statusBar);
                }
                else
                {
                    statusBar = new StatusBar(mobile.Id, namePrefix)
                    {
                        Name          = mobile.Name,
                        CurrentHealth = mobile.CurrentHealth,
                        MaxHealth     = mobile.MaxHealth,
                        Type          = type,
                        IsDead        = mobile.IsDead,
                        IsPoisoned    = mobile.IsPoisoned,
                    };
                }

                Add(statusBar);
            }));
        }
Exemple #3
0
    public StatusBar(StatusBarType type)
    {
        spriteX = 0;
        switch (type)
        {
        case StatusBarType.Health:
            spriteY    = 628;
            totalWidth = 640;
            break;

        case StatusBarType.Ammo:
            spriteY    = 644;
            totalWidth = 384;
            break;
        }
    }
Exemple #4
0
 public StatusBar(string name, StatusBarType type)
 {
     Type = type;
     Name = name;
 }
 public void DeleteComponent(StatusBarType type)
 {
     switch (type)
     {
         case StatusBarType.Text:
             textVisibility = false;
             textValue = null;
             break;
         case StatusBarType.ProgressBar:
             pbVisibility = false;
             pbText = null;
             pbValue = 0;
             break;
     }
 }
 public void SetValue(StatusBarType type, StatusBarValue value)
 {
     switch (type)
     {
         case StatusBarType.Text:
             if (!textVisibility)
                 textVisibility = !textVisibility;
             textValue = (value as TextValue).Text;
             break;
         case StatusBarType.ProgressBar:
             if (!pbVisibility)
                 pbVisibility = !pbVisibility;
             pbValue = ConvertToPersent((value as ProgressBarValue).Value, (value as ProgressBarValue).Length);
             pbText = (value as ProgressBarValue).Text;
             break;
     }
 }
 public static bool LoadFromFile(string fileName, out StatusBarType obj) {
     System.Exception exception = null;
     return LoadFromFile(fileName, out obj, out exception);
 }
 /// <summary>
 /// Deserializes xml markup from file into an StatusBarType object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output StatusBarType object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out StatusBarType obj, out System.Exception exception) {
     exception = null;
     obj = default(StatusBarType);
     try {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (System.Exception ex) {
         exception = ex;
         return false;
     }
 }
 public static bool Deserialize(string xml, out StatusBarType obj) {
     System.Exception exception = null;
     return Deserialize(xml, out obj, out exception);
 }
 /// <summary>
 /// Deserializes workflow markup into an StatusBarType object
 /// </summary>
 /// <param name="xml">string workflow markup to deserialize</param>
 /// <param name="obj">Output StatusBarType object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out StatusBarType obj, out System.Exception exception) {
     exception = null;
     obj = default(StatusBarType);
     try {
         obj = Deserialize(xml);
         return true;
     }
     catch (System.Exception ex) {
         exception = ex;
         return false;
     }
 }