A* pathfinding, autopilot, WIP radar rendering, proper location names, character skills shown in menus, got rid of PreviewCharacter, mantis
This commit is contained in:
@@ -200,7 +200,7 @@ namespace Subsurface
|
||||
|
||||
if (Vector2.Distance(PlayerInput.MousePosition, limbBodyPos)<5.0f && PlayerInput.LeftButtonDown())
|
||||
{
|
||||
limb.sprite.Origin -= PlayerInput.MouseSpeed;
|
||||
limb.sprite.Origin += PlayerInput.MouseSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,17 +259,30 @@ namespace Subsurface
|
||||
|
||||
if (joint.BodyA == limb.body.FarseerBody)
|
||||
{
|
||||
jointPos = limbBodyPos + ConvertUnits.ToDisplayUnits(joint.LocalAnchorA);
|
||||
jointPos = ConvertUnits.ToDisplayUnits(joint.LocalAnchorA);
|
||||
|
||||
}
|
||||
else if (joint.BodyB == limb.body.FarseerBody)
|
||||
{
|
||||
jointPos = limbBodyPos + ConvertUnits.ToDisplayUnits(joint.LocalAnchorB);
|
||||
jointPos = ConvertUnits.ToDisplayUnits(joint.LocalAnchorB);
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
jointPos.Y = -jointPos.Y;
|
||||
jointPos += limbBodyPos;
|
||||
if (joint.BodyA == limb.body.FarseerBody)
|
||||
{
|
||||
float a1 = joint.UpperLimit - MathHelper.PiOver2;
|
||||
float a2 = joint.LowerLimit - MathHelper.PiOver2;
|
||||
float a3 =( a1+a2)/2.0f;
|
||||
GUI.DrawLine(spriteBatch, jointPos, jointPos + new Vector2((float)Math.Cos(a1), -(float)Math.Sin(a1)) * 30.0f, Color.Green);
|
||||
GUI.DrawLine(spriteBatch, jointPos, jointPos + new Vector2((float)Math.Cos(a2), -(float)Math.Sin(a2)) * 30.0f, Color.DarkGreen);
|
||||
|
||||
GUI.DrawLine(spriteBatch, jointPos, jointPos + new Vector2((float)Math.Cos(a3), -(float)Math.Sin(a3)) * 30.0f, Color.LightGray);
|
||||
}
|
||||
|
||||
GUI.DrawRectangle(spriteBatch, jointPos, new Vector2(5.0f, 5.0f), Color.Red, true);
|
||||
if (Vector2.Distance(PlayerInput.MousePosition, jointPos) < 6.0f)
|
||||
@@ -277,13 +290,15 @@ namespace Subsurface
|
||||
GUI.DrawRectangle(spriteBatch, jointPos - new Vector2(3.0f, 3.0f), new Vector2(11.0f, 11.0f), Color.Red, false);
|
||||
if (PlayerInput.LeftButtonDown())
|
||||
{
|
||||
Vector2 speed = ConvertUnits.ToSimUnits(PlayerInput.MouseSpeed);
|
||||
speed.Y = -speed.Y;
|
||||
if (joint.BodyA == limb.body.FarseerBody)
|
||||
{
|
||||
joint.LocalAnchorA += ConvertUnits.ToSimUnits(PlayerInput.MouseSpeed);
|
||||
joint.LocalAnchorA += speed;
|
||||
}
|
||||
else
|
||||
{
|
||||
joint.LocalAnchorB += ConvertUnits.ToSimUnits(PlayerInput.MouseSpeed);
|
||||
joint.LocalAnchorB += speed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,10 +23,7 @@ namespace Subsurface
|
||||
|
||||
SinglePlayerMode gameMode;
|
||||
|
||||
Body previewPlatform;
|
||||
Hull previewHull;
|
||||
|
||||
Character previewCharacter;
|
||||
GUIFrame previewFrame;
|
||||
|
||||
Level selectedLevel;
|
||||
|
||||
@@ -112,57 +109,57 @@ namespace Subsurface
|
||||
{
|
||||
base.Deselect();
|
||||
|
||||
if (previewPlatform != null)
|
||||
{
|
||||
Game1.World.RemoveBody(previewPlatform);
|
||||
previewPlatform = null;
|
||||
}
|
||||
//if (previewPlatform != null)
|
||||
//{
|
||||
// Game1.World.RemoveBody(previewPlatform);
|
||||
// previewPlatform = null;
|
||||
//}
|
||||
|
||||
if (previewHull != null)
|
||||
{
|
||||
previewHull.Remove();
|
||||
previewHull = null;
|
||||
}
|
||||
//if (previewHull != null)
|
||||
//{
|
||||
// previewHull.Remove();
|
||||
// previewHull = null;
|
||||
//}
|
||||
|
||||
if (previewCharacter != null)
|
||||
{
|
||||
previewCharacter.Remove();
|
||||
previewCharacter = null;
|
||||
}
|
||||
//if (previewCharacter != null)
|
||||
//{
|
||||
// previewCharacter.Remove();
|
||||
// previewCharacter = null;
|
||||
//}
|
||||
}
|
||||
|
||||
private void CreatePreviewCharacter()
|
||||
{
|
||||
if (previewCharacter != null) previewCharacter.Remove();
|
||||
//private void CreatePreviewCharacter()
|
||||
//{
|
||||
// if (previewCharacter != null) previewCharacter.Remove();
|
||||
|
||||
Vector2 pos = new Vector2(1000.0f, 1000.0f);
|
||||
// Vector2 pos = new Vector2(1000.0f, 1000.0f);
|
||||
|
||||
previewCharacter = new Character(characterList.SelectedData as CharacterInfo, pos);
|
||||
// previewCharacter = new Character(characterList.SelectedData as CharacterInfo, pos);
|
||||
|
||||
previewCharacter.AnimController.IsStanding = true;
|
||||
// previewCharacter.AnimController.IsStanding = true;
|
||||
|
||||
if (previewPlatform == null)
|
||||
{
|
||||
Body platform = BodyFactory.CreateRectangle(Game1.World, 3.0f, 1.0f, 5.0f);
|
||||
platform.SetTransform(new Vector2(pos.X, pos.Y - 3.5f), 0.0f);
|
||||
platform.IsStatic = true;
|
||||
}
|
||||
// if (previewPlatform == null)
|
||||
// {
|
||||
// Body platform = BodyFactory.CreateRectangle(Game1.World, 3.0f, 1.0f, 5.0f);
|
||||
// platform.SetTransform(new Vector2(pos.X, pos.Y - 3.5f), 0.0f);
|
||||
// platform.IsStatic = true;
|
||||
// }
|
||||
|
||||
if (previewHull == null)
|
||||
{
|
||||
pos = ConvertUnits.ToDisplayUnits(pos);
|
||||
previewHull = new Hull(new Rectangle((int)pos.X - 100, (int)pos.Y + 100, 200, 500));
|
||||
}
|
||||
// if (previewHull == null)
|
||||
// {
|
||||
// pos = ConvertUnits.ToDisplayUnits(pos);
|
||||
// previewHull = new Hull(new Rectangle((int)pos.X - 100, (int)pos.Y + 100, 200, 500));
|
||||
// }
|
||||
|
||||
Physics.Alpha = 1.0f;
|
||||
// Physics.Alpha = 1.0f;
|
||||
|
||||
for (int i = 0; i < 500; i++)
|
||||
{
|
||||
previewCharacter.AnimController.Update((float)Physics.step);
|
||||
previewCharacter.AnimController.UpdateAnim((float)Physics.step);
|
||||
Game1.World.Step((float)Physics.step);
|
||||
}
|
||||
}
|
||||
// for (int i = 0; i < 500; i++)
|
||||
// {
|
||||
// previewCharacter.AnimController.Update((float)Physics.step);
|
||||
// previewCharacter.AnimController.UpdateAnim((float)Physics.step);
|
||||
// Game1.World.Step((float)Physics.step);
|
||||
// }
|
||||
//}
|
||||
|
||||
public void SelectLocation(Location location, LocationConnection connection)
|
||||
{
|
||||
@@ -258,22 +255,34 @@ namespace Subsurface
|
||||
|
||||
if (characterList.SelectedData != null && selectedRightPanel == (int)PanelTab.Crew)
|
||||
{
|
||||
if (previewCharacter != null)
|
||||
if (previewFrame==null || previewFrame.UserData != characterList.UserData)
|
||||
{
|
||||
Vector2 position = new Vector2(characterList.Rect.Right + 100, characterList.Rect.Y + 25.0f);
|
||||
CharacterInfo previewCharacter = (characterList.SelectedData as CharacterInfo);
|
||||
|
||||
Vector2 pos = previewCharacter.Position;
|
||||
pos.Y = -pos.Y;
|
||||
Matrix transform = Matrix.CreateTranslation(new Vector3(-pos + position, 0.0f));
|
||||
GUIFrame frameRoot = new GUIFrame(new Rectangle(350, 30, 300, 500),
|
||||
new Color(0.0f, 0.0f, 0.0f, 0.8f),
|
||||
Alignment.Top, GUI.style, rightPanel[selectedRightPanel]);
|
||||
frameRoot.Padding = new Vector4(20.0f,20.0f,20.0f,20.0f);
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.BackToFront, null, null, null, null, null, transform);
|
||||
previewCharacter.Draw(spriteBatch);
|
||||
spriteBatch.End();
|
||||
}
|
||||
else
|
||||
{
|
||||
CreatePreviewCharacter();
|
||||
previewFrame = previewCharacter.CreateInfoFrame(frameRoot);
|
||||
previewFrame.UserData = previewCharacter;
|
||||
}
|
||||
//if (previewCharacter != null)
|
||||
//{
|
||||
// Vector2 position = new Vector2(characterList.Rect.Right + 100, characterList.Rect.Y + 25.0f);
|
||||
|
||||
// Vector2 pos = previewCharacter.Position;
|
||||
// pos.Y = -pos.Y;
|
||||
// Matrix transform = Matrix.CreateTranslation(new Vector3(-pos + position, 0.0f));
|
||||
|
||||
// spriteBatch.Begin(SpriteSortMode.BackToFront, null, null, null, null, null, transform);
|
||||
// previewCharacter.Draw(spriteBatch);
|
||||
// spriteBatch.End();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// CreatePreviewCharacter();
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,7 +340,7 @@ namespace Subsurface
|
||||
|
||||
if (Character.Controlled != null && characterInfo == Character.Controlled.Info) return false;
|
||||
|
||||
CreatePreviewCharacter();
|
||||
//CreatePreviewCharacter();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -15,8 +15,7 @@ namespace Subsurface
|
||||
|
||||
private GUIListBox saveList;
|
||||
|
||||
private GUITextBox nameBox;
|
||||
private GUITextBox ipBox;
|
||||
private GUITextBox nameBox, ipBox;
|
||||
|
||||
private Game1 game;
|
||||
|
||||
@@ -61,8 +60,8 @@ namespace Subsurface
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 30), "New Game", null, null, Alignment.CenterX, GUI.style, menuTabs[(int)Tabs.NewGame]);
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 30, 0, 30), "Selected map:", null, null, Alignment.Left, GUI.style, menuTabs[(int)Tabs.NewGame]);
|
||||
mapList = new GUIListBox(new Rectangle(0, 60, 200, 400), GUI.style, menuTabs[(int)Tabs.NewGame]);
|
||||
new GUITextBlock(new Rectangle(0, 30, 0, 30), "Selected submarine:", null, null, Alignment.Left, GUI.style, menuTabs[(int)Tabs.NewGame]);
|
||||
mapList = new GUIListBox(new Rectangle(0, 60, 200, 360), GUI.style, menuTabs[(int)Tabs.NewGame]);
|
||||
|
||||
foreach (Submarine map in Submarine.SavedSubmarines)
|
||||
{
|
||||
@@ -77,7 +76,7 @@ namespace Subsurface
|
||||
if (Submarine.SavedSubmarines.Count > 0) mapList.Select(Submarine.SavedSubmarines[0]);
|
||||
|
||||
|
||||
button = new GUIButton(new Rectangle(0, 0, 100, 30), "Start",Alignment.Right | Alignment.Bottom, GUI.style, menuTabs[(int)Tabs.NewGame]);
|
||||
button = new GUIButton(new Rectangle(0, 0, 100, 30), "Start",Alignment.BottomRight, GUI.style, menuTabs[(int)Tabs.NewGame]);
|
||||
button.OnClicked = StartGame;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@@ -137,6 +136,13 @@ namespace Subsurface
|
||||
GUIButton joinButton = new GUIButton(new Rectangle(0, 0, 200, 30), "Join", Alignment.BottomCenter, GUI.style, menuTabs[(int)Tabs.JoinServer]);
|
||||
joinButton.OnClicked = JoinServer;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
for (int i = 1; i < 4; i++ )
|
||||
{
|
||||
button = new GUIButton(new Rectangle(0, 0, 100, 30), "Back", Alignment.TopLeft, GUI.style, menuTabs[i]);
|
||||
button.OnClicked = PreviousTab;
|
||||
}
|
||||
|
||||
this.game = game;
|
||||
|
||||
@@ -193,6 +199,13 @@ namespace Subsurface
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool PreviousTab(GUIButton button, object obj)
|
||||
{
|
||||
selectedTab = (int)Tabs.Main;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool LoadGame(GUIButton button, object obj)
|
||||
{
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ namespace Subsurface
|
||||
|
||||
private GUIListBox jobList;
|
||||
|
||||
private GUITextBox textBox;
|
||||
private GUITextBox textBox, seedBox;
|
||||
|
||||
private GUITextBox seedBox;
|
||||
GUIFrame previewPlayer;
|
||||
|
||||
private GUIScrollBar durationBar;
|
||||
|
||||
@@ -31,8 +31,8 @@ namespace Subsurface
|
||||
|
||||
private float camAngle;
|
||||
|
||||
private Body previewPlatform;
|
||||
private Hull previewHull;
|
||||
//private Body previewPlatform;
|
||||
//private Hull previewHull;
|
||||
|
||||
public bool IsServer;
|
||||
|
||||
@@ -136,17 +136,17 @@ namespace Subsurface
|
||||
{
|
||||
textBox.Deselect();
|
||||
|
||||
if (previewPlatform!=null)
|
||||
{
|
||||
Game1.World.RemoveBody(previewPlatform);
|
||||
previewPlatform = null;
|
||||
}
|
||||
//if (previewPlatform!=null)
|
||||
//{
|
||||
// Game1.World.RemoveBody(previewPlatform);
|
||||
// previewPlatform = null;
|
||||
//}
|
||||
|
||||
if (previewHull!=null)
|
||||
{
|
||||
previewHull.Remove();
|
||||
previewHull = null;
|
||||
}
|
||||
//if (previewHull!=null)
|
||||
//{
|
||||
// previewHull.Remove();
|
||||
// previewHull = null;
|
||||
//}
|
||||
}
|
||||
|
||||
public override void Select()
|
||||
@@ -159,9 +159,6 @@ namespace Subsurface
|
||||
|
||||
textBox.Select();
|
||||
|
||||
//int oldMapIndex = 0;
|
||||
//if (mapList != null && mapList.SelectedData != null) oldMapIndex = mapList.SelectedIndex;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 30, 0, 30), "Selected submarine:", GUI.style, infoFrame);
|
||||
subList = new GUIListBox(new Rectangle(0, 60, 200, 200), Color.White, GUI.style, infoFrame);
|
||||
subList.OnSelected = SelectMap;
|
||||
@@ -238,30 +235,28 @@ namespace Subsurface
|
||||
{
|
||||
int x = playerFrame.Rect.Width / 2;
|
||||
|
||||
|
||||
new GUITextBlock(new Rectangle(x, 0, 200, 30), "Name: ", GUI.style, playerFrame);
|
||||
|
||||
|
||||
GUITextBox playerName = new GUITextBox(new Rectangle(x, 30, 0, 20),
|
||||
Alignment.TopLeft, GUI.style, playerFrame);
|
||||
playerName.Text = Game1.Client.CharacterInfo.Name;
|
||||
playerName.OnEnter += ChangeCharacterName;
|
||||
|
||||
new GUITextBlock(new Rectangle(x,70,200, 30), "Gender: ", GUI.style, playerFrame);
|
||||
new GUITextBlock(new Rectangle(x, 70, 200, 30), "Gender: ", GUI.style, playerFrame);
|
||||
|
||||
GUIButton maleButton = new GUIButton(new Rectangle(x, 100, 70, 20), "Male",
|
||||
Alignment.TopLeft, GUI.style,playerFrame);
|
||||
maleButton.UserData = Gender.Male;
|
||||
maleButton.OnClicked += SwitchGender;
|
||||
|
||||
GUIButton femaleButton = new GUIButton(new Rectangle(x+150, 100, 70, 20), "Female",
|
||||
GUIButton femaleButton = new GUIButton(new Rectangle(x+90, 100, 70, 20), "Female",
|
||||
Alignment.TopLeft, GUI.style, playerFrame);
|
||||
femaleButton.UserData = Gender.Female;
|
||||
femaleButton.OnClicked += SwitchGender;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 150, 200, 30), "Job preferences:", GUI.style, playerFrame);
|
||||
new GUITextBlock(new Rectangle(x, 150, 200, 30), "Job preferences:", GUI.style, playerFrame);
|
||||
|
||||
jobList = new GUIListBox(new Rectangle(0, 180, 200, 0), GUI.style, playerFrame);
|
||||
jobList = new GUIListBox(new Rectangle(x, 180, 200, 0), GUI.style, playerFrame);
|
||||
|
||||
foreach (JobPrefab job in JobPrefab.List)
|
||||
{
|
||||
@@ -279,6 +274,8 @@ namespace Subsurface
|
||||
|
||||
UpdateJobPreferences(jobList);
|
||||
|
||||
UpdatePreviewPlayer(Game1.Client.CharacterInfo);
|
||||
|
||||
}
|
||||
|
||||
base.Select();
|
||||
@@ -358,30 +355,32 @@ namespace Subsurface
|
||||
|
||||
menu.Draw(spriteBatch);
|
||||
|
||||
if (previewPlayer!=null) previewPlayer.Draw(spriteBatch);
|
||||
|
||||
GUI.Draw((float)deltaTime, spriteBatch, null);
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
|
||||
if (Game1.Client != null)
|
||||
{
|
||||
if (Game1.Client.Character != null)
|
||||
{
|
||||
Vector2 position = new Vector2(playerFrame.Rect.X + playerFrame.Rect.Width * 0.25f, playerFrame.Rect.Y + 25.0f);
|
||||
//if (Game1.Client != null)
|
||||
//{
|
||||
// if (Game1.Client.Character != null)
|
||||
// {
|
||||
// Vector2 position = new Vector2(playerFrame.Rect.X + playerFrame.Rect.Width * 0.25f, playerFrame.Rect.Y + 25.0f);
|
||||
|
||||
Vector2 pos = Game1.Client.Character.Position;
|
||||
pos.Y = -pos.Y;
|
||||
Matrix transform = Matrix.CreateTranslation(new Vector3(-pos + position, 0.0f));
|
||||
// Vector2 pos = Game1.Client.Character.Position;
|
||||
// pos.Y = -pos.Y;
|
||||
// Matrix transform = Matrix.CreateTranslation(new Vector3(-pos + position, 0.0f));
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.BackToFront, null, null, null, null, null, transform);
|
||||
Game1.Client.Character.Draw(spriteBatch);
|
||||
spriteBatch.End();
|
||||
}
|
||||
else
|
||||
{
|
||||
CreatePreviewCharacter();
|
||||
}
|
||||
}
|
||||
// spriteBatch.Begin(SpriteSortMode.BackToFront, null, null, null, null, null, transform);
|
||||
// Game1.Client.Character.Draw(spriteBatch);
|
||||
// spriteBatch.End();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// CreatePreviewCharacter();
|
||||
// }
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
@@ -412,43 +411,15 @@ namespace Subsurface
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CreatePreviewCharacter()
|
||||
private void UpdatePreviewPlayer(CharacterInfo characterInfo)
|
||||
{
|
||||
if (Game1.Client.Character != null) Game1.Client.Character.Remove();
|
||||
previewPlayer = new GUIFrame(
|
||||
new Rectangle(playerFrame.Rect.X + 20, playerFrame.Rect.Y + 20, 230, 300),
|
||||
new Color(0.0f, 0.0f, 0.0f, 0.8f), GUI.style);
|
||||
previewPlayer.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
||||
characterInfo.CreateInfoFrame(previewPlayer);
|
||||
|
||||
Vector2 pos = new Vector2(1000.0f, 1000.0f);
|
||||
|
||||
Character character = new Character(Game1.Client.CharacterInfo, pos);
|
||||
character.ID = int.MaxValue;
|
||||
|
||||
Game1.Client.Character = character;
|
||||
|
||||
character.AnimController.IsStanding = true;
|
||||
|
||||
if (previewPlatform == null)
|
||||
{
|
||||
Body platform = BodyFactory.CreateRectangle(Game1.World, 3.0f, 1.0f, 5.0f);
|
||||
platform.SetTransform(new Vector2(pos.X, pos.Y - 2.5f), 0.0f);
|
||||
platform.IsStatic = true;
|
||||
}
|
||||
|
||||
if (previewHull == null)
|
||||
{
|
||||
pos = ConvertUnits.ToDisplayUnits(pos);
|
||||
previewHull = new Hull(new Rectangle((int)pos.X - 100, (int)pos.Y + 100, 200, 200));
|
||||
previewHull.ID = int.MaxValue - 2;
|
||||
}
|
||||
|
||||
Physics.Alpha = 1.0f;
|
||||
|
||||
for (int i = 0; i < 500; i++)
|
||||
{
|
||||
character.AnimController.Update((float)Physics.step);
|
||||
character.AnimController.UpdateAnim((float)Physics.step);
|
||||
Game1.World.Step((float)Physics.step);
|
||||
}
|
||||
|
||||
Game1.Client.SendCharacterData();
|
||||
previewPlayer.UserData = characterInfo;
|
||||
}
|
||||
|
||||
private bool SwitchGender(GUIButton button, object obj)
|
||||
@@ -458,7 +429,8 @@ namespace Subsurface
|
||||
Gender gender = (Gender)obj;
|
||||
Game1.Client.CharacterInfo.Gender = gender;
|
||||
Game1.Client.SendCharacterData();
|
||||
CreatePreviewCharacter();
|
||||
UpdatePreviewPlayer(Game1.Client.CharacterInfo);
|
||||
//CreatePreviewCharacter();
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -491,6 +463,7 @@ namespace Subsurface
|
||||
Game1.Client.SendCharacterData();
|
||||
|
||||
textBox.Text = newName;
|
||||
textBox.Selected = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -502,7 +475,7 @@ namespace Subsurface
|
||||
|
||||
int index = jobList.children.IndexOf(jobText);
|
||||
int newIndex = index + (int)obj;
|
||||
if (newIndex<0 || newIndex>jobList.children.Count-1) return false;
|
||||
if (newIndex < 0 || newIndex > jobList.children.Count - 1) return false;
|
||||
|
||||
GUIComponent temp = jobList.children[newIndex];
|
||||
jobList.children[newIndex] = jobText;
|
||||
@@ -516,12 +489,12 @@ namespace Subsurface
|
||||
private void UpdateJobPreferences(GUIListBox listBox)
|
||||
{
|
||||
listBox.Deselect();
|
||||
for (int i = 1; i<listBox.children.Count; i++)
|
||||
for (int i = 1; i < listBox.children.Count; i++)
|
||||
{
|
||||
float a = (float)(i - 1) / 3.0f;
|
||||
a = Math.Min(a, 3);
|
||||
Color color = new Color(1.0f-a, (1.0f - a)*0.6f, 0.0f, 0.3f);
|
||||
|
||||
Color color = new Color(1.0f - a, (1.0f - a) * 0.6f, 0.0f, 0.3f);
|
||||
|
||||
listBox.children[i].Color = color;
|
||||
}
|
||||
|
||||
@@ -592,8 +565,7 @@ namespace Subsurface
|
||||
string mapName = msg.ReadString();
|
||||
string md5Hash = msg.ReadString();
|
||||
|
||||
TrySelectMap(mapName, md5Hash);
|
||||
|
||||
TrySelectMap(mapName, md5Hash);
|
||||
|
||||
//mapList.Select(msg.ReadInt32());
|
||||
modeList.Select(msg.ReadInt32());
|
||||
@@ -607,8 +579,7 @@ namespace Subsurface
|
||||
{
|
||||
int clientID = msg.ReadInt32();
|
||||
string jobName = msg.ReadString();
|
||||
|
||||
|
||||
|
||||
Client client = null;
|
||||
GUITextBlock textBlock = null;
|
||||
foreach (GUIComponent child in playerList.children)
|
||||
@@ -621,10 +592,17 @@ namespace Subsurface
|
||||
break;
|
||||
}
|
||||
if (client == null) continue;
|
||||
|
||||
client.assignedJob = JobPrefab.List.Find(jp => jp.Name == jobName);
|
||||
|
||||
client.assignedJob = JobPrefab.List.Find(jp => jp.Name == jobName);
|
||||
|
||||
textBlock.Text = client.name + ((client.assignedJob==null) ? "" : " (" + client.assignedJob.Name + ")");
|
||||
|
||||
if (clientID == Game1.Client.ID)
|
||||
{
|
||||
Game1.Client.CharacterInfo.Job = new Job(client.assignedJob);
|
||||
Game1.Client.CharacterInfo.Name = client.name;
|
||||
UpdatePreviewPlayer(Game1.Client.CharacterInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user