public override void OnInspectorGUI()
	{
		if (Application.isPlaying)
		{
//			EditorGUILayout.TextArea("this\nis\nsome\ntext");
			
			histories.Clear();
			foreach(GameObject gameObject in ObjectPoolManager.instance.objectHistory.Keys)
			{
				ObjectHistory toAdd = new ObjectHistory()
				{
					go = gameObject,
					id = ObjectPoolManager.instance.objectIds[gameObject],
					history = ObjectPoolManager.instance.objectHistory[gameObject],
				};
				histories.Add(toAdd);
				
			}
			
			histories.Sort( (x, y) => x.id - y.id );
			
//			for(int i = 0 ; i < histories.Count ; i++)
			foreach(ObjectHistory history in histories)
			{
				if (!open.ContainsKey(history.go))
				{
					open[history.go] = false;
				}
			
				open[history.go] = EditorGUILayout.Foldout(open[history.go], history.go.name);
				
				if (open[history.go])
				{
					EditorGUI.indentLevel += 1;
					foreach (ObjectPoolManager.ObjectHistoryEvent historyEvent in history.history)
					{
						EditorGUILayout.BeginHorizontal();
						EditorGUILayout.ObjectField(history.go,typeof(GameObject), true, GUILayout.MaxWidth(200));
						EditorGUILayout.LabelField(historyEvent.poolEvent+"\t@ frame"+historyEvent.frameCount);
						EditorGUILayout.EndHorizontal();
						EditorGUILayout.TextArea(historyEvent.stacktrace);
					}
					EditorGUI.indentLevel -= 1;
				}
				
				
			}
		}
	}
예제 #2
0
        private object GetTargetFromHistory(object source)
        {
            object target = null;

            if (source != null)
            {
                object        actualSource = source;
                ObjectHistory history      = this.FindHistoryObject(actualSource);

                if (history != null)
                {
                    target = history.Target;
                }
            }

            return(target);
        }
    public override void OnInspectorGUI()
    {
        if (Application.isPlaying)
        {
//			EditorGUILayout.TextArea("this\nis\nsome\ntext");

            histories.Clear();
            foreach (GameObject gameObject in ObjectPoolManager.instance.objectHistory.Keys)
            {
                ObjectHistory toAdd = new ObjectHistory()
                {
                    go      = gameObject,
                    id      = ObjectPoolManager.instance.objectIds[gameObject],
                    history = ObjectPoolManager.instance.objectHistory[gameObject],
                };
                histories.Add(toAdd);
            }

            histories.Sort((x, y) => x.id - y.id);

//			for(int i = 0 ; i < histories.Count ; i++)
            foreach (ObjectHistory history in histories)
            {
                if (!open.ContainsKey(history.go))
                {
                    open[history.go] = false;
                }

                open[history.go] = EditorGUILayout.Foldout(open[history.go], history.go.name);

                if (open[history.go])
                {
                    EditorGUI.indentLevel += 1;
                    foreach (ObjectPoolManager.ObjectHistoryEvent historyEvent in history.history)
                    {
                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.ObjectField(history.go, typeof(GameObject), true, GUILayout.MaxWidth(200));
                        EditorGUILayout.LabelField(historyEvent.poolEvent + "\t@ frame" + historyEvent.frameCount);
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.TextArea(historyEvent.stacktrace);
                    }
                    EditorGUI.indentLevel -= 1;
                }
            }
        }
    }
예제 #4
0
 public bool RollBack(ObjectHistory RollBackTo)
 {
     //SystemMessage = string.Empty;
     if (HasDeleteRights()) {
         int RowsAffected = SiteSettings.DataAccess.WorkFlowObjectRollBack(RollBackTo);
         if (RowsAffected > 0) {
             _versionHistory = null;
             AssignRollBackData(RollBackTo);
             return true;
         }
         else {
             //SystemMessage = "Unable to roll back object in the database.";
             return false;
         }
     }
     else {
         //SystemMessage = "The current user does not have rights to delete/manage history for the requested object";
         return false;
     }
 }
예제 #5
0
        private ObjectHistory FindHistoryObject(object source)
        {
            ObjectHistory history    = null;
            string        sourceGuid = String.Empty;
            var           tempGuid   = source.GetType().GetProperties().AsEnumerable().
                                       FirstOrDefault(prop => Attribute.IsDefined(prop, typeof(KeyAttribute)));

            if (tempGuid != null)
            {
                sourceGuid = tempGuid.GetValue(source, null).ToString();
            }

            if (sourceGuid != String.Empty) // Find by id first if exist.
            {
                history = _createdObjects.FirstOrDefault(o => o.SourceId == sourceGuid);
            }
            else // If the Id is empty then use equality comparision.
            {
                // Attempt to find by object equality (GetHashCode).
                history = _createdObjects.FirstOrDefault(o => o.Source.GetHashCode() == source.GetHashCode());
            }

            return(history);
        }
예제 #6
0
 public void Awake()
 {
     instance = this;
 }
예제 #7
0
 protected abstract void AssignRollBackData(ObjectHistory RollBackTo);