Example #1
0
    private void OnActionnSelected(int index, string title)
    {
        Debug.Log(index + ":" + title);
        string actionName = title;

        currentActionInfo = currentCharacterConfigInfo.GetActionInfo(actionName);
        SetActionAttribute(currentActionInfo);
        if (OnActionSelectedHandler != null)
        {
            OnActionSelectedHandler(actionName);
        }
        //if (tCreature == null) return;
        //tCreature.PlayAnimation(actionName, true);

        actionLengthMap.TryGetValue(currentCharacterConfigInfo.ModelName, out lengthMap);
        if (lengthMap == null)
        {
            lengthMap = new Dictionary <string, float>();
            actionLengthMap.Add(currentCharacterConfigInfo.ModelName, lengthMap);
        }
        if (lengthMap.ContainsKey(actionName))
        {
            ReSet();
        }
        else
        {
            //to do 提示计算时间中 加遮罩屏蔽所有操作
            timerInfo = TimerManager.AddDelayHandler(OnDelayHandler, 0.2f, 1);
        }
    }
Example #2
0
 public override void OnEnter(FSMTranslation translation)
 {
     base.OnEnter(translation);
     delTime = 0f;
     if (actionInfo.SelfMoveDistance > 0f && actionInfo.SelfMoveTime > 0f)
     {
         speed = actionInfo.SelfMoveDistance / actionInfo.SelfMoveTime;
         if (actionInfo.SelfMoveDelayTime > 0f)
         {
             timerInfo = TimerManager.AddDelayHandler(OnDelayHandler, actionInfo.SelfMoveDelayTime, 1);
         }
         else
         {
             isEntry = true;
         }
     }
     creature.PlayAnimation(actionInfo.ActionName, true, OnPlayHitHandler, onPlayEndHandler);
 }
Example #3
0
 public static void Show(string msg, int hideTime = 0)
 {
     msgContent = msg;
     if (content != null)
     {
         content.SetActive(true);
     }
     if (hideTime <= 0)
     {
         text.text = msgContent;
     }
     else
     {
         index     = hideTime;
         text.text = msgContent + " " + index;
         timerInfo = TimerManager.AddDelayHandler(OnDelHandler, 1f, (uint)hideTime + 1);
     }
 }
Example #4
0
    public static void Save(Action OnCltHandler)
    {
        //to do 提示保存中
        OnCompleteHandler = OnCltHandler;
        if (characterInfos.Count == 0 && OnCompleteHandler != null)
        {
            OnCompleteHandler();
            return;
        }


        tempList.Clear();



        foreach (CharacterConfigInfo characterConfigInfo in characterInfos.Values)
        {
            tempList.Add(characterConfigInfo);
        }
        timerInfo = TimerManager.AddDelayHandler(OnDelHandler, 0.02f, (uint)tempList.Count + 1);
    }
Example #5
0
    private void PreviewHandler(CharacterConfigInfo characterConfigInfo, ActionInfo actionInfo)
    {
        Debug.LogError("start preview");
        Alert.Show("预览准备中,请稍等......");
        currentCharacterConfigInfo = characterConfigInfo;
        currentActionInfo          = actionInfo;
        if (currentCharacterConfigInfo != null && currentActionInfo != null && tCreature != null)
        {
            bool isCorrect = CheckActionInfo(currentActionInfo);
            if (!isCorrect)
            {
                return;
            }

            if (currentActionInfo.ActionName != AnimationType.Idle)
            {
                tTimerInfo = TimerManager.AddDelayHandler(OnDelHandler, 2f, 1);
                tCreature.PlayAnimation(AnimationType.Idle, true);
            }
        }
    }
Example #6
0
    public void PlayAnimation(string actionName, bool isClearOldActionInfo = true, Action hitHandler = null, Action endHandler = null)
    {
        if (currentActionName == actionName)
        {
            return;
        }
        StopActionSound();
        if (isClearOldActionInfo)
        {
            StopOldActionEffect(currentActionName);
        }
        TimerManager.RemoveHandler(timerInfo);
        timerInfo          = null;
        OnActionEndHandler = null;
        if (Model != null && characterConfigInfo != null)
        {
            currentActionName = actionName;
            currentActionInfo = characterConfigInfo.GetActionInfo(currentActionName);
            if (currentActionInfo != null)
            {
                bool loop = AnimationType.IsLoopAction(currentActionName);
                if (currentActionInfo.SelfMoveTime > 0f && currentActionInfo.SelfMoveDistance > 0f && currentActionInfo.IsLoop)
                {
                    OnActionEndHandler = endHandler;
                    timerInfo          = TimerManager.AddDelayHandler(OnEndHandler, currentActionInfo.SelfMoveDelayTime + currentActionInfo.SelfMoveTime, 1);
                    Model.PlayAnimation(currentActionName, currentActionInfo.PlaySpeed, hitHandler, null);
                }
                else
                {
                    Model.PlayAnimation(currentActionName, currentActionInfo.PlaySpeed, hitHandler, endHandler);
                }
                PlayActionSound(currentActionInfo.SoundName, loop, (ulong)currentActionInfo.SoundPlayDelayTime);
                for (int i = 0; i < currentActionInfo.ActionEffectInfos.Count; ++i)
                {
                    EffectInfo effectInfo = currentActionInfo.ActionEffectInfos[i];
                    if (effectInfo.EffectType == EffectTypes.Bullet)
                    {
                        continue;
                    }
                    if (effectInfo.EffectType == EffectTypes.Normal && effectInfo.BindType == BindTypes.Bone && (effectInfo.BindName == BindTypes.NONE || string.IsNullOrEmpty(effectInfo.BindName)))
                    {
                        continue;
                    }

                    NEffect    nEffect = GetEffect(effectInfo);
                    GameObject effect  = nEffect.GetEffect();
                    if (effect == null)
                    {
                        continue;
                    }
                    if (effectInfo.BindType == BindTypes.OrginePoint)
                    {
                        //自身同坐标,且随自身一起移动
                        if (Container != null)
                        {
                            effect.transform.SetParent(Container.transform);
                            effect.transform.localPosition = Vector3.zero;
                            effect.transform.localScale    = Vector3.one;
                            effect.transform.localRotation = Quaternion.identity;
                        }
                    }
                    else if (effectInfo.BindType == BindTypes.Self_Point)
                    {
                        //自身同坐标,且不随自身一起移动
                        if (Container != null)
                        {
                            effect.transform.SetParent(null);
                            effect.transform.localPosition = Vector3.zero;
                            effect.transform.localScale    = Vector3.one;
                            effect.transform.localRotation = Quaternion.identity;
                            effect.transform.position      = GetPosition();
                            effect.transform.eulerAngles   = new Vector3(0f, Container.transform.eulerAngles.y, 0f);
                        }
                    }
                    else if (effectInfo.BindType == BindTypes.Bone)
                    {
                        //绑骨骼
                        Transform bone = Model.GetChild(effectInfo.BindName);
                        if (bone != null)
                        {
                            effect.transform.SetParent(bone);
                            effect.transform.localPosition = Vector3.zero;
                            effect.transform.localScale    = Vector3.one;
                            effect.transform.localRotation = Quaternion.identity;
                        }
                    }
                    nEffect.Play();
                }
            }
        }
    }