Example #1
0
        /// <summary>
        /// 播放受击动作
        /// </summary>
        void UpdateAnimationStage()
        {
            if (mbFalseHitBack)
            {
                mbFalseHitBackHasAnimTime = mbFalseHitBackHasAnimTime + Time.deltaTime;
                if (mbFalseHitBackHasAnimTime >= mbFalseHitBackInterval)
                {
                    mbFalseHitBackHasAnimTime = mbFalseHitBackInterval;
                    mbFalseHitBack            = false;
                    mbFlaseHitBack_should     = false;
                }
                float   percent = mbFalseHitBackHasAnimTime / mbFalseHitBackInterval;
                Vector3 new_pos = Vector3.zero;
                if (percent <= 0.5f)
                {
                    new_pos = (mbFalseHitBackDestPos - mbFalseHitBackStartPos) * percent / 0.5f + mbFalseHitBackStartPos;
                }
                else
                {
                    new_pos = (mbFalseHitBackStartPos - mbFalseHitBackDestPos) * (percent - 0.5f) / 0.5f + mbFalseHitBackDestPos;
                }
                mOwner.SetPosition(new_pos);
            }

            // 受击动作播放完毕后再退出受击状态
            AnimationOptions op = GetAnimationOptions(Actor.EAnimation.beAtk_Backward);

            if (!mOwner.IsPlaying(op.Name))
            {
                MoveSpeed      = 0.0f;
                mkBackWardFunc = null;
                mMachine.React((uint)EFSMEvent.DE_Stop);
            }
        }
Example #2
0
        bool SpeedUpShortCut()
        {
            if (mCurStep == null || mOwner == null)
            {
                return(false);
            }

            Vector3 calcPos = CalcDstPosition();
            float   curDis  = GetDistanceOfCurToDst(calcPos);         //当前位置到推算的目标点位置的距离
            //float diff = Mathf.Abs(curDis-DBActor.SpeedUpMinDis);

            MoveStep step  = mCurStep;
            float    speed = step.speed;

            if (step.type == EActorStepType.AT_WALK_END)
            {
                AnimationOptions op = mOwner.GetWalkAniOptions();

                if (op != null)
                {
                    speed = op.Speed;
                }
            }

            bool drag = false;

            if (curDis <= DBActor.SpeedUpMinDis)
            {
                mOwner.MoveSpeed = speed;
            }
            else if (curDis > DBActor.SpeedUpMaxDis)
            {
                mOwner.MoveSpeed = speed;
                mOwner.SetPosition(step.pos);
                mOwner.TurnDir(mCurStep.dir);
                drag = true;
            }
            else
            {
                if (0 == speed)
                {
                    GameDebug.LogError("zero speed");
                    speed = 0.5f;
                }
                float costTime = DBActor.SpeedUpMinDis / speed;
                float s        = curDis / costTime;
                if (s > 0)
                {
                    mOwner.MoveSpeed = s;
                }
            }

            if (mCurStep.type == EActorStepType.AT_WALK_BEGIN)
            {
                mCurStep.pos = calcPos;
                drag         = true;
            }

            return(drag);
        }
Example #3
0
        public static async Task Size(object target, Size size, AnimationOptions options)
        {
            var obj = target as FrameworkElement;

            if (obj != null)
            {
                obj.BeginAnimation(FrameworkElement.WidthProperty, new DoubleAnimation
                {
                    To                = size.Width,
                    Duration          = options.Duration,
                    AccelerationRatio = options.AccelerationRatio,
                    DecelerationRatio = options.DecelerationRatio
                });

                obj.BeginAnimation(FrameworkElement.HeightProperty, new DoubleAnimation
                {
                    To                = size.Height,
                    Duration          = options.Duration,
                    AccelerationRatio = options.AccelerationRatio,
                    DecelerationRatio = options.DecelerationRatio
                });

                await Task.Delay(options.Duration.TimeSpan.Milliseconds);

                obj.BeginAnimation(FrameworkElement.WidthProperty, null);
                obj.BeginAnimation(FrameworkElement.HeightProperty, null);

                obj.Width  = size.Width;
                obj.Height = size.Height;
            }
        }
Example #4
0
        public void UpdateState_Walk(xc.Machine.State s)
        {
            if (mOwner == null)
            {
                return;
            }

            if (mInBattleStatus != mOwner.InBattleStatus)
            {
                mInBattleStatus = mOwner.InBattleStatus;
                AnimationOptions op = mOwner.GetWalkAniOptions();
                if (op != null)
                {
                    float scale = op.OriSpeed != 0 ? MoveSpeed / op.OriSpeed : 1.0f;
                    mOwner.SetMoveAnimationSpeed(scale);
                    CrossFadeAnimation(op);
                }
            }

            // 变身状态下,播放动画的不是当前的模型
            // 因此需要在此处检查下Animator下的状态是否正常
            var walkOpt = mOwner.GetWalkAniOptions();

            if (walkOpt != null)
            {
                if (!mOwner.IsInAnimationState(walkOpt.Name))
                {
                    CrossFadeAnimation(walkOpt);
                }
            }

            UpdateMoveToDest();
        }
Example #5
0
    /// <summary>
    /// 更新战斗属性,主要是移动速度
    /// </summary>
    public void UpdateBattleAttribute()
    {
        if (ParentActor == null)
        {
            return;
        }

        if (mActorAttr != null)
        {
            if (ParentActor.ActorAttribute != null)
            {
                mActorAttr.MoveSpeedScale = (int)(ParentActor.ActorAttribute.MoveSpeedScale);
                mActorAttr.MoveSpeedAdd   = (int)(ParentActor.ActorAttribute.MoveSpeedAdd);
                SetMoveSpeedScale(mActorAttr.MoveSpeedScale * GlobalConst.AttrConvert, mActorAttr.MoveSpeedAdd);
            }
        }

        AnimationOptions op = GetWalkAniOptions();

        if (op != null)
        {
            AnimationOptions parent_actor_walk_options = ParentActor.GetWalkAniOptions();
            if (parent_actor_walk_options != null)
            {
                op.Speed = parent_actor_walk_options.Speed;
            }

            // 护送NPC的走路动作要使用原始速度
            if (IsEscortNPC == true)
            {
                mAnimationSpeed = mOriginalWalkAniSpeed / op.Speed;
                SetAnimationSpeed(mAnimationSpeed);
            }
        }
    }
Example #6
0
        public static UIViewAnimationOptions ToAnimationOptions(this AnimationOptions options)
        {
            var result = UIViewAnimationOptions.TransitionNone;

            if (options != AnimationOptions.None)
            {
                if (options.HasFlag(AnimationOptions.Repeat))
                {
                    result = result | UIViewAnimationOptions.Repeat;
                }
                if (options.HasFlag(AnimationOptions.CurveEaseIn))
                {
                    result = result | UIViewAnimationOptions.CurveEaseIn;
                }
                if (options.HasFlag(AnimationOptions.CurveEaseInOut))
                {
                    result = result | UIViewAnimationOptions.CurveEaseInOut;
                }
                if (options.HasFlag(AnimationOptions.CurveEaseOut))
                {
                    result = result | UIViewAnimationOptions.CurveEaseOut;
                }
            }

            return(result);
        }
Example #7
0
        /// <summary>
        /// 更新死亡状态
        /// </summary>
        public void UpdateState_Death(xc.Machine.State s)
        {
            if (mMoveImpl == null)
            {
                return;
            }

            if (!mDeathInfo.IsFlying)
            {
                if (!IsGrounded())
                {
                    Vector3 move = MoveSpeed * mDir * Time.deltaTime;
                    move.y = mVerticalSpeed * Time.deltaTime;
                    mMoveImpl.Move(move, true, false);

                    mVerticalSpeed -= Time.deltaTime * m_Gravity;
                }

                // 因此在死亡前可能有恢复了变身状态,播放死亡动画的不是当前的模型
                // 因此需要在此处检查下Animator下的状态是否正常
                if (!mOwner.IsInAnimationState(DeathAnimation))
                {
                    PlayAnimation(DeathAnimation);
                }
            }
            else
            {
                // 浮空上升阶段
                if (mVerticalSpeed > 0.0f || !mMoveImpl.IsGrounded)
                {
                    Vector3 move = mDir * MoveSpeed * Time.deltaTime; // xz平面的移动
                    move.y = mVerticalSpeed * Time.deltaTime;         // y高度的移动

                    mVerticalSpeed -= Time.deltaTime * m_Gravity;

                    MoveSpeed -= Time.deltaTime * mDeathInfo.MoveXFric;
                    MoveSpeed  = Mathf.Max(MoveSpeed, 0);
                    mMoveImpl.Move(move, false, false);
                }

                // 浮空下落阶段
                if (mSwitch == false && mVerticalSpeed <= 0.0f)
                {
                    AnimationOptions op = GetAnimationOptions(Actor.EAnimation.falling);
                    PlayAnimation(op);
                    mSwitch = true;
                }

                // 落地阶段
                if (mDeathFlyDown == false && mMoveImpl.IsGrounded)
                {
                    AnimationOptions falldownOp = GetAnimationOptions(Actor.EAnimation.falldown);
                    PlayAnimation(falldownOp);
                    mDeathFlyDown = true;
                }
            }
        }
Example #8
0
        /// <summary>
        /// This method specifies the URL of the online video that should be converted into a animated GIF.
        /// </summary>
        /// <param name="url">The URL to convert into a animated GIF.</param>
        /// <param name="options">A instance of the AnimationOptions class that defines any special options to use when creating the animated GIF.</param>
        public void URLToAnimation(string url, AnimationOptions options)
        {
            lock (thisLock)
            {
                if (options == null)
                {
                    options = new AnimationOptions();
                }

                request.Store(BaseURLGet + "takeanimation.ashx", false, options, url);
            }
        }
Example #9
0
        //第二层状态: beAttacking的子状态
        public void EnterState_BeAtkBackward(xc.Machine.State s)         //beAtkBackwardState
        {
            AnimationOptions op = mOwner.GetAnimationOptions(Actor.EAnimation.beAtk_Backward);

            PlayAnimation(op);

            mVerticalSpeed = 0;

            if (mbFlaseHitBack_should)
            {
                mbFalseHitBack        = true; //是否进行假击退
                mbFlaseHitBack_should = false;
            }
        }
Example #10
0
    /// <summary>
    /// 更新战斗属性
    /// </summary>
    public virtual void UpdateBattleAttribute()
    {
        if (ParentActor == null)
        {
            return;
        }
        this.AttackSpeed = ParentActor.AttackSpeed;

        mActorAttr.MoveSpeedScale = ParentActor.ActorAttribute.MoveSpeedScale;
        mActorAttr.MoveSpeedAdd   = ParentActor.ActorAttribute.MoveSpeedAdd;

        AnimationOptions parent_actor_walk_options = ParentActor.GetWalkAniOptions();
        AnimationOptions op = GetWalkAniOptions();

        if (op != null && parent_actor_walk_options != null)
        {
            op.Speed = parent_actor_walk_options.Speed;
        }
    }
Example #11
0
        public void EnterState_Walk(xc.Machine.State s)         // Walk State
        {
            AnimationOptions op = mOwner.GetWalkAniOptions();

            if (op != null)
            {
                if (0.0f == MoveSpeed)
                {
                    MoveSpeed = op.Speed;
                }

                float scale = op.OriSpeed != 0 ? MoveSpeed / op.OriSpeed : 1.0f;
                mOwner.SetMoveAnimationSpeed(scale);
                CrossFadeAnimation(op);
            }

            CalcMovePath();
            mIsWalking      = true;
            mInBattleStatus = mOwner.InBattleStatus;
        }
Example #12
0
        public static async Task Margin(object target, Thickness to, AnimationOptions options)
        {
            var obj = target as FrameworkElement;

            if (obj != null)
            {
                obj.BeginAnimation(FrameworkElement.MarginProperty, new ThicknessAnimation
                {
                    To                = to,
                    Duration          = options.Duration,
                    AccelerationRatio = options.AccelerationRatio,
                    DecelerationRatio = options.DecelerationRatio
                });

                await Task.Delay(options.Duration.TimeSpan.Milliseconds);

                obj.BeginAnimation(FrameworkElement.MarginProperty, null);

                obj.Margin = to;
            }
        }
Example #13
0
        public static async Task Opacity(object target, double opacity, AnimationOptions options)
        {
            var obj = target as FrameworkElement;

            if (obj != null)
            {
                obj.BeginAnimation(FrameworkElement.OpacityProperty, new DoubleAnimation
                {
                    To                = opacity,
                    Duration          = options.Duration,
                    AccelerationRatio = options.AccelerationRatio,
                    DecelerationRatio = options.DecelerationRatio
                });

                await Task.Delay(options.Duration.TimeSpan.Milliseconds);

                obj.BeginAnimation(FrameworkElement.OpacityProperty, null);

                obj.Opacity = opacity;
            }
        }
Example #14
0
    public override void AfterCreate()
    {
        base.AfterCreate();

        mIsInteractNPC = mCreateInfo.ClientNpcDefine.Function == NpcDefine.EFunction.INTERACTION;

        InitNPCData(mCreateInfo.ClientNpc);

        NpcManager.Instance.AddNpc(this);

        xc.Dungeon.LevelManager.Instance.SetAreaClose(mNpcData.Mark);

        // 读取配置表的待机动作
        m_AnimationMaps[EAnimation.idle]      = new AnimationOptions();
        m_AnimationMaps[EAnimation.idle].Name = Define.IdleAni;

        AnimationOptions op = GetWalkAniOptions();

        if (op != null)
        {
            mOriginalWalkAniSpeed = op.OriSpeed;
        }

        // 这里要stop一下,不然配置的待机动作不生效
        if (IsIdle() == true)
        {
            Stop();
        }

        UpdateInteractEffect();
        UpdateBattleAttribute();

        // 护送NPC要重新激活一次头顶改名字
        if (IsEscortNPC && AutoActiveTextName)
        {
            GetBehavior <TextNameBehavior>().Active(Trans.gameObject);
        }
    }
Example #15
0
                public void UpdateExchangeModel()
                {
                    if (m_need_update_exchange_model == false)
                    {
                        return;
                    }

                    if (m_pkgBossInfo == null)
                    {
                        return;
                    }

                    if (m_pkgBossInfo.state == 1)//世界BOSS处于存活状态,删除墓碑
                    {
                        if (m_uid != null)
                        {
                            InterObjectManager.Instance.DestroyObject(m_uid);
                            m_uid = null;
                        }
                        m_need_update_exchange_model = false;
                    }
                    else//BOSS已经死亡; BOSS播放完死亡动画=>删除BOSS怪物=>创建墓碑
                    {
                        // 查询特殊怪物表
                        var data_mon_attr = DBManager.Instance.GetDB <DBSpecialMon>().GetData(m_pkgBossInfo.id);
                        if (data_mon_attr == null)
                        {
                            GameDebug.LogError("Cannot find special monster info,id:" + m_pkgBossInfo.id);
                            return;
                        }

                        var actor_id = data_mon_attr.ActorId;

                        Dictionary <UnitID, Actor> boss_actor_dict = ActorManager.Instance.GetMonsterSetByActorId(actor_id);
                        bool can_destroy_model = true;
                        foreach (var item in boss_actor_dict)
                        {
                            Actor death_boss_actor = item.Value;
                            if (death_boss_actor != null && death_boss_actor.transform != null)
                            {
                                m_model_Quaternion = death_boss_actor.transform.rotation;
                                Vector3 new_pos = death_boss_actor.transform.position;
                                if (new_pos.y < -500)
                                {
                                    GameDebug.LogError(string.Format("boss_actor pos maybe is error new_pos = {0}, {1}, {2}",
                                                                     new_pos.x, new_pos.y, new_pos.z));
                                }
                                else
                                {
                                    m_pos = death_boss_actor.transform.position;
                                }
                            }

                            if (death_boss_actor != null)
                            {
                                AnimationOptions op = death_boss_actor.GetAnimationOptions(Actor.EAnimation.death);
                                if (op != null && can_destroy_model)
                                {
                                    if (death_boss_actor.IsPlaying())
                                    {
                                        can_destroy_model = false;
                                    }
                                }
                            }
                        }

                        if (has_created_inter_object == false)
                        {
                            has_created_inter_object = true;
                            m_monster_name           = RoleHelp.GetActorName(actor_id);
                            string      prefab = string.Format("Assets/Res/{0}.prefab", RoleHelp.GetPrefabName(actor_id));
                            InterObject create_inter_object = InterObjectManager.Instance.CreateObject <InterObject>(m_uid, prefab, m_pos, m_model_Quaternion, RoleHelp.GetPrefabScale(actor_id));
                            if (create_inter_object != null)
                            {
                                create_inter_object.m_StyleInfo.Offset       = new Vector3(0, 2.8f, 0);
                                create_inter_object.m_StyleInfo.HeadOffset   = new Vector3(0, 2.0f, 0);
                                create_inter_object.m_StyleInfo.ScreenOffset = UI3DText.NameTextScreenOffset;
                                create_inter_object.m_StyleInfo.Scale        = Vector3.one;
                                create_inter_object.m_StyleInfo.IsShowBg     = false;
                                create_inter_object.m_StyleInfo.SpritName    = "";

                                create_inter_object.IsVisible = false;
                                DBWorldBoss.DBWorldBossItem boss_item = DBManager.Instance.GetDB <DBWorldBoss>().GetData(m_pkgBossInfo.id);
                                if (boss_item != null)
                                {
                                    create_inter_object.SetCollider(boss_item.DeathModelCenter, boss_item.DeathModelRadius);
                                }
                            }
                        }

                        if (can_destroy_model)
                        {
                            InterObject create_inter_object = InterObjectManager.Instance.GetObject(m_uid);
                            if (create_inter_object != null)
                            {
                                create_inter_object.IsVisible = true;
                                create_inter_object.SetPosAndQuaternion(m_pos, m_model_Quaternion);
                            }
                            m_need_update_exchange_model = false;
                        }
                    }
                }
Example #16
0
 public AnimationBuilder()
 {
     AnimationOptions = new AnimationOptions();
 }
Example #17
0
        private AnimationOptions CompileAnimationOptions(AnimationRootNode animNode)
        {
            AnimationOptions options = new AnimationOptions();

            if (animNode.optionNodes == null)
            {
                return(options);
            }

            LightList <AnimationOptionNode> optionNodes = animNode.optionNodes;

            if (optionNodes == null)
            {
                return(options);
            }

            for (int i = 0; i < optionNodes.Count; i++)
            {
                string       optionName = optionNodes[i].optionName.ToLower();
                StyleASTNode value      = optionNodes[i].value;

                switch (optionName)
                {
                case "duration":
                    options.duration = StylePropertyMappers.MapUITimeMeasurement(value, context);
                    break;

                case "iterations":
                    options.iterations = (int)StylePropertyMappers.MapNumberOrInfinite(value, context);
                    break;

                case "looptime":
                    options.loopTime = StylePropertyMappers.MapNumber(value, context);
                    break;

                case "delay":
                    options.delay = StylePropertyMappers.MapUITimeMeasurement(value, context);
                    break;

                case "direction":
                    options.direction = StylePropertyMappers.MapEnum <AnimationDirection>(value, context);
                    break;

                case "looptype":
                    options.loopType = StylePropertyMappers.MapEnum <AnimationLoopType>(value, context);
                    break;

                case "forwardstartdelay":
                    options.forwardStartDelay = (int)StylePropertyMappers.MapNumber(value, context);
                    break;

                case "reversestartdelay":
                    options.reverseStartDelay = (int)StylePropertyMappers.MapNumber(value, context);
                    break;

                case "timingfunction":
                    options.timingFunction = StylePropertyMappers.MapEnum <EasingFunction>(value, context);
                    break;

                default:
                    throw new CompileException(optionNodes[i], "Invalid option argument for animation");
                }
            }

            return(options);
        }
Example #18
0
        public static async Task Scale(object target, double x1, double y1, double x2, double y2, AnimationOptions options)
        {
            var obj = target as FrameworkElement;

            if (obj != null)
            {
                var transformGroup = new TransformGroup();

                var scaleTransform = new ScaleTransform();
                transformGroup.Children.Add(scaleTransform);

                obj.RenderTransform       = transformGroup;
                obj.RenderTransformOrigin = new Point(0.5, 0.5);

                scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, new DoubleAnimation
                {
                    From              = x1,
                    To                = x2,
                    Duration          = options.Duration,
                    AccelerationRatio = options.AccelerationRatio,
                    DecelerationRatio = options.DecelerationRatio
                });

                scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, new DoubleAnimation
                {
                    From              = y1,
                    To                = y2,
                    Duration          = options.Duration,
                    AccelerationRatio = options.AccelerationRatio,
                    DecelerationRatio = options.DecelerationRatio
                });

                await Task.Delay(options.Duration.TimeSpan.Milliseconds);

                scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, null);
                scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, null);

                scaleTransform.ScaleX = x2;
                scaleTransform.ScaleY = y2;
            }
        }
Example #19
0
    public float OriSpeed = 0;  //动作的播放速度,对于移动动作来说,表示移动的速度

    public void Clone(AnimationOptions src)
    {
        Name     = src.Name;
        Speed    = src.Speed;
        OriSpeed = src.OriSpeed;
    }
Example #20
0
        private AnimationOptions CompileSpriteSheetOptions(SpriteSheetNode node)
        {
            AnimationOptions options = new AnimationOptions();

            LightList <StyleASTNode> spriteSheetProperties = node.children;

            if (spriteSheetProperties == null)
            {
                return(options);
            }

            for (int i = 0; i < spriteSheetProperties.Count; i++)
            {
                if (spriteSheetProperties[i] is PropertyNode property)
                {
                    string       optionName = property.identifier.ToLower();
                    StyleASTNode value      = property.children[0];

                    switch (optionName)
                    {
                    case "iterations":
                        options.iterations = (int)StylePropertyMappers.MapNumberOrInfinite(value, context);
                        break;

                    case "delay":
                        options.delay = StylePropertyMappers.MapUITimeMeasurement(value, context);
                        break;

                    case "duration":
                        options.duration = StylePropertyMappers.MapUITimeMeasurement(value, context);
                        break;

                    case "looptype":
                        options.loopType = StylePropertyMappers.MapEnum <AnimationLoopType>(value, context);
                        break;

                    case "direction":
                        options.direction = StylePropertyMappers.MapEnum <AnimationDirection>(value, context);
                        break;

                    case "forwardstartdelay":
                        options.forwardStartDelay = (int)StylePropertyMappers.MapNumber(value, context);
                        break;

                    case "reversestartdelay":
                        options.reverseStartDelay = (int)StylePropertyMappers.MapNumber(value, context);
                        break;

                    case "fps":
                        options.fps = (int)StylePropertyMappers.MapNumber(value, context);
                        break;

                    case "startframe":
                        options.startFrame = (int)StylePropertyMappers.MapNumber(value, context);
                        break;

                    case "endframe":
                        options.endFrame = (int)StylePropertyMappers.MapNumber(value, context);
                        break;

                    case "pathprefix":
                        options.pathPrefix = StylePropertyMappers.MapString(value, context);
                        break;

                    default:
                        throw new CompileException(property, "Invalid option argument for animation");
                    }
                }
                else
                {
                    throw new CompileException(spriteSheetProperties[i], "Invalid option argument for animation");
                }
            }

            return(options);
        }
Example #21
0
 /// <summary>
 /// 播放融合动画
 /// </summary>
 /// <param name="op"></param>
 void CrossFadeAnimation(AnimationOptions op)
 {
     mOwner.CrossFade(op);
 }
Example #22
0
        /// <summary>
        /// 进入死亡状态
        /// </summary>
        public void EnterState_Death(xc.Machine.State s)
        {
            m_Gravity = DBActor.Gravity;

            // 下坐骑
            if (mOwner.mRideCtrl != null && mOwner.mRideCtrl.IsRiding())
            {
                mOwner.mRideCtrl.UnRide(true);
            }

            // Unfreeze
            mOwner.UnFreeze();

            // 获取死亡动作
            AnimationOptions op = GetAnimationOptions(Actor.EAnimation.death);

            bool is_shape_shifted = mOwner.IsShapeShift;// 删除buff前判断是否在变身状态

            // 删除buff
            if (mOwner.BuffCtrl != null)
            {
                mOwner.BuffCtrl.DelAllBuff();
            }

            if (!mIsDead)            // 角色之前还进入死亡时,则播放死亡动作
            {
                mIsDead = true;

                // 先检查是否有浮空动作
                AnimationOptions floatingOp = GetAnimationOptions(Actor.EAnimation.floating);
                if (!mOwner.HasAnimation(floatingOp.Name) || is_shape_shifted)// 变身状态、没有击飞动画时
                {
                    mDeathInfo.IsFlying = false;
                }

                if (!mDeathInfo.IsFlying)
                {
                    PlayAnimation(op);
                }
                else
                {
                    // 移动方向
                    MoveDir = mDeathInfo.MoveDir;
                    // 移动速度
                    MoveSpeed      = mDeathInfo.MoveXSpeed;
                    mVerticalSpeed = mDeathInfo.MoveYSpeed;
                    m_Gravity      = mOwner.ActorAttribute.Gravity;
                    // 播放动画
                    PlayAnimation(floatingOp);

                    mSwitch       = false;
                    mDeathFlyDown = false;
                }
            }
            else
            {
                SkillEffectPlayer effect_player = mOwner.SkillEffectPlayer;
                if (effect_player != null)
                {
                    effect_player.PlayEffect(DeathAnimation);
                }
            }

            if (mOwner.IsLocalPlayer)
            {
                ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_LOCAL_PLAYER_NWAR_DEAD, null);
            }

            if (SceneHelp.Instance.IsInWorldBossExperienceInstance && mOwner.IsLocalPlayer == false && mOwner.IsPlayer())
            {
                mOwner.SetNameLayoutVisiable(false);
            }
        }
        public static ContentPage GetChartContentPage(ChartSample chartSample)
        {
            ContentPage page = null;

            switch (chartSample.SampleViewType)
            {
            case (int)ChartSampleViewType.GETTING_STARTED:
                page = new GettingStartedSample();
                break;

            case (int)ChartSampleViewType.CHART_TYPES:
                page = new ChartTypesSample();
                break;

            case (int)ChartSampleViewType.MIXED_CHART_TYPES:
                page = new MixedChartTypesSample();
                break;

            case (int)ChartSampleViewType.LEGEND_AND_TITLES:
                page = new TitleAndLegendSample();
                break;

            case (int)ChartSampleViewType.TOOLTIPS:
                page = new TooltipsSample();
                break;

            case (int)ChartSampleViewType.STYLING_SERIES:
                page = new StylingSeriesSample();
                break;

            case (int)ChartSampleViewType.CUSTOMIZING_AXES:
                page = new CustomizingAxesSample();
                break;

            case (int)ChartSampleViewType.THEMING:
                page = new ThemingSample();
                break;

            case (int)ChartSampleViewType.SELECTION_MODES:
                page = new SelectionModesSample();
                break;

            case (int)ChartSampleViewType.TOGGLE_SERIES:
                page = new ToggleSeriesSample();
                break;

            case (int)ChartSampleViewType.DYNAMIC_CHARTS:
                page = new DynamicChartsSample();
                break;

            case (int)ChartSampleViewType.BUBBLE_CHART:
                page = new BubbleChartSample();
                break;

            case (int)ChartSampleViewType.FINANCIAL_CHART:
                page = new FinancialChart();
                break;

            case (int)ChartSampleViewType.ZOOMING_AND_SCROLLING:
                page = new ZoomingAndScrolling();
                break;

            case (int)ChartSampleViewType.HITTEST:
                page = new HitTest();
                break;

            case (int)ChartSampleViewType.ANIMATION:
                page = new AnimationOptions();
                break;
            }

            page.Title = chartSample.Name;

            return(page);
        }
Example #24
0
 /// <summary>
 /// 播放动画
 /// </summary>
 /// <param name="op"></param>
 void PlayAnimation(AnimationOptions op)
 {
     mOwner.Play(op);
 }
 protected override void Recycle(bool isReleasing)
 {
     _animation = null;
     _animationFrame = 0;
     _animationframeDurationTimer = 0.0f;
     _animationName = string.Empty;
     _animationOptions = AnimationOptions.None;
     _frameOffset = 0;
     _isAnimationPaused = false;
     IsAnimating = false;
     IsAnimationFinished = false;
     base.Recycle(isReleasing);
 }
 protected internal override bool SetValue(string name, string value)
 {
     switch (name)
     {
         case "animation":
         case "animationname":
             _animationName = value;
             return true;
         case "animationoptions":
             switch (value)
             {
                 case "none":
                     _animationOptions |= Graphics.AnimationOptions.None;
                     return true;
                 case "looped":
                     _animationOptions |= Graphics.AnimationOptions.Looped;
                     return true;
                 case "startonrandomframe":
                     _animationOptions |= Graphics.AnimationOptions.StartOnRandomFrame;
                     return true;
             }
             return true;
         case "islooped":
         case "looped":
         case "loop":
             _animationOptions |= AnimationOptions.Looped;
             return true;
         case "startrandom":
         case "random":
             _animationOptions |= AnimationOptions.StartOnRandomFrame;
             return true;
         case "ispaused":
         case "paused":
         case "isstopped":
         case "stopped":
             IsAnimationPaused = bool.Parse(value);
             return true;
         case "foffset":
         case "frameoffset":
             _frameOffset = int.Parse(value, CultureInfo.InvariantCulture);
             return true;
     }
     return base.SetValue(name, value);
 }
        public static Page GetChartContentPage(ChartSample chartSample)
        {
            Page page = null;

            switch (chartSample.SampleViewType)
            {
            case (int)ChartSampleViewType.GETTING_STARTED:
                page = new GettingStartedSample();
                break;

            case (int)ChartSampleViewType.CHART_TYPES:
                page = new ChartTypesSample();
                break;

            case (int)ChartSampleViewType.MIXED_CHART_TYPES:
                page = new MixedChartTypesSample();
                break;

            case (int)ChartSampleViewType.LEGEND_AND_TITLES:
                page = new TitleAndLegendSample();
                break;

            case (int)ChartSampleViewType.TOOLTIPS:
                page = new TooltipsSample();
                break;

            case (int)ChartSampleViewType.STYLING_SERIES:
                page = new StylingSeriesSample();
                break;

            case (int)ChartSampleViewType.CUSTOMIZING_AXES:
                page = new CustomizingAxesSample();
                break;

            case (int)ChartSampleViewType.THEMING:
                page = new ThemingSample();
                break;

            case (int)ChartSampleViewType.SELECTION_MODES:
                page = new SelectionModesSample();
                break;

            case (int)ChartSampleViewType.TOGGLE_SERIES:
                page = new ToggleSeriesSample();
                break;

            case (int)ChartSampleViewType.DYNAMIC_CHARTS:
                page = new DynamicChartsSample();
                break;

            case (int)ChartSampleViewType.BUBBLE_CHART:
                page = new BubbleChartSample();
                break;

            case (int)ChartSampleViewType.FINANCIAL_CHART:
                page = new FinancialChart();
                break;

            case (int)ChartSampleViewType.ZOOMING_AND_SCROLLING:
                page = new ZoomingAndScrolling();
                break;

            case (int)ChartSampleViewType.HITTEST:
                page = new HitTest();
                break;

            case (int)ChartSampleViewType.ANIMATION:
                page = new AnimationOptions();
                break;

            case (int)ChartSampleViewType.MUTIPLE_AXES:
                page = new MultipleAxesSamples();
                break;

            case (int)ChartSampleViewType.CUSTOM_PLOT_ELEMENTS:
                page = new CustomPlotElements();
                break;

            case (int)ChartSampleViewType.CONDITIONAL_FORMAT:
                page = new ConditionalFormatting();
                break;

            case (int)ChartSampleViewType.DATA_LABEL:
                page = new DataLabelSample();
                break;

            case (int)ChartSampleViewType.SNAPSHOT:
                page = new Snapshot();
                break;

            case (int)ChartSampleViewType.UPDATE_ANIMATION:
                page = new UpdateAnimation();
                break;

            case (int)ChartSampleViewType.SCROLLING:
                page = new ScrollingSample();
                break;
            }

            page.Title = chartSample.Name;

            return(page);
        }
 /// <summary>
 /// Plays the <see cref="AnimationSpriteEntity"/>. 
 /// </summary>
 /// <param name="animation">The name of the <see cref="Animation"/> to play.</param>
 /// <param name="options">The <see cref="AnimationOptions"/> to use when playing the <see cref="AnimatedSpriteEntity"/>.</param>
 public void Play(string animation, AnimationOptions options)
 {
     Play(animation, options, 0);
 }
 /// <summary>
 /// Plays the <see cref="AnimationSpriteEntity"/>. 
 /// </summary>
 /// <param name="animation">The name of the <see cref="Animation"/> to play.</param>
 /// <param name="options">The <see cref="AnimationOptions"/> to use when playing the <see cref="AnimatedSpriteEntity"/>.</param>
 /// <param name="frameOffset">The frame offset used when playing the <see cref="AnimatedSpriteEntity"/>.</param>
 public void Play(string animation, AnimationOptions options, int frameOffset)
 {
     AnimationName = animation;
     AnimationOptions = options;
     IsAnimationPaused = false;
     IsAnimating = true;
     IsAnimationFinished = false;
     FrameOffset = frameOffset;
 }