예제 #1
0
        /// <summary>
        /// Creates a new curve through the specified points
        /// </summary>
        internal PSCurve(PSAutomation powerSHAPE, CurveTypes curveType, Geometry.Point[] points) : base(powerSHAPE)
        {
            // Clear created list
            _powerSHAPE.ActiveModel.ClearCreatedItems();

            // Create the curve
            switch (curveType)
            {
            case CurveTypes.Bezier:
                _powerSHAPE.DoCommand("CREATE CURVE THROUGH");
                break;

            case CurveTypes.bSpline:
            case CurveTypes.g2:
                _powerSHAPE.DoCommand("CREATE CURVE " + curveType);
                break;
            }

            foreach (Geometry.Point point in points)
            {
                var _with1 = point;
                _powerSHAPE.DoCommand("ABS " + _with1.X.ToString() + " " + _with1.Y.ToString() + " " + _with1.Z.ToString());
            }
            _powerSHAPE.DoCommand("QUIT");

            // Get the id of the Curve
            PSCurve curve = (PSCurve)_powerSHAPE.ActiveModel.SelectedItems[0];

            _name = curve.Name;
            _id   = curve.Id;
        }
예제 #2
0
 internal SliderTaiko(HitObjectManager hom, Vector2 startPosition, int startTime, bool newCombo, HitObjectSoundType soundType,
                      CurveTypes curveType, int repeatCount, double sliderLength, List <Vector2> sliderPoints, List <HitObjectSoundType> soundTypes, bool kiai)
     : base(hom, startPosition, startTime, newCombo, soundType, curveType, repeatCount, sliderLength, sliderPoints, soundTypes, 0)
 {
     base.SetColour(new Color(252, 184, 6));
     Kiai = kiai;
 }
예제 #3
0
        private void SetCurveType(Rg.Curve curve)
        {
            Rg.Circle   R = new Rg.Circle();
            Rg.Arc      A = new Rg.Arc();
            Rg.Ellipse  S = new Rg.Ellipse();
            Rg.Polyline P = new Rg.Polyline();

            if (curve.TryGetCircle(out R))
            {
                curveType = CurveTypes.Circle;
            }
            else if (curve.TryGetArc(out A))
            {
                curveType = CurveTypes.Arc;
            }
            else if (curve.TryGetEllipse(out S))
            {
                curveType = CurveTypes.Ellipse;
            }
            else if (curve.IsLinear())
            {
                curveType = CurveTypes.Line;
            }
            else if (curve.TryGetPolyline(out P))
            {
                curveType = CurveTypes.Polyline;
            }
            else
            {
                curveType = CurveTypes.Spline;
            }
        }
        /// <summary>
        /// Creates a new curve through the specified points
        /// </summary>
        /// <param name="curveType">CurveTypes enum value for curev type</param>
        /// <param name="points">Optional array of points or singular point for curve to go through</param>
        /// <returns>Curve created by the operation</returns>
        public PSCurve CreateCurveThroughPoints(CurveTypes curveType, Point[] points)
        {
            PSCurve curve = new PSCurve(_powerSHAPE, curveType, points);

            _powerSHAPE.ActiveModel.Curves.Add(curve);
            return(curve);
        }
 public UtilityConsideration()
 {
     CurveType = CurveTypes.Linear;
     m         = d = p = 1;
     k         = c = 0;
     Bookends  = new Vector2(0, 1);
 }
        /// <summary>
        /// Creates a new compcurve through the specified points
        /// </summary>
        /// <param name="curveType">CurveTypes enum value for curev type</param>
        /// <param name="points">Optional array of points or singular point for curve to go through</param>
        /// <returns>A curve created by the operation</returns>
        public PSCompCurve CreateCompCurveThroughPoints(CurveTypes curveType, Geometry.Point[] points)
        {
            PSCurve     curve     = _powerSHAPE.ActiveModel.Curves.CreateCurveThroughPoints(curveType, points);
            PSCompCurve compCurve = CreateCompCurveFromWireframe(new PSWireframe[] { curve });

            curve.Delete();
            return(compCurve);
        }
예제 #7
0
        internal override Slider CreateSlider(Vector2 startPosition, int startTime, bool newCombo,
                                              HitObjectSoundType soundType, CurveTypes curveType, int repeatCount, double sliderLength, List <Vector2> sliderPoints, List <HitObjectSoundType> soundTypes, int comboOffset,
                                              SampleSet sampleSet, SampleSet addSet, List <SampleSet> sampleSets, List <SampleSet> sampleSetAdditions, CustomSampleSet customSampleSet, int volume, string sampleFile)
        {
            SliderMania s;

            if (hitObjectManager.Beatmap.PlayMode == PlayModes.OsuMania)
            {
                s                    = new SliderMania(hitObjectManager, startPosition, startTime, soundType, repeatCount, sliderLength, sliderPoints, soundTypes, ManiaConvertType.NotChange, prevRow);
                s.SampleSet          = sampleSet;
                s.SampleSetAdditions = addSet;
                s.CustomSampleSet    = customSampleSet;
                s.SampleVolume       = volume;
                s.GenerateHitObjects();

                s.HitObjects.ForEach(n => n.ProcessSampleFile(sampleFile));
                record(startPosition, s.EndTime);
            }
            else
            {
                ControlPoint     cp    = hitObjectManager.Beatmap.ControlPointAt(startTime);
                ManiaConvertType ctype = ManiaConvertType.None;
                if (cp != null && !cp.KiaiMode)
                {
                    ctype = ManiaConvertType.LowProbability;
                }
                s                       = new SliderMania(hitObjectManager, startPosition, startTime, soundType, repeatCount, sliderLength, sliderPoints, soundTypes, ctype, prevRow);
                s.SampleSet             = sampleSet;
                s.SampleSetAdditions    = addSet;
                s.SampleSetList         = sampleSets;
                s.SampleSetAdditionList = sampleSetAdditions;
                s.CustomSampleSet       = customSampleSet;
                s.SampleVolume          = volume;
                s.GenerateHitObjects();

                prevRow = new bool[hitObjectManager.ManiaStage.Columns.Count];
                if (s.HitObjects.Count > 1)
                {
                    foreach (HitCircleMania hb in s.HitObjects.FindAll(h => h.EndTime == s.EndTime))
                    {
                        prevRow[hb.LogicalColumn] = true;
                    }
                }
                else
                {
                    prevRow[s.HitObjects[0].LogicalColumn] = true;
                }
                s.HitObjects.ForEach(n => n.ProcessSampleFile(sampleFile));
                int intv = (s.EndTime - startTime) / repeatCount;
                while (repeatCount-- >= 0)
                {
                    record(startPosition, startTime);
                    densityUpdate(startTime);
                    startTime += intv;
                }
            }
            return(s);
        }
예제 #8
0
        internal override Slider CreateSlider(Vector2 startPosition, int startTime, bool newCombo,
                                              HitObjectSoundType soundType, CurveTypes curveType, int repeatCount, double sliderLength, List <Vector2> sliderPoints,
                                              List <HitObjectSoundType> soundTypes, int comboOffset, SampleSet sampleSet, SampleSet addSet, List <SampleSet> sampleSets, List <SampleSet> sampleSetAdditions, CustomSampleSet customSampleSet, int volume, string sampleFile)
        {
            ControlPoint cp   = hitObjectManager.Beatmap.ControlPointAt(startTime + 5);
            bool         kiai = cp != null ? cp.KiaiMode : false;

            return(new SliderTaiko(hitObjectManager, startPosition, startTime, newCombo, soundType, curveType, repeatCount, sliderLength, sliderPoints, soundTypes, kiai));
        }
예제 #9
0
        public ActiveMedicalAgent(IGameController gc, MedicalConsumablesGroup group, CurveTypes activationType, float gameMinutesAgentIsActive)
        {
            _activationType           = activationType;
            _gameMinutesAgentIsActive = gameMinutesAgentIsActive;
            _gc    = gc;
            _group = group;

            BuildCurve();
        }
예제 #10
0
        public static Point Alloc(float x, float y, CurveTypes curveType)
        {
            Point point = new Point();

            point._x         = x;
            point._y         = y;
            point._curveType = curveType;
            return(point);
        }
예제 #11
0
 internal SliderFruits(HitObjectManager hom, Vector2 startPosition, int startTime, bool newCombo, HitObjectSoundType soundType,
                       CurveTypes curveType, int repeatCount, double sliderLength, List <Vector2> sliderPoints,
                       List <HitObjectSoundType> soundTypes, string fruit)
     : base(
         hom, startPosition, startTime, newCombo, soundType, curveType, repeatCount, sliderLength, sliderPoints,
         soundTypes, 0)
 {
     this.fruit    = fruit;
     spriteManager = null;
 }
예제 #12
0
        internal void BackupData(CurveTypes type)
        {
            if (!allowBackup || CurrentChangeType != ChangeType.HitObject)
            {
                return;
            }

            HitObjectRecord current = (HitObjectRecord)currentRecord;

            current.BackupData(type);
        }
 public UtilityConsideration(CurveTypes curve, Vector2 bookends, InputFunction inputFunc, float M, float D, float K, float P, float C)
 {
     CurveType = curve;
     Bookends  = bookends;
     GetInput  = inputFunc;
     m         = M;
     d         = D;
     k         = K;
     p         = P;
     c         = C;
 }
예제 #14
0
        /// <summary>
        /// </summary>
        /// <param name="strvel">开始速度pps</param>
        /// <param name="maxvel">最大速度pps(即稳定运行的速度)</param>
        /// <param name="tacc"> 加速时间s</param>
        /// <param name="tdec">减速时间s</param>
        /// <param name="svacc">加速度圆角(S型运动曲线专用,其他的类型时为零)</param>
        /// <param name="svdec">减速度圆角(S型运动曲线专用,其他的类型时为零)</param>
        /// <param name="velocityCurveType">速度曲线类型</param>
        public VelocityCurve(double strvel, double maxvel, double tacc, double tdec, double svacc, double svdec,
                             CurveTypes velocityCurveType)
        {
            Strvel = strvel;
            Maxvel = maxvel;
            Tacc   = tacc;
            Tdec   = tdec;
            Svacc  = svacc;
            Svdec  = svdec;

            VelocityCurveType = velocityCurveType;
        }
예제 #15
0
        private float CalculateValueByType(CurveTypes curveType, float value, float t)
        {
            float result = 0f;

            switch (curveType)
            {
            case CurveTypes.Bezier:
            {
                point[0]    = default(LocalPoint);
                point[1]    = default(LocalPoint);
                point[2]    = default(LocalPoint);
                point[3]    = default(LocalPoint);
                point[0]._x = 0f;
                point[0]._y = 1f;
                point[3]._x = 1f;
                point[3]._y = 1f - value;
                point[1]._x = 1f;
                point[1]._y = 1f;
                point[2]._x = 0f;
                point[2]._y = 1f - value;
                LocalPoint dest = default(LocalPoint);
                Bezier(ref dest, point, t);
                result = 1f - dest._y;
                break;
            }

            case CurveTypes.Linear:
                result = t * value;
                break;

            case CurveTypes.Raised:
                result = (float)Math.Sqrt(t) * value;
                break;

            case CurveTypes.Flat:
            {
                float num4 = t - 0.5f;
                result = 0.5f - 4f * (num4 * num4 * num4);
                break;
            }

            case CurveTypes.Log:
            {
                float num  = 1024f;
                float num2 = (float)Math.Log(1f + num) / (float)Math.Log(2.0);
                float num3 = -1f;
                result = ((float)Math.Pow(2.0, num2 * t) + num3) / num;
                break;
            }
            }
            return(result);
        }
예제 #16
0
        internal override void ChangeState(State undoState)
        {
            int sIndex = 0;

            foreach (SliderPointData p in pointData)
            {
                SliderOsu      slider       = p.Slider;
                List <Vector2> sliderPoints = slider.sliderCurvePoints;

                int     pIndex   = p.SliderPointIndex;
                Vector2 position = sliderPoints[pIndex];

                float changeX = position.X - p.Position.X;
                float changeY = position.Y - p.Position.Y;

                Vector2 changeVector = new Vector2(changeX, changeY);
                Vector2 newPosition  = position - changeVector;

                sliderPoints[pIndex] = newPosition;

                if (p.IsRed) //Handle stacked points
                {
                    if (pIndex >= 1 && sliderPoints[pIndex - 1] == p.Position)
                    {
                        sliderPoints[pIndex - 1] = newPosition;
                    }
                    else
                    {
                        sliderPoints[pIndex + 1] = newPosition;
                    }
                }

                p.Position = position;

                if (pIndex == 0)
                {
                    slider.Position = slider.BasePosition -= changeVector;
                    slider.sliderStartCircle.ModifyPosition(slider.Position);
                }

                CurveTypes type = slider.CurveType;
                slider.CurveType      = slider.CurveTypeSavable = curveTypeData[sIndex];
                curveTypeData[sIndex] = type;

                slider.SpatialLength = 0;
                slider.UpdateCalculations();

                sIndex++;
            }
        }
        internal override void ChangeState(State undoState)
        {
            SliderOsu      s            = removedPoint.Slider;
            List <Vector2> sliderPoints = s.sliderCurvePoints;
            int            pIndex       = removedPoint.SliderPointIndex;

            switch (undoState)
            {
            case State.Undo:
                if (sliderPoints.Count > pIndex)
                {
                    sliderPoints.Insert(pIndex, removedPoint.Position);
                }
                else
                {
                    pIndex = removedPoint.SliderPointIndex = sliderPoints.Count;
                    sliderPoints.Add(removedPoint.Position);
                }
                break;

            case State.Redo:
                sliderPoints.RemoveAt(pIndex);
                break;
            }

            if (pIndex == 0) //First slider point has been changed - the start circle needs to be updated
            {
                Vector2 position = s.Position;
                s.Position = s.BasePosition = removedPoint.Position;
                s.sliderStartCircle.ModifyPosition(s.Position);
                removedPoint.Position = position;
            }

            if (curveType != null)
            {
                CurveTypes type = s.CurveType;
                s.CurveType = s.CurveTypeSavable = (CurveTypes)curveType;
                curveType   = type;
            }

            s.SpatialLength = 0;
            s.UpdateCalculations();
        }
        public Curve(Stream strm, CurveTypes type)
        {
            Curve temp = null;
            if (type == CurveTypes.PhotoShop)
            {
                temp = Curve.GetPhotoShopCurve(strm);
            }
            else if (type == CurveTypes.Gimp)
            {
                temp = Curve.GetGimpCurve(strm);
            }
            else
            {
                throw new ArgumentException("invalid is CurveTypes.");
            }

            Data = temp.Data;
            Points = temp.Points;
        }
예제 #19
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="strm"></param>
        /// <param name="type"></param>
        public Curve(Stream strm, CurveTypes type)
        {
            Curve temp = null;

            if (type == CurveTypes.Photoshop)
            {
                throw new NotImplementedException();
            }
            else if (type == CurveTypes.Gimp)
            {
                temp = Curve.GetGimpCurve(strm);
            }
            else
            {
                throw new ArgumentException("invalid is CurveTypes.");
            }

            Data   = temp.Data;
            Points = temp.Points;
        }
예제 #20
0
        internal override Slider CreateSlider(Vector2 startPosition, int startTime, bool newCombo,
                                              HitObjectSoundType soundType, CurveTypes curveType, int repeatCount, double sliderLength, List <Vector2> sliderPoints, List <HitObjectSoundType> soundTypes, int comboOffset,
                                              SampleSet sampleSet, SampleSet addSet, List <SampleSet> sampleSets, List <SampleSet> sampleSetAdditions, CustomSampleSet customSampleSet, int volume, string sampleFile)
        {
            SliderOsu s = new SliderOsu(hitObjectManager, startPosition, startTime, newCombo, soundType, curveType, repeatCount, sliderLength, sliderPoints, soundTypes, comboOffset);

            s.SampleSet          = sampleSet;
            s.SampleSetAdditions = addSet;

            s.SampleSetList         = sampleSets;
            s.SampleSetAdditionList = sampleSetAdditions;
            s.CustomSampleSet       = customSampleSet;
            s.SampleVolume          = volume;
            s.ProcessSampleFile(sampleFile);

            if (s.sliderStartCircle != null)
            {
                HitSoundInfo hitsoundInfo = s.GetHitSoundInfo(0);
                s.sliderStartCircle.SampleSet          = hitsoundInfo.SampleSet;
                s.sliderStartCircle.SampleSetAdditions = hitsoundInfo.SampleSetAdditions;
            }

            return(s);
        }
        internal override void ChangeState(State undoState)
        {
            SliderOsu      s            = addedPoint.Slider;
            List <Vector2> sliderPoints = s.sliderCurvePoints;
            int            pIndex       = addedPoint.SliderPointIndex;

            ActiveManager.Editor.Compose.RefreshSelection();
            switch (undoState)
            {
            case State.Undo:
                sliderPoints.RemoveAt(pIndex);
                break;

            case State.Redo:
                if (sliderPoints.Count > pIndex)
                {
                    sliderPoints.Insert(pIndex, addedPoint.Position);
                }
                else
                {
                    addedPoint.SliderPointIndex = sliderPoints.Count;     //This should always be accurate, but reset value to be extra sure.
                    sliderPoints.Add(addedPoint.Position);
                }
                break;
            }

            if (curveType != null)
            {
                CurveTypes type = s.CurveType;
                s.CurveType = s.CurveTypeSavable = (CurveTypes)curveType;
                curveType   = type;
            }

            s.SpatialLength = 0;
            s.UpdateCalculations();
        }
예제 #22
0
 public Point()
 {
     _x         = 0f;
     _y         = 0f;
     _curveType = CurveTypes.Linear;
 }
예제 #23
0
        public override HitObject Parse(string text)
        {
            string[] split = text.Split(',');
            var      type  = (HitObjectType)int.Parse(split[3]);
            bool     combo = type.HasFlag(HitObjectType.NewCombo);

            type &= (HitObjectType)0xF;
            type &= ~HitObjectType.NewCombo;
            OsuHitObject result;

            switch (type)
            {
            case HitObjectType.Circle:
                result = new HitCircle
                {
                    Position = new Vector2(int.Parse(split[0]), int.Parse(split[1]))
                };
                break;

            case HitObjectType.Slider:
                CurveTypes     curveType = CurveTypes.Catmull;
                double         length    = 0;
                List <Vector2> points    = new List <Vector2> {
                    new Vector2(int.Parse(split[0]), int.Parse(split[1]))
                };

                string[] pointsplit = split[5].Split('|');
                foreach (string t in pointsplit)
                {
                    if (t.Length == 1)
                    {
                        switch (t)
                        {
                        case @"C":
                            curveType = CurveTypes.Catmull;
                            break;

                        case @"B":
                            curveType = CurveTypes.Bezier;
                            break;

                        case @"L":
                            curveType = CurveTypes.Linear;
                            break;

                        case @"P":
                            curveType = CurveTypes.PerfectCurve;
                            break;
                        }
                        continue;
                    }

                    string[] temp = t.Split(':');
                    Vector2  v    = new Vector2(
                        (int)Convert.ToDouble(temp[0], CultureInfo.InvariantCulture),
                        (int)Convert.ToDouble(temp[1], CultureInfo.InvariantCulture)
                        );
                    points.Add(v);
                }

                int repeatCount = Convert.ToInt32(split[6], CultureInfo.InvariantCulture);

                if (repeatCount > 9000)
                {
                    throw new ArgumentOutOfRangeException(nameof(repeatCount), @"Repeat count is way too high");
                }

                if (split.Length > 7)
                {
                    length = Convert.ToDouble(split[7], CultureInfo.InvariantCulture);
                }

                result = new Slider
                {
                    ControlPoints = points,
                    Length        = length,
                    CurveType     = curveType,
                    RepeatCount   = repeatCount,
                    Position      = new Vector2(int.Parse(split[0]), int.Parse(split[1]))
                };
                break;

            case HitObjectType.Spinner:
                result = new Spinner
                {
                    Length   = Convert.ToDouble(split[5], CultureInfo.InvariantCulture) - Convert.ToDouble(split[2], CultureInfo.InvariantCulture),
                    Position = new Vector2(512, 384) / 2,
                };
                break;

            default:
                throw new InvalidOperationException($@"Unknown hit object type {type}");
            }
            result.StartTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture);
            result.Sample    = new HitSampleInfo
            {
                Type = (SampleType)int.Parse(split[4]),
                Set  = SampleSet.Soft,
            };
            result.NewCombo = combo;
            // TODO: "addition" field
            return(result);
        }
예제 #24
0
 // Token: 0x06002259 RID: 8793
 // RVA: 0x000CAD04 File Offset: 0x000C8F04
 internal Class321(Class297 class297_1, Vector2 vector2_4, int int_12, bool bool_14, HitObjectSoundType hitObjectSoundType_0, CurveTypes curveTypes_2, int int_13, double double_3, List<Vector2> list_11, List<HitObjectSoundType> list_12, int int_14)
     : base(class297_1)
 {
     this.curveTypes_0 = curveTypes_2;
     this.curveTypes_1 = curveTypes_2;
     this.int_0 = int_14;
     this.class911_0 = this.class297_0.class911_0;
     this.StartTime = int_12;
     this.EndTime = int_12;
     this.Position = vector2_4;
     this.vector2_0 = vector2_4;
     this.EndPosition = vector2_4;
     this.SoundType = hitObjectSoundType_0;
     if (list_11 == null)
     {
         this.list_3 = new List<Vector2>();
         this.list_3.Add(this.Position);
     }
     else
     {
         this.list_3 = list_11;
         if (this.list_3.Count > 0)
         {
             if (this.list_3[0] != this.Position)
             {
                 this.list_3.Insert(0, this.Position);
             }
         }
         else
         {
             this.list_3.Add(this.Position);
         }
     }
     this.SegmentCount = Math.Max(1, int_13);
     this.bool_10 = (list_12 == null || list_12.Count == 0);
     if (!this.bool_10)
     {
         this.list_8 = list_12;
         this.list_9 = new List<SampleSet>(int_13 + 1);
         this.list_10 = new List<SampleSet>(int_13 + 1);
     }
     this.SpatialLength = double_3;
     this.bool_4 = true;
     this.list_2 = new List<Class311>();
     this.Type = HitObjectType.Slider;
     if (bool_14)
     {
         this.Type |= HitObjectType.NewCombo;
     }
     if (this.class911_0 != null)
     {
         this.vmethod_23();
         this.class538_1 = new Class538(Class885.smethod_27("sliderfollowcircle", Enum112.flag_6, true), Enum115.const_0, Origins.Centre, Enum114.const_1, this.Position, 0.99f, false, Color.get_TransparentWhite(), this);
         this.class538_1.method_61();
         Class731[] array = Class885.smethod_27("sliderb", Enum112.flag_6, false);
         bool flag = array[0].enum112_0 == Enum112.flag_1;
         this.class538_0 = new Class538(array, Enum115.const_0, Origins.Centre, Enum114.const_1, this.Position, 0.99f, false, flag ? Class885.smethod_23("SliderBall", true) : Color.get_White(), this);
         this.class538_0.bool_10 = true;
         if (flag)
         {
             this.class531_0 = new Class531(Class885.Load("sliderb-spec", Enum112.flag_6), Enum115.const_0, Origins.Centre, Enum114.const_1, this.Position, 1f, false, Color.get_White(), null)
             {
                 bool_7 = true
             };
             this.class531_1 = new Class531(Class885.Load("sliderb-nd", Enum112.flag_6), Enum115.const_0, Origins.Centre, Enum114.const_1, this.Position, 0.98f, false, new Color(5, 5, 5), null);
         }
         this.class531_2 = new Class531(null, Enum115.const_4, Origins.TopLeft, Enum114.const_1, this.Position, Class911.smethod_4((float)(this.EndTime + 10)), false, Color.get_White(), null);
         this.class531_2.bool_6 = true;
     }
 }
 /// <summary>
 /// Get the curves by the given type
 /// </summary>
 /// <returns></returns>
 public List <InventorDrawingCurve> GetCurvesByType(CurveTypes curveType)
 {
     return(this.Where(curve => curve.CurveType == curveType).ToList());
 }
예제 #26
0
 // Token: 0x06002238 RID: 8760
 internal abstract Class320 vmethod_1(Vector2 vector2_0, int int_0, bool bool_0, HitObjectSoundType hitObjectSoundType_0, CurveTypes curveTypes_0, int int_1, double double_0, List<Vector2> list_0, List<HitObjectSoundType> list_1, int int_2, SampleSet sampleSet_0, SampleSet sampleSet_1, List<SampleSet> list_2, List<SampleSet> list_3, Enum38 enum38_0, int int_3, string string_0);
예제 #27
0
 internal override Slider CreateSlider(Vector2 startPosition, int startTime, bool newCombo,
                                       HitObjectSoundType soundType, CurveTypes curveType, int repeatCount, double sliderLength, List <Vector2> sliderPoints, List <HitObjectSoundType> soundTypes, int comboOffset, double velocity, double tickDistance, List <SampleSetInfo> sampleSets)
 {
     return(new Slider(hitObjectManager, startPosition, startTime, newCombo, comboOffset, soundType, curveType, repeatCount, sliderLength, sliderPoints, soundTypes, velocity, tickDistance, sampleSets));
 }
 /// <summary>
 /// AutoColoringEffect クラスの新しいインスタンスを初期化します。
 /// </summary>
 /// <param name="strm"></param>
 /// <param name="type"></param>
 public AutoColoringEffect(Stream strm, CurveTypes type)
 {
     Curve = new Curve(strm, type);
 }
예제 #29
0
        public void LoadFile()
        {
            spriteManager.ForwardPlayOptimisedAdd = true;

            beatmap.ControlPoints.Clear();

            FileSection currentSection = FileSection.Unknown;

            //Check file just before load -- ensures no modifications have occurred.
            //BeatmapManager.Current.UpdateChecksum();

            List <string> readableFiles = new List <string>();

            readableFiles.Add(beatmap.BeatmapFilename);

            string storyBoardFile = beatmap.StoryboardFilename;

            //if (beatmap.CheckFileExists(storyBoardFile))
            //    readableFiles.Add(storyBoardFile);

            //bool hasCustomColours = false;
            //bool firstColour = true;
            bool hitObjectPreInit = false;
            bool lastAddedSpinner = false;

            //bool verticalFlip = (GameBase.Mode == OsuModes.Play && Player.currentScore != null &&
            //                     ModManager.CheckActive(Player.currentScore.enabledMods, Mods.HardRock));

            int linenumber;

            //The first file will be the actual .osu file.
            //The second file is the .osb for now.
            for (int fn = 0; fn < readableFiles.Count; fn++)
            {
                if (fn > 0)
                {
                    break;
                    //don't handle storyboarding yet.

                    //baseReader = new StreamReader(BeatmapManager.Current.GetFileStream(readableFiles[fn]));
                    //LocatedTextReaderWrapper ltr = new LocatedTextReaderWrapper(baseReader);
                    //osqEngine = new osq.Encoder(ltr);
                }

                //using (TextReader reader = (fn == 0 ? (TextReader)new StreamReader(BeatmapManager.Current.GetFileStream(readableFiles[fn])) : new StringReader(osqEngine.Encode())))
                TextReader reader = new StreamReader(beatmap.GetFileStream(readableFiles[fn]));
                {
                    linenumber = 0;

                    string line = null;

                    bool readNew   = true;
                    int  objnumber = 0;

                    bool headerReadFinished = false;

                    while (true)
                    {
                        if (readNew)
                        {
                            line = reader.ReadLine();
                            if (line == null)
                            {
                                break;
                            }
                            linenumber++;
                        }

                        readNew = true;

                        if (line.Length == 0 || line.StartsWith(" ") || line.StartsWith("_") || line.StartsWith("//"))
                        {
                            continue;
                        }

                        //if (currentSection == FileSection.Events) ParseVariables(ref line);

                        string key = string.Empty;
                        string val = string.Empty;

                        if (!headerReadFinished)
                        {
                            string[] var = line.Split(':');

                            if (var.Length > 1)
                            {
                                key = var[0].Trim();
                                val = var[1].Trim();
                            }
                        }

                        if (line[0] == '[')
                        {
                            try
                            {
                                currentSection =
                                    (FileSection)Enum.Parse(typeof(FileSection), line.Trim('[', ']'));
                                if (currentSection == FileSection.HitObjects)
                                {
                                    headerReadFinished = true;
                                }
                            }
                            catch (Exception)
                            {
                            }

                            continue;
                        }

                        switch (currentSection)
                        {
                        case FileSection.ScoringMultipliers:
                            if (key == "HP")
                            {
                                beatmap.HpStreamAdjustmentMultiplier = double.Parse(val, GameBase.nfi);
                            }
                            else
                            {
                                Difficulty diff = (Difficulty)int.Parse(key);
                                beatmap.DifficultyInfo[diff] = new BeatmapDifficultyInfo(diff)
                                {
                                    ComboMultiplier = double.Parse(val, GameBase.nfi)
                                };
                            }

                            break;

                        case FileSection.General:
                            switch (key)
                            {
                            case "CountdownOffset":
                                if (val.Length > 0)
                                {
                                    beatmap.CountdownOffset = int.Parse(val);
                                }

                                break;
                            }

                            break;

                        case FileSection.TimingPoints:
                        {
                            string[] split = line.Split(',');

                            if (split.Length > 2)
                            {
                                beatmap.ControlPoints.Add(
                                    new ControlPoint(double.Parse(split[0], GameBase.nfi),
                                                     double.Parse(split[1], GameBase.nfi),
                                                     split[2][0] == '0' ? TimeSignatures.SimpleQuadruple : (TimeSignatures)int.Parse(split[2]),
                                                     (SampleSet)int.Parse(split[3]),
                                                     split.Length > 4
                                                ? (CustomSampleSet)int.Parse(split[4])
                                                : CustomSampleSet.Default,
                                                     int.Parse(split[5]),
                                                     split.Length > 6 ? split[6][0] == '1' : true,
                                                     split.Length > 7 ? split[7][0] == '1' : false));
                            }
                            break;
                        }

                        case FileSection.Editor:
                            switch (key)
                            {
                            case "Bookmarks":
                                if (val.Length > 0)
                                {
                                    beatmap.StreamSwitchPoints = new List <int>();
                                    string[] points = val.Split(',');
                                    foreach (string point in points)
                                    {
                                        beatmap.StreamSwitchPoints.Add(int.Parse(point.Trim()));
                                    }
                                }

                                break;
                            }

                            //not relevant
                            continue;

                        case FileSection.Difficulty:
                            switch (key)
                            {
                            case "HPDrainRate":
                                beatmap.DifficultyHpDrainRate = Math.Min((byte)10, Math.Max((byte)0, byte.Parse(val)));
                                break;

                            case "CircleSize":
                                beatmap.DifficultyCircleSize = Math.Min((byte)10, Math.Max((byte)0, byte.Parse(val)));
                                break;

                            case "OverallDifficulty":
                                beatmap.DifficultyOverall = Math.Min((byte)10, Math.Max((byte)0, byte.Parse(val)));
                                //if (!hasApproachRate) DifficultyApproachRate = DifficultyOverall;
                                break;

                            case "SliderMultiplier":
                                beatmap.DifficultySliderMultiplier =
                                    Math.Max(0.4, Math.Min(3.6, double.Parse(val, GameBase.nfi)));
                                break;

                            case "SliderTickRate":
                                beatmap.DifficultySliderTickRate =
                                    Math.Max(0.5, Math.Min(8, double.Parse(val, GameBase.nfi)));
                                break;

                                /*case "ApproachRate":
                                 *  beatmap.DifficultyApproachRate = Math.Min((byte)10, Math.Max((byte)0, byte.Parse(val)));
                                 *  hasApproachRate = true;
                                 *  break;*/
                            }

                            break;

                        case FileSection.HitObjects:
                        {
                            if (fn > 0)
                            {
                                continue;
                            }

                            if (!hitObjectPreInit)
                            {
                                //ComboColoursReset();
                                hitObjectPreInit = true;
                            }

                            string[] split = line.Split(',');

                            int offset = 0;

                            Difficulty difficulty = (Difficulty)int.Parse(split[offset++]);


                            SampleSetInfo ssi = parseSampleSet(split[offset++]);

                            int x    = (int)Math.Max(0, Math.Min(512, decimal.Parse(split[offset++], GameBase.nfi)));
                            int y    = (int)Math.Max(0, Math.Min(512, decimal.Parse(split[offset++], GameBase.nfi)));
                            int time = (int)decimal.Parse(split[offset++], GameBase.nfi);

                            if (objnumber == 0)
                            {
                                CountdownTime = time;
                            }
                            else
                            {
                                CountdownTime = Math.Min(CountdownTime, time);
                            }
                            objnumber++;

                            if (!shouldLoadDifficulty(difficulty))
                            {
                                continue;
                            }

                            HitObjectType      type        = (HitObjectType)int.Parse(split[offset], GameBase.nfi) & ~HitObjectType.ColourHax;
                            int                comboOffset = (Convert.ToInt32(split[offset++], GameBase.nfi) >> 4) & 7; // mask out bits 5-7 for combo offset.
                            HitObjectSoundType soundType   = (HitObjectSoundType)int.Parse(split[offset++], GameBase.nfi);

                            Vector2 pos = new Vector2(x, y);

                            bool newCombo = (type & HitObjectType.NewCombo) > 0 || lastAddedSpinner || StreamHitObjects[(int)difficulty] == null || StreamHitObjects[(int)difficulty].Count == 0;

                            HitObject h = null;

                            //used for new combo forcing after a spinner.
                            lastAddedSpinner = h is Spinner;

                            if ((type & HitObjectType.Circle) > 0)
                            {
                                h = hitFactory.CreateHitCircle(pos, time, newCombo, soundType, newCombo ? comboOffset : 0);
                            }
                            else if ((type & (HitObjectType.Slider | HitObjectType.Hold)) > 0)
                            {
                                CurveTypes                curveType   = CurveTypes.Bezier;
                                int                       repeatCount = 0;
                                double                    length      = 0;
                                List <Vector2>            points      = new List <Vector2>();
                                List <HitObjectSoundType> sounds      = null;

                                string[] pointsplit = split[offset++].Split('|');
                                for (int i = 0; i < pointsplit.Length; i++)
                                {
                                    if (pointsplit[i].Length == 1)
                                    {
                                        switch (pointsplit[i])
                                        {
                                        case "C":
                                            curveType = CurveTypes.Catmull;
                                            break;

                                        case "B":
                                            curveType = CurveTypes.Bezier;
                                            break;

                                        case "L":
                                            curveType = CurveTypes.Linear;
                                            break;

                                        case "P":
                                            curveType = CurveTypes.PerfectCurve;
                                            break;
                                        }

                                        continue;
                                    }

                                    string[] temp = pointsplit[i].Split(':');
                                    Vector2  v    = new Vector2((float)Convert.ToDouble(temp[0], GameBase.nfi),
                                                                (float)Convert.ToDouble(temp[1], GameBase.nfi));
                                    points.Add(v);
                                }

                                repeatCount = Convert.ToInt32(split[offset++], GameBase.nfi);

                                length = Convert.ToDouble(split[offset++], GameBase.nfi);

                                List <SampleSetInfo> listSampleSets = null;

                                //Per-endpoint Sample Additions
                                if (split[offset].Length > 0)
                                {
                                    string[] adds = split[offset++].Split('|');

                                    if (adds.Length > 0)
                                    {
                                        sounds = new List <HitObjectSoundType>(adds.Length);
                                        for (int i = 0; i < adds.Length; i++)
                                        {
                                            int sound;
                                            int.TryParse(adds[i], out sound);
                                            sounds.Add((HitObjectSoundType)sound);
                                        }
                                    }
                                }
                                else
                                {
                                    offset += 1;
                                }

                                if (split.Length > 13)
                                {
                                    string[] samplesets = split[13].Split(':');
                                    listSampleSets = new List <SampleSetInfo>(samplesets.Length);
                                    for (int i = 0; i < samplesets.Length; i++)
                                    {
                                        SampleSetInfo node_ssi = parseSampleSet(samplesets[i]);
                                        listSampleSets.Add(node_ssi);
                                    }
                                }

                                if ((repeatCount > 1 && length < 50) ||
                                    (repeatCount > 4 && length < 100) ||
                                    (type & HitObjectType.Hold) > 0)
                                {
                                    h = hitFactory.CreateHoldCircle(pos, time, newCombo, soundType, repeatCount, length, sounds, newCombo ? comboOffset : 0, Convert.ToDouble(split[offset++], GameBase.nfi), Convert.ToDouble(split[offset++], GameBase.nfi), listSampleSets);
                                }
                                else
                                {
                                    h = hitFactory.CreateSlider(pos, time, newCombo, soundType, curveType, repeatCount, length, points, sounds, newCombo ? comboOffset : 0, Convert.ToDouble(split[offset++], GameBase.nfi), Convert.ToDouble(split[offset++], GameBase.nfi), listSampleSets);
                                }
                            }
                            else if ((type & HitObjectType.Spinner) > 0)
                            {
                                h = hitFactory.CreateSpinner(time, Convert.ToInt32(split[offset++], GameBase.nfi), soundType);
                            }

                            //Make sure we have a valid  hitObject and actually add it to this manager.
                            if (h != null)
                            {
                                h.SampleSet = ssi;
                                Add(h, difficulty);
                            }
                        }
                        break;

                        case FileSection.Unknown:
                            continue;     //todo: readd this?  not sure if we need it anymore.
                        }
                    }
                }
            }

            PostProcessing();
        }
 /// <summary>
 /// Creates a new CurveSelector object with a given curve type and curve progression (if needed be).
 /// </summary>
 public CurveSelector(CurveTypes type, CurveProgressions progression = CurveProgressions.EaseIn)
 {
     CurveType        = type;
     CurveProgression = progression;
 }
예제 #31
0
 // Token: 0x06002C14 RID: 11284
 // RVA: 0x0011D950 File Offset: 0x0011BB50
 internal Class323(Class297 class297_1, Vector2 vector2_4, int int_12, bool bool_14, HitObjectSoundType hitObjectSoundType_0, CurveTypes curveTypes_2, int int_13, double double_3, List<Vector2> list_12, List<HitObjectSoundType> list_13, string string_2)
     : base(class297_1, vector2_4, int_12, bool_14, hitObjectSoundType_0, curveTypes_2, int_13, double_3, list_12, list_13, 0)
 {
     this.string_1 = string_2;
     this.class911_0 = null;
 }
예제 #32
0
 internal override Slider CreateSlider(Vector2 startPosition, int startTime, bool newCombo,
                                       HitObjectSoundType soundType, CurveTypes curveType)
 {
     return(new SliderTaiko(startPosition, startTime, newCombo, soundType, curveType));
 }
예제 #33
0
 internal abstract Slider CreateSlider(Vector2 startPosition, int startTime, bool newCombo,
                                       HitObjectSoundType soundType, CurveTypes curveType, int repeatCount, double sliderLength, List <Vector2> sliderPoints, List <HitObjectSoundType> soundTypes, int comboOffset,
                                       SampleSet sampleSet, SampleSet addSet, List <SampleSet> sampleSets, List <SampleSet> sampleSetAdditions, CustomSampleSet customSampleSet, int volume, string sampleFile);
예제 #34
0
        internal override Slider CreateSlider(Vector2 startPosition, int startTime, bool newCombo, HitObjectSoundType soundType, CurveTypes curveType, int repeatCount, double sliderLength,
                                              List <Vector2> sliderPoints, List <HitObjectSoundType> soundTypes, int comboOffset, SampleSet sampleSet, SampleSet addSet,
                                              List <SampleSet> sampleSets, List <SampleSet> sampleSetAdditions, CustomSampleSet customSampleSet, int volume, string sampleFile)
        {
            SliderFruits sf = new SliderFruits(hitObjectManager, startPosition, startTime, newCombo, soundType, curveType, repeatCount, sliderLength, sliderPoints, soundTypes, GetNextFruit());

            lastStartX    = sliderPoints[sliderPoints.Count - 1].X;
            lastStartTime = sf.EndTime;

            sf.SampleSet             = sampleSet;
            sf.SampleSetAdditions    = addSet;
            sf.SampleSetList         = sampleSets;
            sf.SampleSetAdditionList = sampleSetAdditions;
            sf.CustomSampleSet       = customSampleSet;
            sf.SampleVolume          = volume;
            sf.ProcessSampleFile(sampleFile);
            return(sf);
        }
예제 #35
0
 // Token: 0x06002C23 RID: 11299
 // RVA: 0x0011DD0C File Offset: 0x0011BF0C
 internal Class324(Class297 class297_1, Vector2 vector2_4, int int_13, bool bool_16, HitObjectSoundType hitObjectSoundType_0, CurveTypes curveTypes_2, int int_14, double double_5, List<Vector2> list_12, List<HitObjectSoundType> list_13, bool bool_17)
     : base(class297_1, vector2_4, int_13, bool_16, hitObjectSoundType_0, curveTypes_2, int_14, double_5, list_12, list_13, 0)
 {
     base.vmethod_0(new Color(252, 184, 6));
     this.bool_2 = bool_17;
 }
예제 #36
0
 /// <summary>
 /// AutoColoringEffect クラスの新しいインスタンスを初期化します。
 /// </summary>
 /// <param name="strm"></param>
 /// <param name="type"></param>
 public AutoColoringEffect(Stream strm, CurveTypes type)
 {
     Curve = new Curve(strm, type);
 }