mirror of
https://github.com/ppy/osu.git
synced 2025-03-05 09:13:21 +08:00
Code reformat
This commit is contained in:
parent
48008cd7e6
commit
a33dfbba25
@ -18,7 +18,7 @@ namespace osu.Game.Graphics.Cursor
|
||||
{
|
||||
public class MenuCursor : CursorContainer
|
||||
{
|
||||
protected override Drawable CreateCursor() => new Cursor();
|
||||
protected override Drawable CreateCursor () => new Cursor();
|
||||
|
||||
private Bindable<bool> cursorRotate;
|
||||
|
||||
@ -26,10 +26,9 @@ namespace osu.Game.Graphics.Cursor
|
||||
|
||||
private bool startRotation;
|
||||
|
||||
protected override bool OnMouseMove(InputState state)
|
||||
protected override bool OnMouseMove (InputState state)
|
||||
{
|
||||
if (cursorRotate && dragging)
|
||||
{
|
||||
if (cursorRotate && dragging) {
|
||||
Debug.Assert (state.Mouse.PositionMouseDown != null);
|
||||
|
||||
// don't start rotating until we're moved a minimum distance away from the mouse down location,
|
||||
@ -52,61 +51,60 @@ namespace osu.Game.Graphics.Cursor
|
||||
}
|
||||
}
|
||||
|
||||
return base.OnMouseMove(state);
|
||||
return base.OnMouseMove (state);
|
||||
}
|
||||
|
||||
protected override bool OnDragStart(InputState state)
|
||||
protected override bool OnDragStart (InputState state)
|
||||
{
|
||||
dragging = true;
|
||||
return base.OnDragStart(state);
|
||||
return base.OnDragStart (state);
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||
protected override bool OnMouseDown (InputState state, MouseDownEventArgs args)
|
||||
{
|
||||
ActiveCursor.Scale = new Vector2(1);
|
||||
ActiveCursor.ScaleTo(0.90f, 800, Easing.OutQuint);
|
||||
ActiveCursor.Scale = new Vector2 (1);
|
||||
ActiveCursor.ScaleTo (0.90f, 800, Easing.OutQuint);
|
||||
|
||||
((Cursor)ActiveCursor).AdditiveLayer.Alpha = 0;
|
||||
((Cursor)ActiveCursor).AdditiveLayer.FadeInFromZero(800, Easing.OutQuint);
|
||||
return base.OnMouseDown(state, args);
|
||||
((Cursor)ActiveCursor).AdditiveLayer.FadeInFromZero (800, Easing.OutQuint);
|
||||
return base.OnMouseDown (state, args);
|
||||
}
|
||||
|
||||
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
|
||||
protected override bool OnMouseUp (InputState state, MouseUpEventArgs args)
|
||||
{
|
||||
if (!state.Mouse.HasMainButtonPressed)
|
||||
{
|
||||
if (!state.Mouse.HasMainButtonPressed) {
|
||||
dragging = false;
|
||||
startRotation = false;
|
||||
|
||||
((Cursor)ActiveCursor).AdditiveLayer.FadeOut(500, Easing.OutQuint);
|
||||
ActiveCursor.RotateTo(0, 600 * (1 + Math.Abs(ActiveCursor.Rotation / 720)), Easing.OutElasticHalf);
|
||||
ActiveCursor.ScaleTo(1, 500, Easing.OutElastic);
|
||||
((Cursor)ActiveCursor).AdditiveLayer.FadeOut (500, Easing.OutQuint);
|
||||
ActiveCursor.RotateTo (0, 600 * (1 + Math.Abs (ActiveCursor.Rotation / 720)), Easing.OutElasticHalf);
|
||||
ActiveCursor.ScaleTo (1, 500, Easing.OutElastic);
|
||||
}
|
||||
|
||||
return base.OnMouseUp(state, args);
|
||||
return base.OnMouseUp (state, args);
|
||||
}
|
||||
|
||||
protected override bool OnClick(InputState state)
|
||||
protected override bool OnClick (InputState state)
|
||||
{
|
||||
((Cursor)ActiveCursor).AdditiveLayer.FadeOutFromOne(500, Easing.OutQuint);
|
||||
((Cursor)ActiveCursor).AdditiveLayer.FadeOutFromOne (500, Easing.OutQuint);
|
||||
|
||||
return base.OnClick(state);
|
||||
return base.OnClick (state);
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
protected override void PopIn ()
|
||||
{
|
||||
ActiveCursor.FadeTo(1, 250, Easing.OutQuint);
|
||||
ActiveCursor.ScaleTo(1, 400, Easing.OutQuint);
|
||||
ActiveCursor.FadeTo (1, 250, Easing.OutQuint);
|
||||
ActiveCursor.ScaleTo (1, 400, Easing.OutQuint);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
protected override void PopOut ()
|
||||
{
|
||||
ActiveCursor.FadeTo(0, 900, Easing.OutQuint);
|
||||
ActiveCursor.ScaleTo(0, 500, Easing.In);
|
||||
ActiveCursor.FadeTo (0, 900, Easing.OutQuint);
|
||||
ActiveCursor.ScaleTo (0, 500, Easing.In);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
private void load (OsuConfigManager config)
|
||||
{
|
||||
cursorRotate = config.GetBindable<bool> (OsuSetting.CursorRotation);
|
||||
}
|
||||
@ -120,7 +118,7 @@ namespace osu.Game.Graphics.Cursor
|
||||
|
||||
public Sprite AdditiveLayer;
|
||||
|
||||
public Cursor()
|
||||
public Cursor ()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
}
|
||||
@ -128,30 +126,25 @@ namespace osu.Game.Graphics.Cursor
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config, TextureStore textures, OsuColour colour)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
cursorContainer = new Container
|
||||
{
|
||||
Children = new Drawable[] {
|
||||
cursorContainer = new Container {
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Sprite
|
||||
{
|
||||
Texture = textures.Get(@"Cursor/menu-cursor"),
|
||||
Children = new Drawable[] {
|
||||
new Sprite {
|
||||
Texture = textures.Get (@"Cursor/menu-cursor"),
|
||||
},
|
||||
AdditiveLayer = new Sprite
|
||||
{
|
||||
AdditiveLayer = new Sprite {
|
||||
Blending = BlendingMode.Additive,
|
||||
Colour = colour.Pink,
|
||||
Alpha = 0,
|
||||
Texture = textures.Get(@"Cursor/menu-cursor-additive"),
|
||||
Texture = textures.Get (@"Cursor/menu-cursor-additive"),
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
cursorScale = config.GetBindable<double>(OsuSetting.MenuCursorSize);
|
||||
cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)newScale * base_scale);
|
||||
cursorScale = config.GetBindable<double> (OsuSetting.MenuCursorSize);
|
||||
cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2 ((float)newScale * base_scale);
|
||||
cursorScale.TriggerChange();
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
@ -23,7 +23,6 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<LangVersion>6</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
@ -33,7 +32,6 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
@ -561,11 +559,11 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\osu-framework\osu.Framework\osu.Framework.csproj">
|
||||
<Project>{c76bf5b3-985e-4d39-95fe-97c9c879b83a}</Project>
|
||||
<Project>{C76BF5B3-985E-4D39-95FE-97C9C879B83A}</Project>
|
||||
<Name>osu.Framework</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\osu-resources\osu.Game.Resources\osu.Game.Resources.csproj">
|
||||
<Project>{d9a367c9-4c1a-489f-9b05-a0cea2b53b58}</Project>
|
||||
<Project>{D9A367C9-4C1A-489F-9B05-A0CEA2B53B58}</Project>
|
||||
<Name>osu.Game.Resources</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
@ -585,4 +583,14 @@
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<ProjectExtensions>
|
||||
<MonoDevelop>
|
||||
<Properties>
|
||||
<Policies>
|
||||
<TextStylePolicy inheritsSet="VisualStudio" inheritsScope="text/plain" scope="text/x-csharp" />
|
||||
<CSharpFormattingPolicy IndentSwitchBody="True" IndentBlocksInsideExpressions="True" AnonymousMethodBraceStyle="NextLine" PropertyBraceStyle="NextLine" PropertyGetBraceStyle="NextLine" PropertySetBraceStyle="NextLine" EventBraceStyle="NextLine" EventAddBraceStyle="NextLine" EventRemoveBraceStyle="NextLine" StatementBraceStyle="NextLine" ElseNewLinePlacement="NewLine" CatchNewLinePlacement="NewLine" FinallyNewLinePlacement="NewLine" WhileNewLinePlacement="DoNotCare" ArrayInitializerWrapping="DoNotChange" ArrayInitializerBraceStyle="NextLine" BeforeMethodDeclarationParentheses="False" BeforeMethodCallParentheses="False" BeforeConstructorDeclarationParentheses="False" NewLineBeforeConstructorInitializerColon="NewLine" NewLineAfterConstructorInitializerColon="SameLine" BeforeDelegateDeclarationParentheses="False" NewParentheses="False" SpacesBeforeBrackets="False" inheritsSet="Mono" inheritsScope="text/x-csharp" scope="text/x-csharp" />
|
||||
</Policies>
|
||||
</Properties>
|
||||
</MonoDevelop>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user