CheckSame() public méthode

public CheckSame ( ) : IEnumerable
Résultat IEnumerable
	public IEnumerable Refresh() {
		properties.Clear();
		List<SerializedProperty> myProps = new List<SerializedProperty>();
		List<SerializedProperty> theirProps = new List<SerializedProperty>();
		if(GetComponent(true)) {
			mySO = new SerializedObject(GetComponent(true));
			GetProperties(myProps, mySO);
		}
		if (GetComponent(false)) {
			theirSO = new SerializedObject(GetComponent(false));
			GetProperties(theirProps, theirSO);
		}
		same = myProps.Count == theirProps.Count;
		//TODO: add assertion and unit test for this, which should never happen
		if(mine && theirs && !same)
			Debug.LogWarning("not same number of props... wtf?");
		int count = Mathf.Max(myProps.Count, theirProps.Count);
		for(int i = 0; i < count; i++) {
			SerializedProperty myProp = null;
			SerializedProperty theirProp = null;
			if(i < myProps.Count)
				myProp = myProps[i];
			if(i < theirProps.Count)
				theirProp = theirProps[i];
			if(myProp != null && myProp.name == "m_Script")
				continue;
			if(theirProp != null && theirProp.name == "m_Script")
				continue;
			PropertyHelper ph = new PropertyHelper(this, myProp, theirProp);
			foreach(IEnumerable e in ph.CheckSame())
				yield return e;
			properties.Add(ph);
			if(!ph.same)
				same = false;
		}
	}
Exemple #2
0
	public IEnumerable Refresh() {
		if(ObjectMerge.refreshWatch.Elapsed.TotalSeconds > ObjectMerge.maxFrameTime) {
			ObjectMerge.refreshWatch.Reset();
			yield return null;
			ObjectMerge.refreshWatch.Start();
		}
		properties.Clear();
		List<SerializedProperty> myProps = new List<SerializedProperty>();
		List<SerializedProperty> theirProps = new List<SerializedProperty>();
		if(GetComponent(true)) {
			mySO = new SerializedObject(GetComponent(true));
			GetProperties(myProps, mySO);
		}
		if(GetComponent(false)) {
			theirSO = new SerializedObject(GetComponent(false));
			GetProperties(theirProps, theirSO);
		}
		same = myProps.Count == theirProps.Count;
		if(mine && theirs && !same)
			Debug.LogWarning("not same number of props... wtf?");
		int count = Mathf.Max(myProps.Count, theirProps.Count);
		for(int i = 0; i < count; i++) {
			SerializedProperty myProp = null;
			SerializedProperty theirProp = null;
			if(i < myProps.Count)
				myProp = myProps[i];
			if(i < theirProps.Count)
				theirProp = theirProps[i];
			PropertyHelper ph = new PropertyHelper(this, myProp, theirProp);
			foreach(IEnumerable e in ph.CheckSame())
				yield return e;
			properties.Add(ph);
			if(!ph.same)
				same = false;
		}
	}