Ejemplo n.º 1
0
        public override void SetValue(Channel.Value value)
        {
            base.SetValue(value);
            var channelInfo = ChannelValueInstances.GetInfo(value);

            IconImage.sprite  = channelInfo.EditorSprite;
            IconImage.enabled = channelInfo.EditorSprite != null;
        }
Ejemplo n.º 2
0
        private void OnRequestFrameValueSet(int frameIndex, int channelIndex, Channel.Value value)
        {
            var writer  = Editor.BeatmapWriter;
            var channel = writer.TypeInstance.ChannelFlyweights[channelIndex];

            if (channel.ValueFlyweights.Contains(value))
            {
                var command = new SetChannelValueCommand(writer,
                                                         () => new SetChannelValueCommand.Args(frameIndex, channelIndex, value));

                Editor.UndoStackComponent.ExecuteCommand(command);
                Editor.SetDirty();
            }
        }
Ejemplo n.º 3
0
        private int Compare()
        {
            List <Channel.Value> vList = _beatmap.Frames[_playerInput.ChannelIndex].GetValues();

            Channel.Value startValue = vList[_playerInput.StartIndex];

            if (startValue.Equals(ChannelValueInstances.Hit))
            {
                return(perfectScore);
            }
            else if (startValue.Equals(ChannelValueInstances.HoldBegin))
            {
                for (int i = _playerInput.StartIndex + 1; i < vList.Count && i < _playerInput.EndIndex; ++i)
                {
                    if (vList[i].Equals(ChannelValueInstances.HoldEnd))
                    {
                        return(holdScore * (i - _playerInput.StartIndex));
                    }
                }
                return(holdScore * (_playerInput.EndIndex - _playerInput.StartIndex));
            }
            else if (startValue.Equals(ChannelValueInstances.Empty))
            {
                // search left and right data close to startindex, find <hit> or <hold>
                // search right data(search <Hit> or <Hold Start>)
                for (int i = 1; i < greatSize + excellentSize + perfectSize && i + _playerInput.StartIndex < vList.Count; i++)
                {
                    // judge hit(perfect, excellent, great)
                    if (vList[i + _playerInput.StartIndex].Equals(ChannelValueInstances.Hit))
                    {
                        if (i < perfectSize)
                        {
                            return(perfectScore);
                        }
                        else if (i < perfectSize + excellentSize)
                        {
                            return(excellentScore);
                        }
                        else if (i < perfectSize + excellentSize + greatSize)
                        {
                            return(greatScore);
                        }
                    }
                    else if (vList[i + _playerInput.StartIndex].Equals(ChannelValueInstances.HoldBegin))
                    {
                        int startIndex = i + _playerInput.StartIndex;
                        // sum
                        for (int k = startIndex + 1; k < vList.Count && k < _playerInput.EndIndex; ++k)
                        {
                            if (vList[k].Equals(ChannelValueInstances.HoldEnd))
                            {
                                return(holdScore * (k - startIndex));
                            }
                        }
                        return(holdScore * (_playerInput.EndIndex - startIndex));
                    }
                }
                // search left data(search <Hit> or <Hold Start>)
                for (int i = 1; i < greatSize + excellentSize + perfectSize && _playerInput.StartIndex - i >= 0; i++)
                {
                    // judge hit(perfect, excellent, great)
                    if (vList[_playerInput.StartIndex - i].Equals(ChannelValueInstances.Hit))
                    {
                        if (i < perfectSize)
                        {
                            return(perfectScore);
                        }
                        else if (i < perfectSize + excellentSize)
                        {
                            return(excellentScore);
                        }
                        else if (i < perfectSize + excellentSize + greatSize)
                        {
                            return(greatScore);
                        }
                    }
                    else if (vList[_playerInput.StartIndex - i].Equals(ChannelValueInstances.HoldBegin))
                    {
                        int startIndex = _playerInput.StartIndex - i;
                        // sum
                        for (int k = _playerInput.StartIndex - i + 1; k < vList.Count && k < _playerInput.EndIndex; ++k)
                        {
                            if (vList[k].Equals(ChannelValueInstances.HoldEnd))
                            {
                                return(holdScore * (k - startIndex));
                            }
                        }
                        return(holdScore * (_playerInput.EndIndex - startIndex));
                    }
                }
            }

            return(missScore);
        }
Ejemplo n.º 4
0
 public Args(int frameIndex, int channelIndex, Channel.Value value)
 {
     FrameIndex   = frameIndex;
     ChannelIndex = channelIndex;
     Value        = value;
 }
Ejemplo n.º 5
0
        protected override void SpawnValueController_Late(Channel.Value newValue, int channelIndex, ValueController controller)
        {
            var castController = (EditorValueController)controller;

            castController.OnRequestRotate.AddListener(() => OnRequestValueRotate?.Invoke(channelIndex));  // Removed in controller's OnDestroy().
        }