-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from rengert/credits
Credits
- Loading branch information
Showing
20 changed files
with
279 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Button } from '@pixi/ui'; | ||
import { Sprite, Text } from 'pixi.js'; | ||
import { PixiGameService } from '../services/pixi-game.service'; | ||
import { Popup } from './popup'; | ||
|
||
export class CreditsPopup extends Popup { | ||
constructor(private readonly gameService: PixiGameService) { | ||
super('Credits'); | ||
|
||
this.addText(this.panel, 'Idee & Programmierung', 14, -60); | ||
this.addText(this.panel, 'Thomas Renger', 12, -40); | ||
this.addText(this.panel, 'Grafiken', 14, -10); | ||
this.addText(this.panel, 'Kenney (www.kenney.nl)', 12, 10); | ||
|
||
this.addCloseButton(this.panel); | ||
} | ||
|
||
private addCloseButton(panel: Sprite): void { | ||
const creditButton = new Button(Sprite.from('assets/ui/yellow_button00.png')); | ||
creditButton.view.width = 190; | ||
creditButton.view.height = 49; | ||
creditButton.view.y = 55; | ||
creditButton.view.x = -95; | ||
const text = new Text('Schließen', { fontFamily: 'DefaultFont', dropShadowColor: '000000', fontSize: 14 }); | ||
text.anchor.set(0.5, 0.5); | ||
text.x = 100; | ||
text.y = 20; | ||
creditButton.view.addChild(text); | ||
creditButton.onPress.connect(() => this.gameService.openNavigation(this)); | ||
panel.addChild(creditButton.view); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,44 @@ | ||
import { Button } from '@pixi/ui'; | ||
import gsap from 'gsap'; | ||
import { Container, Sprite, Text, Texture } from 'pixi.js'; | ||
import { Sprite, Text } from 'pixi.js'; | ||
import { PixiGameService } from '../services/pixi-game.service'; | ||
import { Popup } from './popup'; | ||
|
||
export class NavigationPopup extends Container { | ||
private readonly background: Sprite; | ||
private readonly panel: Sprite; | ||
private readonly title: Text; | ||
private readonly doneButton: Button; | ||
private readonly panelBase: Container; | ||
export class NavigationPopup extends Popup { | ||
|
||
constructor(gameService: PixiGameService) { | ||
super(); | ||
constructor(private readonly gameService: PixiGameService) { | ||
super('Solarstriker'); | ||
|
||
this.background = Sprite.from(Texture.WHITE); | ||
this.background.tint = 0xffcc55; | ||
this.background.eventMode = 'none'; | ||
this.addChild(this.background); | ||
|
||
this.panel = Sprite.from('assets/ui/navigation-popup.png'); | ||
this.panel.anchor.set(0.5); | ||
this.panel.width = 265; | ||
this.panel.height = 230; | ||
this.addChild(this.panel); | ||
|
||
this.panelBase = new Container(); | ||
this.panelBase.height = 400; | ||
this.panelBase.width = 400; | ||
this.panel.addChild(this.panelBase); | ||
|
||
this.title = new Text('Solarstriker', { fontFamily: 'DefaultFont', dropShadowColor: '000000', fontSize: 14 }); | ||
this.title.x = 0; | ||
this.title.y = -96; | ||
this.title.anchor.set(0.5, 0.5); | ||
this.panel.addChild(this.title); | ||
this.addStartButton(this.panel); | ||
this.addCreditsButton(this.panel); | ||
} | ||
|
||
this.doneButton = new Button(Sprite.from('assets/ui/yellow_button00.png')); | ||
this.doneButton.view.width = 190; | ||
this.doneButton.view.height = 49; | ||
this.doneButton.view.y = -50; | ||
this.doneButton.view.x = -95; | ||
private addStartButton(panel: Sprite): void { | ||
const startButton = new Button(Sprite.from('assets/ui/yellow_button00.png')); | ||
startButton.view.width = 190; | ||
startButton.view.height = 49; | ||
startButton.view.y = -50; | ||
startButton.view.x = -95; | ||
const text = new Text('Spiel starten!', { fontFamily: 'DefaultFont', dropShadowColor: '000000', fontSize: 14 }); | ||
text.anchor.set(0.5, 0.5); | ||
text.x = 100; | ||
text.y = 20; | ||
this.doneButton.view.addChild(text); | ||
this.doneButton.onPress.connect(() => gameService.start(this)); | ||
this.panel.addChild(this.doneButton.view); | ||
} | ||
|
||
/** Present the popup, animated */ | ||
public async show() { | ||
gsap.killTweensOf(this.background); | ||
gsap.killTweensOf(this.panel.pivot); | ||
this.background.alpha = 0; | ||
this.panel.pivot.y = -400; | ||
gsap.to(this.background, { alpha: 0.8, duration: 0.2, ease: 'linear' }); | ||
await gsap.to(this.panel.pivot, { y: 0, duration: 0.3, ease: 'back.out' }); | ||
startButton.view.addChild(text); | ||
startButton.onPress.connect(() => this.gameService.start(this)); | ||
panel.addChild(startButton.view); | ||
} | ||
|
||
/** Dismiss the popup, animated */ | ||
public async hide() { | ||
gsap.killTweensOf(this.background); | ||
gsap.killTweensOf(this.panel.pivot); | ||
gsap.to(this.background, { alpha: 0, duration: 0.2, ease: 'linear' }); | ||
await gsap.to(this.panel.pivot, { y: -500, duration: 0.3, ease: 'back.in' }); | ||
} | ||
|
||
public resize(width: number, height: number) { | ||
this.background.width = width; | ||
this.background.height = height; | ||
this.panel.x = width * 0.5; | ||
this.panel.y = height * 0.5; | ||
private addCreditsButton(panel: Sprite): void { | ||
const creditButton = new Button(Sprite.from('assets/ui/yellow_button00.png')); | ||
creditButton.view.width = 190; | ||
creditButton.view.height = 49; | ||
creditButton.view.y = 10; | ||
creditButton.view.x = -95; | ||
const text = new Text('Credits', { fontFamily: 'DefaultFont', dropShadowColor: '000000', fontSize: 14 }); | ||
text.anchor.set(0.5, 0.5); | ||
text.x = 100; | ||
text.y = 20; | ||
creditButton.view.addChild(text); | ||
creditButton.onPress.connect(() => this.gameService.openCredits(this)); | ||
panel.addChild(creditButton.view); | ||
} | ||
} |
Oops, something went wrong.