Exemplo n.º 1
0
 public static void Reset()
 {
     Names.Clear();
     Props.Clear();
     PostInitializes.Clear();
     Destroys.Clear();
 }
Exemplo n.º 2
0
        public static void C_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count == 0)
            {
                return;
            }
            ;
            var q = e.AddedItems[0];

            if (q is Team)
            {
                Props.Clear();
                var            tt         = (Team)q;
                var            ttt        = tt.Table.GetType();
                PropertyInfo[] properties = ttt.GetProperties();
                foreach (PropertyInfo property in properties)
                {
                    string displayName = property.Name;
                    try
                    {
                        var attribute = property.GetCustomAttributes(typeof(DisplayNameAttribute), true)
                                        .Cast <DisplayNameAttribute>().Single();
                        displayName = attribute.DisplayName;
                    }
                    catch (Exception exception)
                    {
                    }

                    try
                    {
                        var attribute = property.GetCustomAttributes(typeof(BrowsableAttribute), true)
                                        .Cast <BrowsableAttribute>().Single();
                        if (!attribute.Browsable)
                        {
                            continue;
                        }
                    }
                    catch (Exception exception)
                    {
                    }

                    string value = property.GetValue(tt.Table).ToString();

                    var z = new Prop()
                    {
                        Property = displayName, Value = value
                    };
                    Props.Add(z);
                }

                Dg.Items = null;
                Dg.Items = Props;
            }
        }
Exemplo n.º 3
0
 private void WalkToSection(string s)
 {
     Props.Clear();
     if (s.EndsWith("first section of the hallway", StringComparison.InvariantCultureIgnoreCase))
     {
         Props.AddRange(H1);
         _currSec = 1;
     }
     else if (s.EndsWith("second section of the hallway", StringComparison.InvariantCultureIgnoreCase))
     {
         Props.AddRange(H2);
         _currSec = 2;
     }
     else if (s.EndsWith("third section of the hallway", StringComparison.InvariantCultureIgnoreCase))
     {
         Props.AddRange(H3);
         _currSec = 3;
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Reinitilize child objet
 /// </summary>
 public void Dispose()
 {
     Props.Clear();
     Render();
 }
Exemplo n.º 5
0
        /// <summary>
        /// Load existing prop
        /// </summary>
        /// <param name="buffer"></param>
        public void LoadProp(byte[] buffer)
        {
            Props.Clear();
            try
            {
                using (MemoryReader b = new MemoryReader(buffer))
                {
                    string line;

                    string category     = "";
                    string renderType   = "";
                    string lightMapType = "";
                    string visibleRatio = "";

                    while ((line = b.ReadLine()) != null)
                    {
                        line.Trim();

                        var properties = line.Split(new char[] { '=' }, 2);
                        if (!line.StartsWith(";") && properties.Length == 2)
                        {
                            if (properties[0] == "CATEGORY")
                            {
                                category = properties[1].ToString();
                            }
                            else if (properties[0] == "RENDERTYPE")
                            {
                                renderType = properties[1];
                            }
                            else if (properties[0] == "LIGHTMAPTYPE")
                            {
                                lightMapType = properties[1];
                            }
                            else if (properties[0] == "VISIBLE_RATIO")
                            {
                                visibleRatio = properties[1];
                            }
                            else if (properties[0] == "PROPNAME")
                            {
                                var values = properties[1].Split(new char[] { ',' }, 2);
                                if (values.Length == 2)
                                {
                                    var prop = new PropInfo();
                                    prop.Id           = uint.Parse(values[0]);
                                    prop.Category     = category;
                                    prop.PropName     = values[1];
                                    prop.LightMapType = lightMapType;
                                    prop.VisibleRatio = visibleRatio;
                                    prop.RenderType   = renderType;
                                    Props.Add(prop);
                                }
                            }
                        }
                    }
                }

                Parent.Log(Levels.Success, "Ok\n");
            }
            catch (Exception exception)
            {
                Props = new List <PropInfo>();
                Parent.Log(Levels.Error, "Failed\n");
                Parent.Log(Levels.Fatal, string.Format("Cfg::Prop::Load<Exception> -> {0}\n", exception));
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// Reinitilize child objet
 /// </summary>
 public void Dispose()
 {
     Respawns.Clear();
     Props.Clear();
     Render();
 }