PropertyHelper.CheckSame C# (CSharp) Method

CheckSame() public method

public CheckSame ( ) : IEnumerable
return IEnumerable
	public IEnumerable CheckSame() {
		if(mine == null || theirs == null) {
			same = false;
			yield break;
		}
		foreach(bool e in UniMerge.Util.PropEqual(mine, theirs, ObjectMerge.mine, ObjectMerge.theirs)) {
			if(ObjectMerge.YieldIfNeeded())
				yield return null;
			same = e;
		}
	}

Usage Example

Example #1
0
	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;
		}
	}
All Usage Examples Of PropertyHelper::CheckSame