Exemple #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button btn = sender as Button;

            if (btn.Content.ToString() == "确定")
            {
                AnimationModel childModel = new AnimationModel();
                childModel.AnimationType = curSelectAnimType;
                TreeViewItem it = this.Tag as TreeViewItem;
                ObservableCollection <AnimationModel> animList = it.ItemsSource as ObservableCollection <AnimationModel>;
                foreach (AnimationModel model in animList)
                {
                    if (model.AnimationType == curSelectAnimType)
                    {
                        MessageBox.Show(string.Format("已经包含{0}的动画", curSelectAnimType), "错误");
                        return;
                    }
                }
                animList.Add(childModel);
                it.IsExpanded = animList.Count > 0;
            }
            else
            {
                this.Close();
            }
        }
 private void ShowControlByStatus(int status)
 {
     if (status == -1000)
     {
         this.ShowCheckControl();
         return;
     }
     if (status == -2000)
     {
         this.ShowRebootControl();
         return;
     }
     if (status == -1001)
     {
         this.ShowRouterControl();
         return;
     }
     if (status == -1002)
     {
         this.ShowRaspberryControl();
         return;
     }
     if (status == -3000)
     {
         this.ShowCableControl();
         return;
     }
     if (status == 0)
     {
         base.Close();
         base.Dispose();
         AnimationModel.ConnectAnimateionResume();
         LoopCheckModel.StartBackgroundCheckControlThread();
     }
 }
Exemple #3
0
    void StartAnimation(AnimationModel aModel, string aAnimationType = "")
    {
        foreach (Transform transform in mStartPosition)
        {
            GameObject obj = Instantiate(aModel.Model, transform);

            switch (aAnimationType)
            {
            case "":
                obj.transform.DOMove(aModel.FinalPosition.position, aModel.AnimationTime).SetEase(Ease.Linear).OnComplete(() => {
                    //executes whenever coin reach target position
                    Destroy(obj);
                });
                break;

            case "potions":
                obj.transform.DOMove(aModel.FinalPosition.position, aModel.AnimationTime).SetEase(Ease.Linear).OnComplete(() => {
                    //executes whenever coin reach target position
                    Destroy(obj);
                });
                break;

            case "aor":

                break;
            }
        }
    }
Exemple #4
0
    IEnumerator AnimateRoutine()
    {
        int i = 0;

        while (true)
        {
            yield return(null);

            AnimationModel animationModel = AnimationList[i];

            if (animationModel.Animation == null || animationModel.Animation == "")
            {
                _SkeletonGraphic.AnimationState.ClearTracks();
            }
            else
            {
                _SkeletonGraphic.AnimationState.SetAnimation(0, animationModel.Animation, animationModel.Loop);
            }

            yield return(IndieTime.Instance.WaitForSeconds(animationModel.Time));

            i++;
            if (i >= AnimationList.Count)
            {
                i = 0;
            }
        }
        yield return(null);
    }
Exemple #5
0
        public void LoadContent(string spriteSheetName, string animationName, Vector2 position,
                                float scale = 1f, bool isLooping = true, Color?color = null)
        {
            this.scale     = scale;
            this.isLooping = isLooping;
            this.color     = color ?? Color.White;
            this.scale     = scale;
            elapsedTime    = 0;
            isActive       = true;

            AnimationModel model = Loader.LoadDeserializedJsonFile <AnimationModel>(spriteSheetName);

            frames        = model.Frames;
            frameTags     = model.Meta.FrameTags;
            AnimationName = animationName;
            spriteStrip   = Loader.LoadTexture(spriteSheetName);
            this.position = position;
            SetSequence();
            // Grab the correct frame in the image strip by multiplying the currentFrame index by the Frame width
            sourceRectangle = new Rectangle(frames[sequence[currentFrame]].Frame.X,
                                            frames[sequence[currentFrame]].Frame.Y,
                                            frames[sequence[currentFrame]].Frame.Width,
                                            frames[sequence[currentFrame]].Frame.Height);
            //int height = (int)((frames[collisionFrame].Frame.Height * scale));
            //int width = (int)((frames[collisionFrame].Frame.Width * scale));
            //collisionRectangle = new Rectangle((int)position.X,
            //                                (int)position.Y + (height / 2),
            //                                width,
            //                                height / 2);
            //destinationRectangle = new Rectangle((int)position.X,
            //                                (int)position.Y,
            //                                width,
            //                                height);
        }
Exemple #6
0
        private static AnimationManager LoadAnimation(string texture)
        {
            var       model = new AnimationModel("key1", "Textures/Gameplay/Map/" + texture, 16, 4, 4, 100, true);
            Animation anim  = new Animation(model);

            return(new AnimationManager(new Animation[] { anim }));
        }
    private void SpawnAnimation(AnimationModel animation)
    {
        container_width  = effectRoot.rect.width;
        container_height = effectRoot.rect.height;

        for (int i = 0; i < animation.elements.Count; i++)
        {
            var effect = animation.elements[i];

            RawImage image = GameObject.Instantiate(ImagePrefab);
            var      tex   = new Texture2D(0, 0);
            tex.LoadImage(File.ReadAllBytes(Path.Combine(_configBasePath, "anim/" + effect.elementName)));
            image.texture = tex;
            image.transform.SetParent(effectRoot);
            image.SetNativeSize();
            image.gameObject.SetActive(true);

            var hwRatio = image.rectTransform.sizeDelta.y / image.rectTransform.sizeDelta.x;

            image.rectTransform.sizeDelta = new Vector2(effect.size[0] * container_width, effect.size[1] * container_width * hwRatio);
            var v = new Vector2(effect.position[0] * container_width,
                                effect.position[1] * container_height) - coordnateOffeset;
            image.rectTransform.anchoredPosition = new Vector2(v.x, -v.y);

            effect.ImageGameObject = image;
        }

        animation.IsInit = true;
    }
    public static ActorModel Load(FigureDefinition definition, string initialAnimationName)
    {
        AnimationModel animationModel = AnimationModel.Load(definition, initialAnimationName);
        BehaviorModel  behaviorModel  = new BehaviorModel();

        return(new ActorModel(definition, animationModel, behaviorModel));
    }
Exemple #9
0
 private void OnCloseButtonClick()
 {
     if (ControlCheckWindow.isAllPass)
     {
         AnimationModel.ConnectAnimateionResume();
         LoopCheckModel.StartBackgroundCheckControlThread();
     }
 }
Exemple #10
0
    void OnGUI()
    {
        _animationScroll = EditorGUILayout.BeginScrollView(_animationScroll, GUILayout.Height(100));
        for (int i = 0; i < 2000; i++)
        {
            GUILayout.Space(5);
            AnimationModel am = _animations[0];
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(am.animationName);
            if (GUILayout.Button("编辑", GUILayout.Width(150)))
            {
                Debug.Log("开始编辑:" + am.animationName);

                if (_currentEditAnimation != null)
                {
                    Save();
                }
                _currentEditAnimation = am;
            }
            EditorGUILayout.EndHorizontal();
            GUILayout.Space(5);
        }
        EditorGUILayout.EndScrollView();


        // 动画详情
        GUILayout.Space(15);

        if (_currentEditAnimation != null)
        {
            _currentEditAnimation.animationName = LayoutStringProperty("动画名称", _currentEditAnimation.animationName);
            _currentEditAnimation.duration      = LayoutFloatProperty("持续时间", _currentEditAnimation.duration);
            GUILayout.Space(5);
            GUILayout.Label("子动画");
            _effectScroll = EditorGUILayout.BeginScrollView(_effectScroll);
            for (int i = 0; i < _currentEditAnimation.elements.Count; i++)
            {
                var effect = _currentEditAnimation.elements[i];
                LayoutEffectModel(effect);

                GUILayout.Space(15);
            }
            EditorGUILayout.EndScrollView();
        }

        GUILayout.Space(15);

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("run"))
        {
            RunAnimation();
        }

        if (GUILayout.Button("save"))
        {
            Save();
        }
    }
Exemple #11
0
 private void OnOkClick()
 {
     base.Close();
     base.Dispose();
     if (ControlCheckWindow.isAllPass)
     {
         AnimationModel.ConnectAnimateionResume();
         LoopCheckModel.StartBackgroundCheckControlThread();
     }
 }
Exemple #12
0
        public AnimationManager(AnimationModel animationModel)
        {
            Animation animation = new Animation(animationModel);

            listAnimations = new Dictionary <string, Animation>
            {
                { animation.Key, animation }
            };

            currentAnimation = animation.Key;
        }
    void StartEditAnimation(AnimationModel animation)
    {
        Debug.Log("开始编辑:" + animation.animationName);

        if (_currentAnimation != null)
        {
            Save();
            DisposeAnimationData();
        }
        _currentAnimation = animation;
    }
Exemple #14
0
    public ActorModel(FigureDefinition mainDefinition, AnimationModel animation, BehaviorModel behavior)
    {
        this.mainDefinition = mainDefinition;

        this.animation = animation;
        this.behavior  = behavior;

        inputs = mainDefinition.ChannelSystem.MakeZeroChannelInputs();

        //hack to turn on eCTRLConfident at start
        mainDefinition.ChannelSystem.ChannelsByName["eCTRLConfident?value"].SetValue(inputs, 1);
    }
Exemple #15
0
        public JsonResult List()
        {
            var mongo = new MongoHelper();

            // 获取所有类别
            var filter = Builders <BsonDocument> .Filter.Eq("Type", "Animation");

            var categories = mongo.FindMany(Constant.CategoryCollectionName, filter).ToList();

            var meshes = mongo.FindAll(Constant.AnimationCollectionName).ToList();

            var list = new List <AnimationModel>();

            foreach (var i in meshes)
            {
                var categoryID   = "";
                var categoryName = "";

                if (i.Contains("Category") && !i["Category"].IsBsonNull && !string.IsNullOrEmpty(i["Category"].ToString()))
                {
                    var doc = categories.Where(n => n["_id"].ToString() == i["Category"].ToString()).FirstOrDefault();
                    if (doc != null)
                    {
                        categoryID   = doc["_id"].ToString();
                        categoryName = doc["Name"].ToString();
                    }
                }

                var info = new AnimationModel
                {
                    ID           = i["_id"].ToString(),
                    Name         = i["Name"].ToString(),
                    CategoryID   = categoryID,
                    CategoryName = categoryName,
                    TotalPinYin  = i["TotalPinYin"].ToString(),
                    FirstPinYin  = i["FirstPinYin"].ToString(),
                    Type         = i["Type"].ToString(),
                    Url          = i["Url"].ToString(),
                    Thumbnail    = i.Contains("Thumbnail") && !i["Thumbnail"].IsBsonNull ? i["Thumbnail"].ToString() : null
                };

                list.Add(info);
            }

            list.Reverse();

            return(Json(new
            {
                Code = 200,
                Msg = "Get Successfully!",
                Data = list
            }));
        }
Exemple #16
0
        public MainPage()
        {
            this.InitializeComponent();

            canvas.RenderTransform = new TranslateTransform();
            inkCanvas.InkPresenter.InputDeviceTypes =
                Windows.UI.Core.CoreInputDeviceTypes.Mouse |
                // Uncomment the line below if you want to draw with touch
                // When commented out, long touch to create comment
                // Windows.UI.Core.CoreInputDeviceTypes.Touch |
                Windows.UI.Core.CoreInputDeviceTypes.Pen;

            goalsInkCanvas.InkPresenter.InputDeviceTypes =
                Windows.UI.Core.CoreInputDeviceTypes.Mouse |
                // Uncomment the line below if you want to draw with touch
                // When commented out, long touch to create comment
                // Windows.UI.Core.CoreInputDeviceTypes.Touch |
                Windows.UI.Core.CoreInputDeviceTypes.Pen;

            comments   = new CommentModel();
            animations = new AnimationModel();

            inkCanvas.InkPresenter.StrokesErased += RemovedStrokes;

            //tool bar set up
            inkToolbar.Loading           += InitializeInkToolbar;
            inkToolbar.ActiveToolChanged += InkToolbar_ActiveToolChanged;

            //binding animations to front end view
            AnimationRepresentation.ItemsSource = animations.GetAnimations();

            //animation mode set up
            togglePath.Checked   += TogglePathChecked;
            togglePath.Unchecked += TogglePathUnchecked;
            Application.Current.Resources["AppBarToggleButtonBackgroundChecked"]            = (SolidColorBrush)this.Resources["animationBlockColor"];
            Application.Current.Resources["AppBarToggleButtonBackgroundCheckedPointerOver"] = (SolidColorBrush)this.Resources["animationBlockColor"];
            Application.Current.Resources["AppBarToggleButtonBackgroundCheckedPressed"]     = (SolidColorBrush)this.Resources["animationBlockColor"];

            // animation pen set up
            animationPen         = new InkToolbarCustomToolButton();
            animationPen.Content = new FontIcon
            {
                FontFamily = new FontFamily("Segoe MDL2 Assets"),
                Glyph      = "\uE735",
            };

            //comments set up
            SetUpStickyNotes();
            stickyColor = Colors.Goldenrod;
            toolButtonCommentGlyph.Foreground = new SolidColorBrush(stickyColor);
        }
    void Start()
    {
        for (int i = 0; i < 200; i++)
        {
            AnimationModel am = _animations[0];

            Button button = Instantiate(Resources.Load <GameObject>("Prefabs/Button")).GetComponent <Button>();
            button.transform.SetParent(ScrollView.content);
            button.GetComponentInChildren <Text>().text = am.animationName;
            button.onClick.AddListener(delegate { StartEditAnimation(am); });
        }

        RunAnimationBtn.onClick.AddListener(RunAnimation);
    }
Exemple #18
0
        public void LoadContent(Texture2D spriteSheet, string animationName, AnimationModel model, Vector2 position,
                                float scale = 1f, bool isLooping = true, Color?color = null)
        {
            this.scale     = scale;
            this.isLooping = isLooping;
            this.color     = color ?? Color.White;
            this.scale     = scale;
            elapsedTime    = 0;
            isActive       = true;

            frames        = model.Frames;
            frameTags     = model.Meta.FrameTags;
            AnimationName = animationName;
            spriteStrip   = spriteSheet;
            this.position = position;
            SetSequence();
            // Grab the correct frame in the image strip by multiplying the currentFrame index by the Frame width
            sourceRectangle = new Rectangle(frames[sequence[currentFrame]].Frame.X,
                                            frames[sequence[currentFrame]].Frame.Y,
                                            frames[sequence[currentFrame]].Frame.Width,
                                            frames[sequence[currentFrame]].Frame.Height);
        }
 public AnimationMenuItem(AnimationModel model, Animation animation)
 {
     this.model     = model;
     this.animation = animation;
 }
 public AnimationMenuLevel(AnimationModel model)
 {
     this.model = model;
 }
 public MainPageViewModel(INavigationService navigationService, OxyPlotModel oxyPlotModel, AnimationModel animationModel)
 {
     this.BarChart = oxyPlotModel.Model;
     this.UpdateContentsCommand = new Command <double>(newValue => {
         oxyPlotModel.Update(newValue);
         animationModel.Update(newValue);
     });
 }
Exemple #22
0
        public IActionResult Animation(string id)
        {
            AnimationModel model = new AnimationModel(id);

            return(View(model));
        }
        public JsonResult List()
        {
            var mongo = new MongoHelper();

            // 获取所有类别
            var filter = Builders <BsonDocument> .Filter.Eq("Type", "Animation");

            var categories = mongo.FindMany(Constant.CategoryCollectionName, filter).ToList();

            var docs = new List <BsonDocument>();

            if (ConfigHelper.EnableAuthority)
            {
                var user = UserHelper.GetCurrentUser();

                if (user != null)
                {
                    var filter1 = Builders <BsonDocument> .Filter.Eq("UserID", user.ID);

                    if (user.Name == "Administrator")
                    {
                        var filter2 = Builders <BsonDocument> .Filter.Exists("UserID");

                        var filter3 = Builders <BsonDocument> .Filter.Not(filter2);

                        filter1 = Builders <BsonDocument> .Filter.Or(filter1, filter3);
                    }
                    docs = mongo.FindMany(Constant.AnimationCollectionName, filter1).ToList();
                }
            }
            else
            {
                docs = mongo.FindAll(Constant.AnimationCollectionName).ToList();
            }

            var list = new List <AnimationModel>();

            foreach (var i in docs)
            {
                var categoryID   = "";
                var categoryName = "";

                if (i.Contains("Category") && !i["Category"].IsBsonNull && !string.IsNullOrEmpty(i["Category"].ToString()))
                {
                    var doc = categories.Where(n => n["_id"].ToString() == i["Category"].ToString()).FirstOrDefault();
                    if (doc != null)
                    {
                        categoryID   = doc["_id"].ToString();
                        categoryName = doc["Name"].ToString();
                    }
                }

                var info = new AnimationModel
                {
                    ID           = i["_id"].ToString(),
                    Name         = i["Name"].ToString(),
                    CategoryID   = categoryID,
                    CategoryName = categoryName,
                    TotalPinYin  = i["TotalPinYin"].ToString(),
                    FirstPinYin  = i["FirstPinYin"].ToString(),
                    Type         = i["Type"].ToString(),
                    Url          = i["Url"].ToString(),
                    Thumbnail    = i.Contains("Thumbnail") && !i["Thumbnail"].IsBsonNull ? i["Thumbnail"].ToString() : null
                };

                list.Add(info);
            }

            list.Reverse();

            return(Json(new
            {
                Code = 200,
                Msg = "Get Successfully!",
                Data = list
            }));
        }
Exemple #24
0
 public AnimationEffect(AnimationModel model, bool await = false) : base(model.delay, await, model.repeat)
 {
     Animation = new Animation(model);
     Enabled   = true;
 }