private byte[] Serialize(VisualObject parameters)
 {
     using (var stream = new MemoryStream())
     {
         using (var writer = XmlDictionaryWriter.CreateTextWriter(stream))
         {
             this.serializer.WriteObject(writer, parameters);
             writer.Flush();
             return(stream.ToArray());
         }
     }
 }
Exemple #2
0
        protected override void OnDataInitialize(VisualObject vObject)
        {
            CheckBoxObject checkBoxObject = vObject as CheckBoxObject;

            if (checkBoxObject != null)
            {
                if (this.NormalBackFileData != null && checkBoxObject.NormalBackFileData.GetResourceData().Type != this.NormalBackFileData.Type)
                {
                    checkBoxObject.NormalBackFileData = null;
                }
            }
        }
        protected override void OnDataInitialize(VisualObject vObject)
        {
            ImageViewObject imageViewObject = vObject as ImageViewObject;

            if (imageViewObject != null)
            {
                if (this.FileData != null && imageViewObject.FileData.GetResourceData().Type != this.FileData.Type)
                {
                    imageViewObject.FileData = null;
                }
            }
        }
        protected override void OnDataInitialize(VisualObject vObject)
        {
            LoadingBarObject loadingBarObject = vObject as LoadingBarObject;

            if (loadingBarObject != null)
            {
                if (this.ImageFileData != null && loadingBarObject.ImageFileData.GetResourceData().Type != this.ImageFileData.Type)
                {
                    loadingBarObject.ImageFileData = null;
                }
            }
        }
Exemple #5
0
        protected override void OnDataInitialize(VisualObject vObject)
        {
            TextObject textObject = vObject as TextObject;

            if (textObject != null)
            {
                if ((this.IsCustomSize && this.FontResource != null && textObject.FontResource.GetResourceData().Type == this.FontResource.Type) || !this.IsCustomSize)
                {
                    textObject.Size = base.Size;
                }
            }
        }
        protected override void OnDataInitialize(VisualObject vObject)
        {
            GameMapObject gameMapObject = vObject as GameMapObject;

            if (gameMapObject != null)
            {
                if (this.FileData != null && gameMapObject.FileData.GetResourceData().Type != this.FileData.Type)
                {
                    gameMapObject.FileData = null;
                }
            }
        }
Exemple #7
0
        protected override void OnDataInitialize(VisualObject vObject)
        {
            TextBMFontObject textBMFontObject = vObject as TextBMFontObject;

            if (textBMFontObject != null)
            {
                if (this.labelBMFontFile_CNB != null && textBMFontObject.LabelBMFontFile_CNB.GetResourceData().Type != this.labelBMFontFile_CNB.Type)
                {
                    textBMFontObject.LabelBMFontFile_CNB = null;
                }
            }
        }
        protected override void OnDataInitialize(VisualObject vObject)
        {
            SpriteObject spriteObject = vObject as SpriteObject;

            if (spriteObject != null)
            {
                if (this.FileData != null && spriteObject.FileData.GetResourceData().Type != this.FileData.Type)
                {
                    spriteObject.FileData = null;
                }
            }
        }
Exemple #9
0
        protected override void OnDataInitialize(VisualObject vObject)
        {
            TextAtlasObject textAtlasObject = vObject as TextAtlasObject;

            if (textAtlasObject != null)
            {
                if ((this.LabelAtlasFileImage_CNB != null && textAtlasObject.LabelAtlasFileImage_CNB.GetResourceData().Type != this.LabelAtlasFileImage_CNB.Type) || textAtlasObject.LabelAtlasFileImage_CNB.GetResourceData().Type == EnumResourceType.Default)
                {
                    textAtlasObject.LabelAtlasFileImage_CNB = null;
                }
            }
        }
Exemple #10
0
        public Aggregation(VisualObject from, VisualObject to, Canvas canvas) : base(from, to, canvas)
        {
            if (To.Object is Interface)
            {
                To.Relations.Remove(this);
                From.Relations.Remove(this);
                throw new OOPatternsException(this is Composition ? Properties.Resources.compositionException : Properties.Resources.aggregationException);
            }

            Name = $"{nameof(Relation)}_{nameof(Aggregation)}_{Id}";
            AddVariable();
            Draw();
        }
Exemple #11
0
        public void OnSceneObjectSelected(VisualObject obj)
        {
            foreach (VisualObject vo in Host.SceneManager.CurrentScreen.VisualObjects)
            {
                vo.IsSelected = false;
            }

            if (obj != null)
            {
                obj.IsSelected = true;
                Globals.CurrentSelectedObject = obj;
            }
        }
Exemple #12
0
        protected override async Task OnActivateAsync()
        {
            VisualObject newObject = VisualObject.CreateRandom(this.Id.ToString());

            ActorEventSource.Current.ActorMessage(this, "StateCheck {0}", (await this.StateManager.ContainsStateAsync(StatePropertyName)).ToString());

            VisualObject result = await this.StateManager.GetOrAddStateAsync <VisualObject>(StatePropertyName, newObject);

            this.jsonString = result.ToJson();

            // ACTOR MOVEMENT REFRESH
            this.updateTimer = this.RegisterTimer(this.MoveObject, null, TimeSpan.FromMilliseconds(10), TimeSpan.FromMilliseconds(10));
            return;
        }
        private void OnObjectUndo(VisualObject sprite)
        {
            if (sprite != this)
            {
                return;
            }

            if (PreviousState.Count > 0)
            {
                // Reset the position back
                Position = PreviousState[PreviousState.Count - 1];
                PreviousState.RemoveAt(PreviousState.Count - 1);
            }
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        public ViewManipulationAdorner(ViewManipulationManager OwnerManager, VisualObject TargetObject, AdornerLayer TargetLayer)
            : base(OwnerManager.OwnerView.PresenterControl)
        {
            this.IsHitTestVisible = true;

            this.OwnerManager      = OwnerManager;
            this.ManipulatedObject = TargetObject;
            this.BaseLayer         = TargetLayer;

            this.Indicators = new VisualCollection(this);
            this.ExclusivePointingIndicators = new List <Visual>();

            this.ContextControl = this.OwnerManager.OwnerView.PresenterControl;
        }
 public static async Task WriteObjectAsync(
     IStateStore stateStore,
     VisualObject obj,
     CancellationToken cancellationToken)
 {
     try
     {
         await stateStore.WriteAsync(obj, cancellationToken);
     }
     catch (Exception e)
     {
         Console.WriteLine($"Error in writing the object. {e.ToString()}");
     }
 }
        public void AddObject(VisualObject obj)
        {
            var frame = pnKeyFrameContainer.Controls[CurrentSelectedFrame] as conKeyFrame;

            if (frame != null)
            {
                if (string.IsNullOrEmpty(obj.Name))
                {
                    obj.Name = obj.GetType().ToString();
                }

                frame.VisualObjects.Add(obj);
            }
        }
Exemple #17
0
        public void SetKeyFrames <T>(AbsoluteKeyFrameCollection <T> keyFrames)
        {
            Curves?.Destroy();
            KeyFrames?.Destroy();

            if (keyFrames == null)
            {
                Curves    = null;
                KeyFrames = null;
            }
            else
            {
                var t = new TimelineKeyFrames <T> {
                    KeyFrames = keyFrames
                };
                var curves = new CurveVisualObject {
                    Series = new TimelineCurveSeries <T> {
                        KeyFrames = keyFrames
                    }, IsSelectable = false
                }.Style(new Pen(Brushes.White, 1));

                t.SelectionChanged += (sender, e) =>
                {
                    if (e.OriginalSource is TimelineKeyFrame <T> tkf)
                    {
                        m_setting = true;
                        var kf = tkf.Selection.IsEmpty ? null : tkf.Focus < 1 ? tkf.KeyFrame : tkf.NextKeyFrame;
                        keyFramesEditor.Type   = kf == null ? null : typeof(AbsoluteKeyFrame <T>);
                        keyFramesEditor.Object = kf;
                        m_setting = false;
                    }
                };
                t.Changed += (sender, e) =>
                {
                    plane.RenderdWithoutCache(t);
                    plane.RenderdWithoutCache(curves);
                    UpdateCursorPoint(PropertiesAnimation.GeneralTime);
                };

                plane.Items.Insert(1, curves);
                plane.Items.Add(t);

                KeyFrames = t;
                Curves    = curves;
            }

            m_keyFrames = keyFrames;
            UpdateCursorPoint(PropertiesAnimation.GeneralTime);
        }
    /// <summary>
    /// 使场景变暗
    /// </summary>
    /// <param name="excludeobjs"></param>
    public void DarkenScene(uint[] excludeobjs, float alpha = 0.7f)
    {
        GameObject cameraobj = CameraController.Instance.CurCamera.gameObject;

        //场景变暗
        if (mSceneMask == null)
        {
            mSceneMask = cameraobj.AddComponent <SceenMask>();
        }
        mSceneMask.enabled = true;
        mSceneMask.SetAlpha(alpha);
        //排除某些物体
        SceneObjManager objMng = SceneManager.Instance.GetCurScene().GetSceneObjManager();

        mDarkExcludeList.Clear();
        foreach (uint instid in excludeobjs)
        {
            ObjectBase obj = objMng.FindObject(instid);
            if (obj == null)
            {
                continue;
            }
            VisualObject vObj = obj as VisualObject;
            if (vObj == null)
            {
                continue;
            }
            if (vObj.OriginalMtl == null)
            {
                continue;
            }

            DarkTask task = new DarkTask();
            task.instID = instid;
            List <int> q = new List <int>();
            for (int i = 0; i < vObj.OriginalInstMtl.Length; ++i)
            {
                Material mtl = vObj.OriginalInstMtl[i];
                if (mtl == null)
                {
                    continue;
                }
                q.Add(mtl.renderQueue);
                mtl.renderQueue = 4000 + 1;
            }
            task.queue = q.ToArray();
            mDarkExcludeList.Add(task);
        }
    }
Exemple #19
0
        protected override void inputDispatch_BeforeMouseMove(MouseEventArgsExtend args, IEnumerable <VisualObject> selectedParentObject)
        {
            base.inputDispatch_BeforeMouseMove(args, selectedParentObject);
            VisualObject visualObject = (VisualObject)null;

            if (args != null && args.HitResult != null)
            {
                visualObject = args.HitResult.HitVisual;
            }
            if (this.bMouseValid)
            {
                selectedParentObject.ForEach <VisualObject>((System.Action <VisualObject>)(a => a.MouseMove(args)));
            }
            args.Handled = true;
        }
        public void StatboardShouldCopyProperly()
        {
            StatboardDefinition chartDefinition = new StatboardDefinition {
                Name = "Statboard"
            };

            Statboard chart = new Statboard(chartDefinition);

            VisualObject copy = chart.Copy("Copied Statboard");

            copy.Should().BeOfType <Statboard>();
            Statboard copiedChart = ( Statboard )copy;

            copiedChart.ChartDefinition.Should().BeOfType <StatboardDefinition>();
            copiedChart.Name.Should().Be("Copied Statboard");
        }
Exemple #21
0
        public void OnObjectRemoved(VisualObject obj)
        {
            CurrentSelectedObject = null;

            RenderWindow.RemoveVisualObject(obj);

            if (Globals.Paths.Contains(obj))
            {
                LedgeBuilder b = obj as LedgeBuilder;

                if (b != null)
                {
                    Globals.Paths.Remove(b);
                }
            }
        }
        public void MultiChartShouldCopyProperly()
        {
            MultiChartDefinition chartDefinition = new MultiChartDefinition {
                Name = "MultiChart"
            };

            MultiChart chart = new MultiChart(chartDefinition);

            VisualObject copy = chart.Copy("Copied MultiChart");

            copy.Should().BeOfType <MultiChart>();
            MultiChart copiedChart = ( MultiChart )copy;

            copiedChart.ChartDefinition.Should().BeOfType <MultiChartDefinition>();
            copiedChart.Name.Should().Be("Copied MultiChart");
        }
Exemple #23
0
 protected override void inputDispatch_BeforeMouseMove(MouseEventArgsExtend args, IEnumerable <VisualObject> selectedParentObject)
 {
     base.inputDispatch_BeforeMouseMove(args, selectedParentObject);
     if (args != null && args.HitResult != null)
     {
         VisualObject hitVisual = args.HitResult.HitVisual;
     }
     if (this.bMouseValid)
     {
         selectedParentObject.ForEach(delegate(VisualObject a)
         {
             a.MouseMove(args);
         });
     }
     args.Handled = true;
 }
        public override bool Parse(Mpeg4Parser parser)
        {
            if (!base.Parse(parser))
            {
                return(false);
            }

            // in the parse end method the DataBlock property is set to the correct value.
            // until that time, the DataBlock hold the previous header.
            VisualObject visualObject = Parent as VisualObject;

            uint verId = 0;

            if (visualObject != null)
            {
                verId = visualObject.VersionId;
            }
            else
            {
                if ((parser.ShowBits(19) & 1) == 1)
                {
                    verId = 0;
                }
            }

            if (verId != 1)
            {
                /*bool tilingDisable = */ parser.GetBit();
                parser.GetBit();
            }

            /*uint textureObjectId = */ parser.GetBits(16, Attribute.TextureObjectID);
            if (!parser.GetMarkerBit())
            {
                return(false);
            }

            /*bool waveletFilterType = */ parser.GetBit();
            /*bool waveletDownload = */ parser.GetBit();
            /*byte waveletDecompositionLevels = (byte)*/ parser.GetBits(4);
            /*bool scanDirection = */ parser.GetBit();
            /*bool startCodeEnabled = */ parser.GetBit();
            /*byte textureObjectLayerShape = (byte)*/ parser.GetBits(2, Attribute.TextureObjectLayerShape);
            /*byte quantisationType = (byte)*/ parser.GetBits(2);

            return(true);
        }
Exemple #25
0
        private void HandlePosition(PointF point)
        {
            if (!TimelineActionManager.Instance.OnionSkinEnable || TimelineActionManager.Instance.AutoKey)
            {
                VisualObject visualObject = this.selectedParentObjects.FirstOrDefault <VisualObject>();
                if (visualObject != null)
                {
                    PointF pointF   = visualObject.TransformToParent(this.lastMousePoint);
                    PointF pointF2  = visualObject.TransformToParent(point);
                    PointF position = this.Position;
                    PointF pointF3  = new PointF(position.X + pointF2.X - pointF.X, position.Y + pointF2.Y - pointF.Y);
                    if (this.isShiftDown)
                    {
                        switch (this.moveDirection)
                        {
                        case MoveDirection.NONE:
                            this.Position = pointF3;
                            break;

                        case MoveDirection.X:
                            this.Position = new PointF(pointF3.X, this.Position.Y);
                            break;

                        case MoveDirection.Y:
                            this.Position = new PointF(this.Position.X, pointF3.Y);
                            break;
                        }
                        if (this.moveDirection == MoveDirection.NONE)
                        {
                            if (pointF2.X - pointF.X != 0f)
                            {
                                this.moveDirection = MoveDirection.X;
                            }
                            else
                            {
                                this.moveDirection = MoveDirection.Y;
                            }
                        }
                    }
                    else
                    {
                        this.Position = pointF3;
                    }
                }
            }
        }
Exemple #26
0
    void initialize()
    {
        brick  = Resources.Load <GameObject>("Prefabs/Brick");
        cherry = Resources.Load <GameObject>("Prefabs/Cherry");

        createGrid();

        scoreText = score.GetComponent <Text>();

        player           = GameObject.Instantiate(Resources.Load <GameObject>("Prefabs/Player"));
        playerController = player.GetComponent <PlayerController>();
        playerController.setSize(grid.getCellSize());
        playerController.setSpawnPoint(grid.spawnPoint, grid.gridPosToRealPos(grid.spawnPoint));
        VisualObject playerVS = player.GetComponent <VisualObject>();

        grid.add(playerVS, playerController.pos);
    }
Exemple #27
0
        private async Task MoveObject(object obj)
        {
            VisualObject visualObject = await this.StateManager.GetStateAsync <VisualObject>(StatePropertyName);

            //alternate which lines are commented out
            //then do an upgrade to cause the
            //visual objects to start rotating

            visualObject.Move(false);
            //visualObject.Move(true);

            await this.StateManager.SetStateAsync <VisualObject>(StatePropertyName, visualObject);

            this.jsonString = visualObject.ToJson();

            return;
        }
        private void rlSceneObjects_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            // Deselect all scene objects
            foreach (VisualObject vo in SceneObjects)
            {
                vo.IsSelected = false;
            }

            // Loop thru and select all the ones we have highlighted in the list box
            foreach (var i in rlSceneObjects.SelectedItems)
            {
                if (i is VisualObject)
                {
                    VisualObject o = i as VisualObject;
                    o.IsSelected = true;
                }
            }
        }
Exemple #29
0
 /// <summary>
 /// Returns current anchor for the "first" object
 /// </summary>
 /// <param name="first">From object</param>
 /// <param name="second">To object</param>
 /// <returns></returns>
 protected AnchorType GetAnchor(VisualObject first, VisualObject second)
 {
     if (first.X > second.X + second.Width)
     {
         if (first.Y > second.Y + second.Y)
         {
             return(AnchorType.Top);
         }
         else if (first.Y + first.Height < second.Y)
         {
             return(AnchorType.Bottom);
         }
         else
         {
             return(AnchorType.Left);
         }
     }
     else if (first.X + first.Width < second.X)
     {
         if (first.Y > second.Y + second.Y)
         {
             return(AnchorType.Top);
         }
         else if (first.Y + first.Height < second.Y)
         {
             return(AnchorType.Bottom);
         }
         else
         {
             return(AnchorType.Right);
         }
     }
     else
     {
         if (first.Y > second.Y + second.Height)
         {
             return(AnchorType.Top);
         }
         else
         {
             return(AnchorType.Bottom);
         }
     }
 }
Exemple #30
0
        private void HandlePosition(PointF point)
        {
            if (TimelineActionManager.Instance.OnionSkinEnable && !TimelineActionManager.Instance.AutoKey)
            {
                return;
            }
            VisualObject visualObject = this.selectedParentObjects.FirstOrDefault <VisualObject>();

            if (visualObject == null)
            {
                return;
            }
            PointF parent1  = visualObject.TransformToParent(this.lastMousePoint);
            PointF parent2  = visualObject.TransformToParent(point);
            PointF position = this.Position;
            PointF pointF   = new PointF(position.X + parent2.X - parent1.X, position.Y + parent2.Y - parent1.Y);

            if (this.isShiftDown)
            {
                switch (this.moveDirection)
                {
                case MoveDirection.NONE:
                    this.Position = pointF;
                    break;

                case MoveDirection.X:
                    this.Position = new PointF(pointF.X, this.Position.Y);
                    break;

                case MoveDirection.Y:
                    this.Position = new PointF(this.Position.X, pointF.Y);
                    break;
                }
                if (this.moveDirection != MoveDirection.NONE)
                {
                    return;
                }
                this.moveDirection = (double)parent2.X - (double)parent1.X == 0.0 ? MoveDirection.Y : MoveDirection.X;
            }
            else
            {
                this.Position = pointF;
            }
        }