private string GenerateInput_ObjectAnimations()
        {
            string result = "[OBJECT_ANIMATIONS]\n";

            result += "#ID\tStateAnimId1\tStateAnimId2\t...\n";

            foreach (var item in data)
            {
                if (item.Value is ObjectAnimations)
                {
                    ObjectAnimations objAnims = item.Value as ObjectAnimations;

                    int id = intIds[objAnims.StringId];
                    result += $"{id}\t";

                    foreach (StateAnimation state in objAnims.States)
                    {
                        result += $"{intIds[state.StringId]}\t\t";
                    }

                    result += "\n";
                }
            }

            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// Import: add every data in imported code to library
        /// </summary>
        public override void AddToLib()
        {
            // don't re-import a file, otherwise will cause infinite recursion!
            if (AnimatingObjectsLib.Instance.Get(StringId) != null)
            {
                return;
            }

            base.AddToLib();

            CountTotalFilesToImport = 1;
            RecurImports            = new List <Import>();

            var scopes = ImportedCode.Split(Utils.EndScopeChar);

            foreach (var scope in scopes)
            {
                string error;
                var    tempObj = ObjectAnimations.InterpretScope(scope, out error);

                if (error == "" || error == null)
                {
                    // if this object has not been added before
                    if (tempObj != null)
                    {
                        bool notAddedBefore = AnimatingObjectsLib.Instance.Get(tempObj.StringId) == null;
                        tempObj.AddToLib();

                        // this is save for generating preview
                        if (tempObj is Import && notAddedBefore)
                        {
                            RecurImports.Add(tempObj as Import);
                            CountTotalFilesToImport += (tempObj as Import).CountTotalFilesToImport;
                        }
                    }
                }
            }
        }