Ejemplo n.º 1
0
        public void CopyBodyRangeToCurrentFrameIfStay()
        {
            FrameConfig config = currentFrame;

            if (config == null || !config.stayBodyRange)
            {
                return;
            }

            List <RangeConfig> target = FindStayBodyRangeStartWith(frameSelectIndex);

            if (target == null)
            {
                config.bodyRanges = new List <RangeConfig>();
                return;
            }

            config.CopyBodyRangeFrom(target);
            config.stayBodyRange = false;
        }
Ejemplo n.º 2
0
        private void PasteRangeFrame()
        {
            if (win.frameSelectIndex < 0)
            {
                EditorUtility.DisplayDialog("提示", "请选择一帧", "确定");
                return;
            }

            int maxCount = win.currentFrames?.Count ?? 0;

            if (setting.fromIndex > setting.toIndex || setting.fromIndex < 0 || setting.toIndex < 0 || setting.fromIndex >= maxCount || setting.toIndex >= maxCount)
            {
                EditorUtility.DisplayDialog("提示", $"开始应小于结束,且都大于零,小于最大帧数 {maxCount} ", "确定");
                return;
            }

            FrameConfig        frame        = win.currentFrame;
            List <RangeConfig> attackRanges = setting.copyAttackRanges ? frame.CopyAttackRanges() : null;//拷贝一遍,防止修改的列表为当前被拷贝的列表
            List <RangeConfig> bodyRanges   = setting.copyBodyRanges ? win.FindStayBodyRangeFromCurrent(true) : null;

            for (int i = setting.fromIndex; i <= setting.toIndex; i++)
            {
                if (i == win.frameSelectIndex)
                {//自身不用拷贝,跳过
                    continue;
                }

                FrameConfig config = win.currentFrames[i];
                if (setting.copyAttackRanges)
                {
                    config.CopyAttackRangeFrom(attackRanges);
                }
                if (setting.copyBodyRanges)
                {
                    config.CopyBodyRangeFrom(bodyRanges);
                }
            }
        }