本文整理汇总了C#中Range.Size方法的典型用法代码示例。如果您正苦于以下问题:C# Range.Size方法的具体用法?C# Range.Size怎么用?C# Range.Size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Range
的用法示例。
在下文中一共展示了Range.Size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnTick
protected override void OnTick(float delta)
{
base.OnTick(delta);
//NeedWorldDestroy
if (GameWorld.Instance.NeedWorldDestroy)
{
EntitySystemWorld.Instance.Simulation = false;
MapSystemWorld.MapDestroy();
EntitySystemWorld.Instance.WorldDestroy();
ScreenControlManager.Instance.Controls.Clear();
ScreenControlManager.Instance.Controls.Add(new MainMenuWindow());
return;
}
//If atop openly any window to not process
if (Controls.Count != 1)
return;
if (ScreenControlManager.Instance != null &&
ScreenControlManager.Instance.IsControlFocused())
return;
//update mouse relative mode
{
if (GetRealCameraType() == CameraType.Free && !FreeCameraMouseRotating)
EngineApp.Instance.MouseRelativeMode = false;
if (EntitySystemWorld.Instance.Simulation && GetRealCameraType() != CameraType.Free)
EngineApp.Instance.MouseRelativeMode = true;
if (DebugInformationWindow.Instance != null && !DebugInformationWindow.Instance.Background)
EngineApp.Instance.MouseRelativeMode = false;
}
if (GetRealCameraType() == CameraType.TPS && !IsCutSceneEnabled() &&
!EngineConsole.Instance.Active)
{
Range distanceRange = new Range(2, 200);
Range centerOffsetRange = new Range(0, 10);
float cameraDistance;
float cameraCenterOffset;
if (IsPlayerUnitVehicle())
{
cameraDistance = tpsVehicleCameraDistance;
cameraCenterOffset = tpsVehicleCameraCenterOffset;
}
else
{
cameraDistance = tpsCameraDistance;
cameraCenterOffset = tpsCameraCenterOffset;
}
if (EngineApp.Instance.IsKeyPressed(EKeys.PageUp))
{
cameraDistance -= delta * distanceRange.Size() / 20.0f;
if (cameraDistance < distanceRange[0])
cameraDistance = distanceRange[0];
}
if (EngineApp.Instance.IsKeyPressed(EKeys.PageDown))
{
cameraDistance += delta * distanceRange.Size() / 20.0f;
if (cameraDistance > distanceRange[1])
cameraDistance = distanceRange[1];
}
if (EngineApp.Instance.IsKeyPressed(EKeys.Home))
{
cameraCenterOffset += delta * centerOffsetRange.Size() / 4.0f;
if (cameraCenterOffset > centerOffsetRange[1])
cameraCenterOffset = centerOffsetRange[1];
}
if (EngineApp.Instance.IsKeyPressed(EKeys.End))
{
cameraCenterOffset -= delta * centerOffsetRange.Size() / 4.0f;
if (cameraCenterOffset < centerOffsetRange[0])
cameraCenterOffset = centerOffsetRange[0];
}
if (IsPlayerUnitVehicle())
{
tpsVehicleCameraDistance = cameraDistance;
tpsVehicleCameraCenterOffset = cameraCenterOffset;
}
else
{
tpsCameraDistance = cameraDistance;
tpsCameraCenterOffset = cameraCenterOffset;
}
}
//GameControlsManager
if (EntitySystemWorld.Instance.Simulation)
{
if (GetRealCameraType() != CameraType.Free && !IsCutSceneEnabled())
GameControlsManager.Instance.DoTick(delta);
//.........这里部分代码省略.........
示例2: OnTick
protected override void OnTick( float delta )
{
base.OnTick( delta );
//NeedWorldDestroy
if( GameWorld.Instance.NeedWorldDestroy )
{
if( EntitySystemWorld.Instance.IsServer() || EntitySystemWorld.Instance.IsSingle() )
EntitySystemWorld.Instance.Simulation = false;
MapSystemWorld.MapDestroy();
EntitySystemWorld.Instance.WorldDestroy();
GameEngineApp.Instance.Server_DestroyServer( "The server has been destroyed" );
GameEngineApp.Instance.Client_DisconnectFromServer();
//close all windows
foreach( EControl control in GameEngineApp.Instance.ControlManager.Controls )
control.SetShouldDetach();
//create main menu
GameEngineApp.Instance.ControlManager.Controls.Add( new MainMenuWindow() );
return;
}
//If atop openly any window to not process
if( Controls.Count != 1 )
return;
if( GameEngineApp.Instance.ControlManager != null &&
GameEngineApp.Instance.ControlManager.IsControlFocused() )
return;
//update mouse relative mode
{
bool relative = EngineApp.Instance.MouseRelativeMode;
if( GetRealCameraType() == CameraType.Free && !FreeCameraMouseRotating )
relative = false;
if( EntitySystemWorld.Instance.Simulation && GetRealCameraType() != CameraType.Free )
relative = true;
if( DebugInformationWindow.Instance != null && !DebugInformationWindow.Instance.Background )
relative = false;
EngineApp.Instance.MouseRelativeMode = relative;
}
bool activeConsole = EngineConsole.Instance != null && EngineConsole.Instance.Active;
if( GetRealCameraType() == CameraType.TPS && !IsCutSceneEnabled() && !activeConsole )
{
Range distanceRange = new Range( 2, 200 );
Range centerOffsetRange = new Range( 0, 10 );
float cameraDistance;
float cameraCenterOffset;
if( IsPlayerUnitVehicle() )
{
cameraDistance = tpsVehicleCameraDistance;
cameraCenterOffset = tpsVehicleCameraCenterOffset;
}
else
{
cameraDistance = tpsCameraDistance;
cameraCenterOffset = tpsCameraCenterOffset;
}
if( EngineApp.Instance.IsKeyPressed( EKeys.PageUp ) )
{
cameraDistance -= delta * distanceRange.Size() / 20.0f;
if( cameraDistance < distanceRange[ 0 ] )
cameraDistance = distanceRange[ 0 ];
}
if( EngineApp.Instance.IsKeyPressed( EKeys.PageDown ) )
{
cameraDistance += delta * distanceRange.Size() / 20.0f;
if( cameraDistance > distanceRange[ 1 ] )
cameraDistance = distanceRange[ 1 ];
}
if( EngineApp.Instance.IsKeyPressed( EKeys.Home ) )
{
cameraCenterOffset += delta * centerOffsetRange.Size() / 4.0f;
if( cameraCenterOffset > centerOffsetRange[ 1 ] )
cameraCenterOffset = centerOffsetRange[ 1 ];
}
if( EngineApp.Instance.IsKeyPressed( EKeys.End ) )
{
cameraCenterOffset -= delta * centerOffsetRange.Size() / 4.0f;
if( cameraCenterOffset < centerOffsetRange[ 0 ] )
cameraCenterOffset = centerOffsetRange[ 0 ];
}
if( IsPlayerUnitVehicle() )
{
tpsVehicleCameraDistance = cameraDistance;
tpsVehicleCameraCenterOffset = cameraCenterOffset;
//.........这里部分代码省略.........
示例3: OnTick
protected override void OnTick(float delta)
{
base.OnTick(delta);
TickAKunitCamera(delta);
//chatshit
if (chatMessageEditBox != null)
{
chatMessageEditBox = hudControl.Controls["Game/ChatMessage"] as EditBox;
chatMessageEditBox.PreKeyDown += ChatMessageEditBox_PreKeyDown;
if (EntitySystemWorld.Instance.IsSingle())
{
//hide chat edit box for single mode
if (hudControl.Controls["ChatText"] != null)
hudControl.Controls["ChatText"].Visible = false;
if (hudControl.Controls["Game/ChatMessage"] != null)
hudControl.Controls["Game/ChatMessage"].Visible = false;
}
if (!chatfirstclean && chatMessageEditBox.Text == "j")
{
chatMessageEditBox.Text = "";
chatfirstclean = true;
}
}
//NeedWorldDestroy
if (GameWorld.Instance.NeedWorldDestroy)
{
if (EntitySystemWorld.Instance.IsServer() || EntitySystemWorld.Instance.IsSingle())
EntitySystemWorld.Instance.Simulation = false;
MapSystemWorld.MapDestroy();
EntitySystemWorld.Instance.WorldDestroy();
GameEngineApp.Instance.Server_DestroyServer("The server has been destroyed");
GameEngineApp.Instance.Client_DisconnectFromServer();
//close all windows
foreach (Control control in GameEngineApp.Instance.ControlManager.Controls)
control.SetShouldDetach();
//create main menu
GameEngineApp.Instance.ControlManager.Controls.Add(new MainMenuWindow());
return;
}
//If atop openly any window to not process
if (Controls.Count != 1)
return;
if (GameEngineApp.Instance.ControlManager.IsControlFocused())
return;
//update mouse relative mode
{
//!!!!!!mb not here
if (GetRealCameraType() == CameraType.Free && !FreeCameraMouseRotating)
EngineApp.Instance.MouseRelativeMode = false;
if (EntitySystemWorld.Instance.Simulation && GetRealCameraType() != CameraType.Free)
EngineApp.Instance.MouseRelativeMode = true;
if (GameEngineApp.Instance.ControlManager != null &&
GameEngineApp.Instance.ControlManager.IsControlFocused())
EngineApp.Instance.MouseRelativeMode = false;
}
if (GetRealCameraType() == CameraType.TPS && !IsCutSceneEnabled() &&
!EngineConsole.Instance.Active)
{
Range distanceRange = new Range(2, 200);
Range centerOffsetRange = new Range(0, 10);
float cameraDistance;
float cameraCenterOffset;
if (IsPlayerUnitVehicle())
{
cameraDistance = tpsVehicleCameraDistance;
cameraCenterOffset = tpsVehicleCameraCenterOffset;
}
else
{
cameraDistance = tpsCameraDistance;
cameraCenterOffset = tpsCameraCenterOffset;
}
if (EngineApp.Instance.IsKeyPressed(EKeys.PageUp))
{
cameraDistance -= delta * distanceRange.Size() / 20.0f;
if (cameraDistance < distanceRange[0])
cameraDistance = distanceRange[0];
}
if (EngineApp.Instance.IsKeyPressed(EKeys.PageDown))
{
cameraDistance += delta * distanceRange.Size() / 20.0f;
if (cameraDistance > distanceRange[1])
cameraDistance = distanceRange[1];
//.........这里部分代码省略.........