Skip to content

Commit c0c3a80

Browse files
Merge conflict resolution
2 parents b6946a2 + 48aaba4 commit c0c3a80

File tree

8 files changed

+62
-45
lines changed

8 files changed

+62
-45
lines changed

Objects/Dynamics/Player.cs renamed to Objects/Dynamics/PlayerObject.cs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public enum Direction
1010
Up=0, Down=1, Left=2, Right=3
1111
};
1212

13-
public class Player : DynamicRectObject
13+
public class PlayerObject : DynamicRectObject
1414
{
1515
protected Point SightAreaSize;
1616
public Direction SightDirection;
@@ -19,14 +19,15 @@ public virtual Rectangle SightArea
1919
{
2020
get
2121
{
22+
Rectangle c = Collider;
2223
switch (SightDirection)
2324
{
2425
case Direction.Up:
2526
{
2627
return new Rectangle
2728
(
28-
Collider.X + Collider.Width / 2 - SightAreaSize.X,
29-
Collider.Y - SightAreaSize.Y,
29+
c.X + c.Width / 2 - SightAreaSize.X,
30+
c.Y - SightAreaSize.Y,
3031
SightAreaSize.X,
3132
SightAreaSize.Y
3233
);
@@ -35,8 +36,8 @@ public virtual Rectangle SightArea
3536
{
3637
return new Rectangle
3738
(
38-
Collider.X + Collider.Width / 2 - SightAreaSize.X,
39-
Collider.Y + Collider.Height + SightAreaSize.Y,
39+
c.X + c.Width / 2 - SightAreaSize.X,
40+
c.Y + c.Height + SightAreaSize.Y,
4041
SightAreaSize.X,
4142
SightAreaSize.Y
4243
);
@@ -45,28 +46,28 @@ public virtual Rectangle SightArea
4546
{
4647
return new Rectangle
4748
(
48-
Collider.X - SightArea.X,
49-
Collider.Y + Collider.Height / 2 - SightAreaSize.Y,
50-
SightAreaSize.X,
51-
SightAreaSize.Y
49+
c.X - SightAreaSize.X,
50+
c.Y + c.Height / 2 - SightAreaSize.Y,
51+
SightAreaSize.Y,
52+
SightAreaSize.X
5253
);
5354
}
5455
case Direction.Right:
5556
{
5657
return new Rectangle
5758
(
58-
Collider.X + Collider.Width + SightArea.X,
59-
Collider.Y + Collider.Height / 2 - SightAreaSize.Y,
60-
SightAreaSize.X,
61-
SightAreaSize.Y
59+
c.X + c.Width + SightAreaSize.X,
60+
c.Y + c.Height / 2 - SightAreaSize.Y,
61+
SightAreaSize.Y,
62+
SightAreaSize.X
6263
);
6364
}
6465
default:
6566
{
6667
return new Rectangle
6768
(
68-
Collider.X + Collider.Width / 2 - SightAreaSize.X / 2,
69-
Collider.Y + Collider.Height / 2 - SightAreaSize.Y / 2,
69+
c.X + c.Width / 2 - SightAreaSize.X / 2,
70+
c.Y + c.Height / 2 - SightAreaSize.Y / 2,
7071
SightAreaSize.X,
7172
SightAreaSize.Y
7273
);
@@ -75,7 +76,7 @@ public virtual Rectangle SightArea
7576
}
7677
}
7778

78-
public Player(Point StartLocation, Point colliderSize, Single mass, Point sightAreaSize) : base(StartLocation, colliderSize, mass, false)
79+
public PlayerObject(Point StartLocation, Point colliderSize, Single mass, Point sightAreaSize) : base(StartLocation, colliderSize, mass, false)
7980
{
8081
SightAreaSize = sightAreaSize;
8182
}

Scripting/Pipeline/ScriptImporter.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22
using Scripting = DotRPG.Scripting;
33
using System.IO;
44

5-
using TImport = System.String;
6-
75
namespace DotRPG.Scripting.Pipeline
86
{
97
[ContentImporter(".lua", DisplayName = "DotRPG embeddable script handler", DefaultProcessor = "ScriptProcessor")]
10-
public class ScriptImporter : ContentImporter<TImport>
8+
public class ScriptImporter : ContentImporter<LuaModule>
119
{
12-
public override TImport Import(string filename, ContentImporterContext context)
10+
public override LuaModule Import(string filename, ContentImporterContext context)
1311
{
14-
return File.ReadAllText(filename);
12+
return new Scripting::LuaModule(File.ReadAllText(filename));
1513
}
1614
}
1715
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using Microsoft.Xna.Framework.Content.Pipeline;
22

3-
using TInput = System.String;
3+
using TInput = DotRPG.Scripting.LuaModule;
44
using TOutput = DotRPG.Scripting.LuaModule;
55

66
namespace ScriptImporter
@@ -10,7 +10,7 @@ class ScriptProcessor : ContentProcessor<TInput, TOutput>
1010
{
1111
public override TOutput Process(TInput input, ContentProcessorContext context)
1212
{
13-
return new TOutput(input);
13+
return input;
1414
}
1515
}
1616
}

Scripting/SceneSwitchSet.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace DotRPG.Scripting
6+
{
7+
public class SceneSwitchSet
8+
{
9+
public Boolean AutoScroll = false;
10+
public Boolean ExitDialog = false;
11+
}
12+
}

_Example/DotRPG.Example.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@
3131
<ItemGroup>
3232
<ProjectReference Include="..\Objects\DotRPG.Objects.csproj" />
3333
<ProjectReference Include="..\Objects\Dynamics\DotRPG.Objects.Dynamics.csproj" />
34+
<ProjectReference Include="..\Scripting\DotRPG.Scripting.csproj" />
3435
</ItemGroup>
3536
</Project>

_Example/Game1.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public static void SetFrameNumber(Object sender, EventArgs e, GameTime gameTime)
8686

8787
private void StartScroll(Object sender, EventArgs e, GameTime gameTime)
8888
{
89-
ActiveFrame = Frames[1];
89+
ActiveFrame = Frames[2];
9090
ActiveFrame.LoadContent();
9191
}
9292

@@ -104,6 +104,8 @@ protected override void Initialize()
104104
Frames[0].Initialize();
105105
Frames.Add(new DynamicsTestFrame(this, ResourceHGlobal, LogicEventSet));
106106
Frames[1].Initialize();
107+
Frames.Add(new ScriptTest(this, ResourceHGlobal, LogicEventSet));
108+
Frames[2].Initialize();
107109
base.Initialize();
108110
}
109111

_Example/GameData/DotRPG.Example_data.mgcb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
/processorParam:TextureFormat=Compressed
2828
/build:Fonts/MainFont_Large.spritefont
2929

30+
#begin Scripts/dialog.lua
31+
/copy:Scripts/dialog.lua
32+
3033
#begin Sounds/clickText.wav
3134
/importer:WavImporter
3235
/processor:SoundEffectProcessor

_Example/GameData/Scripts/dialog.lua

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@ event_counts = {7}
44

55
function loop(objID, eventID, frameTime, totalTime)
66
if objID == 0 then
7-
if eventID == 0 then
8-
dialog.Text = "You ran across white rectangular object.\nSo what?"
9-
elseif eventID == 1 then
10-
dialog.Text = "You should better go elsewhere."
11-
scene.ExitDialog = true
12-
elseif eventID == 2 then
13-
dialog.Text = "A white rectangular object."
14-
scene.ExitDialog = true
15-
elseif eventID == 3 then
16-
dialog.Text = "You've never seen object that is more white\nand rectangular than this one."
17-
scene.ExitDialog = true
18-
elseif eventID == 4 then
19-
dialog.Text = "Don't you have better things to do?"
20-
scene.ExitDialog = true
21-
elseif eventID == 5 then
22-
dialog.Text = "You ran across white rect"
23-
scene.AutoScroll = true
24-
elseif eventID == 6 then
25-
dialog.Text = "COME ON, QUIT IT ALREADY!"
26-
scene.ExitDialog = true
27-
end
7+
if eventID == 0 then
8+
dialog.Text = "You ran across white rectangular object.\nSo what?"
9+
elseif eventID == 1 then
10+
dialog.Text = "You should better go elsewhere."
11+
scene.ExitDialog = true
12+
elseif eventID == 2 then
13+
dialog.Text = "A white rectangular object."
14+
scene.ExitDialog = true
15+
elseif eventID == 3 then
16+
dialog.Text = "You've never seen object that is more white\nand rectangular than this one."
17+
scene.ExitDialog = true
18+
elseif eventID == 4 then
19+
dialog.Text = "Don't you have better things to do?"
20+
scene.ExitDialog = true
21+
elseif eventID == 5 then
22+
dialog.Text = "You ran across white rect"
23+
scene.AutoScroll = true
24+
elseif eventID == 6 then
25+
dialog.Text = "COME ON, QUIT IT ALREADY!"
26+
scene.ExitDialog = true
2827
end
28+
end
2929
end

0 commit comments

Comments
 (0)