Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/textures/DeliverFlag.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/textures/FetchFlag.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/textures/MagicFoolIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/textures/OpenInventory.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/textures/OpenStatistics.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions module.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
{
"id": "ItemRendering",
"minVersion": "1.1.0"
},
{
"id": "Journal",
"minVersion": "1.0.0"
},
{
"id": "LightAndShadowResources",
Expand Down
101 changes: 101 additions & 0 deletions overrides/Journal/ui/JournalWindow.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"type": "SetTutorialImages",
"skin": "Journal:journal",
"contents": {
"type": "rowLayout",
"contents": [
{
"type": "relativeLayout",
"contents": [
{
"type": "ScrollableArea",
"id": "entries",
"content": {
"type": "BrowserWidget",
"id": "journalList"
},
"family": "journalList",
"layoutInfo": {
"width": 450,
"height": 600,
"position-horizontal-center": {},
"position-vertical-center": {}
}
},
{
"type": "ColumnLayout",
"id": "row",
"contents": [
{
"type": "ColumnLayout",
"columns": 2,
"column-widths": [
0.5,
0.5
],
"contents": [
{
"type": "UIImage",
"id": "fetchFlag"
},
{
"type": "UIImage",
"id": "deliverFlag"
}
],
"horizontalSpacing": 10
},
{
"type": "ColumnLayout",
"columns": 2,
"column-widths": [
0.5,
0.5
],
"contents": [
{
"type": "UIImage",
"id": "openStatistics"
},
{
"type": "UIImage",
"id": "openInventory"
}
],
"horizontalSpacing": 10
}
],
"layoutInfo": {
"height": 400,
"position-horizontal-center": {},
"position-top": {
"target": "TOP",
"widget": "entries"
},
"width": 430,
"position-vertical-center": {}
}
},
{
"type": "ScrollableArea",
"id": "chapters",
"content": {
"type": "UIList",
"id": "chapterList"
},
"family": "chapterList",
"layoutInfo": {
"width": 80,
"height": 600,
"position-right": {
"target": "LEFT",
"widget": "entries"
},
"position-vertical-center": {}
}
}
]
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* Copyright 2017 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.terasology.journal.integration;

import org.terasology.dialogs.ShowDialogEvent;
import org.terasology.engine.entitySystem.entity.EntityRef;
import org.terasology.engine.entitySystem.event.ReceiveEvent;
import org.terasology.engine.entitySystem.systems.BaseComponentSystem;
import org.terasology.engine.entitySystem.systems.RegisterMode;
import org.terasology.engine.entitySystem.systems.RegisterSystem;
import org.terasology.engine.network.ClientComponent;
import org.terasology.engine.registry.In;
import org.terasology.engine.rendering.nui.NUIManager;
import org.terasology.engine.utilities.Assets;
import org.terasology.journal.BrowserJournalChapterHandler;
import org.terasology.journal.DiscoveredNewJournalEntry;
import org.terasology.journal.JournalButton;
import org.terasology.journal.JournalManager;
import org.terasology.journal.NewJournalEntryDiscoveredEvent;

import java.util.Arrays;

@RegisterSystem(RegisterMode.AUTHORITY)
public class LASJournalIntegration extends BaseComponentSystem {
@In
private NUIManager nuiManager;
@In
private JournalManager journalManager;
private boolean entryReceived;
private String lasChapterId = "LightAndShadow";
private SetTutorialImages window;

@Override
public void preBegin() {
entryReceived = false;
BrowserJournalChapterHandler chapterHandler = new BrowserJournalChapterHandler();
chapterHandler.registerJournalEntry("Instructions", Arrays.asList());
journalManager.registerJournalChapter(lasChapterId,
Assets.getTextureRegion("LightAndShadow:MagicFoolIcon").get(),
"LightAndShadow", chapterHandler);
}

@ReceiveEvent
public void onDialogActivated(ShowDialogEvent event, EntityRef player) {
player.send(new DiscoveredNewJournalEntry(lasChapterId, "Instructions"));
}

@ReceiveEvent
public void onReceiveNewJournalEntry(NewJournalEntryDiscoveredEvent event, EntityRef character) {
entryReceived = true;
if (window == null) {
if (!nuiManager.isOpen("Journal:JournalWindow")) {
nuiManager.toggleScreen("Journal:JournalWindow");
}
window = (SetTutorialImages) nuiManager.getScreen("Journal:JournalWindow");
nuiManager.closeScreen("Journal:JournalWindow");
}
}

@ReceiveEvent
public void onLASJournalDiscover(JournalButton event, EntityRef character,
ClientComponent clientComponent) {

if (entryReceived) {
window.setImages();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright 2020 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.journal.integration;

import org.terasology.engine.registry.In;
import org.terasology.engine.rendering.assets.texture.Texture;
import org.terasology.gestalt.assets.management.AssetManager;
import org.terasology.journal.ui.JournalNUIWindow;
import org.terasology.nui.widgets.UIImage;

public class SetTutorialImages extends JournalNUIWindow {

@In
AssetManager assetManager;
private UIImage fetchFlag;
private UIImage deliverFlag;
private UIImage inventory;
private UIImage statistics;

@Override
public void initialise() {
fetchFlag = find("fetchFlag", UIImage.class);
deliverFlag = find("deliverFlag", UIImage.class);
inventory = find("openInventory", UIImage.class);
statistics = find("openStatistics", UIImage.class);
super.initialise();
}

@Override
public void update(float delta) {
super.update(delta);
}

public void setImages() {
Texture texture = assetManager.getAsset("LightAndShadow:FetchFlag", Texture.class).get();
fetchFlag.setImage(texture);
texture = assetManager.getAsset("LightAndShadow:DeliverFlag", Texture.class).get();
deliverFlag.setImage(texture);
texture = assetManager.getAsset("LightAndShadow:OpenStatistics", Texture.class).get();
statistics.setImage(texture);
texture = assetManager.getAsset("LightAndShadow:OpenInventory", Texture.class).get();
inventory.setImage(texture);
}
}