Online quest mode, fixed bug when swimming from hull to another, monitors with editable text, choosing exe in content package, monster quests, misc bugfixes
This commit is contained in:
+1
-1
@@ -105,7 +105,7 @@ namespace Launcher
|
||||
{
|
||||
SaveSettings(configPath);
|
||||
|
||||
Process.Start(Directory.GetCurrentDirectory() + "/Subsurface.exe");
|
||||
Process.Start(new ProcessStartInfo(Directory.GetCurrentDirectory() + "//"+settings.SelectedContentPackage.GetFilesOfType(ContentType.Executable)[0]));
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
|
||||
Generated
+76
-21
@@ -49,20 +49,25 @@
|
||||
this.itemFolder = new System.Windows.Forms.Button();
|
||||
this.structureFolder = new System.Windows.Forms.Button();
|
||||
this.jobFolder = new System.Windows.Forms.Button();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.exeBox = new System.Windows.Forms.TextBox();
|
||||
this.exeButton = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// packageList
|
||||
//
|
||||
this.packageList.FormattingEnabled = true;
|
||||
this.packageList.Location = new System.Drawing.Point(12, 73);
|
||||
this.packageList.Location = new System.Drawing.Point(12, 87);
|
||||
this.packageList.Name = "packageList";
|
||||
this.packageList.Size = new System.Drawing.Size(180, 342);
|
||||
this.packageList.Size = new System.Drawing.Size(180, 381);
|
||||
this.packageList.TabIndex = 3;
|
||||
this.packageList.SelectedIndexChanged += new System.EventHandler(this.packageList_SelectedIndexChanged);
|
||||
//
|
||||
// newPackageName
|
||||
//
|
||||
this.newPackageName.Location = new System.Drawing.Point(12, 421);
|
||||
this.newPackageName.Location = new System.Drawing.Point(12, 474);
|
||||
this.newPackageName.Name = "newPackageName";
|
||||
this.newPackageName.Size = new System.Drawing.Size(129, 20);
|
||||
this.newPackageName.TabIndex = 4;
|
||||
@@ -71,7 +76,7 @@
|
||||
// newPackage
|
||||
//
|
||||
this.newPackage.Enabled = false;
|
||||
this.newPackage.Location = new System.Drawing.Point(147, 421);
|
||||
this.newPackage.Location = new System.Drawing.Point(147, 474);
|
||||
this.newPackage.Name = "newPackage";
|
||||
this.newPackage.Size = new System.Drawing.Size(45, 20);
|
||||
this.newPackage.TabIndex = 5;
|
||||
@@ -84,7 +89,7 @@
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.BackColor = System.Drawing.Color.Transparent;
|
||||
this.label1.ForeColor = System.Drawing.SystemColors.Control;
|
||||
this.label1.Location = new System.Drawing.Point(215, 285);
|
||||
this.label1.Location = new System.Drawing.Point(215, 338);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(51, 13);
|
||||
this.label1.TabIndex = 7;
|
||||
@@ -93,14 +98,14 @@
|
||||
// itemList
|
||||
//
|
||||
this.itemList.FormattingEnabled = true;
|
||||
this.itemList.Location = new System.Drawing.Point(218, 307);
|
||||
this.itemList.Location = new System.Drawing.Point(218, 360);
|
||||
this.itemList.Name = "itemList";
|
||||
this.itemList.Size = new System.Drawing.Size(255, 134);
|
||||
this.itemList.TabIndex = 8;
|
||||
//
|
||||
// itemButton
|
||||
//
|
||||
this.itemButton.Location = new System.Drawing.Point(301, 281);
|
||||
this.itemButton.Location = new System.Drawing.Point(317, 334);
|
||||
this.itemButton.Name = "itemButton";
|
||||
this.itemButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.itemButton.TabIndex = 9;
|
||||
@@ -113,7 +118,7 @@
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.BackColor = System.Drawing.Color.Transparent;
|
||||
this.label2.ForeColor = System.Drawing.SystemColors.Control;
|
||||
this.label2.Location = new System.Drawing.Point(215, 120);
|
||||
this.label2.Location = new System.Drawing.Point(215, 173);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(77, 13);
|
||||
this.label2.TabIndex = 7;
|
||||
@@ -122,14 +127,15 @@
|
||||
// characterList
|
||||
//
|
||||
this.characterList.FormattingEnabled = true;
|
||||
this.characterList.Location = new System.Drawing.Point(218, 145);
|
||||
this.characterList.Location = new System.Drawing.Point(218, 198);
|
||||
this.characterList.Name = "characterList";
|
||||
this.characterList.Size = new System.Drawing.Size(255, 121);
|
||||
this.characterList.TabIndex = 8;
|
||||
this.characterList.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.fileList_KeyPress);
|
||||
//
|
||||
// characterButton
|
||||
//
|
||||
this.characterButton.Location = new System.Drawing.Point(301, 116);
|
||||
this.characterButton.Location = new System.Drawing.Point(317, 169);
|
||||
this.characterButton.Name = "characterButton";
|
||||
this.characterButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.characterButton.TabIndex = 9;
|
||||
@@ -142,7 +148,7 @@
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.BackColor = System.Drawing.Color.Transparent;
|
||||
this.label3.ForeColor = System.Drawing.SystemColors.Control;
|
||||
this.label3.Location = new System.Drawing.Point(489, 121);
|
||||
this.label3.Location = new System.Drawing.Point(489, 174);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(96, 13);
|
||||
this.label3.TabIndex = 7;
|
||||
@@ -151,14 +157,14 @@
|
||||
// structureList
|
||||
//
|
||||
this.structureList.FormattingEnabled = true;
|
||||
this.structureList.Location = new System.Drawing.Point(492, 145);
|
||||
this.structureList.Location = new System.Drawing.Point(492, 198);
|
||||
this.structureList.Name = "structureList";
|
||||
this.structureList.Size = new System.Drawing.Size(255, 121);
|
||||
this.structureList.TabIndex = 8;
|
||||
//
|
||||
// structureButton
|
||||
//
|
||||
this.structureButton.Location = new System.Drawing.Point(603, 116);
|
||||
this.structureButton.Location = new System.Drawing.Point(591, 169);
|
||||
this.structureButton.Name = "structureButton";
|
||||
this.structureButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.structureButton.TabIndex = 9;
|
||||
@@ -168,7 +174,7 @@
|
||||
//
|
||||
// jobButton
|
||||
//
|
||||
this.jobButton.Location = new System.Drawing.Point(603, 281);
|
||||
this.jobButton.Location = new System.Drawing.Point(591, 334);
|
||||
this.jobButton.Name = "jobButton";
|
||||
this.jobButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.jobButton.TabIndex = 12;
|
||||
@@ -179,7 +185,7 @@
|
||||
// jobList
|
||||
//
|
||||
this.jobList.FormattingEnabled = true;
|
||||
this.jobList.Location = new System.Drawing.Point(492, 307);
|
||||
this.jobList.Location = new System.Drawing.Point(492, 360);
|
||||
this.jobList.Name = "jobList";
|
||||
this.jobList.Size = new System.Drawing.Size(255, 134);
|
||||
this.jobList.TabIndex = 11;
|
||||
@@ -189,7 +195,7 @@
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.BackColor = System.Drawing.Color.Transparent;
|
||||
this.label4.ForeColor = System.Drawing.SystemColors.Control;
|
||||
this.label4.Location = new System.Drawing.Point(489, 286);
|
||||
this.label4.Location = new System.Drawing.Point(489, 339);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(48, 13);
|
||||
this.label4.TabIndex = 10;
|
||||
@@ -197,7 +203,7 @@
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Location = new System.Drawing.Point(623, 503);
|
||||
this.okButton.Location = new System.Drawing.Point(623, 513);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(124, 37);
|
||||
this.okButton.TabIndex = 13;
|
||||
@@ -207,7 +213,7 @@
|
||||
//
|
||||
// characterFolder
|
||||
//
|
||||
this.characterFolder.Location = new System.Drawing.Point(398, 116);
|
||||
this.characterFolder.Location = new System.Drawing.Point(398, 169);
|
||||
this.characterFolder.Name = "characterFolder";
|
||||
this.characterFolder.Size = new System.Drawing.Size(75, 23);
|
||||
this.characterFolder.TabIndex = 9;
|
||||
@@ -217,7 +223,7 @@
|
||||
//
|
||||
// itemFolder
|
||||
//
|
||||
this.itemFolder.Location = new System.Drawing.Point(398, 280);
|
||||
this.itemFolder.Location = new System.Drawing.Point(398, 333);
|
||||
this.itemFolder.Name = "itemFolder";
|
||||
this.itemFolder.Size = new System.Drawing.Size(75, 23);
|
||||
this.itemFolder.TabIndex = 14;
|
||||
@@ -227,7 +233,7 @@
|
||||
//
|
||||
// structureFolder
|
||||
//
|
||||
this.structureFolder.Location = new System.Drawing.Point(672, 116);
|
||||
this.structureFolder.Location = new System.Drawing.Point(672, 169);
|
||||
this.structureFolder.Name = "structureFolder";
|
||||
this.structureFolder.Size = new System.Drawing.Size(75, 23);
|
||||
this.structureFolder.TabIndex = 15;
|
||||
@@ -237,7 +243,7 @@
|
||||
//
|
||||
// jobFolder
|
||||
//
|
||||
this.jobFolder.Location = new System.Drawing.Point(672, 281);
|
||||
this.jobFolder.Location = new System.Drawing.Point(672, 334);
|
||||
this.jobFolder.Name = "jobFolder";
|
||||
this.jobFolder.Size = new System.Drawing.Size(75, 23);
|
||||
this.jobFolder.TabIndex = 16;
|
||||
@@ -245,6 +251,46 @@
|
||||
this.jobFolder.UseVisualStyleBackColor = true;
|
||||
this.jobFolder.Click += new System.EventHandler(this.addFolderButton_Click);
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
this.pictureBox1.BackColor = System.Drawing.Color.OrangeRed;
|
||||
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
|
||||
this.pictureBox1.Location = new System.Drawing.Point(0, 26);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.Size = new System.Drawing.Size(784, 42);
|
||||
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||
this.pictureBox1.TabIndex = 17;
|
||||
this.pictureBox1.TabStop = false;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.BackColor = System.Drawing.Color.Transparent;
|
||||
this.label5.ForeColor = System.Drawing.SystemColors.Control;
|
||||
this.label5.Location = new System.Drawing.Point(215, 87);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(63, 13);
|
||||
this.label5.TabIndex = 18;
|
||||
this.label5.Text = "Executable:";
|
||||
//
|
||||
// exeBox
|
||||
//
|
||||
this.exeBox.Enabled = false;
|
||||
this.exeBox.Location = new System.Drawing.Point(284, 84);
|
||||
this.exeBox.Name = "exeBox";
|
||||
this.exeBox.Size = new System.Drawing.Size(176, 20);
|
||||
this.exeBox.TabIndex = 19;
|
||||
//
|
||||
// exeButton
|
||||
//
|
||||
this.exeButton.Location = new System.Drawing.Point(466, 84);
|
||||
this.exeButton.Name = "exeButton";
|
||||
this.exeButton.Size = new System.Drawing.Size(32, 20);
|
||||
this.exeButton.TabIndex = 20;
|
||||
this.exeButton.Text = "...";
|
||||
this.exeButton.UseVisualStyleBackColor = true;
|
||||
this.exeButton.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// PackageManager
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@@ -252,6 +298,10 @@
|
||||
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
|
||||
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.ClientSize = new System.Drawing.Size(784, 562);
|
||||
this.Controls.Add(this.exeButton);
|
||||
this.Controls.Add(this.exeBox);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.pictureBox1);
|
||||
this.Controls.Add(this.jobFolder);
|
||||
this.Controls.Add(this.structureFolder);
|
||||
this.Controls.Add(this.itemFolder);
|
||||
@@ -275,6 +325,7 @@
|
||||
this.DoubleBuffered = true;
|
||||
this.Name = "PackageManager";
|
||||
this.Text = "PackageManager";
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -302,6 +353,10 @@
|
||||
private System.Windows.Forms.Button itemFolder;
|
||||
private System.Windows.Forms.Button structureFolder;
|
||||
private System.Windows.Forms.Button jobFolder;
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.TextBox exeBox;
|
||||
private System.Windows.Forms.Button exeButton;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,8 @@ namespace Launcher
|
||||
private ContentPackage selectedPackage;
|
||||
|
||||
private List<ListBox> fileBoxes;
|
||||
private List<TextBox> singleFileBoxes;
|
||||
|
||||
private List<Button> fileButtons;
|
||||
|
||||
public PackageManager(ContentPackage _selectedPackage)
|
||||
@@ -35,6 +37,8 @@ namespace Launcher
|
||||
fileBoxes = new List<ListBox>();
|
||||
fileButtons = new List<Button>();
|
||||
|
||||
singleFileBoxes = new List<TextBox>();
|
||||
|
||||
fileBoxes.Add(itemList);
|
||||
itemList.Tag = ContentType.Item;
|
||||
itemButton.Tag = ContentType.Item;
|
||||
@@ -63,6 +67,10 @@ namespace Launcher
|
||||
fileButtons.Add(jobButton);
|
||||
fileButtons.Add(jobFolder);
|
||||
|
||||
singleFileBoxes.Add(exeBox);
|
||||
exeBox.Tag = ContentType.Executable;
|
||||
exeButton.Tag = ContentType.Executable;
|
||||
|
||||
foreach (Button fileButton in fileButtons)
|
||||
{
|
||||
fileButton.Enabled = false;
|
||||
@@ -150,6 +158,28 @@ namespace Launcher
|
||||
}
|
||||
}
|
||||
|
||||
private void fileList_KeyPress(object sender, PreviewKeyDownEventArgs e)
|
||||
{
|
||||
if (e.KeyCode != Keys.Delete) return;
|
||||
|
||||
ListBox listBox = sender as ListBox;
|
||||
|
||||
ContentType type = (listBox.Tag is ContentType) ? (ContentType)listBox.Tag : ContentType.None;
|
||||
Debug.Assert(type != ContentType.None, "ContentType of a button tag was ContentType.None");
|
||||
|
||||
List<ContentFile> selectedFiles = new List<ContentFile>();
|
||||
|
||||
foreach (ContentFile item in listBox.SelectedItems)
|
||||
{
|
||||
selectedFiles.Add(item);
|
||||
}
|
||||
|
||||
foreach (ContentFile file in selectedFiles)
|
||||
{
|
||||
RemoveFile(listBox, file);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddFile(ContentType type, string path)
|
||||
{
|
||||
ListBox selectedBox = null;
|
||||
@@ -161,10 +191,17 @@ namespace Launcher
|
||||
break;
|
||||
}
|
||||
|
||||
ContentFile newPackage = selectedPackage.AddFile(GetRelativePath(path, Directory.GetCurrentDirectory()), type);
|
||||
ContentFile newFile = selectedPackage.AddFile(GetRelativePath(path, Directory.GetCurrentDirectory()), type);
|
||||
|
||||
if (newPackage!=null) selectedBox.Items.Add(newPackage);
|
||||
|
||||
if (newFile!=null && selectedBox!=null) selectedBox.Items.Add(newFile);
|
||||
}
|
||||
|
||||
private void RemoveFile(ListBox listBox, ContentFile file)
|
||||
{
|
||||
if (file == null) return;
|
||||
|
||||
if (listBox != null) listBox.Items.Remove(file);
|
||||
selectedPackage.RemoveFile(file);
|
||||
}
|
||||
|
||||
private void addFolderButton_Click(object sender, EventArgs e)
|
||||
@@ -223,6 +260,39 @@ namespace Launcher
|
||||
|
||||
this.Close();
|
||||
}
|
||||
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
Button button = sender as Button;
|
||||
|
||||
ContentType type = (button.Tag is ContentType) ? (ContentType)button.Tag : ContentType.None;
|
||||
Debug.Assert(type != ContentType.None, "ContentType of a button tag was ContentType.None");
|
||||
|
||||
TextBox selectedBox = null;
|
||||
foreach (TextBox fileBox in singleFileBoxes)
|
||||
{
|
||||
if (type != ((fileBox.Tag is ContentType) ? (ContentType)fileBox.Tag : ContentType.None)) continue;
|
||||
|
||||
selectedBox = fileBox;
|
||||
break;
|
||||
}
|
||||
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.Filter = (type == ContentType.Executable) ? "Executable (*.exe)|*.exe" : "XML files (*.xml)|*.xml;*.XML";
|
||||
ofd.Multiselect = false;
|
||||
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
var existingFile = selectedPackage.files.Find(f => f.type == type);
|
||||
|
||||
if (existingFile!=null)
|
||||
{
|
||||
RemoveFile(null, existingFile);
|
||||
}
|
||||
|
||||
AddFile(type, ofd.FileName);
|
||||
selectedBox.Text = GetRelativePath(ofd.FileName, Directory.GetCurrentDirectory());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2771
-1
File diff suppressed because it is too large
Load Diff
@@ -463,19 +463,19 @@ namespace Subsurface
|
||||
MoveLimb(leftFoot, footPos + transformedFootPos, 2.5f);
|
||||
MoveLimb(rightFoot, footPos - transformedFootPos, 2.5f);
|
||||
|
||||
float legCorrection = MathUtils.GetShortestAngle(leftLeg.Rotation, torso.body.Rotation);
|
||||
//float legCorrection = MathUtils.GetShortestAngle(leftLeg.Rotation, torso.body.Rotation);
|
||||
|
||||
leftLeg.body.ApplyTorque(legCorrection);
|
||||
//leftLeg.body.ApplyTorque(legCorrection);
|
||||
|
||||
legCorrection = MathUtils.GetShortestAngle(rightLeg.Rotation, torso.body.Rotation);
|
||||
//legCorrection = MathUtils.GetShortestAngle(rightLeg.Rotation, torso.body.Rotation);
|
||||
|
||||
rightLeg.body.ApplyTorque(legCorrection);
|
||||
//Vector2 feetExtendForce = new Vector2(
|
||||
// (float)-Math.Sin(torso.body.Rotation),
|
||||
// (float)Math.Cos(torso.body.Rotation));
|
||||
//rightLeg.body.ApplyTorque(legCorrection);
|
||||
Vector2 feetExtendForce = new Vector2(
|
||||
(float)-Math.Sin(torso.body.Rotation),
|
||||
(float)Math.Cos(torso.body.Rotation));
|
||||
|
||||
//leftFoot.body.ApplyForce(feetExtendForce);
|
||||
//rightFoot.body.ApplyForce(feetExtendForce);
|
||||
leftFoot.body.ApplyForce(feetExtendForce);
|
||||
rightFoot.body.ApplyForce(feetExtendForce);
|
||||
|
||||
leftFoot.body.ApplyTorque(leftFoot.body.Mass * -Dir);
|
||||
rightFoot.body.ApplyTorque(rightFoot.body.Mass * -Dir);
|
||||
@@ -486,7 +486,7 @@ namespace Subsurface
|
||||
//if (!leftHand.Disabled) leftHand.body.ApplyTorque(leftHand.body.Mass * Dir);
|
||||
|
||||
//at the surface, not moving sideways -> hands just float around
|
||||
if (!headInWater && TargetMovement.X == 0.0f)
|
||||
if (!headInWater && TargetMovement.X == 0.0f && TargetMovement.Y>0)
|
||||
{
|
||||
handPos.X = handPos.X + Dir * 0.6f;
|
||||
|
||||
@@ -700,7 +700,7 @@ namespace Subsurface
|
||||
itemAngle = (torso.body.Rotation + holdAngle * Dir);
|
||||
}
|
||||
|
||||
Vector2 shoulderPos = head.SimPosition + (torso.SimPosition - head.SimPosition) *0.9f;
|
||||
Vector2 shoulderPos = limbJoints[2].WorldAnchorA;
|
||||
Vector2 transformedHoldPos = shoulderPos;
|
||||
|
||||
if (itemPos == Vector2.Zero)
|
||||
@@ -754,10 +754,10 @@ namespace Subsurface
|
||||
Limb arm = (i == 0) ? rightArm : leftArm;
|
||||
|
||||
//hand length
|
||||
float a = 24.0f;
|
||||
float a = 37.0f;
|
||||
|
||||
//arm length
|
||||
float b = 34.0f;
|
||||
float b = 28.0f;
|
||||
|
||||
//distance from shoulder to holdpos
|
||||
float c = ConvertUnits.ToDisplayUnits(Vector2.Distance(transformedHoldPos + transformedHandlePos[i], shoulderPos));
|
||||
|
||||
@@ -473,7 +473,7 @@ namespace Subsurface
|
||||
inWater = false;
|
||||
headInWater = false;
|
||||
|
||||
if (ConvertUnits.ToSimUnits(currentHull.Surface)-floorY> HeadPosition*0.95f)
|
||||
if (currentHull.Volume>currentHull.FullVolume*0.95f || ConvertUnits.ToSimUnits(currentHull.Surface)-floorY> HeadPosition*0.95f)
|
||||
inWater = true;
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<limb id = "2" radius="8" height="20" mass="3" type="LeftArm">
|
||||
<sprite texture="Content/Characters/Human/[GENDER]torso.png" sourcerect="30,2,17,39" depth="0.15" origin="0.5,0.5"/>
|
||||
</limb>
|
||||
<limb id = "3" radius="6" height="26" mass="3" type="LeftHand" pullpos="0.0,-15.0">
|
||||
<limb id = "3" radius="6" height="26" mass="3" type="LeftHand" pullpos="0.0,-18.0">
|
||||
<sprite texture="Content/Characters/Human/[GENDER]torso.png" sourcerect="49,2,13,47" depth="0.16" origin="0.5,0.5"/>
|
||||
</limb>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<limb id = "4" radius="8" height="20" mass="3" type="RightArm">
|
||||
<sprite texture="Content/Characters/Human/[GENDER]torso.png" sourcerect="30,2,17,39" depth="0.01" origin="0.5,0.5"/>
|
||||
</limb>
|
||||
<limb id = "5" radius="6" height="26" mass ="3" type="RightHand" pullpos="0.0,-15.0">
|
||||
<limb id = "5" radius="6" height="26" mass ="3" type="RightHand" pullpos="0.0,-18.0">
|
||||
<sprite texture="Content/Characters/Human/[GENDER]torso.png" sourcerect="49,2,13,47" origin="0.5,0.5"/>
|
||||
</limb>
|
||||
|
||||
@@ -75,12 +75,12 @@
|
||||
|
||||
<!-- body to left leg -->
|
||||
<joint limb1="12" limb1anchor="0,-1" limb2="6" limb2anchor="0,14" lowerlimit="-30" upperlimit="140"/>
|
||||
<joint limb1="6" limb1anchor="0,-15" limb2="7" limb2anchor="0,20" lowerlimit="-170" upperlimit="0"/>
|
||||
<joint limb1="6" limb1anchor="0,-15" limb2="7" limb2anchor="0,20" lowerlimit="-140" upperlimit="0"/>
|
||||
<joint limb1="7" limb1anchor="-3,-21" limb2="8" limb2anchor="5,7" lowerlimit="20" upperlimit="90"/>
|
||||
|
||||
<!-- body to right leg -->
|
||||
<joint limb1="12" limb1anchor="0,-1" limb2="9" limb2anchor="0,14" lowerlimit="-30" upperlimit="140"/>
|
||||
<joint limb1="9" limb1anchor="0,-15" limb2="10" limb2anchor="0,20" lowerlimit="-170" upperlimit="0"/>
|
||||
<joint limb1="9" limb1anchor="0,-15" limb2="10" limb2anchor="0,20" lowerlimit="-140" upperlimit="0"/>
|
||||
<joint limb1="10" limb1anchor="-3,-21" limb2="11" limb2anchor="5,7" lowerlimit="20" upperlimit="90"/>
|
||||
|
||||
</ragdoll>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
<Wearable limbtype="Head" slots="Any,Head">
|
||||
<sprite texture="DivingMask.png" limb="Head" sourcerect="1,1,37,38"/>
|
||||
<StatusEffect type="OnWearing" target="Contained,Character" targetnames="Oxygen Tank,human" Condition="-0.7" Oxygen="20.0"/>
|
||||
<StatusEffect type="OnWearing" target="Contained,Character" targetnames="Oxygen Tank,human" Condition="-0.5" Oxygen="20.0"/>
|
||||
<StatusEffect type="OnWearing" target="Contained,Character" targetnames="Welding Fuel Tank,human" Condition="-0.7" Oxygen="-20.0"/>
|
||||
</Wearable>
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<sprite texture="DivingSuit.png" limb="RightArm" sourcerect="0,0,18,40" origin="0.5,0.4" depth="0.005"/>
|
||||
<sprite texture="DivingSuit.png" limb="LeftArm" sourcerect="0,0,18,40" origin="0.5,0.4" depth="0.005"/>
|
||||
|
||||
<StatusEffect type="OnWearing" target="Contained,Character" targetnames="Oxygen Tank,human" Condition="-0.7" Oxygen="20.0"/>
|
||||
<StatusEffect type="OnWearing" target="Contained,Character" targetnames="Oxygen Tank,human" Condition="-0.5" Oxygen="20.0"/>
|
||||
<StatusEffect type="OnWearing" target="Character" PressureProtection="100.0"/>
|
||||
</Wearable>
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 216 B |
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Item
|
||||
name="Monitor"
|
||||
linkable="true"
|
||||
pickdistance="150">
|
||||
|
||||
<Sprite texture ="monitor.png" depth="0.85"/>
|
||||
|
||||
<Body width="16" height="16"/>
|
||||
|
||||
<Holdable slots="Any,RightHand,LeftHand" msg="Detach [Wrench]"
|
||||
aimpos="35,-10" handle1="0,0" attachable="true" aimable="true">
|
||||
<requireditem name="Wrench" type="Equipped"/>
|
||||
</Holdable>
|
||||
|
||||
<Label canbeselected = "true">
|
||||
<GuiFrame rect="0,0,0.4,0.4" alignment="Center" color="0.0,0.0,0.0,0.8"/>
|
||||
</Label>
|
||||
</Item>
|
||||
@@ -2,7 +2,6 @@
|
||||
<Items>
|
||||
<Item
|
||||
name="Junction Box"
|
||||
type="JunctionBox"
|
||||
linkable="true"
|
||||
pickdistance="150">
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
@@ -2,7 +2,7 @@
|
||||
name="MiniMap"
|
||||
linkable="true">
|
||||
|
||||
<Sprite texture ="reactor.png" depth="0.8"/>
|
||||
<Sprite texture ="fabricator.png" depth="0.8"/>
|
||||
|
||||
<trigger/>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<OxygenGenerator powerconsumption="1000.0" minvoltage="0.5" canbeselected = "true">
|
||||
<StatusEffect type="OnActive" target="Contained" targetnames="Oxygen Tank" Condition="2.0"/>
|
||||
<sound file="oxygengenerator.ogg" type="OnActive" range="2000.0" volume="PowerConsumption" volumemultiplier="0.001f"/>
|
||||
<sound file="oxygengenerator.ogg" type="OnActive" range="2000.0" volume="CurrPowerConsumption" volumemultiplier="0.001f"/>
|
||||
</OxygenGenerator>
|
||||
|
||||
<trigger/>
|
||||
@@ -27,7 +27,7 @@
|
||||
name="Vent"
|
||||
linkable="true">
|
||||
|
||||
<Sprite texture ="vent.png" depth="0.8"/>
|
||||
<Sprite texture ="vent.png" depth="0.85"/>
|
||||
|
||||
<Vent>
|
||||
<sound file="ventilation.ogg" type="OnActive" range="600.0" volume="OxygenFlow" volumemultiplier="0.001f"/>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<Pump canbeselected = "true" maxflow="500" PowerConsumption="300.0" MinVoltage="0.3">
|
||||
<GuiFrame rect="0,0,0.3,0.3" alignment="Center" color="0.0,0.0,0.0,0.8"/>
|
||||
<sound file="pump.ogg" type="OnActive" range="800.0" volume="PowerConsumption" volumemultiplier="0.003"/>
|
||||
<sound file="pump.ogg" type="OnActive" range="800.0" volume="CurrPowerConsumption" volumemultiplier="0.003"/>
|
||||
</Pump>
|
||||
|
||||
<ConnectionPanel canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
Tags="smallitem"
|
||||
pickdistance="200">
|
||||
|
||||
<Sprite texture ="weldingtool.png" depth="0.04"/>
|
||||
<Sprite texture ="weldingtool.png" depth="0.5"/>
|
||||
|
||||
<!-- physics body -->
|
||||
<Body width="39" height="18" density="5"/>
|
||||
@@ -47,7 +47,7 @@
|
||||
Tags="smallitem"
|
||||
pickdistance="200">
|
||||
|
||||
<Sprite texture ="plasmacutter.png" depth="0.04"/>
|
||||
<Sprite texture ="plasmacutter.png" depth="0.5"/>
|
||||
|
||||
<Body width="39" height="18" density="5"/>
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
Tags="smallitem"
|
||||
pickdistance="150">
|
||||
|
||||
<Sprite texture ="fueltank.png" depth="0.05"/>
|
||||
<Sprite texture ="fueltank.png" depth="0.5"/>
|
||||
|
||||
<Body radius="6" height="22" density="5"/>
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
Tags="smallitem"
|
||||
pickdistance="200">
|
||||
|
||||
<Sprite texture ="screwdriver.png"/>
|
||||
<Sprite texture ="screwdriver.png" depth="0.5"/>
|
||||
|
||||
<Body width="30" height="8" density="20"/>
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
Tags="smallitem"
|
||||
pickdistance="200">
|
||||
|
||||
<Sprite texture ="wrench.png"/>
|
||||
<Sprite texture ="wrench.png" depth="0.5"/>
|
||||
|
||||
<Body width="30" height="8" density="20"/>
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
name="Harpoon Gun"
|
||||
pickdistance="200" >
|
||||
|
||||
<Sprite texture ="harpoongun.png" depth="0.04"/>
|
||||
<Sprite texture ="harpoongun.png" depth="0.5"/>
|
||||
|
||||
<Body width="90" height="30" density="10"/>
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
<smallhorizontalback sprite="Content/Map/testroom.png" sourcerect="0,64,896,32" depth ="0.4"
|
||||
width = "128" height ="32" resizehorizontal="true"/>
|
||||
|
||||
<leftwall sprite="Content/Map/testroom.png" sourcerect="688,352,32,496" depth ="0.05" castshadow="true"
|
||||
width = "32" height ="64" resizevertical="true" body="true" health="500"/>
|
||||
<leftwall sprite="Content/Map/testroom.png" sourcerect="688,368,32,496" depth ="0.05" castshadow="true"
|
||||
width = "32" height ="64" resizevertical="true" fliphorizontal="true" body="true" health="500"/>
|
||||
|
||||
<rightwall sprite="Content/Map/testroom.png" fliphorizontal="true" sourcerect="688,352,32,496" depth ="0.05" castshadow="true"
|
||||
<rightwall sprite="Content/Map/testroom.png" sourcerect="688,368,32,496" depth ="0.05" castshadow="true"
|
||||
width = "32" height ="64" resizevertical="true" body="true" health="500"/>
|
||||
|
||||
<topwall sprite="Content/Map/testroom.png" sourcerect="144,464,496,32" depth ="0.05" castshadow="true"
|
||||
|
||||
@@ -2,9 +2,38 @@
|
||||
<Quests>
|
||||
<SalvageQuest
|
||||
name="Salvaging an artifact"
|
||||
description="Researchers have picked up an infrasonic signal highly similar to those emitted by alien artifacts previously discovered on Europa. Investigate the signal and retrieve the potential artifact."
|
||||
description="Researchers of [location1] have picked up an infrasonic signal highly similar to those emitted by alien artifacts previously discovered on Europa. Investigate the signal and retrieve the potential artifact."
|
||||
commonness="10"
|
||||
reward="1000"
|
||||
successmessage="You have successfully retrieved the artifact."
|
||||
itemname="Skyholder Artifact">
|
||||
</SalvageQuest>
|
||||
|
||||
<MonsterQuest
|
||||
name="Killing a Moloch"
|
||||
description="A particularly aggressive Moloch has been terrorizing vessels traveling between [location1] and [location2]. A reward of 1000 credits has been promised to those who kill the creature."
|
||||
commonness="10"
|
||||
reward="1000"
|
||||
successmessage="You have successfully killed the Moloch."
|
||||
monsterfile="Content/Characters/Moloch/moloch.xml">
|
||||
</MonsterQuest>
|
||||
|
||||
<MonsterQuest
|
||||
name="Killing a Tiger Thresher"
|
||||
description="A particularly aggressive Tiger Thresher has been terrorizing vessels traveling between [location1] and [location2]. A reward of 800 credits has been promised to those who kill the creature."
|
||||
commonness="10"
|
||||
reward="800"
|
||||
successmessage="You have successfully killed the Tiger Thresher."
|
||||
monsterfile="Content/Characters/TigerThresher/tigerthresher.xml">
|
||||
</MonsterQuest>
|
||||
|
||||
<MonsterQuest
|
||||
name="Salvaging an artifact"
|
||||
description="Researchers of [location1] have picked up an infrasonic signal highly similar to those emitted by alien artifacts previously discovered on Europa. Investigate the signal and retrieve the potential artifact."
|
||||
commonness="5"
|
||||
reward="1000"
|
||||
failuremessage="It turns out the signal picked up by [location1] was emitted by a Moloch."
|
||||
successmessage="It turns out the signal was emitted by a Moloch. The researchers of [location1] have agreed to pay you the reward nevertheless for killing the Moloch."
|
||||
monsterfile="Content/Characters/Moloch/moloch.xml">
|
||||
</MonsterQuest>
|
||||
</Quests>
|
||||
@@ -3,7 +3,7 @@
|
||||
<MonsterEvent name="Under attack" description=""
|
||||
characterfile="Content/Characters/Crawler/Crawler.xml"
|
||||
commonness="10"
|
||||
difficulty="10"
|
||||
difficulty="15"
|
||||
minamount="2" maxamount="3"
|
||||
starttimemin="15" starttimemax="20"
|
||||
musictype="monster"/>
|
||||
@@ -11,14 +11,14 @@
|
||||
<MonsterEvent name="Under attack" description=""
|
||||
characterfile="Content/Characters/TigerThresher/tigerthresher.xml"
|
||||
commonness="10"
|
||||
difficulty="50"
|
||||
difficulty="30"
|
||||
starttimemin="15" starttimemax="20"
|
||||
musictype="monster"/>
|
||||
|
||||
<MonsterEvent name="Under attack" description=""
|
||||
characterfile="Content/Characters/Moloch/moloch.xml"
|
||||
commonness="10"
|
||||
difficulty="30"
|
||||
difficulty="50"
|
||||
starttimemin="15" starttimemax="20"
|
||||
musictype="monster"/>
|
||||
</Randomevents>
|
||||
@@ -9,7 +9,7 @@ namespace Subsurface
|
||||
{
|
||||
public enum ContentType
|
||||
{
|
||||
None, Jobs, Item, Character, Structure
|
||||
None, Jobs, Item, Character, Structure, Executable
|
||||
}
|
||||
|
||||
public class ContentPackage
|
||||
@@ -88,6 +88,11 @@ namespace Subsurface
|
||||
return cf;
|
||||
}
|
||||
|
||||
public void RemoveFile(ContentFile file)
|
||||
{
|
||||
files.Remove(file);
|
||||
}
|
||||
|
||||
public void Save(string filePath)
|
||||
{
|
||||
XDocument doc = new XDocument();
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
using FarseerPhysics;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Subsurface
|
||||
{
|
||||
class MonsterQuest : Quest
|
||||
{
|
||||
//string monsterName;
|
||||
|
||||
string monsterFile;
|
||||
|
||||
Character monster;
|
||||
|
||||
public override string RadarLabel
|
||||
{
|
||||
get
|
||||
{
|
||||
return monster.SpeciesName;
|
||||
}
|
||||
}
|
||||
|
||||
public override Vector2 RadarPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
return monster.Position;
|
||||
}
|
||||
}
|
||||
|
||||
public MonsterQuest(XElement element)
|
||||
: base(element)
|
||||
{
|
||||
//monsterName = ToolBox.GetAttributeString(element, "monstername", "");
|
||||
monsterFile = ToolBox.GetAttributeString(element, "monsterfile", "");
|
||||
}
|
||||
|
||||
public override void Start(Level level)
|
||||
{
|
||||
Vector2 position = level.PositionsOfInterest[Rand.Int(level.PositionsOfInterest.Count)];
|
||||
|
||||
monster = new Character(monsterFile, ConvertUnits.ToSimUnits(position+level.Position));
|
||||
}
|
||||
|
||||
public override void End()
|
||||
{
|
||||
if (!monster.IsDead) return;
|
||||
|
||||
GiveReward();
|
||||
|
||||
completed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ namespace Subsurface
|
||||
failureMessage = ToolBox.GetAttributeString(element, "failuremessage", "");
|
||||
}
|
||||
|
||||
public static Quest LoadRandom(Random rand)
|
||||
public static Quest LoadRandom(Location[] locations, Random rand)
|
||||
{
|
||||
XDocument doc = ToolBox.TryLoadXml(configFile);
|
||||
if (doc == null) return null;
|
||||
@@ -116,7 +116,11 @@ namespace Subsurface
|
||||
ConstructorInfo constructor = t.GetConstructor(new[] { typeof(XElement) });
|
||||
object instance = constructor.Invoke(new object[] { element });
|
||||
|
||||
return (Quest)instance;
|
||||
Quest quest = (Quest)instance;
|
||||
quest.description = quest.description.Replace("[location1]", locations[0].Name);
|
||||
quest.description = quest.description.Replace("[location2]", locations[1].Name);
|
||||
|
||||
return quest;
|
||||
}
|
||||
|
||||
randomNumber -= eventProbability[i];
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Subsurface
|
||||
{
|
||||
Vector2 position = level.PositionsOfInterest[Rand.Int(level.PositionsOfInterest.Count)];
|
||||
|
||||
item = new Item(itemPrefab, position+level.Position);
|
||||
item = new Item(itemPrefab, position + level.Position);
|
||||
//item.MoveWithLevel = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Subsurface
|
||||
|
||||
y += 60;
|
||||
|
||||
if (Screen.Selected == Game1.GameScreen)
|
||||
if (Screen.Selected == Game1.GameScreen && Game1.GameSession !=null)
|
||||
{
|
||||
SinglePlayerMode spMode = Game1.GameSession.gameMode as SinglePlayerMode;
|
||||
if (spMode!=null)
|
||||
|
||||
@@ -21,8 +21,14 @@ namespace Subsurface
|
||||
this.Buttons[0].OnClicked = Close;
|
||||
}
|
||||
|
||||
public GUIMessageBox(string header, string text, string[] buttons, Alignment textAlignment = Alignment.TopLeft)
|
||||
: base(new Rectangle(0,0, DefaultWidth, DefaultHeight),
|
||||
public GUIMessageBox(string header, string text, int width, int height)
|
||||
: this(header, text, new string[] { "OK" }, width, height)
|
||||
{
|
||||
this.Buttons[0].OnClicked = Close;
|
||||
}
|
||||
|
||||
public GUIMessageBox(string header, string text, string[] buttons, int width=DefaultWidth, int height=DefaultHeight, Alignment textAlignment = Alignment.TopLeft)
|
||||
: base(new Rectangle(0,0, width, height),
|
||||
null, Alignment.Center, GUI.style, null)
|
||||
{
|
||||
//Padding = GUI.style.smallPadding;
|
||||
@@ -34,7 +40,7 @@ namespace Subsurface
|
||||
//}
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 30), header, Color.Transparent, Color.White, textAlignment, GUI.style, this, true);
|
||||
new GUITextBlock(new Rectangle(0, 30, 0, DefaultHeight - 70), text, Color.Transparent, Color.White, textAlignment, GUI.style, this, true);
|
||||
new GUITextBlock(new Rectangle(0, 30, 0, height - 70), text, Color.Transparent, Color.White, textAlignment, GUI.style, this, true);
|
||||
|
||||
int x = 0;
|
||||
this.Buttons = new GUIButton[buttons.Length];
|
||||
|
||||
@@ -43,6 +43,12 @@ namespace Subsurface
|
||||
}
|
||||
}
|
||||
|
||||
public bool LimitText
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Vector2 TextPos
|
||||
{
|
||||
get { return textPos; }
|
||||
@@ -124,14 +130,14 @@ namespace Subsurface
|
||||
{
|
||||
if (text==null) return;
|
||||
|
||||
Vector2 size = MeasureText();
|
||||
Vector2 size = MeasureText(text);
|
||||
|
||||
if (Wrap && rect.Width>0)
|
||||
{
|
||||
//text = text.Replace("\n"," ");
|
||||
text = ToolBox.WrapText(text, rect.Width, Font);
|
||||
|
||||
Vector2 newSize = MeasureText();
|
||||
Vector2 newSize = MeasureText(text);
|
||||
|
||||
//Rectangle newRect = rect;
|
||||
|
||||
@@ -141,6 +147,12 @@ namespace Subsurface
|
||||
//Rect = newRect;
|
||||
size = newSize;
|
||||
}
|
||||
|
||||
if (LimitText && text.Length>1 && size.Y > rect.Height)
|
||||
{
|
||||
string[] lines = text.Split('\n');
|
||||
text = string.Join("\n", lines, 0, lines.Length-1);
|
||||
}
|
||||
|
||||
textPos = new Vector2(rect.Width / 2.0f, rect.Height / 2.0f);
|
||||
origin = size * 0.5f;
|
||||
@@ -163,10 +175,20 @@ namespace Subsurface
|
||||
textPos.X = (int)textPos.X;
|
||||
textPos.Y = (int)textPos.Y;
|
||||
|
||||
caretPos = new Vector2(rect.X + size.X, rect.Y) + textPos - origin;
|
||||
if (text.Contains("\n"))
|
||||
{
|
||||
string[] lines = text.Split('\n');
|
||||
Vector2 lastLineSize = MeasureText(lines[lines.Length-1]);
|
||||
caretPos = new Vector2(rect.X + lastLineSize.X, rect.Y + size.Y - lastLineSize.Y) + textPos - origin;
|
||||
}
|
||||
else
|
||||
{
|
||||
caretPos = new Vector2(rect.X + size.X, rect.Y) + textPos - origin;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Vector2 MeasureText()
|
||||
private Vector2 MeasureText(string text)
|
||||
{
|
||||
Vector2 size = Vector2.Zero;
|
||||
while (size == Vector2.Zero)
|
||||
|
||||
@@ -36,6 +36,12 @@ namespace Subsurface
|
||||
set { textBlock.Wrap = value; }
|
||||
}
|
||||
|
||||
public bool LimitText
|
||||
{
|
||||
get { return textBlock.LimitText; }
|
||||
set { textBlock.LimitText = value; }
|
||||
}
|
||||
|
||||
public bool Enabled
|
||||
{
|
||||
get;
|
||||
@@ -187,10 +193,8 @@ namespace Subsurface
|
||||
new Vector2((int)caretPos.X + 2, caretPos.Y + Font.MeasureString("I").Y - 3),
|
||||
textBlock.TextColor * (textBlock.TextColor.A / 255.0f));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void ReceiveTextInput(char inputChar)
|
||||
{
|
||||
Text = Text + inputChar;
|
||||
|
||||
@@ -45,10 +45,7 @@ namespace Subsurface
|
||||
//public readonly bool IsSinglePlayer;
|
||||
|
||||
private GUIProgressBar timerBar;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected bool isRunning;
|
||||
|
||||
//protected string name;
|
||||
@@ -57,6 +54,11 @@ namespace Subsurface
|
||||
|
||||
private string endMessage;
|
||||
|
||||
public virtual Quest Quest
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public DateTime StartTime
|
||||
{
|
||||
get { return startTime; }
|
||||
@@ -143,13 +145,10 @@ namespace Subsurface
|
||||
public static void Init()
|
||||
{
|
||||
new GameModePreset("Single Player", typeof(SinglePlayerMode), true);
|
||||
|
||||
new GameModePreset("SandBox", typeof(GameMode), false);
|
||||
new GameModePreset("Traitor", typeof(TraitorMode), false);
|
||||
|
||||
|
||||
//new SinglePlayerMode("Single Player", true);
|
||||
//new GameMode("Sandbox");
|
||||
//new TraitorMode("Traitor");
|
||||
new GameModePreset("Quest", typeof(QuestMode), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Subsurface
|
||||
//protected DateTime endTime;
|
||||
|
||||
public readonly GameMode gameMode;
|
||||
|
||||
|
||||
private GUIFrame guiRoot;
|
||||
|
||||
//private GUIListBox chatBox;
|
||||
@@ -29,6 +29,16 @@ namespace Subsurface
|
||||
|
||||
private Submarine submarine;
|
||||
|
||||
|
||||
public Quest Quest
|
||||
{
|
||||
get
|
||||
{
|
||||
if (gameMode != null) return gameMode.Quest;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Level level;
|
||||
|
||||
public Level Level
|
||||
@@ -100,7 +110,7 @@ namespace Subsurface
|
||||
public void StartShift(TimeSpan duration, Level level, bool reloadSub = true)
|
||||
{
|
||||
Game1.LightManager.LosEnabled = (Game1.Server==null);
|
||||
|
||||
|
||||
this.level = level;
|
||||
|
||||
if (reloadSub || Submarine.Loaded != submarine) submarine.Load();
|
||||
@@ -111,15 +121,18 @@ namespace Subsurface
|
||||
submarine.SetPosition(level.StartPosition - new Vector2(0.0f, 2000.0f));
|
||||
}
|
||||
|
||||
if (Quest!=null) Quest.Start(Level.Loaded);
|
||||
|
||||
if (gameMode!=null) gameMode.Start(duration);
|
||||
|
||||
|
||||
|
||||
|
||||
taskManager.StartShift(level);
|
||||
}
|
||||
|
||||
public void EndShift(string endMessage)
|
||||
{
|
||||
|
||||
if (Quest != null) Quest.End();
|
||||
|
||||
if (Game1.Server!=null)
|
||||
{
|
||||
Game1.Server.EndGame(endMessage);
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Subsurface
|
||||
{
|
||||
class QuestMode : GameMode
|
||||
{
|
||||
Quest quest;
|
||||
|
||||
public override Quest Quest
|
||||
{
|
||||
get
|
||||
{
|
||||
return quest;
|
||||
}
|
||||
}
|
||||
|
||||
public QuestMode(GameModePreset preset)
|
||||
: base(preset)
|
||||
{
|
||||
Location[] locations = new Location[2];
|
||||
|
||||
Random rand = new Random(Game1.NetLobbyScreen.LevelSeed.GetHashCode());
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
locations[i] = Location.CreateRandom(new Vector2((float)rand.NextDouble() * 10000.0f, (float)rand.NextDouble() * 10000.0f));
|
||||
}
|
||||
quest = Quest.LoadRandom(locations, rand);
|
||||
}
|
||||
|
||||
public override void Start(TimeSpan duration)
|
||||
{
|
||||
base.Start(duration);
|
||||
|
||||
new GUIMessageBox(quest.Name, quest.Description, 400, 400);
|
||||
|
||||
quest.Start(Level.Loaded);
|
||||
}
|
||||
|
||||
public override void End(string endMessage = "")
|
||||
{
|
||||
quest.End();
|
||||
|
||||
base.End(endMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,8 +18,6 @@ namespace Subsurface
|
||||
private GUIButton endShiftButton;
|
||||
|
||||
public readonly CargoManager CargoManager;
|
||||
|
||||
private Quest quest;
|
||||
|
||||
public Map map;
|
||||
|
||||
@@ -28,6 +26,14 @@ namespace Subsurface
|
||||
|
||||
private bool savedOnStart;
|
||||
|
||||
public override Quest Quest
|
||||
{
|
||||
get
|
||||
{
|
||||
return map.SelectedConnection.Quest;
|
||||
}
|
||||
}
|
||||
|
||||
public int Money
|
||||
{
|
||||
get { return crewManager.Money; }
|
||||
@@ -93,8 +99,6 @@ namespace Subsurface
|
||||
{
|
||||
CargoManager.CreateItems();
|
||||
|
||||
Game1.GameSession.Map.SelectedConnection.Quest.Start(Level.Loaded);
|
||||
|
||||
if (!savedOnStart)
|
||||
{
|
||||
SaveUtil.SaveGame(Game1.GameSession.SavePath);
|
||||
@@ -176,8 +180,6 @@ namespace Subsurface
|
||||
{
|
||||
base.End(endMessage);
|
||||
|
||||
quest.End();
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
List<Character> casualties = crewManager.characters.FindAll(c => c.IsDead);
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ namespace Subsurface
|
||||
|
||||
public override void Update(float deltaTime)
|
||||
{
|
||||
if (Game1.Server == null) return;
|
||||
|
||||
base.Update(deltaTime);
|
||||
|
||||
if (!isRunning) return;
|
||||
|
||||
@@ -70,15 +70,7 @@ namespace Subsurface
|
||||
|
||||
public void Save(string filePath)
|
||||
{
|
||||
XDocument doc = null;
|
||||
try
|
||||
{
|
||||
doc = XDocument.Load(filePath);
|
||||
}
|
||||
catch
|
||||
{
|
||||
doc = new XDocument();
|
||||
}
|
||||
XDocument doc = new XDocument();
|
||||
|
||||
if (doc.Root == null)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Xml.Linq;
|
||||
using FarseerPhysics;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Subsurface.Items.Components
|
||||
{
|
||||
@@ -8,6 +9,10 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
//the position(s) in the item that the character grabs
|
||||
protected Vector2[] handlePos;
|
||||
|
||||
private List<RelatedItem> prevRequiredItems;
|
||||
|
||||
string prevMsg;
|
||||
|
||||
//protected Character picker;
|
||||
|
||||
@@ -83,29 +88,20 @@ namespace Subsurface.Items.Components
|
||||
|
||||
canBePicked = true;
|
||||
|
||||
if (attachable)
|
||||
{
|
||||
prevRequiredItems = new List<RelatedItem>(requiredItems);
|
||||
prevMsg = Msg;
|
||||
|
||||
requiredItems.Clear();
|
||||
Msg = "";
|
||||
}
|
||||
|
||||
|
||||
//holdAngle = ToolBox.GetAttributeFloat(element, "holdangle", 0.0f);
|
||||
//holdAngle = MathHelper.ToRadians(holdAngle);
|
||||
}
|
||||
|
||||
//public override void Equip(Character picker)
|
||||
//{
|
||||
// if (picker == null) return;
|
||||
// if (picker.Inventory == null) return;
|
||||
|
||||
// this.picker = picker;
|
||||
|
||||
// for (int i = item.linkedTo.Count - 1; i >= 0; i--)
|
||||
// item.linkedTo[i].RemoveLinked((MapEntity)item);
|
||||
// item.linkedTo.Clear();
|
||||
|
||||
// System.Diagnostics.Debug.WriteLine("picked item");
|
||||
|
||||
// //this.picker = picker;
|
||||
// picker.SelectedItem = item;
|
||||
|
||||
// isActive = true;
|
||||
//}
|
||||
|
||||
public override void Drop(Character dropper)
|
||||
{
|
||||
if (picker == null)
|
||||
@@ -147,27 +143,31 @@ namespace Subsurface.Items.Components
|
||||
if (picker == null) return;
|
||||
|
||||
picker.DeselectItem(item);
|
||||
|
||||
|
||||
item.body.Enabled = false;
|
||||
isActive = false;
|
||||
}
|
||||
|
||||
public override bool Pick(Character picker)
|
||||
{
|
||||
if (!base.Pick(picker)) return false;
|
||||
if (!attachable)
|
||||
{
|
||||
return base.Pick(picker);
|
||||
}
|
||||
|
||||
if (!attachable) return false;
|
||||
if (!base.Pick(picker))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
requiredItems.Clear();
|
||||
Msg = "";
|
||||
}
|
||||
|
||||
//if (item.body==null)
|
||||
//{
|
||||
// DebugConsole.ThrowError("Item " + item + " must have a physics body component to be attachable!");
|
||||
// return false;
|
||||
//}
|
||||
|
||||
//if (attached) return false;
|
||||
|
||||
item.body = body;
|
||||
item.body.Enabled = true;
|
||||
attached = false;
|
||||
if (body!=null) item.body = body;
|
||||
//item.body.Enabled = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -180,6 +180,9 @@ namespace Subsurface.Items.Components
|
||||
item.body.Enabled = false;
|
||||
item.body = null;
|
||||
|
||||
requiredItems = new List<RelatedItem>(prevRequiredItems);
|
||||
Msg = prevMsg;
|
||||
|
||||
attached = true;
|
||||
|
||||
return true;
|
||||
@@ -191,15 +194,7 @@ namespace Subsurface.Items.Components
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
{
|
||||
//if (picker == null)// || picker.animController.selectedItem != item)
|
||||
//{
|
||||
// System.Diagnostics.Debug.WriteLine("drop");
|
||||
// //picker = null;
|
||||
// isActive = false;
|
||||
// return;
|
||||
//}
|
||||
|
||||
{
|
||||
if (!item.body.Enabled) return;
|
||||
if (!picker.HasSelectedItem(item)) isActive = false;
|
||||
|
||||
@@ -209,6 +204,8 @@ namespace Subsurface.Items.Components
|
||||
|
||||
AnimController ac = picker.AnimController;
|
||||
|
||||
item.sprite.Depth = picker.AnimController.GetLimb(LimbType.RightHand).sprite.Depth + 0.01f;
|
||||
|
||||
ac.HoldItem(deltaTime, cam, item, handlePos, holdPos, aimPos, holdAngle);
|
||||
}
|
||||
|
||||
@@ -221,7 +218,17 @@ namespace Subsurface.Items.Components
|
||||
|
||||
public override void OnMapLoaded()
|
||||
{
|
||||
if (attached) Use(1.0f);
|
||||
//prevRequiredItems = new List<RelatedItem>(requiredItems);
|
||||
|
||||
if (attached)
|
||||
{
|
||||
Use(1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
requiredItems.Clear();
|
||||
Msg = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
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;
|
||||
|
||||
private string text;
|
||||
|
||||
[HasDefaultValue("", true)]
|
||||
public string Text
|
||||
{
|
||||
get { return text; }
|
||||
set
|
||||
{
|
||||
text = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
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;
|
||||
|
||||
GUIButton button = new GUIButton(new Rectangle(0,0,100,15), "OK", null, Alignment.BottomRight, GUI.style, GuiFrame);
|
||||
button.OnClicked = Close;
|
||||
}
|
||||
|
||||
textBox.Text = text;
|
||||
|
||||
textBox.Select();
|
||||
|
||||
return base.Select(character);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
//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);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool Close(GUIButton button, object obj)
|
||||
{
|
||||
textBox.Deselect();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Text = newText;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,10 +14,9 @@ namespace Subsurface.Items.Components
|
||||
|
||||
float? targetLevel;
|
||||
|
||||
//bool flowIn;
|
||||
|
||||
Hull hull1, hull2;
|
||||
|
||||
[HasDefaultValue(0.0f, true)]
|
||||
private float FlowPercentage
|
||||
{
|
||||
get { return flowPercentage; }
|
||||
@@ -38,14 +37,20 @@ namespace Subsurface.Items.Components
|
||||
public Pump(Item item, XElement element)
|
||||
: base(item, element)
|
||||
{
|
||||
flowPercentage = 100.0f;
|
||||
|
||||
item.linkedTo.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{ GetHulls(); };
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
{
|
||||
if (targetLevel != null)
|
||||
{
|
||||
float hullPercentage = 0.0f;
|
||||
if (hull1 != null) hullPercentage = (hull1.Volume / hull1.FullVolume) * 100.0f;
|
||||
flowPercentage = ((float)targetLevel - hullPercentage);
|
||||
}
|
||||
|
||||
|
||||
currPowerConsumption = powerConsumption * Math.Abs(flowPercentage / 100.0f);
|
||||
|
||||
if (voltage < minVoltage) return;
|
||||
@@ -56,16 +61,9 @@ namespace Subsurface.Items.Components
|
||||
//flowPercentage = maxFlow * powerFactor;
|
||||
|
||||
float deltaVolume = 0.0f;
|
||||
if (targetLevel!=null)
|
||||
{
|
||||
float hullPercentage = 0.0f;
|
||||
if (hull1 != null) hullPercentage = (hull1.Volume / hull1.FullVolume)*100.0f;
|
||||
deltaVolume = ((float)targetLevel - hullPercentage)/100.0f * maxFlow * powerFactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
deltaVolume = (flowPercentage/100.0f) * maxFlow * powerFactor;
|
||||
}
|
||||
|
||||
|
||||
hull1.Volume += deltaVolume;
|
||||
if (hull1.Volume > hull1.FullVolume) hull1.Pressure += 0.5f;
|
||||
@@ -113,6 +111,7 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
targetLevel = null;
|
||||
isActive = !isActive;
|
||||
if (!isActive) currPowerConsumption = 0.0f;
|
||||
}
|
||||
|
||||
spriteBatch.DrawString(GUI.Font, "Flow percentage: " + (int)flowPercentage + " %", new Vector2(x + 20, y + 80), Color.White);
|
||||
@@ -134,7 +133,7 @@ namespace Subsurface.Items.Components
|
||||
}
|
||||
else if (connection.Name == "set_active")
|
||||
{
|
||||
isActive = (signal != "0");
|
||||
isActive = (signal != "0");
|
||||
}
|
||||
else if (connection.Name == "set_speed")
|
||||
{
|
||||
@@ -152,6 +151,8 @@ namespace Subsurface.Items.Components
|
||||
targetLevel = MathHelper.Clamp(tempTarget, 0.0f, 100.0f);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isActive) currPowerConsumption = 0.0f;
|
||||
}
|
||||
|
||||
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetOutgoingMessage message)
|
||||
|
||||
@@ -9,17 +9,13 @@ using System.Xml.Linq;
|
||||
|
||||
namespace Subsurface.Items.Components
|
||||
{
|
||||
class Radar : ItemComponent
|
||||
class Radar : Powered
|
||||
{
|
||||
float range;
|
||||
private float range;
|
||||
|
||||
float angle;
|
||||
private float pingState;
|
||||
|
||||
float pingState;
|
||||
|
||||
//RenderTarget2D renderTarget;
|
||||
|
||||
Sprite pingCircle, screenOverlay;
|
||||
private Sprite pingCircle, screenOverlay;
|
||||
|
||||
[HasDefaultValue(0.0f, false)]
|
||||
public float Range
|
||||
@@ -51,14 +47,21 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
base.Update(deltaTime, cam);
|
||||
|
||||
pingState = (pingState + deltaTime * 0.5f);
|
||||
if (pingState>1.0f)
|
||||
if (voltage>=minVoltage)
|
||||
{
|
||||
pingState = (pingState + deltaTime * 0.5f);
|
||||
if (pingState>1.0f)
|
||||
{
|
||||
item.Use(deltaTime, null);
|
||||
pingState = 0.0f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item.Use(deltaTime, null);
|
||||
pingState = 0.0f;
|
||||
}
|
||||
|
||||
//angle = (angle + deltaTime) % MathHelper.TwoPi;
|
||||
|
||||
}
|
||||
|
||||
public override bool Use(float deltaTime, Character character = null)
|
||||
@@ -74,10 +77,14 @@ namespace Subsurface.Items.Components
|
||||
|
||||
GuiFrame.Draw(spriteBatch);
|
||||
|
||||
if (voltage < minVoltage) return;
|
||||
|
||||
if (GUI.DrawButton(spriteBatch, new Rectangle(x+20, y+20, 200, 30), "Activate Radar")) isActive = !isActive;
|
||||
|
||||
int radius = GuiFrame.Rect.Height / 2 - 10;
|
||||
DrawRadar(spriteBatch, new Rectangle((int)GuiFrame.Center.X - radius, (int)GuiFrame.Center.Y - radius, radius * 2, radius * 2));
|
||||
|
||||
voltage = 0.0f;
|
||||
}
|
||||
|
||||
private void DrawRadar(SpriteBatch spriteBatch, Rectangle rect)
|
||||
@@ -94,9 +101,10 @@ namespace Subsurface.Items.Components
|
||||
pingCircle.Draw(spriteBatch, center, Color.White * (1.0f-pingState), 0.0f, (rect.Width/pingCircle.size.X)*pingState);
|
||||
}
|
||||
|
||||
|
||||
float scale = 0.015f;
|
||||
float displayScale = ConvertUnits.ToDisplayUnits(scale);
|
||||
float radius = pingCircle.size.X / 2.0f;
|
||||
|
||||
float simScale = 1.5f;
|
||||
float displayScale = 0.015f;
|
||||
|
||||
if (Level.Loaded != null)
|
||||
{
|
||||
@@ -106,15 +114,15 @@ namespace Subsurface.Items.Components
|
||||
for (int i = 0; i < edges.Count; i++)
|
||||
{
|
||||
GUI.DrawLine(spriteBatch,
|
||||
center + (edges[i][0] - offset) * scale,
|
||||
center + (edges[i][1] - offset) * scale, Color.White);
|
||||
center + (edges[i][0] - offset) * displayScale,
|
||||
center + (edges[i][1] - offset) * displayScale, Color.White);
|
||||
}
|
||||
|
||||
for (int i = 0; i < Submarine.Loaded.HullVertices.Count; i++)
|
||||
{
|
||||
Vector2 start = Submarine.Loaded.HullVertices[i] * displayScale;
|
||||
Vector2 start = Submarine.Loaded.HullVertices[i] * simScale;
|
||||
start.Y = -start.Y;
|
||||
Vector2 end = Submarine.Loaded.HullVertices[(i + 1) % Submarine.Loaded.HullVertices.Count] * displayScale;
|
||||
Vector2 end = Submarine.Loaded.HullVertices[(i + 1) % Submarine.Loaded.HullVertices.Count] * simScale;
|
||||
end.Y = -end.Y;
|
||||
|
||||
GUI.DrawLine(spriteBatch, center + start, center + end, Color.White);
|
||||
@@ -125,11 +133,11 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
if (c.AnimController.CurrentHull != null) continue;
|
||||
|
||||
if (c.SimPosition != Vector2.Zero && c.SimPosition.Length() < 7 * Level.GridCellWidth)
|
||||
Vector2 pos = c.Position * displayScale;
|
||||
if (c.SimPosition != Vector2.Zero && pos.Length() < radius)
|
||||
{
|
||||
int width = (int)MathHelper.Clamp(c.Mass / 20, 1, 10);
|
||||
|
||||
Vector2 pos = c.Position * scale;
|
||||
pos.Y = -pos.Y;
|
||||
pos += center;
|
||||
|
||||
@@ -174,35 +182,38 @@ namespace Subsurface.Items.Components
|
||||
|
||||
DrawMarker(spriteBatch,
|
||||
(Game1.GameSession.Map == null) ? "Start" : Game1.GameSession.Map.CurrentLocation.Name,
|
||||
Level.Loaded.StartPosition + Level.Loaded.Position, center, (rect.Width * 0.55f));
|
||||
(Level.Loaded.StartPosition + Level.Loaded.Position), displayScale, center, (rect.Width * 0.55f));
|
||||
|
||||
DrawMarker(spriteBatch,
|
||||
(Game1.GameSession.Map == null) ? "End" : Game1.GameSession.Map.SelectedLocation.Name,
|
||||
Level.Loaded.EndPosition + Level.Loaded.Position, center, (rect.Width * 0.55f));
|
||||
(Level.Loaded.EndPosition + Level.Loaded.Position), displayScale, center, (rect.Width * 0.55f));
|
||||
|
||||
if (Game1.GameSession.Map != null && Game1.GameSession.Map.SelectedConnection.Quest!=null)
|
||||
if (Game1.GameSession.Quest != null)
|
||||
{
|
||||
var quest = Game1.GameSession.Map.SelectedConnection.Quest;
|
||||
var quest = Game1.GameSession.Quest;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(quest.RadarLabel))
|
||||
{
|
||||
DrawMarker(spriteBatch,
|
||||
quest.RadarLabel,
|
||||
quest.RadarPosition, center, (rect.Width * 0.55f));
|
||||
quest.RadarPosition, displayScale, center, (rect.Width * 0.55f));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawMarker(SpriteBatch spriteBatch, string label, Vector2 position, Vector2 center, float radius)
|
||||
private void DrawMarker(SpriteBatch spriteBatch, string label, Vector2 position, float scale, Vector2 center, float radius)
|
||||
{
|
||||
//position += Level.Loaded.Position;
|
||||
|
||||
float dist = position.Length();
|
||||
|
||||
position *= scale;
|
||||
position.Y = -position.Y;
|
||||
Vector2 markerPos = center + Vector2.Normalize(position) * radius;
|
||||
|
||||
Vector2 markerPos = (dist*scale>radius) ? Vector2.Normalize(position) * radius : position;
|
||||
markerPos += center;
|
||||
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)markerPos.X, (int)markerPos.Y, 5, 5), Color.LightGreen);
|
||||
|
||||
@@ -211,9 +222,5 @@ namespace Subsurface.Items.Components
|
||||
|
||||
}
|
||||
|
||||
private void UpdateRendertarget()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,12 +39,11 @@ namespace Subsurface.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HasDefaultValue(10.0f, false), Editable]
|
||||
public float Capacity
|
||||
{
|
||||
get { return capacity; }
|
||||
set { capacity = Math.Max(value,1.0f); }
|
||||
set { capacity = Math.Max(value, 1.0f); }
|
||||
}
|
||||
|
||||
[HasDefaultValue(10.0f, false), Editable]
|
||||
@@ -54,7 +53,7 @@ namespace Subsurface.Items.Components
|
||||
set
|
||||
{
|
||||
if (float.IsNaN(value)) return;
|
||||
rechargeSpeed = MathHelper.Clamp(rechargeSpeed, 0.0f, maxRechargeSpeed);
|
||||
rechargeSpeed = MathHelper.Clamp(value, 0.0f, maxRechargeSpeed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,9 +195,16 @@ namespace Subsurface.Items.Components
|
||||
|
||||
spriteBatch.DrawString(GUI.Font, "Recharge rate: " + (rechargeSpeed / maxRechargeSpeed), new Vector2(x + 30, y + 100), Color.White);
|
||||
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 50, y + 150, 40, 40), "+", true))
|
||||
rechargeSpeed = Math.Min(rechargeSpeed + 10.0f, maxRechargeSpeed);
|
||||
{
|
||||
item.NewComponentEvent(this, true);
|
||||
rechargeSpeed = Math.Min(rechargeSpeed + 10.0f, maxRechargeSpeed);
|
||||
}
|
||||
|
||||
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 250, y + 150, 40, 40), "-", true))
|
||||
{
|
||||
rechargeSpeed = Math.Max(rechargeSpeed - 10.0f, 0.0f);
|
||||
item.NewComponentEvent(this, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetOutgoingMessage message)
|
||||
|
||||
@@ -139,6 +139,7 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
connection.SendSignal(signal, sender, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,8 @@ namespace Subsurface.Items.Components
|
||||
light.Position = ConvertUnits.ToDisplayUnits(item.body.Position);
|
||||
}
|
||||
|
||||
if (item.container!= null)
|
||||
Pickable pickable = item.GetComponent<Pickable>();
|
||||
if (item.container!= null || (pickable!=null && pickable.Picker!=null))
|
||||
{
|
||||
light.Color = Color.Transparent;
|
||||
return;
|
||||
|
||||
@@ -715,8 +715,7 @@ namespace Subsurface
|
||||
Rectangle transformedTrigger = item.TransformTrigger(trigger);
|
||||
|
||||
if (!Submarine.RectContains(transformedTrigger, displayPos))continue;
|
||||
|
||||
|
||||
|
||||
Vector2 triggerCenter =
|
||||
new Vector2(
|
||||
transformedTrigger.X + transformedTrigger.Width / 2.0f,
|
||||
@@ -735,10 +734,11 @@ namespace Subsurface
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (item.prefab.PickDistance == 0.0f) continue;
|
||||
if (Vector2.Distance(position, item.SimPosition) > item.prefab.PickDistance) continue;
|
||||
|
||||
if (Submarine.CheckVisibility(position, item.SimPosition)!=null) continue;
|
||||
|
||||
dist = Vector2.Distance(pickPosition, item.SimPosition);
|
||||
if ((closest == null || dist < closestDist))
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Subsurface
|
||||
|
||||
private Rectangle borders;
|
||||
|
||||
private List<Body> bodies = new List<Body>();
|
||||
private List<Body> bodies;
|
||||
|
||||
private List<Vector2> positionsOfInterest;
|
||||
|
||||
@@ -151,6 +151,8 @@ namespace Subsurface
|
||||
|
||||
List<Vector2> sites = new List<Vector2>();
|
||||
|
||||
bodies = new List<Body>();
|
||||
|
||||
Random rand = new Random(seed.GetHashCode());
|
||||
|
||||
float siteVariance = siteInterval * 0.8f;
|
||||
@@ -273,7 +275,7 @@ namespace Subsurface
|
||||
|
||||
var newPathCells = GeneratePath(rand, new List<Vector2> { start, end }, cells, pathBorders, 0.0f, 0.8f, mirror);
|
||||
|
||||
for (int n = 1; n < newPathCells.Count; n += 3)
|
||||
for (int n = 0; n < newPathCells.Count-5; n += 3)
|
||||
{
|
||||
positionsOfInterest.Add(newPathCells[n].Center);
|
||||
}
|
||||
@@ -681,9 +683,11 @@ int currentTargetIndex = 1;
|
||||
// cell.body.SetTransform(cell.body.Position + simAmount, cell.body.Rotation);
|
||||
//}
|
||||
|
||||
|
||||
int i = 0;
|
||||
foreach (Body body in bodies)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(i);
|
||||
i++;
|
||||
body.SetTransform(body.Position + simAmount, body.Rotation);
|
||||
}
|
||||
|
||||
@@ -943,6 +947,9 @@ int currentTargetIndex = 1;
|
||||
|
||||
cells = null;
|
||||
|
||||
bodies.Clear();
|
||||
bodies = null;
|
||||
|
||||
vertexBuffer.Dispose();
|
||||
vertexBuffer = null;
|
||||
}
|
||||
|
||||
@@ -388,8 +388,12 @@ namespace Subsurface
|
||||
if (quest==null || quest.Completed)
|
||||
{
|
||||
if (quest !=null && quest.Completed) questsCompleted++;
|
||||
Random rand = new Random(GetHashCode() + questsCompleted);
|
||||
quest = Quest.LoadRandom(rand);
|
||||
|
||||
int seed = (int)locations[0].MapPosition.X + (int)locations[0].MapPosition.Y * 100;
|
||||
seed += (int)locations[1].MapPosition.X*10000 + (int)locations[1].MapPosition.Y * 1000000;
|
||||
|
||||
Random rand = new Random(seed + questsCompleted);
|
||||
quest = Quest.LoadRandom(locations, rand);
|
||||
}
|
||||
|
||||
return quest;
|
||||
|
||||
@@ -343,12 +343,16 @@ namespace Subsurface
|
||||
return closestBody;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// check visibility between two points (in sim units)
|
||||
/// </summary>
|
||||
/// <returns>a physics body that was between the points (or null)</returns>
|
||||
public static Body CheckVisibility(Vector2 rayStart, Vector2 rayEnd)
|
||||
{
|
||||
Body closestBody = null;
|
||||
float closestFraction = 1.0f;
|
||||
|
||||
if (Vector2.Distance(rayStart,rayEnd)<0.01f)
|
||||
if (Vector2.Distance(rayStart, rayEnd) < 0.01f)
|
||||
{
|
||||
closestFraction = 0.01f;
|
||||
return null;
|
||||
|
||||
@@ -335,7 +335,7 @@ namespace Subsurface.Networking
|
||||
TimeSpan duration = new TimeSpan(0,(int)durationMinutes,0);
|
||||
|
||||
//int gameModeIndex = inc.ReadInt32();
|
||||
Game1.GameSession = new GameSession(Submarine.Loaded);
|
||||
Game1.GameSession = new GameSession(Submarine.Loaded, Game1.NetLobbyScreen.SelectedMode);
|
||||
Game1.GameSession.StartShift(duration, levelSeed);
|
||||
|
||||
//myCharacter = ReadCharacterData(inc);
|
||||
|
||||
@@ -285,7 +285,7 @@ namespace Subsurface
|
||||
}
|
||||
}
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch, Sprite sprite, Color color)
|
||||
public void Draw(SpriteBatch spriteBatch, Sprite sprite, Color color, float? depth = null)
|
||||
{
|
||||
if (!body.Enabled) return;
|
||||
|
||||
@@ -296,7 +296,7 @@ namespace Subsurface
|
||||
|
||||
drawRotation = Physics.Interpolate(prevRotation, body.Rotation);
|
||||
|
||||
sprite.Draw(spriteBatch, new Vector2(drawPosition.X, -drawPosition.Y), color, -drawRotation, 1.0f, spriteEffect);
|
||||
sprite.Draw(spriteBatch, new Vector2(drawPosition.X, -drawPosition.Y), color, -drawRotation, 1.0f, spriteEffect, depth);
|
||||
|
||||
//prevPosition = body.Position;
|
||||
//prevRotation = body.Rotation;
|
||||
|
||||
@@ -345,7 +345,7 @@ namespace Subsurface
|
||||
Game1.GameSession.Map.Draw(spriteBatch, new Rectangle(
|
||||
rightPanel[selectedRightPanel].Rect.X + 20,
|
||||
rightPanel[selectedRightPanel].Rect.Y + 20,
|
||||
rightPanel[selectedRightPanel].Rect.Width - 250,
|
||||
rightPanel[selectedRightPanel].Rect.Width - 280,
|
||||
rightPanel[selectedRightPanel].Rect.Height - 40), 3.0f);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace Subsurface
|
||||
|
||||
public string DurationText()
|
||||
{
|
||||
return "Game duration: "+GameDuration+" min";
|
||||
return "Game duration: " + GameDuration + " min";
|
||||
}
|
||||
|
||||
public NetLobbyScreen()
|
||||
@@ -154,6 +154,9 @@ namespace Subsurface
|
||||
|
||||
textBox.Select();
|
||||
|
||||
Character.Controlled = null;
|
||||
Game1.GameScreen.Cam.TargetPos = Vector2.Zero;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 110, 0, 30), "Selected submarine:", GUI.style, infoFrame);
|
||||
subList = new GUIListBox(new Rectangle(0, 140, 200, 200), Color.White, GUI.style, infoFrame);
|
||||
subList.OnSelected = SelectMap;
|
||||
|
||||
@@ -185,9 +185,9 @@ namespace Subsurface
|
||||
spriteBatch.Draw(texture, pos + offset, sourceRect, Color.White, rotation + rotate, origin, scale, spriteEffect, depth);
|
||||
}
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch, Vector2 pos, Color color, float rotate = 0.0f, float scale = 1.0f, SpriteEffects spriteEffect = SpriteEffects.None)
|
||||
public void Draw(SpriteBatch spriteBatch, Vector2 pos, Color color, float rotate = 0.0f, float scale = 1.0f, SpriteEffects spriteEffect = SpriteEffects.None, float? depth = null)
|
||||
{
|
||||
spriteBatch.Draw(texture, pos + offset, sourceRect, color, rotation + rotate, origin, scale, spriteEffect, depth);
|
||||
spriteBatch.Draw(texture, pos + offset, sourceRect, color, rotation + rotate, origin, scale, spriteEffect, depth==null ? this.depth : (float)depth);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -67,10 +67,13 @@
|
||||
<Compile Include="ContentPackage.cs" />
|
||||
<Compile Include="CoroutineManager.cs" />
|
||||
<Compile Include="Events\Quests\Quest.cs" />
|
||||
<Compile Include="Events\Quests\MonsterQuest.cs" />
|
||||
<Compile Include="Events\Quests\SalvageQuest.cs" />
|
||||
<Compile Include="GameSession\CargoManager.cs" />
|
||||
<Compile Include="GameSession\QuestMode.cs" />
|
||||
<Compile Include="GUI\GUIMessage.cs" />
|
||||
<Compile Include="GUI\TitleScreen.cs" />
|
||||
<Compile Include="Items\Components\Label.cs" />
|
||||
<Compile Include="Items\Components\Signal\SignalCheckComponent.cs" />
|
||||
<Compile Include="Items\FixRequirement.cs" />
|
||||
<Compile Include="Map\Lights\Light.cs" />
|
||||
@@ -296,6 +299,12 @@
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Items\Electricity\monitor.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Items\Electricity\monitors.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Items\Medical\medical.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<SubType>Designer</SubType>
|
||||
@@ -303,6 +312,9 @@
|
||||
<Content Include="Content\Items\Medical\med.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Items\MiniMap\fabricator.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Items\Weapons\explosives.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
<ErrorReportUrlHistory />
|
||||
<FallbackCulture>en-US</FallbackCulture>
|
||||
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
<ProjectView>ProjectFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
Binary file not shown.
Reference in New Issue
Block a user