//实现IIterator的三个接口 Object IIterator.Next() { if (mListEnumerator.MoveNext()) { XmlNode node = (XmlNode)mListEnumerator.Current; try{ mCurrentEvaluation = new EvaluationAttribute( Convert.ToInt32(node.Attributes["bar_num"].Value), Convert.ToSingle(node.Attributes["torso_pos_weight"].Value), Convert.ToSingle(node.Attributes["torso_rot_weight"].Value), Convert.ToSingle(node.Attributes["left_hip_weight"].Value), Convert.ToSingle(node.Attributes["right_hip_weight"].Value), Convert.ToSingle(node.Attributes["left_shoulder_weight"].Value), Convert.ToSingle(node.Attributes["right_shoulder_weight"].Value) ); } catch { return(null); } mIndex++; return(mCurrentEvaluation); } else { return(null); } }
//通过迭代器读取评价数据 void ReadEvaluationAttribute() { mEvaluateIterator = SingletonGameData.GetInstance().CreateEvaluateIterator(); while (mEvaluateIterator.HasNext()) { EvaluationAttribute mEvaluationAttribute = (EvaluationAttribute)mEvaluateIterator.Next(); mListEvaluationAttribute.Add(mEvaluationAttribute); } }
//private List mArrayListStdMotionJointQuaternionVector=new ArrayList(); //private ArrayList mArrayListUserMotionJointQuaternionVector=new ArrayList(); public virtual void Init(EvaluationAttribute evalutionAttribute) { /*float mWeightSum=torsoPositionWeight+torsoRotationWeight+leftHipWeight+rightHipWeight+leftShoulderWeight+rightShoulderWeight; * mTorsoPositionWeight=torsoPositionWeight/mWeightSum; * mTorsoRotationWeight=torsoRotationWeight/mWeightSum; * mLeftHipWeight=leftHipWeight/mWeightSum; * mRightHipWeight=rightHipWeight/mWeightSum; * mLeftShoulderWeight=leftShoulderWeight/mWeightSum; * mRightShoulderWeight=rightShoulderWeight/mWeightSum; * mArrayListStdMotionJointQuaternionVector.Clear(); * mArrayListUserMotionJointQuaternionVector.Clear();*/ }
public override void Init(EvaluationAttribute evalutionAttribute) { base.Init(evalutionAttribute); float mWeightSum = evalutionAttribute.TorsoPositionWeight + evalutionAttribute.TorsoRotationWeight + evalutionAttribute.LeftHipWeight + evalutionAttribute.RightHipWeight + evalutionAttribute.LeftShoulderWeight + evalutionAttribute.RightSoulderWeight; mTorsoPositionWeight = evalutionAttribute.TorsoPositionWeight / mWeightSum; mTorsoRotationWeight = evalutionAttribute.TorsoRotationWeight / mWeightSum; mLeftHipWeight = evalutionAttribute.LeftHipWeight / mWeightSum; mRightHipWeight = evalutionAttribute.RightHipWeight / mWeightSum; mLeftShoulderWeight = evalutionAttribute.LeftShoulderWeight / mWeightSum; mRightShoulderWeight = evalutionAttribute.RightSoulderWeight / mWeightSum; mListMatchScore.Clear(); mListStd.Clear(); //float mWeightSum = evalutionAttribute.TorsoPositionWeight+evalutionAttribute.TorsoRotationWeight+evalutionAttribute.LeftHipWeight+evalutionAttribute.RightHipWeight+evalutionAttribute.LeftShoulderWeight+evalutionAttribute.RightSoulderWeight; //mListMatchScore.Clear(); }