示例#1
0
        protected override void OnActiveExecute(Markup.Programming.Core.Engine engine)
        {
            var canvas = FindParent <Canvas>(AssociatedObject);
            var state  = StateMap.Values.Where(value => value.Canvas == canvas).FirstOrDefault();

            if (state == null)
            {
                state = new MoveObjectState {
                    Canvas = canvas
                };
            }
            StateMap[AssociatedObject] = state;
            if (IsMoveObject)
            {
                state.SetParent(this);
                MoveObject.Visibility = Visibility.Collapsed;
            }

            MoveObject.PreviewMouseLeftButtonDown +=
                (sender, e) => StateMap[sender].element_MouseDown(sender, e);
            MoveObject.PreviewMouseMove +=
                (sender, e) => StateMap[sender].element_MouseMove(sender, e);
            MoveObject.PreviewMouseLeftButtonUp +=
                (sender, e) => StateMap[sender].element_MouseUp(sender, e);
        }
示例#2
0
    void OnRecvMoveObjectState(int id, MoveObjectState msg)
    {
        SceneObjcet so = this.GetSceneObject(msg.ObjState.Objid);

        if (null == so)
        {
            so = new SceneObjcet(msg.ObjState.Objid, msg.ObjState.ObjType, msg.ObjState.ModelId);
            m_sceneObjects[so.id] = so;
        }
        so.SetPos(msg.ObjState.Pos);
        so.faceDir = msg.ObjState.Rotation;
    }