More easily readable netstats (B/kB/MB instead of just B), scrollable netstats client list, possible to wear multiple items in same limb, handcuffs
This commit is contained in:
@@ -76,19 +76,16 @@
|
|||||||
<sound file ="Content/step.ogg"/>
|
<sound file ="Content/step.ogg"/>
|
||||||
</limb>
|
</limb>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- head to body -->
|
<!-- head to body -->
|
||||||
<joint limb1="0" limb1anchor="0,-7" limb2="1" limb2anchor="-1,26" lowerlimit="-90" upperlimit="45"/>
|
<joint limb1="0" limb1anchor="0,-7" limb2="1" limb2anchor="-1,26" lowerlimit="-90" upperlimit="45"/>
|
||||||
<joint limb1="1" limb1anchor="0,-17" limb2="12" limb2anchor="0,7" lowerlimit="-10" upperlimit="10"/>
|
<joint limb1="1" limb1anchor="0,-17" limb2="12" limb2anchor="0,7" lowerlimit="-10" upperlimit="10"/>
|
||||||
|
|
||||||
|
|
||||||
<!-- body to left arm -->
|
<!-- body to left arm -->
|
||||||
<joint limb1="1" limb1anchor="-3,14" limb2="2" limb2anchor="0,12"/>
|
<joint limb1="1" limb1anchor="-3,14" limb2="2" limb2anchor="0,12"/>
|
||||||
<joint limb1="2" limb1anchor="0,-16" limb2="3" limb2anchor="-2,19" lowerlimit="0" upperlimit="170"/>
|
<joint limb1="2" limb1anchor="0,-16" limb2="3" limb2anchor="-2,19" lowerlimit="5" upperlimit="170"/>
|
||||||
<!-- body to right arm -->
|
<!-- body to right arm -->
|
||||||
<joint limb1="1" limb1anchor="-3,14" limb2="4" limb2anchor="0,12"/>
|
<joint limb1="1" limb1anchor="-3,14" limb2="4" limb2anchor="0,12"/>
|
||||||
<joint limb1="4" limb1anchor="0,-16" limb2="5" limb2anchor="-2,19" lowerlimit="0" upperlimit="170"/>
|
<joint limb1="4" limb1anchor="0,-16" limb2="5" limb2anchor="-2,19" lowerlimit="5" upperlimit="170"/>
|
||||||
|
|
||||||
<!-- body to left leg -->
|
<!-- body to left leg -->
|
||||||
<joint limb1="12" limb1anchor="0,-1" limb2="6" limb2anchor="0,14" lowerlimit="-30" upperlimit="120"/>
|
<joint limb1="12" limb1anchor="0,-1" limb2="6" limb2anchor="0,14" lowerlimit="-30" upperlimit="120"/>
|
||||||
|
|||||||
@@ -95,6 +95,24 @@
|
|||||||
</Wearable>
|
</Wearable>
|
||||||
</Item>
|
</Item>
|
||||||
|
|
||||||
|
<Item
|
||||||
|
name="Handcuffs"
|
||||||
|
category="Equipment"
|
||||||
|
pickdistance="150"
|
||||||
|
tags="smallitem" >
|
||||||
|
|
||||||
|
<Sprite texture = "securitygear.png" sourcerect="0,63,32,14" depth="0.6"/>
|
||||||
|
|
||||||
|
<Body width="30" height="12"/>
|
||||||
|
|
||||||
|
<Wearable slots="Any,RightHand+LeftHand">
|
||||||
|
<sprite texture="securitygear.png" limb="RightHand" sourcerect="32,62,16,16" origin="0.5,-0.5" depth="0.01"/>
|
||||||
|
<sprite texture="securitygear.png" limb="LeftHand" sourcerect="32,62,16,16" origin="0.5,-0.5" depth="0.01"/>
|
||||||
|
|
||||||
|
<StatusEffect type="OnWearing" target="Character" lockhands="true" setvalue="true"/>
|
||||||
|
</Wearable>
|
||||||
|
</Item>
|
||||||
|
|
||||||
<Item
|
<Item
|
||||||
name="Orange Jumpsuit"
|
name="Orange Jumpsuit"
|
||||||
category="Equipment"
|
category="Equipment"
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 14 KiB |
@@ -128,16 +128,46 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
strongestImpact = 0.0f;
|
strongestImpact = 0.0f;
|
||||||
|
|
||||||
|
if (character.LockHands)
|
||||||
|
{
|
||||||
|
var leftHand = GetLimb(LimbType.LeftHand);
|
||||||
|
var rightHand = GetLimb(LimbType.RightHand);
|
||||||
|
|
||||||
|
var waist = GetLimb(LimbType.Waist);
|
||||||
|
|
||||||
|
rightHand.Disabled = true;
|
||||||
|
leftHand.Disabled = true;
|
||||||
|
|
||||||
|
|
||||||
|
Vector2 midPos = waist.SimPosition;
|
||||||
|
|
||||||
|
Matrix torsoTransform = Matrix.CreateRotationZ(waist.Rotation);
|
||||||
|
|
||||||
|
|
||||||
|
midPos += Vector2.Transform(new Vector2(-0.3f*Dir,-0.2f), torsoTransform);
|
||||||
|
|
||||||
|
if (rightHand.pullJoint.Enabled) midPos = (midPos + rightHand.pullJoint.WorldAnchorB) / 2.0f;
|
||||||
|
|
||||||
|
HandIK(rightHand, midPos);
|
||||||
|
HandIK(leftHand, midPos);
|
||||||
|
|
||||||
|
//rightHand.pullJoint.Enabled = true;
|
||||||
|
//rightHand.pullJoint.WorldAnchorB = midPos;
|
||||||
|
|
||||||
|
//rightHand.pullJoint.Enabled = true;
|
||||||
|
//rightHand.pullJoint.WorldAnchorB = midPos;
|
||||||
|
}
|
||||||
|
|
||||||
if (stunTimer > 0)
|
if (stunTimer > 0)
|
||||||
{
|
{
|
||||||
stunTimer -= deltaTime;
|
stunTimer -= deltaTime;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Anim != Animation.UsingConstruction) ResetPullJoints();
|
|
||||||
|
|
||||||
if (TargetDir != dir) Flip();
|
if (TargetDir != dir) Flip();
|
||||||
|
|
||||||
|
if (Anim != Animation.UsingConstruction) ResetPullJoints();
|
||||||
|
|
||||||
if (SimplePhysicsEnabled)
|
if (SimplePhysicsEnabled)
|
||||||
{
|
{
|
||||||
UpdateStandingSimple();
|
UpdateStandingSimple();
|
||||||
@@ -815,7 +845,17 @@ namespace Barotrauma
|
|||||||
|
|
||||||
|
|
||||||
target.AnimController.IgnorePlatforms = IgnorePlatforms;
|
target.AnimController.IgnorePlatforms = IgnorePlatforms;
|
||||||
target.AnimController.TargetMovement = TargetMovement;
|
|
||||||
|
if (target.Stun > 0.0f || target.IsDead)
|
||||||
|
{
|
||||||
|
target.AnimController.TargetMovement = TargetMovement;
|
||||||
|
}
|
||||||
|
else if (target is AICharacter)
|
||||||
|
{
|
||||||
|
target.AnimController.TargetMovement = Vector2.Lerp(target.AnimController.TargetMovement, (character.SimPosition + Vector2.UnitX*Dir) - target.SimPosition, 0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void HoldItem(float deltaTime, Item item, Vector2[] handlePos, Vector2 holdPos, Vector2 aimPos, bool aim, float holdAngle)
|
public override void HoldItem(float deltaTime, Item item, Vector2[] handlePos, Vector2 holdPos, Vector2 aimPos, bool aim, float holdAngle)
|
||||||
@@ -994,12 +1034,14 @@ namespace Barotrauma
|
|||||||
case LimbType.LeftArm:
|
case LimbType.LeftArm:
|
||||||
case LimbType.RightHand:
|
case LimbType.RightHand:
|
||||||
case LimbType.RightArm:
|
case LimbType.RightArm:
|
||||||
difference = limb.body.SimPosition - torso.SimPosition;
|
if (!limb.pullJoint.Enabled)
|
||||||
difference = Vector2.Transform(difference, torsoTransform);
|
{
|
||||||
difference.Y = -difference.Y;
|
difference = limb.body.SimPosition - torso.SimPosition;
|
||||||
|
difference = Vector2.Transform(difference, torsoTransform);
|
||||||
TrySetLimbPosition(limb, limb.SimPosition, torso.SimPosition + Vector2.Transform(difference, -torsoTransform));
|
difference.Y = -difference.Y;
|
||||||
|
|
||||||
|
TrySetLimbPosition(limb, limb.SimPosition, torso.SimPosition + Vector2.Transform(difference, -torsoTransform));
|
||||||
|
}
|
||||||
limb.body.SetTransform(limb.body.SimPosition, -limb.body.Rotation);
|
limb.body.SetTransform(limb.body.SimPosition, -limb.body.Rotation);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -149,6 +149,19 @@ namespace Barotrauma
|
|||||||
get { return inventory; }
|
get { return inventory; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private float lockHandsTimer;
|
||||||
|
public bool LockHands
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return lockHandsTimer > 0.0f;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
lockHandsTimer = MathHelper.Clamp(lockHandsTimer + (value ? 1.0f : -0.5f), 0.0f, 10.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Vector2 CursorPosition
|
public Vector2 CursorPosition
|
||||||
{
|
{
|
||||||
get { return cursorPosition; }
|
get { return cursorPosition; }
|
||||||
@@ -304,14 +317,6 @@ namespace Barotrauma
|
|||||||
public bool IsDead
|
public bool IsDead
|
||||||
{
|
{
|
||||||
get { return isDead; }
|
get { return isDead; }
|
||||||
//set
|
|
||||||
//{
|
|
||||||
// if (isDead == value) return;
|
|
||||||
// if (isDead)
|
|
||||||
// {
|
|
||||||
// Revive(false);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CauseOfDeath CauseOfDeath
|
public CauseOfDeath CauseOfDeath
|
||||||
@@ -319,6 +324,14 @@ namespace Barotrauma
|
|||||||
get { return causeOfDeath; }
|
get { return causeOfDeath; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool CanBeSelected
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return isDead || Stun > 0.0f || LockHands;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override Vector2 SimPosition
|
public override Vector2 SimPosition
|
||||||
{
|
{
|
||||||
get { return AnimController.RefLimb.SimPosition; }
|
get { return AnimController.RefLimb.SimPosition; }
|
||||||
@@ -658,8 +671,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (selectedCharacter!=null)
|
if (selectedCharacter!=null)
|
||||||
{
|
{
|
||||||
if (Vector2.Distance(selectedCharacter.SimPosition, SimPosition) > 3.0f ||
|
if (Vector2.Distance(selectedCharacter.SimPosition, SimPosition) > 2.0f || !selectedCharacter.CanBeSelected)
|
||||||
(!selectedCharacter.isDead && selectedCharacter.Stun <= 0.0f))
|
|
||||||
{
|
{
|
||||||
DeselectCharacter();
|
DeselectCharacter();
|
||||||
}
|
}
|
||||||
@@ -765,9 +777,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
selectedCharacter = character;
|
selectedCharacter = character;
|
||||||
|
|
||||||
if (createNetworkEvent)
|
if (createNetworkEvent) new NetworkEvent(NetworkEventType.SelectCharacter, ID, true, selectedCharacter.ID);
|
||||||
new NetworkEvent(NetworkEventType.SelectCharacter, ID, true, selectedCharacter.ID);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeselectCharacter(bool createNetworkEvent = true)
|
private void DeselectCharacter(bool createNetworkEvent = true)
|
||||||
@@ -820,8 +830,6 @@ namespace Barotrauma
|
|||||||
(AnimController.CurrentHull.LethalPressure - 50.0f) / 50.0f);
|
(AnimController.CurrentHull.LethalPressure - 50.0f) / 50.0f);
|
||||||
}
|
}
|
||||||
cam.OffsetAmount = MathHelper.Lerp(cam.OffsetAmount, (Submarine == null ? 400.0f : 250.0f)+pressureEffect, 0.05f);
|
cam.OffsetAmount = MathHelper.Lerp(cam.OffsetAmount, (Submarine == null ? 400.0f : 250.0f)+pressureEffect, 0.05f);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cursorPosition = cam.ScreenToWorld(PlayerInput.MousePosition);
|
cursorPosition = cam.ScreenToWorld(PlayerInput.MousePosition);
|
||||||
@@ -844,66 +852,65 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//find the closest item if selectkey has been hit, or if the Character is being
|
if (!LockHands)
|
||||||
//controlled by the player (in order to highlight it)
|
|
||||||
|
|
||||||
if (findClosestTimer <= 0.0f || Screen.Selected == GameMain.EditMapScreen)
|
|
||||||
{
|
{
|
||||||
closestCharacter = FindClosestCharacter(mouseSimPos);
|
//find the closest item if selectkey has been hit, or if the Character is being
|
||||||
if (closestCharacter != null && closestCharacter.info==null)
|
//controlled by the player (in order to highlight it)
|
||||||
{
|
|
||||||
closestCharacter = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
closestItem = FindClosestItem(mouseSimPos);
|
if (findClosestTimer <= 0.0f || Screen.Selected == GameMain.EditMapScreen)
|
||||||
|
|
||||||
if (closestCharacter != null && closestItem != null)
|
|
||||||
{
|
{
|
||||||
if (Vector2.Distance(closestCharacter.SimPosition, mouseSimPos) < Vector2.Distance(closestItem.SimPosition, mouseSimPos))
|
closestCharacter = FindClosestCharacter(mouseSimPos);
|
||||||
{
|
if (closestCharacter != null && closestCharacter.info==null)
|
||||||
if (selectedConstruction != closestItem) closestItem = null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
closestCharacter = null;
|
closestCharacter = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
closestItem = FindClosestItem(mouseSimPos);
|
||||||
|
|
||||||
|
if (closestCharacter != null && closestItem != null)
|
||||||
|
{
|
||||||
|
if (Vector2.Distance(closestCharacter.SimPosition, mouseSimPos) < Vector2.Distance(closestItem.SimPosition, mouseSimPos))
|
||||||
|
{
|
||||||
|
if (selectedConstruction != closestItem) closestItem = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
closestCharacter = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
findClosestTimer = 0.1f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
findClosestTimer -= deltaTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
findClosestTimer = 0.1f;
|
if (selectedCharacter == null && closestItem != null)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
findClosestTimer -= deltaTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selectedCharacter == null)
|
|
||||||
{
|
|
||||||
if (closestItem != null)
|
|
||||||
{
|
{
|
||||||
closestItem.IsHighlighted = true;
|
closestItem.IsHighlighted = true;
|
||||||
if (closestItem.Pick(this))
|
if (!LockHands && closestItem.Pick(this))
|
||||||
{
|
{
|
||||||
new NetworkEvent(NetworkEventType.PickItem, ID, true,
|
new NetworkEvent(NetworkEventType.PickItem, ID, true,
|
||||||
new int[]
|
new int[]
|
||||||
{
|
{
|
||||||
closestItem.ID,
|
closestItem.ID,
|
||||||
IsKeyHit(InputType.Select) ? 1 : 0,
|
IsKeyHit(InputType.Select) ? 1 : 0,
|
||||||
IsKeyHit(InputType.Use) ? 1 : 0
|
IsKeyHit(InputType.Use) ? 1 : 0
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (IsKeyHit(InputType.Select))
|
if (IsKeyHit(InputType.Select))
|
||||||
{
|
|
||||||
if (selectedCharacter != null)
|
|
||||||
{
|
{
|
||||||
DeselectCharacter();
|
if (selectedCharacter != null)
|
||||||
}
|
{
|
||||||
else if (closestCharacter != null && closestCharacter.IsHumanoid &&
|
DeselectCharacter();
|
||||||
(closestCharacter.isDead || closestCharacter.AnimController.StunTimer > 0.0f))
|
}
|
||||||
{
|
else if (closestCharacter != null && closestCharacter.IsHumanoid && closestCharacter.CanBeSelected)
|
||||||
SelectCharacter(closestCharacter);
|
{
|
||||||
|
SelectCharacter(closestCharacter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1003,6 +1010,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
Health -= bleeding*deltaTime;
|
Health -= bleeding*deltaTime;
|
||||||
if (health <= 0.0f) Kill(CauseOfDeath.Bloodloss, false);
|
if (health <= 0.0f) Kill(CauseOfDeath.Bloodloss, false);
|
||||||
|
|
||||||
|
if (!IsDead) LockHands = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -56,16 +56,16 @@ namespace Barotrauma
|
|||||||
|
|
||||||
DrawStatusIcons(spriteBatch, character);
|
DrawStatusIcons(spriteBatch, character);
|
||||||
|
|
||||||
if (character.Inventory != null) character.Inventory.DrawOwn(spriteBatch);
|
if (character.Inventory != null && !character.LockHands) character.Inventory.DrawOwn(spriteBatch, Vector2.Zero);
|
||||||
|
|
||||||
if (character.SelectedCharacter != null && character.SelectedCharacter.Inventory!=null)
|
if (character.SelectedCharacter != null && character.SelectedCharacter.Inventory!=null)
|
||||||
{
|
{
|
||||||
character.SelectedCharacter.Inventory.Draw(spriteBatch);
|
character.SelectedCharacter.Inventory.DrawOwn(spriteBatch, new Vector2(GameMain.GraphicsWidth - 310, 0.0f));
|
||||||
|
|
||||||
//if (Vector2.Distance(selectedCharacter.SimPosition, SimPosition) > 2.0f) selectedCharacter = null;
|
//if (Vector2.Distance(selectedCharacter.SimPosition, SimPosition) > 2.0f) selectedCharacter = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (character.ClosestCharacter != null && (character.ClosestCharacter.IsDead || character.ClosestCharacter.Stun > 0.0f))
|
if (character.ClosestCharacter != null && character.ClosestCharacter.CanBeSelected)
|
||||||
{
|
{
|
||||||
Vector2 startPos = character.DrawPosition + (character.ClosestCharacter.DrawPosition - character.DrawPosition) * 0.7f;
|
Vector2 startPos = character.DrawPosition + (character.ClosestCharacter.DrawPosition - character.DrawPosition) * 0.7f;
|
||||||
startPos = cam.WorldToScreen(startPos);
|
startPos = cam.WorldToScreen(startPos);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using FarseerPhysics.Dynamics.Joints;
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Barotrauma.Items.Components;
|
using Barotrauma.Items.Components;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
@@ -64,8 +65,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private Direction dir;
|
private Direction dir;
|
||||||
|
|
||||||
private Wearable wearingItem;
|
private List<WearableSprite> wearingItems;
|
||||||
private WearableSprite wearingItemSprite;
|
|
||||||
|
|
||||||
private Vector2 animTargetPos;
|
private Vector2 animTargetPos;
|
||||||
|
|
||||||
@@ -172,22 +172,24 @@ namespace Barotrauma
|
|||||||
// set { bleeding = MathHelper.Clamp(value, 0.0f, 100.0f); }
|
// set { bleeding = MathHelper.Clamp(value, 0.0f, 100.0f); }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
public Wearable WearingItem
|
public List<WearableSprite> WearingItems
|
||||||
{
|
{
|
||||||
get { return wearingItem; }
|
get { return wearingItems; }
|
||||||
set { wearingItem = value; }
|
set { wearingItems = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public WearableSprite WearingItemSprite
|
//public WearableSprite WearingItemSprite
|
||||||
{
|
//{
|
||||||
get { return wearingItemSprite; }
|
// get { return wearingItemSprite; }
|
||||||
set { wearingItemSprite = value; }
|
// set { wearingItemSprite = value; }
|
||||||
}
|
//}
|
||||||
|
|
||||||
public Limb (Character character, XElement element, float scale = 1.0f)
|
public Limb (Character character, XElement element, float scale = 1.0f)
|
||||||
{
|
{
|
||||||
this.character = character;
|
this.character = character;
|
||||||
|
|
||||||
|
WearingItems = new List<WearableSprite>();
|
||||||
|
|
||||||
dir = Direction.Right;
|
dir = Direction.Right;
|
||||||
|
|
||||||
doesFlip = ToolBox.GetAttributeBool(element, "flip", false);
|
doesFlip = ToolBox.GetAttributeBool(element, "flip", false);
|
||||||
@@ -327,14 +329,17 @@ namespace Barotrauma
|
|||||||
totalArmorValue += armorValue;
|
totalArmorValue += armorValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wearingItem!=null &&
|
foreach (WearableSprite wearable in wearingItems)
|
||||||
wearingItem.ArmorValue>0.0f &&
|
|
||||||
SectorHit(wearingItem.ArmorSectorLimits, position))
|
|
||||||
{
|
{
|
||||||
hitArmor = true;
|
if (wearable.WearableComponent.ArmorValue > 0.0f &&
|
||||||
totalArmorValue += wearingItem.ArmorValue;
|
SectorHit(wearable.WearableComponent.ArmorSectorLimits, position))
|
||||||
|
{
|
||||||
|
hitArmor = true;
|
||||||
|
totalArmorValue += wearable.WearableComponent.ArmorValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (hitArmor)
|
if (hitArmor)
|
||||||
{
|
{
|
||||||
totalArmorValue = Math.Max(totalArmorValue, 0.0f);
|
totalArmorValue = Math.Max(totalArmorValue, 0.0f);
|
||||||
@@ -456,7 +461,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
body.Dir = Dir;
|
body.Dir = Dir;
|
||||||
|
|
||||||
if (wearingItem == null || !wearingItemSprite.HideLimb)
|
if (wearingItems.Find(w => w != null && w.HideLimb) == null)
|
||||||
{
|
{
|
||||||
body.Draw(spriteBatch, sprite, color, null, scale);
|
body.Draw(spriteBatch, sprite, color, null, scale);
|
||||||
}
|
}
|
||||||
@@ -465,25 +470,25 @@ namespace Barotrauma
|
|||||||
body.UpdateDrawPosition();
|
body.UpdateDrawPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wearingItem != null)
|
foreach (WearableSprite wearable in wearingItems)
|
||||||
{
|
{
|
||||||
SpriteEffects spriteEffect = (dir == Direction.Right) ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
SpriteEffects spriteEffect = (dir == Direction.Right) ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
||||||
|
|
||||||
Vector2 origin = wearingItemSprite.Sprite.Origin;
|
Vector2 origin = wearable.Sprite.Origin;
|
||||||
if (body.Dir == -1.0f) origin.X = wearingItemSprite.Sprite.SourceRect.Width - origin.X;
|
if (body.Dir == -1.0f) origin.X = wearable.Sprite.SourceRect.Width - origin.X;
|
||||||
|
|
||||||
float depth = sprite.Depth - 0.000001f;
|
float depth = sprite.Depth - 0.000001f;
|
||||||
|
|
||||||
if (wearingItemSprite.DepthLimb!=LimbType.None)
|
if (wearable.DepthLimb != LimbType.None)
|
||||||
{
|
{
|
||||||
Limb depthLimb = character.AnimController.GetLimb(wearingItemSprite.DepthLimb);
|
Limb depthLimb = character.AnimController.GetLimb(wearable.DepthLimb);
|
||||||
if (depthLimb!=null)
|
if (depthLimb != null)
|
||||||
{
|
{
|
||||||
depth = depthLimb.sprite.Depth - 0.000001f;
|
depth = depthLimb.sprite.Depth - 0.000001f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wearingItemSprite.Sprite.Draw(spriteBatch,
|
wearable.Sprite.Draw(spriteBatch,
|
||||||
new Vector2(body.DrawPosition.X, -body.DrawPosition.Y),
|
new Vector2(body.DrawPosition.X, -body.DrawPosition.Y),
|
||||||
color, origin,
|
color, origin,
|
||||||
-body.DrawRotation,
|
-body.DrawRotation,
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ namespace Barotrauma
|
|||||||
//listBox.Select(selection);
|
//listBox.Select(selection);
|
||||||
Character character = selection as Character;
|
Character character = selection as Character;
|
||||||
|
|
||||||
if (character == null) return false;
|
if (character == null || character.IsDead) return false;
|
||||||
|
|
||||||
if (characters.Contains(character))
|
if (characters.Contains(character))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ namespace Barotrauma
|
|||||||
return TryPutItem(item, new List<LimbSlot>() {placeToSlots}, createNetworkEvent);
|
return TryPutItem(item, new List<LimbSlot>() {placeToSlots}, createNetworkEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawOwn(SpriteBatch spriteBatch)
|
public void DrawOwn(SpriteBatch spriteBatch, Vector2 offset)
|
||||||
{
|
{
|
||||||
string toolTip = "";
|
string toolTip = "";
|
||||||
Rectangle highlightedSlot = Rectangle.Empty;
|
Rectangle highlightedSlot = Rectangle.Empty;
|
||||||
@@ -227,8 +227,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
for (int i = 0; i < capacity; i++)
|
for (int i = 0; i < capacity; i++)
|
||||||
{
|
{
|
||||||
slotRect.X = (int)SlotPositions[i].X;
|
slotRect.X = (int)(SlotPositions[i].X + offset.X);
|
||||||
slotRect.Y = (int)SlotPositions[i].Y;
|
slotRect.Y = (int)(SlotPositions[i].Y + offset.Y);
|
||||||
|
|
||||||
if (i==1) //head
|
if (i==1) //head
|
||||||
{
|
{
|
||||||
@@ -248,8 +248,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
for (int i = 0; i < capacity; i++)
|
for (int i = 0; i < capacity; i++)
|
||||||
{
|
{
|
||||||
slotRect.X = (int)SlotPositions[i].X;
|
slotRect.X = (int)(SlotPositions[i].X + offset.X);
|
||||||
slotRect.Y = (int)SlotPositions[i].Y;
|
slotRect.Y = (int)(SlotPositions[i].Y + offset.Y);
|
||||||
|
|
||||||
bool multiSlot = false;
|
bool multiSlot = false;
|
||||||
//skip if the item is in multiple slots
|
//skip if the item is in multiple slots
|
||||||
@@ -295,8 +295,8 @@ namespace Barotrauma
|
|||||||
//check if the item is in multiple slots
|
//check if the item is in multiple slots
|
||||||
if (Items[i] != null)
|
if (Items[i] != null)
|
||||||
{
|
{
|
||||||
slotRect.X = (int)SlotPositions[i].X;
|
slotRect.X = (int)(SlotPositions[i].X + offset.X);
|
||||||
slotRect.Y = (int)SlotPositions[i].Y;
|
slotRect.Y = (int)(SlotPositions[i].Y + offset.Y);
|
||||||
slotRect.Width = 40;
|
slotRect.Width = 40;
|
||||||
slotRect.Height = 40;
|
slotRect.Height = 40;
|
||||||
|
|
||||||
@@ -310,7 +310,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
multiSlot = true;
|
multiSlot = true;
|
||||||
slotRect = Rectangle.Union(
|
slotRect = Rectangle.Union(
|
||||||
new Rectangle((int)SlotPositions[n].X, (int)SlotPositions[n].Y, rectWidth, rectHeight), slotRect);
|
new Rectangle((int)(SlotPositions[n].X+offset.X), (int)(SlotPositions[n].Y+offset.Y), rectWidth, rectHeight), slotRect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
foreach (Limb limb in character.AnimController.Limbs)
|
foreach (Limb limb in character.AnimController.Limbs)
|
||||||
{
|
{
|
||||||
if (limb.WearingItem==null || limb.WearingItem.Item != item) continue;
|
if (limb.WearingItems.Find(w => w.WearableComponent.Item != this.item)==null) continue;
|
||||||
|
|
||||||
limb.body.ApplyForce(propulsion);
|
limb.body.ApplyForce(propulsion);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,11 @@ namespace Barotrauma.Items.Components
|
|||||||
public bool HideLimb;
|
public bool HideLimb;
|
||||||
public LimbType DepthLimb;
|
public LimbType DepthLimb;
|
||||||
|
|
||||||
public WearableSprite(Sprite sprite, bool hideLimb, LimbType depthLimb = LimbType.None)
|
public Wearable WearableComponent;
|
||||||
|
|
||||||
|
public WearableSprite(Wearable item, Sprite sprite, bool hideLimb, LimbType depthLimb = LimbType.None)
|
||||||
{
|
{
|
||||||
|
WearableComponent = item;
|
||||||
Sprite = sprite;
|
Sprite = sprite;
|
||||||
HideLimb = hideLimb;
|
HideLimb = hideLimb;
|
||||||
|
|
||||||
@@ -85,7 +88,7 @@ namespace Barotrauma.Items.Components
|
|||||||
spritePath = Path.GetDirectoryName( item.Prefab.ConfigFile)+"/"+spritePath;
|
spritePath = Path.GetDirectoryName( item.Prefab.ConfigFile)+"/"+spritePath;
|
||||||
|
|
||||||
var sprite = new Sprite(subElement, "", spritePath);
|
var sprite = new Sprite(subElement, "", spritePath);
|
||||||
wearableSprites[i] = new WearableSprite(sprite, ToolBox.GetAttributeBool(subElement, "hidelimb", false),
|
wearableSprites[i] = new WearableSprite(this, sprite, ToolBox.GetAttributeBool(subElement, "hidelimb", false),
|
||||||
(LimbType)Enum.Parse(typeof(LimbType),
|
(LimbType)Enum.Parse(typeof(LimbType),
|
||||||
ToolBox.GetAttributeString(subElement, "depthlimb", "None"), true));
|
ToolBox.GetAttributeString(subElement, "depthlimb", "None"), true));
|
||||||
|
|
||||||
@@ -105,10 +108,10 @@ namespace Barotrauma.Items.Components
|
|||||||
if (equipLimb == null) continue;
|
if (equipLimb == null) continue;
|
||||||
|
|
||||||
//something is already on the limb -> unequip it
|
//something is already on the limb -> unequip it
|
||||||
if (equipLimb.WearingItem != null && equipLimb.WearingItem != this)
|
//if (equipLimb.WearingItem != null && equipLimb.WearingItem != this)
|
||||||
{
|
//{
|
||||||
equipLimb.WearingItem.Unequip(character);
|
// equipLimb.WearingItem.Unequip(character);
|
||||||
}
|
//}
|
||||||
|
|
||||||
//sprite[i].Depth = equipLimb.sprite.Depth - 0.001f;
|
//sprite[i].Depth = equipLimb.sprite.Depth - 0.001f;
|
||||||
|
|
||||||
@@ -117,8 +120,7 @@ namespace Barotrauma.Items.Components
|
|||||||
IsActive = true;
|
IsActive = true;
|
||||||
|
|
||||||
limb[i] = equipLimb;
|
limb[i] = equipLimb;
|
||||||
equipLimb.WearingItem = this;
|
equipLimb.WearingItems.Add(wearableSprites[i]);
|
||||||
equipLimb.WearingItemSprite = wearableSprites[i];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,11 +142,20 @@ namespace Barotrauma.Items.Components
|
|||||||
Limb equipLimb = character.AnimController.GetLimb(limbType[i]);
|
Limb equipLimb = character.AnimController.GetLimb(limbType[i]);
|
||||||
if (equipLimb == null) continue;
|
if (equipLimb == null) continue;
|
||||||
|
|
||||||
if (equipLimb.WearingItem != this) continue;
|
//foreach (WearableSprite wearable in equipLimb.WearingItems)
|
||||||
|
//{
|
||||||
|
// if (wearable != wearableSprites[i]) continue;
|
||||||
|
|
||||||
|
// equipLimb.WearingItems.Remove(wearableSprites[i]);
|
||||||
|
//}
|
||||||
|
|
||||||
|
equipLimb.WearingItems.RemoveAll(w=> w!=null && w==wearableSprites[i]);
|
||||||
|
|
||||||
|
//if (equipLimb.WearingItem != this) continue;
|
||||||
|
|
||||||
limb[i] = null;
|
limb[i] = null;
|
||||||
equipLimb.WearingItem = null;
|
//equipLimb.WearingItem = null;
|
||||||
equipLimb.WearingItemSprite = null;
|
//equipLimb.WearingItemSprite = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
IsActive = false;
|
IsActive = false;
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ namespace Barotrauma
|
|||||||
float dmg = (float)Math.Sqrt(size.X) * deltaTime / c.AnimController.Limbs.Count();
|
float dmg = (float)Math.Sqrt(size.X) * deltaTime / c.AnimController.Limbs.Count();
|
||||||
foreach (Limb limb in c.AnimController.Limbs)
|
foreach (Limb limb in c.AnimController.Limbs)
|
||||||
{
|
{
|
||||||
if (limb.WearingItem != null && limb.WearingItem.Item.FireProof) continue;
|
if (limb.WearingItems.Find(w => w!=null && w.WearableComponent.Item.FireProof)!=null) continue;
|
||||||
limb.Burnt += dmg * 10.0f;
|
limb.Burnt += dmg * 10.0f;
|
||||||
c.AddDamage(limb.SimPosition, DamageType.None, dmg, 0,0,false);
|
c.AddDamage(limb.SimPosition, DamageType.None, dmg, 0,0,false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ namespace Barotrauma.Networking
|
|||||||
private ServerLog log;
|
private ServerLog log;
|
||||||
private GUIButton showLogButton;
|
private GUIButton showLogButton;
|
||||||
|
|
||||||
|
private GUIScrollBar clientListScrollBar;
|
||||||
|
|
||||||
public TraitorManager TraitorManager;
|
public TraitorManager TraitorManager;
|
||||||
|
|
||||||
public GameServer(string name, int port, bool isPublic = false, string password = "", bool attemptUPnP = false, int maxPlayers = 10)
|
public GameServer(string name, int port, bool isPublic = false, string password = "", bool attemptUPnP = false, int maxPlayers = 10)
|
||||||
@@ -1177,33 +1179,57 @@ namespace Barotrauma.Networking
|
|||||||
if (!ShowNetStats) return;
|
if (!ShowNetStats) return;
|
||||||
|
|
||||||
int width = 200, height = 300;
|
int width = 200, height = 300;
|
||||||
int x = GameMain.GraphicsWidth - width, y = (int)(GameMain.GraphicsHeight*0.3f);
|
int x = GameMain.GraphicsWidth - width, y = (int)(GameMain.GraphicsHeight * 0.3f);
|
||||||
|
|
||||||
GUI.DrawRectangle(spriteBatch, new Rectangle(x,y,width,height), Color.Black*0.7f, true);
|
|
||||||
spriteBatch.DrawString(GUI.Font, "Network statistics:", new Vector2(x+10, y+10), Color.White);
|
if (clientListScrollBar == null)
|
||||||
|
{
|
||||||
|
clientListScrollBar = new GUIScrollBar(new Rectangle(x + width - 10, y, 10, height), GUI.Style, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GUI.DrawRectangle(spriteBatch, new Rectangle(x, y, width, height), Color.Black * 0.7f, true);
|
||||||
|
spriteBatch.DrawString(GUI.Font, "Network statistics:", new Vector2(x + 10, y + 10), Color.White);
|
||||||
|
|
||||||
spriteBatch.DrawString(GUI.SmallFont, "Connections: "+server.ConnectionsCount, new Vector2(x + 10, y + 30), Color.White);
|
spriteBatch.DrawString(GUI.SmallFont, "Connections: "+server.ConnectionsCount, new Vector2(x + 10, y + 30), Color.White);
|
||||||
spriteBatch.DrawString(GUI.SmallFont, "Received bytes: " + server.Statistics.ReceivedBytes, new Vector2(x + 10, y + 45), Color.White);
|
spriteBatch.DrawString(GUI.SmallFont, "Received bytes: " + MathUtils.GetBytesReadable(server.Statistics.ReceivedBytes), new Vector2(x + 10, y + 45), Color.White);
|
||||||
spriteBatch.DrawString(GUI.SmallFont, "Received packets: " + server.Statistics.ReceivedPackets, new Vector2(x + 10, y + 60), Color.White);
|
spriteBatch.DrawString(GUI.SmallFont, "Received packets: " + server.Statistics.ReceivedPackets, new Vector2(x + 10, y + 60), Color.White);
|
||||||
|
|
||||||
spriteBatch.DrawString(GUI.SmallFont, "Sent bytes: " + server.Statistics.SentBytes, new Vector2(x + 10, y + 75), Color.White);
|
spriteBatch.DrawString(GUI.SmallFont, "Sent bytes: " + MathUtils.GetBytesReadable(server.Statistics.SentBytes), new Vector2(x + 10, y + 75), Color.White);
|
||||||
spriteBatch.DrawString(GUI.SmallFont, "Sent packets: " + server.Statistics.SentPackets, new Vector2(x + 10, y + 90), Color.White);
|
spriteBatch.DrawString(GUI.SmallFont, "Sent packets: " + server.Statistics.SentPackets, new Vector2(x + 10, y + 90), Color.White);
|
||||||
|
|
||||||
int resentMessages = 0;
|
int resentMessages = 0;
|
||||||
|
|
||||||
y += 110;
|
int clientListHeight = ConnectedClients.Count() * 40;
|
||||||
|
float scrollBarHeight = (height - 110) / (float)Math.Max(clientListHeight, 110);
|
||||||
|
|
||||||
|
if (clientListScrollBar.BarSize != scrollBarHeight)
|
||||||
|
{
|
||||||
|
clientListScrollBar.BarSize = scrollBarHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
int startY = y + 110;
|
||||||
|
y = (startY - (int)(clientListScrollBar.BarScroll * (clientListHeight-(height - 110))));
|
||||||
foreach (Client c in ConnectedClients)
|
foreach (Client c in ConnectedClients)
|
||||||
{
|
{
|
||||||
spriteBatch.DrawString(GUI.SmallFont, c.name + ":", new Vector2(x + 10, y), Color.White);
|
Color clientColor = c.Connection.AverageRoundtripTime > 0.3f ? Color.Red : Color.White;
|
||||||
spriteBatch.DrawString(GUI.SmallFont, "- avg roundtrip " + c.Connection.AverageRoundtripTime+" s", new Vector2(x + 20, y + 15), Color.White);
|
|
||||||
spriteBatch.DrawString(GUI.SmallFont, "- resent messages " + c.Connection.Statistics.ResentMessages, new Vector2(x + 20, y + 30), Color.White);
|
if (y >= startY && y < startY + height - 120)
|
||||||
|
{
|
||||||
|
spriteBatch.DrawString(GUI.SmallFont, c.name + ":", new Vector2(x + 10, y), clientColor);
|
||||||
|
spriteBatch.DrawString(GUI.SmallFont, "Ping: " + (int)(c.Connection.AverageRoundtripTime * 1000.0f) + " ms", new Vector2(x + width - 100, y), clientColor);
|
||||||
|
}
|
||||||
|
if (y + 10 >= startY && y < startY + height - 130) spriteBatch.DrawString(GUI.SmallFont, "Resent messages: " + c.Connection.Statistics.ResentMessages, new Vector2(x + 10, y + 10), clientColor);
|
||||||
|
|
||||||
resentMessages += (int)c.Connection.Statistics.ResentMessages;
|
resentMessages += (int)c.Connection.Statistics.ResentMessages;
|
||||||
|
|
||||||
y += 50;
|
y += 40;
|
||||||
}
|
}
|
||||||
|
|
||||||
netStats.AddValue(NetStats.NetStatType.ResentMessages, resentMessages);
|
clientListScrollBar.Update(1.0f / 60.0f);
|
||||||
|
clientListScrollBar.Draw(spriteBatch);
|
||||||
|
|
||||||
|
netStats.AddValue(NetStats.NetStatType.ResentMessages, Math.Max(resentMessages, 0));
|
||||||
netStats.AddValue(NetStats.NetStatType.SentBytes, server.Statistics.SentBytes);
|
netStats.AddValue(NetStats.NetStatType.SentBytes, server.Statistics.SentBytes);
|
||||||
netStats.AddValue(NetStats.NetStatType.ReceivedBytes, server.Statistics.ReceivedBytes);
|
netStats.AddValue(NetStats.NetStatType.ReceivedBytes, server.Statistics.ReceivedBytes);
|
||||||
|
|
||||||
|
|||||||
@@ -72,13 +72,13 @@ namespace Barotrauma.Networking
|
|||||||
graphs[(int)NetStatType.ResentMessages].Draw(spriteBatch, rect, null, 0.0f, Color.Red);
|
graphs[(int)NetStatType.ResentMessages].Draw(spriteBatch, rect, null, 0.0f, Color.Red);
|
||||||
|
|
||||||
spriteBatch.DrawString(GUI.SmallFont,
|
spriteBatch.DrawString(GUI.SmallFont,
|
||||||
"Peak received: "+graphs[(int)NetStatType.ReceivedBytes].LargestValue()+" bytes/s " +
|
"Peak received: " + MathUtils.GetBytesReadable((int)graphs[(int)NetStatType.ReceivedBytes].LargestValue()) + "/s " +
|
||||||
"Avg received: " + graphs[(int)NetStatType.ReceivedBytes].Average() + " bytes/s",
|
"Avg received: " + MathUtils.GetBytesReadable((int)graphs[(int)NetStatType.ReceivedBytes].Average()) + "/s",
|
||||||
new Vector2(rect.X + 10, rect.Y+10), Color.Cyan);
|
new Vector2(rect.X + 10, rect.Y + 10), Color.Cyan);
|
||||||
|
|
||||||
|
|
||||||
spriteBatch.DrawString(GUI.SmallFont, "Peak sent: " + graphs[(int)NetStatType.SentBytes].LargestValue() + " bytes/s " +
|
spriteBatch.DrawString(GUI.SmallFont, "Peak sent: " + MathUtils.GetBytesReadable((int)graphs[(int)NetStatType.SentBytes].LargestValue()) + "/s " +
|
||||||
"Avg sent: " + graphs[(int)NetStatType.SentBytes].Average() + " bytes/s",
|
"Avg sent: " + MathUtils.GetBytesReadable((int)graphs[(int)NetStatType.SentBytes].Average()) + " bytes/s",
|
||||||
new Vector2(rect.X + 10, rect.Y + 30), Color.Orange);
|
new Vector2(rect.X + 10, rect.Y + 30), Color.Orange);
|
||||||
|
|
||||||
spriteBatch.DrawString(GUI.SmallFont, "Peak resent: " + graphs[(int)NetStatType.ResentMessages].LargestValue() + " messages/s",
|
spriteBatch.DrawString(GUI.SmallFont, "Peak resent: " + graphs[(int)NetStatType.ResentMessages].LargestValue() + " messages/s",
|
||||||
|
|||||||
@@ -273,6 +273,55 @@ namespace Barotrauma
|
|||||||
|
|
||||||
return segments;
|
return segments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns the human-readable file size for an arbitrary, 64-bit file size
|
||||||
|
// The default format is "0.### XB", e.g. "4.2 KB" or "1.434 GB"
|
||||||
|
public static string GetBytesReadable(long i)
|
||||||
|
{
|
||||||
|
// Get absolute value
|
||||||
|
long absolute_i = (i < 0 ? -i : i);
|
||||||
|
// Determine the suffix and readable value
|
||||||
|
string suffix;
|
||||||
|
double readable;
|
||||||
|
if (absolute_i >= 0x1000000000000000) // Exabyte
|
||||||
|
{
|
||||||
|
suffix = "EB";
|
||||||
|
readable = (i >> 50);
|
||||||
|
}
|
||||||
|
else if (absolute_i >= 0x4000000000000) // Petabyte
|
||||||
|
{
|
||||||
|
suffix = "PB";
|
||||||
|
readable = (i >> 40);
|
||||||
|
}
|
||||||
|
else if (absolute_i >= 0x10000000000) // Terabyte
|
||||||
|
{
|
||||||
|
suffix = "TB";
|
||||||
|
readable = (i >> 30);
|
||||||
|
}
|
||||||
|
else if (absolute_i >= 0x40000000) // Gigabyte
|
||||||
|
{
|
||||||
|
suffix = "GB";
|
||||||
|
readable = (i >> 20);
|
||||||
|
}
|
||||||
|
else if (absolute_i >= 0x100000) // Megabyte
|
||||||
|
{
|
||||||
|
suffix = "MB";
|
||||||
|
readable = (i >> 10);
|
||||||
|
}
|
||||||
|
else if (absolute_i >= 0x400) // Kilobyte
|
||||||
|
{
|
||||||
|
suffix = "KB";
|
||||||
|
readable = i;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return i.ToString("0 B"); // Byte
|
||||||
|
}
|
||||||
|
// Divide by 1024 to get fractional value
|
||||||
|
readable = (readable / 1024);
|
||||||
|
// Return formatted number with suffix
|
||||||
|
return readable.ToString("0.# ") + suffix;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CompareCCW : IComparer<Vector2>
|
class CompareCCW : IComparer<Vector2>
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user