Esempio n. 1
0
        public void Load(ZPackage pkg)
        {
            int propertyCount = pkg.ReadInt();

            for (int i = 0; i < propertyCount; i++)
            {
                var key      = pkg.ReadString();
                var dataType = (TyrDataType)Enum.ToObject(typeof(TyrDataType), pkg.ReadInt());
                if (dataType == TyrDataType.FLOAT)
                {
                    var val = pkg.ReadSingle();
                    m_properties[key] = new TyrProperty(key, val, true);
                }
                else if (dataType == TyrDataType.INT)
                {
                    var val = pkg.ReadInt();
                    m_properties[key] = new TyrProperty(key, val, true);
                }
                else if (dataType == TyrDataType.LONG)
                {
                    var val = pkg.ReadLong();
                    m_properties[key] = new TyrProperty(key, val, true);
                }
                else if (dataType == TyrDataType.STRING)
                {
                    var val = pkg.ReadString();
                    m_properties[key] = new TyrProperty(key, val, true);
                }
            }
        }
Esempio n. 2
0
 public void Set(string key, object value, bool mutable = true)
 {
     m_properties[key] = new TyrProperty(key, value, mutable);
 }