water ambience sounds change according to speed, oxygengenerator fills oxygen tanks even if their condition is 0, submarine refactoring & bugfixes, wire node editing bugfixes

This commit is contained in:
Regalis
2015-09-24 15:21:10 +03:00
parent f6966f06c3
commit bf7619bcc4
33 changed files with 635 additions and 490 deletions
+85 -85
View File
@@ -1,106 +1,106 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
//using Microsoft.Xna.Framework;
//using Microsoft.Xna.Framework.Graphics;
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Xml.Linq;
namespace Subsurface.Items.Components
{
class Label : ItemComponent
{
GUITextBox textBox;
//namespace Subsurface.Items.Components
//{
// class Label : ItemComponent
// {
// GUITextBox textBox;
private string text;
// private string text;
[HasDefaultValue("", true)]
public string Text
{
get { return text; }
set
{
text = value;
}
}
// [HasDefaultValue("", true)]
// public string Text
// {
// get { return text; }
// set
// {
// text = value;
// }
// }
public Label(Item item, XElement element)
: base(item, element)
{
// public Label(Item item, XElement element)
// : base(item, element)
// {
}
// }
public override bool Select(Character character)
{
if (textBox == null)
{
textBox = new GUITextBox(Rectangle.Empty, GUI.Style, GuiFrame);
textBox.Wrap = true;
textBox.OnTextChanged = TextChanged;
textBox.LimitText = true;
// public override bool Select(Character character)
// {
// if (textBox == null)
// {
// textBox = new GUITextBox(Rectangle.Empty, GUI.Style, GuiFrame);
// textBox.Wrap = true;
// textBox.OnTextChanged = TextChanged;
// textBox.LimitText = true;
GUIButton button = new GUIButton(new Rectangle(0,0,100,15), "OK", null, Alignment.BottomRight, GUI.Style, GuiFrame);
button.OnClicked = Close;
}
// GUIButton button = new GUIButton(new Rectangle(0,0,100,15), "OK", null, Alignment.BottomRight, GUI.Style, GuiFrame);
// button.OnClicked = Close;
// }
textBox.Text = text;
// textBox.Text = text;
textBox.Select();
// textBox.Select();
return base.Select(character);
}
// return base.Select(character);
// }
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
{
//isActive = true;
GuiFrame.Update((float)Physics.step);
GuiFrame.Draw(spriteBatch);
// public override void DrawHUD(SpriteBatch spriteBatch, Character character)
// {
// //isActive = true;
// GuiFrame.Update((float)Physics.step);
// GuiFrame.Draw(spriteBatch);
//int width = 300, height = 300;
//int x = Game1.GraphicsWidth / 2 - width / 2;
//int y = Game1.GraphicsHeight / 2 - height / 2 - 50;
// //int width = 300, height = 300;
// //int x = Game1.GraphicsWidth / 2 - width / 2;
// //int y = Game1.GraphicsHeight / 2 - height / 2 - 50;
//GUI.DrawRectangle(spriteBatch, new Rectangle(x, y, width, height), Color.Black, true);
if (!textBox.Selected) character.SelectedConstruction = null;
}
// //GUI.DrawRectangle(spriteBatch, new Rectangle(x, y, width, height), Color.Black, true);
// if (!textBox.Selected) character.SelectedConstruction = null;
// }
private bool TextChanged(GUITextBox textBox, string text)
{
this.text = text;
item.NewComponentEvent(this, true);
// private bool TextChanged(GUITextBox textBox, string text)
// {
// this.text = text;
// item.NewComponentEvent(this, true);
return true;
}
// return true;
// }
private bool Close(GUIButton button, object obj)
{
textBox.Deselect();
// private bool Close(GUIButton button, object obj)
// {
// textBox.Deselect();
return true;
}
// return true;
// }
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetOutgoingMessage message)
{
message.Write(Text);
}
// public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetOutgoingMessage message)
// {
// message.Write(Text);
// }
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message)
{
string newText = "";
try
{
newText = message.ReadString();
}
// public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message)
// {
// string newText = "";
// try
// {
// newText = message.ReadString();
// }
catch (Exception e)
{
#if DEBUG
DebugConsole.ThrowError("invalid network message", e);
#endif
return;
}
// catch (Exception e)
// {
//#if DEBUG
// DebugConsole.ThrowError("invalid network message", e);
//#endif
// return;
// }
Text = newText;
}
}
}
// Text = newText;
// }
// }
//}