4 using Microsoft.Xna.Framework;
5 using Microsoft.Xna.Framework.Graphics;
15 internal sealed
class TestScreen : EditorScreen
17 public override Camera Cam {
get; }
19 private Item? miniMapItem;
22 public static Effect? BlueprintEffect;
23 public TabMenu? TabMenu;
28 BlueprintEffect = GameMain.GameScreen.BlueprintEffect;
30 new GUIButton(
new RectTransform(
new Point(256, 256),
Frame.
RectTransform),
"Reload shader")
32 OnClicked = (button, o) =>
34 BlueprintEffect.Dispose();
35 GameMain.Instance.Content.Unload();
36 BlueprintEffect = EffectLoader.Load(
"Effects/blueprintshader");
37 GameMain.GameScreen.BlueprintEffect = BlueprintEffect;
43 public override void Select()
46 if (dummyCharacter is {
Removed:
false })
48 dummyCharacter.Remove();
51 dummyCharacter =
Character.Create(CharacterPrefab.HumanSpeciesName, Vector2.Zero,
"",
id: Entity.DummyID, hasAi:
false);
52 dummyCharacter.Info.Job =
new Job(JobPrefab.Prefabs.FirstOrDefault(
static jp => jp.Identifier ==
"captain"), isPvP:
false);
53 dummyCharacter.Info.Name =
"Galldren";
54 dummyCharacter.Inventory.CreateSlots();
55 dummyCharacter.Info.GiveExperience(999999);
57 miniMapItem =
new Item(ItemPrefab.Find(
null,
"circuitbox".ToIdentifier()), Vector2.Zero,
null, 1337,
false);
58 miniMapItem.GetComponent<
Holdable>().AttachToWall();
61 GameMain.World.ProcessChanges();
63 dummyCharacter.Info.TalentRefundPoints = 2;
64 TabMenu =
new TabMenu();
67 public override void AddToGUIUpdateList()
71 dummyCharacter?.SelectedItem?.AddToGUIUpdateList();
72 TabMenu?.AddToGUIUpdateList();
75 public override void Update(
double deltaTime)
77 base.Update(deltaTime);
78 TabMenu?.Update((
float)deltaTime);
80 if (dummyCharacter is { } dummy && miniMapItem is { } item)
82 if (dummy.SelectedItem != item)
84 dummy.SelectedItem = item;
87 dummy.SelectedItem?.UpdateHUD(Cam, dummy, (
float)deltaTime);
88 item.SendSignal(
"1",
"signal_in1");
89 Vector2 pos = FarseerPhysics.ConvertUnits.ToSimUnits(item.Position);
91 foreach (Limb limb
in dummy.AnimController.Limbs)
93 limb.body.SetTransform(pos, 0.0f);
96 if (dummy.AnimController?.Collider is { } collider)
98 collider.SetTransform(pos, 0);
101 dummy.ControlLocalPlayer((
float)deltaTime, Cam,
false);
102 dummy.Control((
float)deltaTime, Cam);
106 public override void Draw(
double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
108 base.Draw(deltaTime, graphics, spriteBatch);
109 graphics.Clear(BackgroundColor);
111 spriteBatch.Begin(SpriteSortMode.BackToFront, transformMatrix: Cam.Transform);
112 miniMapItem?.Draw(spriteBatch,
false);
113 if (dummyCharacter is { } dummy)
115 dummyCharacter.DrawFront(spriteBatch, Cam);
116 dummyCharacter.Draw(spriteBatch, Cam);
121 spriteBatch.Begin(SpriteSortMode.Deferred, samplerState: GUI.SamplerState);
123 GUI.Draw(Cam, spriteBatch);
125 dummyCharacter?.DrawHUD(spriteBatch, Cam,
false);
virtual void AddToGUIUpdateList(bool ignoreChildren=false, int order=0)
RectTransform RectTransform
@ Character
Characters only