Exemple #1
0
        // -------------------------------------------------------------------------------
        // Init
        // -------------------------------------------------------------------------------
        public void Init(GameObject _parent = null, int level = 1)
        {
            base.Init(_parent);

            syncAttributes.Clear();

            foreach (BaseAttribute attribute in defaultAttributes)
            {
                if (attribute.template != null)
                {
                    SAttribute sAttribute = new SAttribute(attribute.template.GetId, attribute.value.Get(level));
                    syncAttributes.Add(sAttribute);
                }
            }
        }
Exemple #2
0
        // -------------------------------------------------------------------------------
        // Load
        // -------------------------------------------------------------------------------
        public override void Load(BaseDataTable data)
        {
            syncAttributes.Clear();

            for (int i = 0; i < data.Rows.Count; ++i)
            {
                TemplateAttribute tmpl;

                if (DataManager.dictAttribute.TryGetValue(data.GetIdHash(i), out tmpl))
                {
                    SAttribute sAttribute = new SAttribute(tmpl.GetId, data.GetLongAsInt(DatabaseManager.fieldValue, i));
                    syncAttributes.Add(sAttribute);
                }
                else
                {
                    Debug.LogWarning("Skipped template '" + data.GetString(DatabaseManager.fieldName) + "' as it was not found in Library.");
                }
            }

            data.Cleanup();
        }