示例#1
0
        /// <summary>
        /// Updates the AnimatorAccess component of the specified game object.
        /// </summary>
        /// <param name="go">Go.</param>
        public void Update(GameObject go)
        {
            string file = GetTargetFile(go);

            if (string.IsNullOrEmpty(file))
            {
                return;
            }
            ClassElementsBuilder a = new ClassElementsBuilder(go);
            CodeGeneratorResult  r = a.PrepareCodeGeneration(true);

            if (!r.Error)
            {
                r = a.GenerateCode();
                if (r.Success)
                {
                    BackupAndSave(a.Code, file);
                    EditorStatusObserver.CheckForAutoRefresh();
                }
            }
            else
            {
                Logger.Warning(r);
                EditorUtility.DisplayDialog(r.ErrorTitle, r.ErrorText, "OK");
            }
        }
示例#2
0
		public void TestAnimatorAccessGenerator (GameObject go) {
			ClassElementsBuilder a = new ClassElementsBuilder (go);
			CodeGeneratorResult r = a.PrepareCodeGeneration (true);
			if (!r.Error) {
				r = a.GenerateCode ();
				if (r.Success) {
					WriteToFile (a.Code, "/Users/kay/tmp/TimeMachine.ignore/Trash/New.cs");
				}
			} else {
				Logger.Warning (r);
			}
		}
示例#3
0
        /// <summary>
        /// Create a new AnimatorAccess component for the specified game object and saves it to targetCodeFile. The
        /// caller is responsible for ensuring that there is not yet a component existing with the same name.
        /// </summary>
        /// <param name="go">Go.</param>
        /// <param name="targetCodeFile">Target code file.</param>
        public void Create(GameObject go, string targetCodeFile)
        {
            ClassElementsBuilder gen    = new ClassElementsBuilder(go, targetCodeFile);
            CodeGeneratorResult  result = gen.PrepareCodeGeneration(false);

            if (result.Error)
            {
                EditorUtility.DisplayDialog(result.ErrorTitle, result.ErrorText, "OK");
                return;
            }
            result = gen.GenerateCode();
            if (result.Success)
            {
                BackupAndSave(gen.Code, targetCodeFile);
                EditorStatusObserver.RegisterForPostProcessing(gen.FullClassName);
            }
        }
示例#4
0
        public void TestAnimatorAccessGenerator(GameObject go)
        {
            ClassElementsBuilder a = new ClassElementsBuilder(go);
            CodeGeneratorResult  r = a.PrepareCodeGeneration(true);

            if (!r.Error)
            {
                r = a.GenerateCode();
                if (r.Success)
                {
                    WriteToFile(a.Code, "/Users/kay/tmp/TimeMachine.ignore/Trash/New.cs");
                }
            }
            else
            {
                Logger.Warning(r);
            }
        }
示例#5
0
		/// <summary>
		/// Create a new AnimatorAccess component for the specified game object and saves it to targetCodeFile. The 
		/// caller is responsible for ensuring that there is not yet a component existing with the same name.
		/// </summary>
		/// <param name="go">Go.</param>
		/// <param name="targetCodeFile">Target code file.</param>
		public void Create (GameObject go, string targetCodeFile) {
			ClassElementsBuilder gen = new ClassElementsBuilder (go, targetCodeFile);
			CodeGeneratorResult result = gen.PrepareCodeGeneration (false);
			if (result.Error) {
				EditorUtility.DisplayDialog (result.ErrorTitle, result.ErrorText, "OK");
				return;
			}
			result = gen.GenerateCode ();
			if (result.Success) {
				BackupAndSave (gen.Code, targetCodeFile);
				EditorStatusObserver.RegisterForPostProcessing (gen.FullClassName);
			}
		}
示例#6
0
		/// <summary>
		/// Compares the current version of class with a potential new version.
		/// </summary>
		/// <returns>The for updates.</returns>
		/// <param name="go">GameOject whose attached BaseAnimatorAccess component should be used.</param>
		public List<ClassMemberCompareElement> CheckForUpdates (GameObject go) {
			ClassElementsBuilder a = new ClassElementsBuilder (go);
			return a.Compare (go);
		}
示例#7
0
		/// <summary>
		/// Updates the AnimatorAccess component of the specified game object.
		/// </summary>
		/// <param name="go">Go.</param>
		public void Update (GameObject go) {
			string file = GetTargetFile (go);
			if (string.IsNullOrEmpty (file)) {
				return;
			}
			ClassElementsBuilder a = new ClassElementsBuilder (go);
			CodeGeneratorResult r = a.PrepareCodeGeneration (true);
			if (!r.Error) {
				r = a.GenerateCode ();
				if (r.Success) {
					BackupAndSave (a.Code, file);
					EditorStatusObserver.CheckForAutoRefresh ();
				}
			} else {
				Logger.Warning (r);
				EditorUtility.DisplayDialog (r.ErrorTitle, r.ErrorText, "OK");
			}
		}
示例#8
0
        /// <summary>
        /// Compares the current version of class with a potential new version.
        /// </summary>
        /// <returns>The for updates.</returns>
        /// <param name="go">GameOject whose attached BaseAnimatorAccess component should be used.</param>
        public List <ClassMemberCompareElement> CheckForUpdates(GameObject go)
        {
            ClassElementsBuilder a = new ClassElementsBuilder(go);

            return(a.Compare(go));
        }