Added wire-tag to all wires (to allow using it for fixes even if the name isn't ''Wire''), disconnect networkmember when going to main menu, fixed questmode crashing in multiplayer, fixed too short seeds throwing an error, attachable items aren't attached if secondary key isn't held, update hull when attaching an item, dropping connected wires when detaching items, kicking players with a button click instead of debugconsole
This commit is contained in:
@@ -6,13 +6,18 @@
|
||||
|
||||
<Sprite texture ="door.png" sourcerect="0,0,48,208" depth="0.01" origin="0.5,0.5"/>
|
||||
|
||||
<Door>
|
||||
<Door canbeselected="true">
|
||||
<Sprite texture ="door.png" sourcerect="80,0,19,208" depth="0.05" origin="0.5,0.0"/>
|
||||
<WeldedSprite texture ="door.png" sourcerect="104,0,48,208" depth="0.0" origin="0.0,0.0"/>
|
||||
<sound file="door.ogg" type="OnUse" range="500.0"/>
|
||||
</Door>
|
||||
|
||||
<AiTarget sightrange="5000.0"/>
|
||||
|
||||
<fixrequirement name="Mechanical repairs">
|
||||
<skill name="Construction" level="40"/>
|
||||
<item name="Welding Tool"/>
|
||||
</fixrequirement>
|
||||
|
||||
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||
<requireditem name="Screwdriver" type="Equipped"/>
|
||||
@@ -30,7 +35,7 @@
|
||||
|
||||
<Sprite texture ="door.png" sourcerect="0,0,48,208" depth="0.01" origin="0.5,0.5"/>
|
||||
|
||||
<Door window="0,-18,10,89">
|
||||
<Door window="0,-18,10,89" canbeselected="true">
|
||||
<Sprite texture ="door.png" sourcerect="56,0,19,208" depth="0.0" origin="0.5,0.0"/>
|
||||
<WeldedSprite texture ="door.png" sourcerect="104,0,48,208" depth="0.0" origin="0.0,0.0"/>
|
||||
<sound file="door.ogg" type="OnUse" range="500.0"/>
|
||||
@@ -38,6 +43,11 @@
|
||||
|
||||
<AiTarget sightrange="5000.0"/>
|
||||
|
||||
<fixrequirement name="Mechanical repairs">
|
||||
<skill name="Construction" level="40"/>
|
||||
<item name="Welding Tool"/>
|
||||
</fixrequirement>
|
||||
|
||||
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||
<requireditem name="Screwdriver" type="Equipped"/>
|
||||
<input name="toggle"/>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<Item
|
||||
name="Wire"
|
||||
Tags="smallitem"
|
||||
Tags="smallitem,wire"
|
||||
pickdistance="150"
|
||||
linkable="true"
|
||||
canbepicked="true"
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<Item
|
||||
name="Red Wire"
|
||||
Tags="smallitem"
|
||||
Tags="smallitem,wire"
|
||||
spritecolor="1.0,0.0,0.0,1.0"
|
||||
pickdistance="150"
|
||||
linkable="true"
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
<Item
|
||||
name="Blue Wire"
|
||||
Tags="smallitem"
|
||||
Tags="smallitem,wire"
|
||||
spritecolor="0.0,0.6,1.0,1.0"
|
||||
pickdistance="150"
|
||||
linkable="true"
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
<Item
|
||||
name="Orange Wire"
|
||||
Tags="smallitem"
|
||||
Tags="smallitem,wire"
|
||||
spritecolor="1.0,0.5,0.0,1.0"
|
||||
pickdistance="150"
|
||||
linkable="true"
|
||||
|
||||
@@ -160,6 +160,8 @@ namespace Barotrauma
|
||||
public void GiveReward()
|
||||
{
|
||||
var mode = GameMain.GameSession.gameMode as SinglePlayerMode;
|
||||
if (mode == null) return;
|
||||
|
||||
mode.Money += reward;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(successMessage))
|
||||
|
||||
@@ -131,6 +131,11 @@ namespace Barotrauma
|
||||
SaveUtil.SaveGame(GameMain.GameSession.SaveFile);
|
||||
}
|
||||
|
||||
if (GameMain.NetworkMember!=null)
|
||||
{
|
||||
GameMain.NetworkMember.Disconnect();
|
||||
GameMain.NetworkMember = null;
|
||||
}
|
||||
|
||||
GameMain.MainMenuScreen.Select();
|
||||
//Game1.MainMenuScreen.SelectTab(null, (int)MainMenuScreen.Tabs.Main);
|
||||
|
||||
@@ -238,6 +238,8 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
{
|
||||
convexHull.Enabled = true;
|
||||
if (convexHull2 != null) convexHull2.Enabled = true;
|
||||
if (!isStuck)
|
||||
{
|
||||
OpenState += deltaTime * ((isOpen) ? 2.0f : -2.0f);
|
||||
@@ -251,9 +253,10 @@ namespace Barotrauma.Items.Components
|
||||
public override void UpdateBroken(float deltaTime, Camera cam)
|
||||
{
|
||||
body.Enabled = false;
|
||||
//convexHull.Enabled = false;
|
||||
convexHull.Enabled = false;
|
||||
if (convexHull2 != null) convexHull2.Enabled = false;
|
||||
|
||||
linkedGap.Open = 1.0f;
|
||||
//if (convexHull2 != null) convexHull2.Enabled = false;
|
||||
}
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch, bool editing)
|
||||
|
||||
@@ -181,6 +181,7 @@ namespace Barotrauma.Items.Components
|
||||
public override bool Use(float deltaTime, Character character = null)
|
||||
{
|
||||
if (!attachable || item.body==null) return true;
|
||||
if (character != null && !character.GetInputState(InputType.SecondaryHeld)) return false;
|
||||
|
||||
item.Drop();
|
||||
|
||||
@@ -202,6 +203,8 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
attached = true;
|
||||
|
||||
item.NewComponentEvent(this, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -247,5 +250,29 @@ namespace Barotrauma.Items.Components
|
||||
Msg = "";
|
||||
}
|
||||
}
|
||||
|
||||
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetOutgoingMessage message)
|
||||
{
|
||||
message.Write(item.SimPosition.X);
|
||||
message.Write(item.SimPosition.Y);
|
||||
}
|
||||
|
||||
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message)
|
||||
{
|
||||
Vector2 newPos = Vector2.Zero;
|
||||
|
||||
try
|
||||
{
|
||||
newPos = new Vector2(message.ReadFloat(), message.ReadFloat());
|
||||
}
|
||||
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
item.SetTransform(newPos, 0.0f);
|
||||
if (!attached) Use(1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,21 @@ namespace Barotrauma.Items.Components
|
||||
item.linkedTo[i].RemoveLinked(item);
|
||||
item.linkedTo.Clear();
|
||||
|
||||
var connectionPanel = item.GetComponent<ConnectionPanel>();
|
||||
if (connectionPanel!=null)
|
||||
{
|
||||
foreach (Connection c in connectionPanel.connections)
|
||||
{
|
||||
foreach (Wire w in c.Wires)
|
||||
{
|
||||
if (w == null) continue;
|
||||
|
||||
w.Item.Drop(picker);
|
||||
w.Item.SetTransform(item.SimPosition, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ApplyStatusEffects(ActionType.OnPicked, 1.0f, picker);
|
||||
|
||||
//foreach (StatusEffect effect in item.Prefab.statusEffects)
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Barotrauma
|
||||
GUIComponent component = reqFrame.children.Find(c => c.UserData as string == itemName);
|
||||
|
||||
GUITextBlock text = component as GUITextBlock;
|
||||
Item item = character.Inventory.items.FirstOrDefault(i => i !=null && i.Name == itemName);
|
||||
Item item = character.Inventory.items.FirstOrDefault(i => i !=null && (i.Name == itemName || i.HasTag(itemName)));
|
||||
bool itemFound = (item != null);
|
||||
|
||||
if (!itemFound) success = false;
|
||||
|
||||
@@ -339,6 +339,8 @@ namespace Barotrauma
|
||||
|
||||
rect.X = (int)(displayPos.X - rect.Width / 2.0f);
|
||||
rect.Y = (int)(displayPos.Y + rect.Height / 2.0f);
|
||||
|
||||
FindHull();
|
||||
}
|
||||
|
||||
public override void Move(Vector2 amount)
|
||||
@@ -390,7 +392,7 @@ namespace Barotrauma
|
||||
|
||||
public bool HasTag(string tag)
|
||||
{
|
||||
return (tags.Contains(tag));
|
||||
return (tags.Contains(tag) || tags.Contains(tag.ToLower()));
|
||||
}
|
||||
|
||||
|
||||
@@ -863,7 +865,7 @@ namespace Barotrauma
|
||||
{
|
||||
picker.SelectedConstruction = (picker.SelectedConstruction == this) ? null : this;
|
||||
}
|
||||
|
||||
|
||||
if (!hasRequiredSkills && Character.Controlled==picker)
|
||||
{
|
||||
GUI.AddMessage("Your skills may be insufficient to use the item!", Color.Red, 5.0f);
|
||||
|
||||
@@ -404,7 +404,8 @@ namespace Barotrauma.Networking
|
||||
string msg = inc.ReadString();
|
||||
|
||||
new GUIMessageBox("You have been kicked out from the server", msg);
|
||||
|
||||
|
||||
Disconnect();
|
||||
GameMain.MainMenuScreen.Select();
|
||||
|
||||
break;
|
||||
@@ -433,7 +434,6 @@ namespace Barotrauma.Networking
|
||||
|
||||
private IEnumerable<object> StartGame(NetIncomingMessage inc)
|
||||
{
|
||||
|
||||
if (this.Character != null) Character.Remove();
|
||||
|
||||
int seed = inc.ReadInt32();
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace Barotrauma.Networking
|
||||
crewFrame = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), GUI.Style);
|
||||
crewFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
|
||||
|
||||
GUIListBox crewList = new GUIListBox(new Rectangle(0, 0, 200, 300), Color.White * 0.7f, GUI.Style, crewFrame);
|
||||
GUIListBox crewList = new GUIListBox(new Rectangle(0, 0, 300, 300), Color.White * 0.7f, GUI.Style, crewFrame);
|
||||
crewList.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
|
||||
crewList.OnSelected = SelectCharacter;
|
||||
|
||||
|
||||
@@ -155,6 +155,12 @@ namespace Barotrauma
|
||||
{
|
||||
base.Select();
|
||||
|
||||
if (GameMain.NetworkMember != null)
|
||||
{
|
||||
GameMain.NetworkMember.Disconnect();
|
||||
GameMain.NetworkMember = null;
|
||||
}
|
||||
|
||||
Submarine.Unload();
|
||||
|
||||
SelectTab(null, 0);
|
||||
|
||||
@@ -23,12 +23,12 @@ namespace Barotrauma
|
||||
|
||||
private GUITextBox textBox, seedBox;
|
||||
|
||||
//private GUIScrollBar durationBar;
|
||||
|
||||
private GUIFrame playerFrame;
|
||||
private GUIFrame myPlayerFrame;
|
||||
|
||||
private GUIFrame jobInfoFrame;
|
||||
|
||||
private GUIFrame playerFrame;
|
||||
|
||||
private float camAngle;
|
||||
|
||||
public bool IsServer;
|
||||
@@ -125,11 +125,11 @@ namespace Barotrauma
|
||||
|
||||
//player info panel ------------------------------------------------------------
|
||||
|
||||
playerFrame = new GUIFrame(
|
||||
myPlayerFrame = new GUIFrame(
|
||||
new Rectangle((int)(panelRect.Width * 0.7f + 20), 0,
|
||||
(int)(panelRect.Width * 0.3f - 20), (int)(panelRect.Height * 0.6f)),
|
||||
GUI.Style, menu);
|
||||
playerFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
|
||||
myPlayerFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
|
||||
|
||||
//player list ------------------------------------------------------------------
|
||||
|
||||
@@ -139,6 +139,7 @@ namespace Barotrauma
|
||||
GUI.Style, menu);
|
||||
|
||||
playerList = new GUIListBox(new Rectangle(0,0,0,0), null, GUI.Style, playerListFrame);
|
||||
playerList.OnSelected = SelectPlayer;
|
||||
|
||||
//submarine list ------------------------------------------------------------------
|
||||
|
||||
@@ -203,16 +204,6 @@ namespace Barotrauma
|
||||
|
||||
columnX += modeDescription.Rect.Width + 40;
|
||||
|
||||
//duration ------------------------------------------------------------------
|
||||
|
||||
//GUITextBlock durationText = new GUITextBlock(new Rectangle(columnX, 120, columnWidth, 20),
|
||||
// "Duration: ", GUI.Style, Alignment.Left, Alignment.TopLeft, infoFrame);
|
||||
//durationText.TextGetter = DurationText;
|
||||
|
||||
//durationBar = new GUIScrollBar(new Rectangle(columnX, 150, columnWidth, 20),
|
||||
// GUI.Style, 0.1f, infoFrame);
|
||||
//durationBar.BarSize = 0.1f;
|
||||
|
||||
//seed ------------------------------------------------------------------
|
||||
|
||||
new GUITextBlock(new Rectangle(columnX, 120, columnWidth, 20),
|
||||
@@ -253,6 +244,7 @@ namespace Barotrauma
|
||||
GameMain.GameScreen.Cam.TargetPos = Vector2.Zero;
|
||||
|
||||
subList.Enabled = GameMain.Server != null;
|
||||
playerList.Enabled = GameMain.Server != null;
|
||||
modeList.Enabled = GameMain.Server != null;
|
||||
seedBox.Enabled = GameMain.Server != null;
|
||||
serverMessage.Enabled = GameMain.Server != null;
|
||||
@@ -274,9 +266,9 @@ namespace Barotrauma
|
||||
if (subList.CountChildren > 0 && subList.Selected == null) subList.Select(-1);
|
||||
if (GameModePreset.list.Count > 0 && modeList.Selected == null) modeList.Select(-1);
|
||||
|
||||
if (playerFrame.children.Find(c => c.UserData as string == "playyourself") == null)
|
||||
if (myPlayerFrame.children.Find(c => c.UserData as string == "playyourself") == null)
|
||||
{
|
||||
var playYourself = new GUITickBox(new Rectangle(-10, -10, 20, 20), "Play yourself", Alignment.TopLeft, playerFrame);
|
||||
var playYourself = new GUITickBox(new Rectangle(-10, -10, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame);
|
||||
playYourself.Selected = GameMain.Server.CharacterInfo != null;
|
||||
playYourself.OnSelected = TogglePlayYourself;
|
||||
playYourself.UserData = "playyourself";
|
||||
@@ -292,40 +284,40 @@ namespace Barotrauma
|
||||
|
||||
private void UpdatePlayerFrame(CharacterInfo characterInfo)
|
||||
{
|
||||
if (playerFrame.children.Count <= 1)
|
||||
if (myPlayerFrame.children.Count <= 1)
|
||||
{
|
||||
playerFrame.ClearChildren();
|
||||
myPlayerFrame.ClearChildren();
|
||||
|
||||
if (IsServer && GameMain.Server != null)
|
||||
{
|
||||
var playYourself = new GUITickBox(new Rectangle(-10, -10, 20, 20), "Play yourself", Alignment.TopLeft, playerFrame);
|
||||
var playYourself = new GUITickBox(new Rectangle(-10, -10, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame);
|
||||
playYourself.Selected = GameMain.Server.CharacterInfo != null;
|
||||
playYourself.OnSelected = TogglePlayYourself;
|
||||
playYourself.UserData = "playyourself";
|
||||
}
|
||||
|
||||
new GUITextBlock(new Rectangle(60, 30, 200, 30), "Name: ", GUI.Style, playerFrame);
|
||||
new GUITextBlock(new Rectangle(60, 30, 200, 30), "Name: ", GUI.Style, myPlayerFrame);
|
||||
|
||||
GUITextBox playerName = new GUITextBox(new Rectangle(60, 55, 0, 20),
|
||||
Alignment.TopLeft, GUI.Style, playerFrame);
|
||||
Alignment.TopLeft, GUI.Style, myPlayerFrame);
|
||||
playerName.Text = characterInfo.Name;
|
||||
playerName.OnEnter += ChangeCharacterName;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 100, 200, 30), "Gender: ", GUI.Style, playerFrame);
|
||||
new GUITextBlock(new Rectangle(0, 100, 200, 30), "Gender: ", GUI.Style, myPlayerFrame);
|
||||
|
||||
GUIButton maleButton = new GUIButton(new Rectangle(70, 100, 60, 20), "Male",
|
||||
Alignment.TopLeft, GUI.Style, playerFrame);
|
||||
Alignment.TopLeft, GUI.Style, myPlayerFrame);
|
||||
maleButton.UserData = Gender.Male;
|
||||
maleButton.OnClicked += SwitchGender;
|
||||
|
||||
GUIButton femaleButton = new GUIButton(new Rectangle(140, 100, 60, 20), "Female",
|
||||
Alignment.TopLeft, GUI.Style, playerFrame);
|
||||
Alignment.TopLeft, GUI.Style, myPlayerFrame);
|
||||
femaleButton.UserData = Gender.Female;
|
||||
femaleButton.OnClicked += SwitchGender;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 150, 200, 30), "Job preferences:", GUI.Style, playerFrame);
|
||||
new GUITextBlock(new Rectangle(0, 150, 200, 30), "Job preferences:", GUI.Style, myPlayerFrame);
|
||||
|
||||
jobList = new GUIListBox(new Rectangle(0, 180, 0, 0), GUI.Style, playerFrame);
|
||||
jobList = new GUIListBox(new Rectangle(0, 180, 0, 0), GUI.Style, myPlayerFrame);
|
||||
jobList.Enabled = false;
|
||||
|
||||
|
||||
@@ -366,14 +358,14 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
playerFrame.ClearChildren();
|
||||
myPlayerFrame.ClearChildren();
|
||||
|
||||
if (IsServer && GameMain.Server != null)
|
||||
{
|
||||
GameMain.Server.CharacterInfo = null;
|
||||
GameMain.Server.Character = null;
|
||||
|
||||
var playYourself = new GUITickBox(new Rectangle(0, -20, 20, 20), "Play yourself", Alignment.TopLeft, playerFrame);
|
||||
var playYourself = new GUITickBox(new Rectangle(0, -20, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame);
|
||||
playYourself.OnSelected = TogglePlayYourself;
|
||||
}
|
||||
}
|
||||
@@ -430,11 +422,43 @@ namespace Barotrauma
|
||||
if (child != null) playerList.RemoveChild(child);
|
||||
}
|
||||
|
||||
//public void RemovePlayer(Client client)
|
||||
//{
|
||||
// if (client == null) return;
|
||||
// playerList.RemoveChild(playerList.GetChild(client));
|
||||
//}
|
||||
private bool SelectPlayer(GUIComponent component, object obj)
|
||||
{
|
||||
playerFrame = new GUIFrame(new Rectangle(0, 0, 0, 0), Color.Black * 0.3f);
|
||||
|
||||
var playerFrameInner = new GUIFrame(new Rectangle(0,0,300,150), null, Alignment.Center, GUI.Style, playerFrame);
|
||||
playerFrameInner.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
|
||||
|
||||
new GUITextBlock(new Rectangle(0,0,200,20), component.UserData.ToString(),
|
||||
GUI.Style, Alignment.TopLeft, Alignment.TopLeft,
|
||||
playerFrameInner, false, GUI.LargeFont);
|
||||
|
||||
var kickButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Kick", Alignment.BottomLeft, GUI.Style, playerFrameInner);
|
||||
kickButton.UserData = obj;
|
||||
kickButton.OnClicked += KickPlayer;
|
||||
kickButton.OnClicked += ClosePlayerFrame;
|
||||
|
||||
var closeButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Close", Alignment.BottomRight, GUI.Style, playerFrameInner);
|
||||
closeButton.OnClicked = ClosePlayerFrame;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool ClosePlayerFrame(GUIButton button, object userData)
|
||||
{
|
||||
playerFrame = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool KickPlayer(GUIButton button, object userData)
|
||||
{
|
||||
if (GameMain.Server == null || userData == null) return false;
|
||||
|
||||
GameMain.Server.KickPlayer(userData.ToString());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void ClearPlayers()
|
||||
{
|
||||
@@ -465,6 +489,8 @@ namespace Barotrauma
|
||||
menu.Update((float)deltaTime);
|
||||
|
||||
if (jobInfoFrame != null) jobInfoFrame.Update((float)deltaTime);
|
||||
|
||||
if (playerFrame != null) playerFrame.Update((float)deltaTime);
|
||||
|
||||
//durationBar.BarScroll = Math.Max(durationBar.BarScroll, 1.0f / 60.0f);
|
||||
}
|
||||
@@ -483,6 +509,8 @@ namespace Barotrauma
|
||||
|
||||
//if (previewPlayer!=null) previewPlayer.Draw(spriteBatch);
|
||||
|
||||
if (playerFrame != null) playerFrame.Draw(spriteBatch);
|
||||
|
||||
GUI.Draw((float)deltaTime, spriteBatch, null);
|
||||
|
||||
spriteBatch.End();
|
||||
@@ -522,10 +550,10 @@ namespace Barotrauma
|
||||
|
||||
private void UpdatePreviewPlayer(CharacterInfo characterInfo)
|
||||
{
|
||||
GUIComponent existing = playerFrame.FindChild("playerhead");
|
||||
if (existing != null) playerFrame.RemoveChild(existing);
|
||||
GUIComponent existing = myPlayerFrame.FindChild("playerhead");
|
||||
if (existing != null) myPlayerFrame.RemoveChild(existing);
|
||||
|
||||
GUIImage image = new GUIImage(new Rectangle(0, 40, 30, 30), characterInfo.HeadSprite, Alignment.TopLeft, playerFrame);
|
||||
GUIImage image = new GUIImage(new Rectangle(0, 40, 30, 30), characterInfo.HeadSprite, Alignment.TopLeft, myPlayerFrame);
|
||||
image.UserData = "playerhead";
|
||||
}
|
||||
|
||||
|
||||
@@ -301,8 +301,15 @@ namespace Barotrauma
|
||||
{
|
||||
str = str.Substring(0, Math.Min(str.Length, 32));
|
||||
|
||||
str = str.PadLeft(4, 'a');
|
||||
|
||||
byte[] asciiBytes = Encoding.ASCII.GetBytes(str);
|
||||
|
||||
for (int i = 4; i < asciiBytes.Length; i++)
|
||||
{
|
||||
asciiBytes[i % 4] |= asciiBytes[i];
|
||||
}
|
||||
|
||||
return BitConverter.ToInt32(asciiBytes, 0);
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user