private void DoInteract(SimulationComponent simulation, IInteractor interactor, IInteractable interactable) { var quest = simulation.World.Quests.SingleOrDefault(q => q.Name == "Heidis Quest"); before.Visible = quest.State == QuestState.Inactive; after.Visible = quest.State == QuestState.Active && quest.CurrentProgress.Id == "return"; RheinwerkGame game = simulation.Game as RheinwerkGame; simulation.ShowInteractionScreen(interactor as Player, new DialogScreen(game.Screen, this, interactor as Player, dialog)); }
public RheinwerkGame() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; graphics.IsFullScreen = false; IsMouseVisible = true; Input = new InputComponent(this); Input.UpdateOrder = 0; Components.Add(Input); Screen = new ScreenComponent(this); Screen.UpdateOrder = 1; Screen.DrawOrder = 2; Components.Add(Screen); Local = new LocalComponent(this); Local.UpdateOrder = 2; Components.Add(Local); var client = new ClientComponent(this); Client = client; client.UpdateOrder = 3; Components.Add(client); var server = new ServerComponent(this); Server = server; server.UpdateOrder = 4; Components.Add(server); Simulation = new SimulationComponent(this); Simulation.UpdateOrder = 5; Components.Add(Simulation); Scene = new SceneComponent(this); Scene.UpdateOrder = 6; Scene.DrawOrder = 0; Components.Add(Scene); Hud = new HudComponent(this); Hud.UpdateOrder = 7; Hud.DrawOrder = 1; Components.Add(Hud); Music = new MusicComponent(this); Music.UpdateOrder = 8; Components.Add(Music); Sound = new SoundComponent(this); Sound.UpdateOrder = 9; Components.Add(Sound); // Einstellungen laden Settings = Settings.LoadSettings(); }
/// <summary> /// Update /// </summary> /// <param name="simulation">Simulation.</param> /// <param name="items">Items.</param> public void Update(SimulationComponent simulation, Dictionary<int, ItemCacheEntry> items) { Message m; while (messages.TryDequeue(out m)) { switch (m.MessageType) { case MessageType.ClientClose: Close(null, true); break; case MessageType.ClientUpdateVelocity: Player.Velocity = new Vector2( BitConverter.ToSingle(m.Payload, 0), BitConverter.ToSingle(m.Payload, 4)); break; case MessageType.ClientTriggerAttack: Player.AttackSignal = true; break; case MessageType.ClientQuestUpdate: using (MemoryStream stream = new MemoryStream(m.Payload)) { using (BinaryReader br = new BinaryReader(stream)) { string quest = br.ReadString(); string progress = br.ReadString(); QuestState state = (QuestState)br.ReadByte(); switch (state) { case QuestState.Active: simulation.SetQuestProgress(quest, progress); break; case QuestState.Failed: simulation.SetQuestFail(quest, progress); break; case QuestState.Succeeded: simulation.SetQuestSuccess(quest, progress); break; } } } break; case MessageType.ClientTransferItem: int itemId = BitConverter.ToInt32(m.Payload, 0); int senderId = BitConverter.ToInt32(m.Payload, 4); int receiverId = BitConverter.ToInt32(m.Payload, 8); Item item = null; if (items.ContainsKey(itemId)) item = items[itemId].Item; Item sender = null; if (items.ContainsKey(senderId)) sender = items[senderId].Item; Item receiver = null; if (items.ContainsKey(receiverId)) receiver = items[receiverId].Item; if (item != null && sender != null) simulation.Transfer(item, sender as IInventory, receiver as IInventory); break; } } }
private void DoInteract(SimulationComponent simulation, IInteractor interactor, IInteractable interactable) { RheinwerkGame game = simulation.Game as RheinwerkGame; simulation.ShowInteractionScreen(interactor as Player, new ShoutScreen(game.Screen, this, "Bleib ein Weilchen und hoer zu!")); }