Esempio n. 1
0
        public static AttributeFormats Load()
        {
            string           path    = Application.streamingAssetsPath + "/CardAttributeFormats.json";
            AttributeFormats formats = new AttributeFormats(JsonConvert.DeserializeObject <List <AttributeFormat> >(File.ReadAllText(path)));

            return(formats);
        }
Esempio n. 2
0
        static void UpdateClasses()
        {
            AttributeFormats formats = AttributeFormats.Load();

            foreach (AttributeFormat format in formats)
            {
                CreateClassFile(format, null, true);
            }
        }
Esempio n. 3
0
        public void OnEnable()
        {
            if (attributeFormats == null)
            {
                attributeFormats = AttributeFormats.Load();
            }
            data = (ICardData)target;
            foreach (AttributeFormat format in attributeFormats)
            {
                string className = char.ToUpper(format.type[0]) + format.type.Substring(1);
                //displayed name bei m ist Collectiblox.Monster
                //warum ist t null?
                //Funktioniert in Unity wegen Serialisierungs-Magie nicht...
                //Type t = Type.GetType("Collectiblox.Monster");
                //Type m = typeof(Monster);

                //https://answers.unity.com/questions/206665/typegettypestring-does-not-work-in-unity.html
                if (!System.AppDomain.CurrentDomain.GetAssemblies()
                    .Any(a => a.GetType("Collectiblox." + className) != null))
                {
                    ClassFileCreator.CreateClassFile(format, null);
                }
            }
        }