void Play()
    {
        Rest();
        for (int i = 0; i < cardType; i++)
        {
            Transform chiledTrans = transform.GetChild(i);
            int       index       = Index(i + 1, cardType);
            chiledTrans.localPosition  = new Vector3(0, chiledTrans.localPosition.y, 0);
            chiledTrans.localPosition += Vector3.up * i * 7;
            CommonAnimation chiledAni = chiledTrans.gameObject.AddComponent <CommonAnimation>();
            chiledAni.angleList.Add(chiledTrans.localEulerAngles);
            chiledAni.angleList.Add(Vector3.forward * 20 * index);
            chiledAni.angleDelayTime = 0.5f;
            chiledAni.time           = 0.2f;
            chiledAni.Play();
        }

        int posIndex = 1;

        for (int i = cardType; i < transform.childCount; i++)
        {
            Transform chiledTrans = transform.GetChild(i);
            chiledTrans.localPosition += Vector3.right * (200 + posIndex++ *(chiledTrans as RectTransform).sizeDelta.x / 2);
        }
    }
Esempio n. 2
0
 private void mouseClickManager_DoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (this.showMaxButton)
     {
         if (!this.isMaximized)
         {
             DraggingEnabled = false;
             this.initialWindowSize.Width  = !double.IsNaN(base.Width) ? base.Width : base.ActualWidth;
             this.initialWindowSize.Height = !double.IsNaN(base.Height) ? base.Height : base.ActualHeight;
             this.initialBarLocation.X     = Canvas.GetLeft(this);
             this.initialBarLocation.Y     = Canvas.GetTop(this);
             if (this.Maximized != null)
             {
                 this.Maximized(this, EventArgs.Empty);
             }
         }
         else
         {
             Storyboard PrepareWindow = CommonAnimation.PrepareWindow
                                            (this, TimeOffset, new Point(0, 0), initialBarLocation, new Size(this.Width, this.Height), initialWindowSize, 0, 1, false);
             PrepareWindow.Begin();
             if (this.Normalized != null)
             {
                 this.Normalized(this, EventArgs.Empty);
             }
             DraggingEnabled = true;
         }
         this.isMaximized = !this.isMaximized;
     }
 }
Esempio n. 3
0
    // 角度布局
    void AngleLayout(int angleCardNumber)
    {
        Vector3 anglePos = Vector3.zero;

        for (int i = 0; i < angleCardNumber; i++)
        {
            Transform chiledTrans = curParentTrans.GetChild(i);
            chiledTrans.localPosition = Vector3.zero;
            int index = Index(i + 1, angleCardNumber);
            chiledTrans.localPosition += Vector3.left * 200 + Vector3.up * i * 7;
            CommonAnimation chiledAni = chiledTrans.gameObject.AddComponent <CommonAnimation>();
            chiledAni.angleList.Add(chiledTrans.localEulerAngles);
            chiledAni.angleList.Add(Vector3.forward * 20 * index);
            chiledAni.angleDelayTime = 0.2f;
            chiledAni.time           = 0.1f;
            chiledAni.Play();
            anglePos = chiledTrans.localPosition;
        }



        int posIndex = 1;

        for (int i = angleCardNumber; i < curParentTrans.childCount; i++)
        {
            Transform chiledTrans = curParentTrans.GetChild(i);
            chiledTrans.localPosition = new Vector3(anglePos.x, 0, 0) + Vector3.right * 200 + (Vector3.right * posIndex++ *(chiledTrans as RectTransform).sizeDelta.x / 2.5f);
        }
    }
    /// <summary>
    /// 设置倍数显示
    /// </summary>
    /// <param name="ratio"></param>
    IEnumerator SetRatioLb(int ratio)
    {
        ratioLb.gameObject.SetActive(true);
        ratioLb.text = "x" + ratio;
        yield return(new WaitForSecondsRealtime(1.5f));

        CommonAnimation commonAni = ratioLb.GetComponent <CommonAnimation>();

        commonAni.Play();
        commonAni.pointEndAction = () => ratioLb.gameObject.SetActive(false);
    }
Esempio n. 5
0
        public static void MaxWindow(object sender)
        {
            Window     element       = (Window)sender;
            Point      from          = new Point(Canvas.GetLeft(element), Canvas.GetTop(element));
            Size       fromSize      = new Size(element.Width, element.Height);
            Size       toSize        = new Size(desktop.ActualWidth, desktop.ActualHeight);
            Storyboard PrepareWindow = CommonAnimation.PrepareWindow
                                           (element, element.TimeOffset, from, new Point(0, 0), fromSize, toSize, 0, 1, false);

            PrepareWindow.Begin();
        }
Esempio n. 6
0
    public void Move(Vector3 targetPoint)
    {
        CommonAnimation ca = GetComponent <CommonAnimation>();

        ca.pointList.Clear();
        ca.pointList.Add(transform.localPosition);
        if (transform.localPosition.x - targetPoint.x > MaJangScene.mjSize.x * 2)
        {
            ca.pointList.Add(transform.localPosition + Vector3.up * MaJangScene.mjSize.y);
            ca.pointList.Add(targetPoint + Vector3.up * MaJangScene.mjSize.y);
        }
        ca.pointList.Add(targetPoint);
        ca.space = Space.Self;
        ca.time  = 0.25f;
        ca.Play();
    }
Esempio n. 7
0
        private static void taskBarItem_Clicked(object sender, EventArgs e)
        {
            TaskBarItem taskBarItem = (TaskBarItem)sender;

            Window window = (Window)desktop.Children.Where <UIElement>(delegate(UIElement i)
            {
                return((i is Window) && (((Window)i).Name == taskBarItem.Name.Substring(2)));
            }).FirstOrDefault <UIElement>();

            if (window != null)
            {
                if (window.Visibility == Visibility.Collapsed)
                {
                    if (!window.IsHideWindow)
                    {
                        window.Visibility = Visibility.Visible;
                        GeneralTransform gentransform = taskBarItem.TransformToVisual(desktop);
                        Point            point        = gentransform.Transform(new Point(0, 0));
                        Point            to           = new Point(Canvas.GetLeft(window), Canvas.GetTop(window));

                        Storyboard PrepareWindow = CommonAnimation.PrepareWindow
                                                       (window, window.TimeOffset, point, window.TaskBarPoint, new Size(2, 2), window.HideWindowSize, 0, 1, true);
                        PrepareWindow.Begin();
                        PrepareWindow.Completed += (ob, arg) => { window.IsHideWindow = true; };
                    }
                }
                else
                {
                    if (window.IsHideWindow)
                    {
                        GeneralTransform gentransform = taskBarItem.TransformToVisual(desktop);
                        Point            point        = gentransform.Transform(new Point(0, 0));
                        window.TaskBarPoint   = new Point(Canvas.GetLeft(window), Canvas.GetTop(window));
                        window.HideWindowSize = new Size(window.Width, window.Height);


                        Storyboard PrepareWindow = CommonAnimation.PrepareWindow
                                                       (window, window.TimeOffset, window.TaskBarPoint, point, window.HideWindowSize, new Size(2, 2), 1, 0, true);
                        PrepareWindow.Begin();
                        PrepareWindow.Completed += (o, arg) =>
                        { window.Visibility = Visibility.Collapsed; window.IsHideWindow = false; };
                        ArrangeActiveWindow();
                    }
                }
                window.Focus();
            }
        }
Esempio n. 8
0
    public void Move(bool toLeft)
    {
        CommonAnimation ca = GetComponent <CommonAnimation>();

        ca.pointList.Clear();
        ca.pointList.Add(transform.localPosition);
        if (toLeft)
        {
            ca.pointList.Add(transform.localPosition + MaJangScene.mjSize.x * Vector3.left);
        }
        else
        {
            ca.pointList.Add(transform.localPosition + MaJangScene.mjSize.x * Vector3.right);
        }
        ca.space = Space.Self;
        ca.time  = 0.25f;
        ca.Play();
    }
Esempio n. 9
0
    /// <summary>
    /// 设置滚动
    /// </summary>
    void SetMovePos()
    {
        CommonAnimation anim = curText.gameObject.GetComponent <CommonAnimation>();

        anim.pointList.Clear();
        anim.pointDelayTime = 1f;
        anim.pointList.Add(new Vector2(851, 0));
        anim.pointList.Add(new Vector2(851 - curText.preferredWidth - (content.transform as RectTransform).sizeDelta.x - 30 - 200, 0));
        anim.time = curText.preferredWidth / (curText.preferredWidth) * 5;
        SetVisibel(true);
        curText.gameObject.SetActive(true);
        anim.Play();
        float a = curText.preferredWidth;

        anim.pointEndAction = () =>
        {
            OnMoveEnd();
        };
    }
Esempio n. 10
0
        /// <summary>
        /// 激活窗口
        /// </summary>
        /// <param name="WindowName"></param>
        public static void ActiveWindow(string WindowName)
        {
            ///根据窗口名称获取窗口在任务栏按钮的对象以及窗口对象
            TaskBarItem taskBarItem = (TaskBarItem)taskBar.Children.Where <UIElement>(delegate(UIElement i)
            {
                return((i is TaskBarItem) && (((TaskBarItem)i).Name == "tb" + WindowName));
            }).FirstOrDefault <UIElement>();
            Window window = (Window)desktop.Children.Where <UIElement>(delegate(UIElement i)
            {
                return((i is Window) && (((Window)i).Name == WindowName));
            }).FirstOrDefault <UIElement>();

            ///判断窗口是否为NULL
            if (window != null)
            {
                //如果窗口视图为不显示则将其从任务栏位置显示出来
                if (window.Visibility == Visibility.Collapsed)
                {
                    if (!window.IsHideWindow)
                    {
                        ///设置窗口显示,并使用动画将其呈现
                        window.Visibility = Visibility.Visible;
                        GeneralTransform gentransform = taskBarItem.TransformToVisual(desktop);
                        Point            point        = gentransform.Transform(new Point(0, 0));
                        Point            to           = new Point(Canvas.GetLeft(window), Canvas.GetTop(window));

                        Storyboard PrepareWindow = CommonAnimation.PrepareWindow
                                                       (window, window.TimeOffset, point, window.TaskBarPoint, new Size(2, 2), window.HideWindowSize, 0, 1, true);
                        PrepareWindow.Begin();
                        PrepareWindow.Completed += (ob, arg) => { window.IsHideWindow = true; };
                    }
                }
                else
                {
                    Canvas.SetZIndex(window, Window.currentZIndex++);
                }
                window.Focus();
            }
        }
Esempio n. 11
0
        private static void window_Minimized(object sender, EventArgs e)
        {
            Window      window = (Window)sender;
            TaskBarItem item   = (TaskBarItem)taskBar.Children.Where <UIElement>(delegate(UIElement i)
            {
                return((i is TaskBarItem) && (((TaskBarItem)i).Name == "tb" + window.Name));
            }).FirstOrDefault <UIElement>();

            if (window.IsHideWindow)
            {
                GeneralTransform gentransform = item.TransformToVisual(desktop);
                Point            point        = gentransform.Transform(new Point(0, 0));
                window.TaskBarPoint   = new Point(Canvas.GetLeft(window), Canvas.GetTop(window));
                window.HideWindowSize = new Size(window.Width, window.Height);

                Storyboard PrepareWindow = CommonAnimation.PrepareWindow
                                               (window, window.TimeOffset, window.TaskBarPoint, point, window.HideWindowSize, new Size(2, 2), 1, 0, true);
                PrepareWindow.Begin();
                PrepareWindow.Completed += (o, arg) =>
                { window.Visibility = Visibility.Collapsed; window.IsHideWindow = false; };
                ArrangeActiveWindow();
            }
        }
Esempio n. 12
0
    public override void OnInspectorGUI()
    {
        obj = new SerializedObject(target);
        Transform curCaTf = ((CommonAnimation)obj.targetObject).transform;

        GetProperty();
        CommonAnimation ca = target as CommonAnimation;

        GUILayout.BeginHorizontal();
        {
            ca.isLoop      = GUILayout.Toggle(ca.isLoop, "isLoop");
            ca.isPingPong  = GUILayout.Toggle(ca.isPingPong, "isPingPong");
            ca.isFoward    = GUILayout.Toggle(ca.isFoward, "isFoward");
            ca.isAutoPlay  = GUILayout.Toggle(ca.isAutoPlay, "isAutoPlay");
            ca.isBackInit  = GUILayout.Toggle(ca.isBackInit, "isBackInit");
            ca.isDisappear = GUILayout.Toggle(ca.isDisappear, "isDisappear");
        }
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        {
            ca.point      = GUILayout.Toggle(ca.point, "point");
            ca.angle      = GUILayout.Toggle(ca.angle, "angle");
            ca.scale      = GUILayout.Toggle(ca.scale, "scale");
            ca.color      = GUILayout.Toggle(ca.color, "color");
            ca.alpha      = GUILayout.Toggle(ca.alpha, "alpha");
            ca.size       = GUILayout.Toggle(ca.size, "size");
            ca.fillAmount = GUILayout.Toggle(ca.fillAmount, "fillAmount");
        }
        GUILayout.EndHorizontal();

        if (ca.isDisappear)
        {
            EditorGUILayout.PropertyField(disType);
        }

        if (ca.isPingPong)
        {
            ca.isLoop = true;
        }

        if (ca.isLoop)
        {
            ca.isBackInit = false;
        }

        if (ca.isDisappear)
        {
            ca.isPingPong = false;
            ca.isLoop     = false;
        }

        if (ca.point)
        {
            EditorGUILayout.PropertyField(pointTime);
            GUILayout.BeginHorizontal();
            {
                EditorGUILayout.PropertyField(pointList, true);
                if (GUILayout.Button("添加当前坐标"))
                {
                    pointList.arraySize++;
                    if (space.enumValueIndex == 0)//世界坐标
                    {
                        pointList.GetArrayElementAtIndex(pointList.arraySize - 1).vector3Value = curCaTf.position;
                    }
                    else
                    {
                        pointList.GetArrayElementAtIndex(pointList.arraySize - 1).vector3Value = curCaTf.localPosition;
                    }
                }
            }
            GUILayout.EndHorizontal();
            EditorGUILayout.PropertyField(pointDelayTime);
            EditorGUILayout.PropertyField(space);
        }

        if (ca.angle)
        {
            EditorGUILayout.PropertyField(angleTime);
            GUILayout.BeginHorizontal();
            {
                EditorGUILayout.PropertyField(angleList, true);
                if (GUILayout.Button("添加当前角度"))
                {
                    angleList.arraySize++;
                    angleList.GetArrayElementAtIndex(angleList.arraySize - 1).vector3Value = curCaTf.localEulerAngles;
                }
            }
            GUILayout.EndHorizontal();
            EditorGUILayout.PropertyField(angleDelayTime);
        }

        if (ca.scale)
        {
            EditorGUILayout.PropertyField(scaleTime);
            GUILayout.BeginHorizontal();
            {
                EditorGUILayout.PropertyField(scaleList, true);
                if (GUILayout.Button("添加当前比例系数"))
                {
                    scaleList.arraySize++;
                    scaleList.GetArrayElementAtIndex(scaleList.arraySize - 1).vector3Value = curCaTf.localScale;
                }
            }
            GUILayout.EndHorizontal();
            EditorGUILayout.PropertyField(scaleDelayTime);
        }

        if (ca.color)
        {
            EditorGUILayout.PropertyField(colorTime);
            GUILayout.BeginHorizontal();
            {
                EditorGUILayout.PropertyField(colorList, true);
                if (GUILayout.Button("添加当前元素的颜色"))
                {
                    if (curCaTf.GetComponent <Graphic>())
                    {
                        colorList.arraySize++;
                        colorList.GetArrayElementAtIndex(colorList.arraySize - 1).colorValue = curCaTf.GetComponent <Graphic>().color;
                    }
                    else
                    {
                        Debug.Log("没有可以获取到颜色信息的组件");
                    }
                }
            }
            GUILayout.EndHorizontal();
            EditorGUILayout.PropertyField(colorDelayTime);
        }

        if (ca.alpha)
        {
            EditorGUILayout.PropertyField(alphaTime);
            GUILayout.BeginHorizontal();
            {
                EditorGUILayout.PropertyField(alphaList, true);
                if (GUILayout.Button("添加当前的透明度"))
                {
                    if (curCaTf.GetComponent <CanvasGroup>())
                    {
                        alphaList.arraySize++;
                        alphaList.GetArrayElementAtIndex(alphaList.arraySize - 1).floatValue = curCaTf.GetComponent <CanvasGroup>().alpha;
                    }
                    else
                    {
                        Debug.Log("没有可以获取到透明度信息的组件,需要添加CanvasGroup组件");
                    }
                }
            }
            GUILayout.EndHorizontal();
            EditorGUILayout.PropertyField(alphaDelayTime);
        }

        if (ca.size)
        {
            EditorGUILayout.PropertyField(sizeTime);
            GUILayout.BeginHorizontal();
            {
                EditorGUILayout.PropertyField(sizeList, true);
                if (GUILayout.Button("添加当前尺寸"))
                {
                    sizeList.arraySize++;
                    sizeList.GetArrayElementAtIndex(sizeList.arraySize - 1).vector2Value = curCaTf.GetComponent <RectTransform>().rect.size;
                }
            }
            GUILayout.EndHorizontal();
            EditorGUILayout.PropertyField(sizeDelayTime);
        }

        if (ca.fillAmount)
        {
            EditorGUILayout.PropertyField(fillAmountTime);
            GUILayout.BeginHorizontal();
            {
                EditorGUILayout.PropertyField(fillAmountList, true);
                if (GUILayout.Button("添加当前的fillAmount值"))
                {
                    if (curCaTf.GetComponent <Image>())
                    {
                        fillAmountList.arraySize++;
                        fillAmountList.GetArrayElementAtIndex(fillAmountList.arraySize - 1).floatValue = curCaTf.GetComponent <Image>().fillAmount;
                    }
                    else
                    {
                        Debug.Log("没有可以获取到fillAmount值的组件,需要添加Image组件");
                    }
                }
            }
            GUILayout.EndHorizontal();
            EditorGUILayout.PropertyField(fillAmountDelayTime);
        }
        obj.ApplyModifiedProperties();
    }