begin chat hud

This commit is contained in:
RandomityGuy 2024-06-12 19:37:28 +05:30
parent 1aad5ef361
commit c104293ae0

View file

@ -104,6 +104,10 @@ class PlayGui {
var totalGems:Int = 0;
var chatHudCtrl:GuiControl;
var chatHud:GuiMLText;
var chats:Array<String>;
public function dispose() {
if (_init) {
playGuiCtrlOuter.dispose();
@ -120,6 +124,13 @@ class PlayGui {
playerListScoresShadowCtrl.dispose();
playerListScoresShadowCtrl = null;
}
if (chatHudCtrl != null) {
chatHudCtrl.dispose();
chatHudCtrl = null;
chatHud.dispose();
chatHud = null;
chats = null;
}
for (textureResource in textureResources) {
textureResource.release();
@ -180,8 +191,10 @@ class PlayGui {
if (game == 'ultra')
initBlastBar();
initTexts();
if (MarbleGame.instance.world.isMultiplayer)
if (MarbleGame.instance.world.isMultiplayer) {
initPlayerList();
initChatHud();
}
if (Util.isTouchDevice()) {
MarbleGame.instance.touchInput.showControls(this.playGuiCtrlOuter, game == 'ultra');
@ -586,6 +599,27 @@ class PlayGui {
});
}
public function initChatHud() {
var arial14fontdata = ResourceLoader.getFileEntry("data/font/Arial Bold.fnt");
var arial14b = new BitmapFont(arial14fontdata.entry);
@:privateAccess arial14b.loader = ResourceLoader.loader;
var arial14 = arial14b.toSdfFont(cast 16 * Settings.uiScale, MultiChannel);
this.chatHudCtrl = new GuiControl();
this.chatHudCtrl.position = new Vector(playGuiCtrl.extent.x - 201, 150);
this.chatHudCtrl.extent = new Vector(150, 200);
this.chatHudCtrl.horizSizing = Left;
this.playGuiCtrl.addChild(chatHudCtrl);
this.chats = [];
this.chatHud = new GuiMLText(arial14, (s) -> arial14);
this.chatHud.position = new Vector(0, 0);
this.chatHud.extent = new Vector(150, 200);
this.chatHudCtrl.addChild(chatHud);
this.chatHud.text.text = "User 1: Hi<br/>User 2: Hello<br/>User 3: Hey";
}
var blastValue:Float = 0;
public function setBlastValue(value:Float) {