} // DoCallBackFromEE // This is called by both the call back functions above. internal void DoCallBackGeneric( IntPtr targetCtxID, CrossContextDelegate deleg) { TransitionCall msgCall = new TransitionCall(targetCtxID, deleg); Message.PropagateCallContextFromThreadToMessage(msgCall); //DBG Console.WriteLine("CallBackGeneric starting!"); IMessage retMsg = this.GetClientContextChain().SyncProcessMessage(msgCall); if (null != retMsg) { Message.PropagateCallContextFromMessageToThread(retMsg); } IMethodReturnMessage msg = retMsg as IMethodReturnMessage; if (null != msg) { if (msg.Exception != null) { throw msg.Exception; } } //DBG Console.WriteLine("CallBackGeneric finished!"); }
internal void DoCallBackGeneric(IntPtr targetCtxID, CrossContextDelegate deleg) { TransitionCall transitionCall = new TransitionCall(targetCtxID, deleg); Message.PropagateCallContextFromThreadToMessage((IMessage)transitionCall); IMessage msg = this.GetClientContextChain().SyncProcessMessage((IMessage)transitionCall); if (msg != null) { Message.PropagateCallContextFromMessageToThread(msg); } IMethodReturnMessage methodReturnMessage = msg as IMethodReturnMessage; if (methodReturnMessage != null && methodReturnMessage.Exception != null) { throw methodReturnMessage.Exception; } }
internal static void DoCallBackFromEE(IntPtr targetCtxID, IntPtr privateData, int targetDomainID) { if (targetDomainID == 0) { CrossContextDelegate deleg = new CrossContextDelegate(new CallBackHelper(privateData, true, targetDomainID).Func); Thread.CurrentContext.DoCallBackGeneric(targetCtxID, deleg); } else { TransitionCall transitionCall = new TransitionCall(targetCtxID, privateData, targetDomainID); Message.PropagateCallContextFromThreadToMessage((IMessage)transitionCall); IMessage msg = Thread.CurrentContext.GetClientContextChain().SyncProcessMessage((IMessage)transitionCall); Message.PropagateCallContextFromMessageToThread(msg); IMethodReturnMessage methodReturnMessage = msg as IMethodReturnMessage; if (methodReturnMessage != null && methodReturnMessage.Exception != null) { throw methodReturnMessage.Exception; } } }
// This is called when EE needs to do a transition and execute some // code. Before calling, EE determines if this is a x-domain case. // targetDomainID will be 0 if it is a simple x-context call. internal static void DoCallBackFromEE( IntPtr targetCtxID, IntPtr privateData, int targetDomainID) { BCLDebug.Assert(targetCtxID != IntPtr.Zero, "Bad transition context"); /*DBG Console.WriteLine("private DoCallBackFromEE: targetCtx: " + Int32.Format(targetCtxID,"x") + " PvtData: " + Int32.Format(privateData,"x"));DBG*/ if (targetDomainID == 0) { CallBackHelper cb = new CallBackHelper( privateData, true /*fromEE*/, targetDomainID); CrossContextDelegate ctxDel = new CrossContextDelegate(cb.Func); Thread.CurrentContext.DoCallBackGeneric(targetCtxID, ctxDel); } else { // for x-appdomain calls, we can't pass a delegate since that // would require us to deserialize it on the other side which // is not allowed for non-public methods. TransitionCall msgCall = new TransitionCall(targetCtxID, privateData, targetDomainID); Message.PropagateCallContextFromThreadToMessage(msgCall); //DBG Console.WriteLine("CallBackGeneric starting!"); IMessage retMsg = Thread.CurrentContext.GetClientContextChain().SyncProcessMessage(msgCall); Message.PropagateCallContextFromMessageToThread(retMsg); IMethodReturnMessage msg = retMsg as IMethodReturnMessage; if (null != msg) { if (msg.Exception != null) { throw msg.Exception; } } } } // DoCallBackFromEE
public void updateProperties(GameTime gameTime, IDictionary <string, object> properties, double duration, ETransition transition) { double startTime = gameTime.TotalGameTime.TotalSeconds; double endTime = startTime + duration; foreach (KeyValuePair <string, object> item in properties) { string name = item.Key; IProperty property = null; System.Reflection.PropertyInfo proInfo = obj.GetType().GetProperty(name); if (proInfo != null) { property = new PropertyProperty() { property = proInfo }; } if (property == null) { System.Reflection.FieldInfo fieldInfo = obj.GetType().GetField(name); if (fieldInfo != null) { property = new FieldProperty() { field = fieldInfo }; } } if (property == null) { continue; } Type proType = property.getType(); IChangeSet changeSet = null; TransitionCall transCall = EaseUtils.easeLinear; switch (transition) { case ETransition.EaseInElastic: transCall = EaseUtils.easeInElastic; break; case ETransition.EaseOutElastic: transCall = EaseUtils.easeOutElastic; break; case ETransition.EaseInOutElastic: transCall = EaseUtils.easeInOutElastic; break; case ETransition.EaseInCubic: transCall = EaseUtils.easeInCubic; break; case ETransition.EaseOutCubic: transCall = EaseUtils.easeOutCubic; break; case ETransition.Linear: transCall = EaseUtils.easeLinear; break; } if (proType == typeof(float)) { float beginValue = (float)(property.getValue(obj, null)); float gotoValue = float.Parse(item.Value.ToString()); float changeValue = gotoValue - beginValue; FloatSet floatSet = new FloatSet(transCall) { name = name, beginValue = beginValue, changeValue = changeValue, startTime = startTime, endTime = endTime, duration = duration, property = property, }; changeSet = floatSet; } else if (proType == typeof(int)) { int beginValue = (int)(property.getValue(obj, null)); int gotoValue = int.Parse(item.Value.ToString()); int changeValue = gotoValue - beginValue; changeSet = new IntSet(transCall) { name = name, beginValue = beginValue, changeValue = changeValue, startTime = startTime, endTime = endTime, duration = duration, property = property, }; } if (changeSet != null) { if (!_names.Contains(name)) { _names.Add(name); } _changeSets[name] = changeSet; } } }
public FloatSet(TransitionCall transCall) { _transCall = transCall; }
public IntSet(TransitionCall transCall) { _transCall = transCall; }