コード例 #1
0
        /// <summary>
        /// 当[是否显示同步图标动画]改变时
        /// </summary>
        /// <param name="_oldValue">旧的值</param>
        /// <param name="_newValue">新的值</param>
        public void SyncIconAnimationStateTypeChange(AnimationStateType _oldValue, AnimationStateType _newValue)
        {
            //如果当前不是协同合作模式
            if (UiControl.Visibility == Visibility.Collapsed)
            {
                AppManager.Systems.CollaborationSystem.SyncStateType = SyncStateType.NoSync;
            }

            //如果当前是协同合作模式
            else
            {
                //比较值
                switch (_newValue)
                {
                //如果是[动画开始了]
                case AnimationStateType.Start:
                    break;

                //如果是[动画结束了]
                case AnimationStateType.End:
                    //修改同步状态
                    AppManager.Systems.CollaborationSystem.SyncStateType = SyncStateType.Synced;
                    break;
                }
            }
        }
コード例 #2
0
        private IEnumerator IPlayAllStates()
        {
            state = AnimationStateType.Running;

            bool oneLoop = true;

            while (oneLoop)
            {
                for (int i = 0; i < states.Length; i++)
                {
                    if (states[i].IsProcessable())
                    {
                        OnPlay(states[i]);
                        yield return(animationRoutine = StartCoroutine(states[i].Process(this, Action)));
                    }
                }

                if (loop == false)
                {
                    oneLoop = false;
                }
            }

            state = AnimationStateType.Idle;
        }
コード例 #3
0
        /// <summary>
        /// 这个方法,用于触发 WaitSyncAnimationStateTypeChange 路由事件
        /// </summary>
        private void OnWaitSyncAnimationStateTypeChange(AnimationStateType _oldValue, AnimationStateType _newValue)
        {
            //创建路由事件参数
            RoutedPropertyChangedEventArgs <AnimationStateType> args = new RoutedPropertyChangedEventArgs <AnimationStateType>(_oldValue, _newValue);

            //设置这是哪个路由事件?
            args.RoutedEvent = SyncUiControl.WaitSyncAnimationStateTypeChangeEvent;

            //引发这个路由事件
            RaiseEvent(args);
        }
コード例 #4
0
        private IEnumerator IPlayState(int nr)
        {
            state = AnimationStateType.Running;

            if (states[nr].IsProcessable())
            {
                OnPlay(states[nr]);
                yield return(animationRoutine = StartCoroutine(states[nr].Process(this, Action)));
            }

            state = AnimationStateType.Idle;
        }
コード例 #5
0
        public void Stop()
        {
            if (!enabled)
            {
                return;
            }

            state = AnimationStateType.Idle;
            if (animationRoutine != null)
            {
                StopCoroutine(animationRoutine);
            }
        }
コード例 #6
0
ファイル: UI.cs プロジェクト: lin5/UIFramework
 public virtual void Destroy()
 {
     Disable();
     if (this.UIState != UIStateType.Destroy)
     {
         this.OnDestroy();
         GameObject.Destroy(this.GameObject);
         this.GameObject             = null;
         this.Transform              = null;
         this.UIState                = UIStateType.Destroy;
         this.AnimationState         = AnimationStateType.Destroy;
         AwakeState                  = false;
         this.IsPlayingAniamtionTask = null;
     }
 }
コード例 #7
0
 public void ToggleAnimation(int newID)
 {
     if (id == newID)
     {
         if (animationStateType == AnimationStateType.FIRST)
         {
             animationStateType = AnimationStateType.SECOND;
             animator.SetTrigger(secondAnimationTriggerName);
         }
         else if (animationStateType == AnimationStateType.SECOND)
         {
             animationStateType = AnimationStateType.FIRST;
             animator.SetTrigger(firstAnimationTriggerName);
         }
     }
 }
コード例 #8
0
ファイル: UI.cs プロジェクト: lin5/UIFramework
        public async Task DisableAsync()
        {
            if (this.UIState == UIStateType.Start || this.UIState == UIStateType.Enable)
            {
                BeforeDisable();
                this.AnimationState = AnimationStateType.Disable;

                //播放暂停动画
                if (this.UIContext.UIData.HasAnimation)
                {
                    IsPlayingAniamtionTask = new TaskCompletionSource <bool>();
                    this.Animator.enabled  = true;
                    this.Animator.Play("Disable");
                    this.Animator.Update(0);
                }
                await this.WaitAnimationFinished();

                Disable();
            }
        }
コード例 #9
0
ファイル: UI.cs プロジェクト: lin5/UIFramework
        public async Task DestroyAsync()
        {
            if (this.UIState != UIStateType.Destroy)
            {
                BeforeDestroy();
                this.AnimationState = AnimationStateType.Destroy;

                //播放退出动画
                if (this.UIContext.UIData.HasAnimation)
                {
                    IsPlayingAniamtionTask = new TaskCompletionSource <bool>();
                    this.Animator.enabled  = true;
                    this.Animator.Play("Disable");
                    this.Animator.Update(0);
                }

                await this.WaitAnimationFinished();

                Destroy();
            }
        }
コード例 #10
0
ファイル: UI.cs プロジェクト: lin5/UIFramework
        public virtual async Task StartAsync(params object[] args)
        {
            if (this.UIState == UIStateType.Awake)
            {
                Start(args);
                BeforeEnable();
                Enable();
                this.AnimationState = AnimationStateType.Start;

                //播放进场动画
                if (this.UIContext.UIData.HasAnimation)
                {
                    IsPlayingAniamtionTask = new TaskCompletionSource <bool>();
                    this.Animator.enabled  = true;
                    this.Animator.Play("Enable");
                    this.Animator.Update(0);
                }

                await this.WaitAnimationFinished();
            }
        }
コード例 #11
0
        /// <summary>
        /// 当[是否等待同步]改变时
        /// </summary>
        /// <param name="_oldValue">旧的值</param>
        /// <param name="_newValue">新的值</param>
        public void WaitSyncAnimationStateTypeChange(AnimationStateType _oldValue, AnimationStateType _newValue)
        {
            //如果当前不是协同合作模式
            if (UiControl.Visibility == Visibility.Collapsed)
            {
                AppManager.Systems.CollaborationSystem.SyncStateType = SyncStateType.NoSync;
            }

            //如果当前是协同合作模式
            else
            {
                //比较值
                switch (_newValue)
                {
                //如果是[等待同步]
                case AnimationStateType.Start:
                    break;

                //如果是[等待同步结束了]
                case AnimationStateType.End:
                    //进行同步
                    bool _isHaveSync = AppManager.Systems.CollaborationSystem.Sync();

                    //如果同步成功
                    if (_isHaveSync == true)
                    {
                        //修改同步状态
                        AppManager.Systems.CollaborationSystem.SyncStateType = SyncStateType.Syncing;
                    }
                    else
                    {
                        //修改同步状态
                        AppManager.Systems.CollaborationSystem.SyncStateType = SyncStateType.None;
                    }
                    break;
                }
            }
        }