Beispiel #1
0
        public SkillTimeLineVO getRuntimeSkillVO(bool isEditorUse = false)
        {
            SkillTimeLineVO    skillTimeLineVo = new SkillTimeLineVO();
            List <SkillLineVO> lines           = timeLine.dataProvider;

            if (lines == null)
            {
                return(null);
            }

            int len = lines.Count;

            for (int i = 0; i < len; i++)
            {
                SkillLineVO         lineVO   = lines[i];
                List <SkillPointVO> pointVos = lineVO.points as List <SkillPointVO>;
                if (pointVos == null)
                {
                    continue;
                }

                List <SkillPointVO> resultPointVos = new List <SkillPointVO>();
                foreach (SkillPointVO pointVo in pointVos)
                {
                    if (pointVo.isEmpty == false)
                    {
                        resultPointVos.Add(pointVo);
                    }
                }

                if (resultPointVos.Count > 0)
                {
                    SkillLineVO newLineVO = new SkillLineVO();
                    newLineVO.copyFrom(lineVO);
                    newLineVO.points = resultPointVos;
                    if (newLineVO.enabled == false && isEditorUse)
                    {
                        continue;
                    }
                    skillTimeLineVo.addLine(newLineVO);
                }
            }
            return(skillTimeLineVo);
        }
Beispiel #2
0
        private void playHandle(EventX eventX)
        {
            SkillTimeLineVO skillTimeLineVo = getRuntimeSkillVO(true);

            if (skillTimeLineVo == null || selectedbaseObject == null)
            {
                return;
            }

            playButton.text = "停止";
            Time.timeScale  = timeScaleSlider.value; // = 1.0f;
            _currentTime    = 0;
            int currentMaxTime = 0;

            foreach (SkillLineVO lineVo in skillTimeLineVo.lines)
            {
                foreach (SkillPointVO pointVo in lineVo.points)
                {
                    if (pointVo.startTime < currentMaxTime)
                    {
                        continue;
                    }
                    currentMaxTime = pointVo.startTime;
                }
            }

            _endFrame = Mathf.CeilToInt(currentMaxTime / frameTime);


            if (_currentBaseSkill != null)
            {
                _currentBaseSkill.stop();
            }
            _currentBaseSkill = new BaseSkill();

            SkillExData exData = selectedbaseObject.getSkillExData();

            exData.isHero = true;

            _currentBaseSkill.createBy(selectedbaseObject, null, exData);
            _currentBaseSkill.play(skillTimeLineVo);

            window.AddTick(tickHandle);
        }
Beispiel #3
0
        public void updateView(SkillTimeLineVO value)
        {
            timeLine.Clear();

            _currentSkillTimeLineVo = new SkillTimeLineVO();
            foreach (SkillLineVO lineVO in value.lines)
            {
                List <SkillPointVO> points = new List <SkillPointVO>();

                for (int i = 0; i < totalFrame; i++)
                {
                    SkillPointVO pointVo = new SkillPointVO();
                    pointVo.startTime = i * frameTime;
                    points.Add(pointVo);
                }

                int len = Math.Min(lineVO.points.Count, totalFrame);
                for (int i = 0; i < len; i++)
                {
                    SkillPointVO pointVo = lineVO.points[i];
                    int          index   = (int)(pointVo.startTime / frameTime);

                    if (index >= totalFrame)
                    {
                        this.ShowNotification("超出时间线:" + index + "被修正:" + totalFrame);
                        index             = totalFrame - 1;
                        pointVo.startTime = index * frameTime;
                    }

                    points[index] = pointVo;
                }

                SkillLineVO newLineVo = new SkillLineVO();
                newLineVo.copyFrom(lineVO);
                newLineVo.points = points;
                _currentSkillTimeLineVo.addLine(newLineVo);
            }

            timeLine.dataProvider = _currentSkillTimeLineVo.lines;
        }