diff --git a/TaikoWebUI/Pages/Profile.razor b/TaikoWebUI/Pages/Profile.razor index 39afad8..7c251e9 100644 --- a/TaikoWebUI/Pages/Profile.razor +++ b/TaikoWebUI/Pages/Profile.razor @@ -3,9 +3,11 @@ @inject IGameDataService GameDataService @inject IDialogService DialogService @inject LoginService LoginService +@inject IJSRuntime JS +

Profile

@if (LoginService.LoginRequired) { @@ -35,10 +37,9 @@ else

Profile Options

- - + @@ -50,10 +51,10 @@ else - + - + Select a Title @@ -68,7 +69,7 @@ else - + @foreach (var item in Enum.GetValues()) @@ -76,12 +77,12 @@ else } - + - + @@ -93,7 +94,7 @@ else @DifficultySettingCourseStrings[index] } - + @for (uint i = 0; i < DifficultySettingStarStrings.Length; i++) { @@ -101,7 +102,7 @@ else @DifficultySettingStarStrings[index] } - + @for (uint i = 0; i < DifficultySettingSortStrings.Length; i++) { @@ -114,7 +115,7 @@ else
- +

Costume Options

@@ -129,7 +130,7 @@ else @index - @costumeTitle } - + @for (var i = 0; i < costumeFlagArraySizes[2]; i++) { @@ -138,7 +139,7 @@ else @index - @costumeTitle } - + @for (var i = 0; i < costumeFlagArraySizes[3]; i++) { @@ -147,7 +148,7 @@ else @index - @costumeTitle } - + @for (var i = 0; i < costumeFlagArraySizes[0]; i++) { @@ -156,7 +157,7 @@ else @index - @costumeTitle } - + @for (var i = 0; i < costumeFlagArraySizes[4]; i++) { @@ -166,7 +167,7 @@ else }
- + @for (uint i = 0; i < Constants.COSTUME_COLOR_MAX; i++) @@ -203,7 +204,7 @@ else
- +

Song Options

@@ -225,7 +226,7 @@ else @SpeedStrings[index] } - + @foreach (var item in Enum.GetValues()) @@ -233,7 +234,7 @@ else } - + @for (uint i = 0; i < ToneStrings.Length; i++) { @@ -241,7 +242,7 @@ else @ToneStrings[index] } - + Notes Position @@ -253,40 +254,60 @@ else - - + + - + -
- @if (response.Kigurumi == 0) - { - - - + @* Player Visualizer *@ + + + @if (response.Kigurumi == 0) + { + + + + + + + + } + else + { + + + + } + + + - - - - - } - else + @* Player Nameplate *@ + + @* Title text *@ + + + @response.Title + + + @* Name text *@ + + @* Name textoffset to the right for Dan Rank *@ + + @response.MyDonName + @response.MyDonName + + + + + @if (response.IsDisplayDanOnNamePlate) { - - - + } - - -
+
- @* - Share - Learn More - *@ -
+ } +} + +@code { + private async Task UpdateMyDonName() + { + @if (response is not null) await JS.InvokeVoidAsync("updateMyDonName", response.MyDonName); + } + + private async Task UpdateTitle() + { + @if (response is not null) await JS.InvokeVoidAsync("updateTitle", response.Title); + } } \ No newline at end of file diff --git a/TaikoWebUI/Pages/Profile.razor.cs b/TaikoWebUI/Pages/Profile.razor.cs index d560526..1d3bb07 100644 --- a/TaikoWebUI/Pages/Profile.razor.cs +++ b/TaikoWebUI/Pages/Profile.razor.cs @@ -35,20 +35,15 @@ public partial class Profile "masks/body-bodymask-0070", "masks/body-bodymask-0092", "masks/body-bodymask-0121", "masks/body-bodymask-0123", "masks/body-bodymask-0127", "masks/body-bodymask-0136", "masks/body-bodymask-0153", - "masks/body-facemask-0005", "masks/body-facemask-0015", "masks/body-facemask-0030", "masks/body-facemask-0064", "masks/body-facemask-0065", "masks/body-facemask-0069", "masks/body-facemask-0090", "masks/body-facemask-0092", "masks/body-facemask-0136", "masks/body-facemask-0151", "masks/body-facemask-0152", "masks/body-facemask-0153", - "masks/head-bodymask-0113", "masks/head-bodymask-0138", - "masks/head-facemask-0003", "masks/head-facemask-0113", "masks/head-facemask-0137", "masks/head-facemask-0138", - "masks/kigurumi-bodymask-0052", "masks/kigurumi-bodymask-0109", "masks/kigurumi-bodymask-0110", "masks/kigurumi-bodymask-0115", "masks/kigurumi-bodymask-0123", - "masks/kigurumi-facemask-0052", "masks/kigurumi-facemask-0109", "masks/kigurumi-facemask-0110", "masks/kigurumi-facemask-0115", "masks/kigurumi-facemask-0123", }; diff --git a/TaikoWebUI/wwwroot/css/Nijiiro.woff2 b/TaikoWebUI/wwwroot/css/Nijiiro.woff2 new file mode 100644 index 0000000..a595281 Binary files /dev/null and b/TaikoWebUI/wwwroot/css/Nijiiro.woff2 differ diff --git a/TaikoWebUI/wwwroot/css/app.css b/TaikoWebUI/wwwroot/css/app.css index 8c8d833..b1daabe 100644 --- a/TaikoWebUI/wwwroot/css/app.css +++ b/TaikoWebUI/wwwroot/css/app.css @@ -1,5 +1,10 @@ @import url('open-iconic/font/css/open-iconic-bootstrap.min.css'); +@font-face { + font-family: 'Nijiiro'; + src: url('Nijiiro.woff2') format('woff2') +} + html, body { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; } diff --git a/TaikoWebUI/wwwroot/images/Nameplates/nameplate.png b/TaikoWebUI/wwwroot/images/Nameplates/nameplate.png new file mode 100644 index 0000000..1841a32 Binary files /dev/null and b/TaikoWebUI/wwwroot/images/Nameplates/nameplate.png differ diff --git a/TaikoWebUI/wwwroot/images/Nameplates/nameplate_AI_1.png b/TaikoWebUI/wwwroot/images/Nameplates/nameplate_AI_1.png new file mode 100644 index 0000000..6790ccf Binary files /dev/null and b/TaikoWebUI/wwwroot/images/Nameplates/nameplate_AI_1.png differ diff --git a/TaikoWebUI/wwwroot/images/Nameplates/nameplate_AI_2.png b/TaikoWebUI/wwwroot/images/Nameplates/nameplate_AI_2.png new file mode 100644 index 0000000..6790ccf Binary files /dev/null and b/TaikoWebUI/wwwroot/images/Nameplates/nameplate_AI_2.png differ diff --git a/TaikoWebUI/wwwroot/images/Nameplates/nameplate_AI_3.png b/TaikoWebUI/wwwroot/images/Nameplates/nameplate_AI_3.png new file mode 100644 index 0000000..6790ccf Binary files /dev/null and b/TaikoWebUI/wwwroot/images/Nameplates/nameplate_AI_3.png differ diff --git a/TaikoWebUI/wwwroot/images/Nameplates/nameplate_AI_4.png b/TaikoWebUI/wwwroot/images/Nameplates/nameplate_AI_4.png new file mode 100644 index 0000000..6790ccf Binary files /dev/null and b/TaikoWebUI/wwwroot/images/Nameplates/nameplate_AI_4.png differ diff --git a/TaikoWebUI/wwwroot/images/Nameplates/nameplate_dan.png b/TaikoWebUI/wwwroot/images/Nameplates/nameplate_dan.png new file mode 100644 index 0000000..71ebf4c Binary files /dev/null and b/TaikoWebUI/wwwroot/images/Nameplates/nameplate_dan.png differ diff --git a/TaikoWebUI/wwwroot/images/Nameplates/nameplate_gold.png b/TaikoWebUI/wwwroot/images/Nameplates/nameplate_gold.png new file mode 100644 index 0000000..e4e199c Binary files /dev/null and b/TaikoWebUI/wwwroot/images/Nameplates/nameplate_gold.png differ diff --git a/TaikoWebUI/wwwroot/images/Nameplates/nameplate_purple.png b/TaikoWebUI/wwwroot/images/Nameplates/nameplate_purple.png new file mode 100644 index 0000000..c1e78ea Binary files /dev/null and b/TaikoWebUI/wwwroot/images/Nameplates/nameplate_purple.png differ diff --git a/TaikoWebUI/wwwroot/images/Nameplates/nameplate_rainbow.png b/TaikoWebUI/wwwroot/images/Nameplates/nameplate_rainbow.png new file mode 100644 index 0000000..4718b5e Binary files /dev/null and b/TaikoWebUI/wwwroot/images/Nameplates/nameplate_rainbow.png differ diff --git a/TaikoWebUI/wwwroot/images/Nameplates/nameplate_wood.png b/TaikoWebUI/wwwroot/images/Nameplates/nameplate_wood.png new file mode 100644 index 0000000..fa7cda8 Binary files /dev/null and b/TaikoWebUI/wwwroot/images/Nameplates/nameplate_wood.png differ diff --git a/TaikoWebUI/wwwroot/index.html b/TaikoWebUI/wwwroot/index.html index 567bbd7..de7cf5a 100644 --- a/TaikoWebUI/wwwroot/index.html +++ b/TaikoWebUI/wwwroot/index.html @@ -16,8 +16,8 @@
- - + +
@@ -29,6 +29,8 @@ + + \ No newline at end of file diff --git a/TaikoWebUI/wwwroot/js/textFit.min.js b/TaikoWebUI/wwwroot/js/textFit.min.js new file mode 100644 index 0000000..d2af16d --- /dev/null +++ b/TaikoWebUI/wwwroot/js/textFit.min.js @@ -0,0 +1 @@ +(function(root,factory){"use strict";if(typeof define==="function"&&define.amd){define([],factory)}else if(typeof exports==="object"){module.exports=factory()}else{root.textFit=factory()}})(typeof global==="object"?global:this,function(){"use strict";var defaultSettings={alignVert:false,alignHoriz:false,multiLine:false,detectMultiLine:true,minFontSize:6,maxFontSize:80,reProcess:true,widthOnly:false,alignVertWithFlexbox:false};return function textFit(els,options){if(!options)options={};var settings={};for(var key in defaultSettings){if(options.hasOwnProperty(key)){settings[key]=options[key]}else{settings[key]=defaultSettings[key]}}if(typeof els.toArray==="function"){els=els.toArray()}var elType=Object.prototype.toString.call(els);if(elType!=="[object Array]"&&elType!=="[object NodeList]"&&elType!=="[object HTMLCollection]"){els=[els]}for(var i=0;i=parseInt(window.getComputedStyle(innerSpan)["font-size"],10)*2){multiLine=true}if(!multiLine){el.style["white-space"]="nowrap"}low=settings.minFontSize;high=settings.maxFontSize;var size=low;while(low<=high){mid=high+low>>1;innerSpan.style.fontSize=mid+"px";if(innerSpan.scrollWidth<=originalWidth&&(settings.widthOnly||innerSpan.scrollHeight<=originalHeight)){size=mid;low=mid+1}else{high=mid-1}}if(innerSpan.style.fontSize!=size+"px")innerSpan.style.fontSize=size+"px";if(settings.alignVert){addStyleSheet();var height=innerSpan.scrollHeight;if(window.getComputedStyle(el)["position"]==="static"){el.style["position"]="relative"}if(!hasClass(innerSpan,"textFitAlignVert")){innerSpan.className=innerSpan.className+" textFitAlignVert"}innerSpan.style["height"]=height+"px";if(settings.alignVertWithFlexbox&&!hasClass(el,"textFitAlignVertFlex")){el.className=el.className+" textFitAlignVertFlex"}}}function innerHeight(el){var style=window.getComputedStyle(el,null);return el.clientHeight-parseInt(style.getPropertyValue("padding-top"),10)-parseInt(style.getPropertyValue("padding-bottom"),10)}function innerWidth(el){var style=window.getComputedStyle(el,null);return el.clientWidth-parseInt(style.getPropertyValue("padding-left"),10)-parseInt(style.getPropertyValue("padding-right"),10)}function isElement(o){return typeof HTMLElement==="object"?o instanceof HTMLElement:o&&typeof o==="object"&&o!==null&&o.nodeType===1&&typeof o.nodeName==="string"}function hasClass(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1}function addStyleSheet(){if(document.getElementById("textFitStyleSheet"))return;var style=[".textFitAlignVert{","position: absolute;","top: 0; right: 0; bottom: 0; left: 0;","margin: auto;","display: flex;","justify-content: center;","flex-direction: column;","}",".textFitAlignVertFlex{","display: flex;","}",".textFitAlignVertFlex .textFitAlignVert{","position: static;","}"].join("");var css=document.createElement("style");css.type="text/css";css.id="textFitStyleSheet";css.innerHTML=style;document.body.appendChild(css)}}); diff --git a/TaikoWebUI/wwwroot/js/updateTextFit.js b/TaikoWebUI/wwwroot/js/updateTextFit.js new file mode 100644 index 0000000..24d5adc --- /dev/null +++ b/TaikoWebUI/wwwroot/js/updateTextFit.js @@ -0,0 +1,81 @@ +// Function to be called when the viewfinder size changes +var title; +var myDonName; +var myDonNameOutline; +var init = false +const observer = new ResizeObserver(handleResize); +function handleResize() { + updateFit() +} + +function waitForElm(selector) { + return new Promise(resolve => { + if (document.querySelector(selector)) { + return resolve(document.querySelector(selector)); + } + + const observer = new MutationObserver(mutations => { + if (document.querySelector(selector)) { + observer.disconnect(); + resolve(document.querySelector(selector)); + } + }); + + observer.observe(document.body, { + childList: true, + subtree: true + }); + }); +} + +// This is a monkey hack to detect when the page has changed (to stop the observer events) +var pushState = history.pushState; +history.pushState = function () { + pushState.apply(history, arguments); + init = false; + observer.disconnect(); +}; + +// Fetches all the relevant objects on the page so updateFit can reference them later +function initNameplate() { + if (window.location.href.indexOf("Profile") > -1) { + waitForElm('#nameplate-title').then((elm) => { + title = elm + waitForElm('#nameplate-name').then((elm) => { + myDonName = elm + waitForElm('#nameplate-name-outline').then((elm) => { + myDonNameOutline = elm + observer.observe(document.getElementById('nameplate')); + init = true + }); + }); + }); + } +} + +function updateFit() { + textFit(title, { alignHoriz: true, alignVert: true }); + textFit(myDonName, { alignHoriz: true, alignVert: true }); + textFit(myDonNameOutline, { alignHoriz: true, alignVert: true }); +} + + +// Used to individually update texts on the nameplate +function updateMyDonName(elm) { + if (init) { + myDonName.textContent = elm + myDonNameOutline.textContent = elm + updateFit() + } +} +function updateTitle(elm) { + if (init) { + title.textContent = elm + updateFit() + } +} + +// Called by html onload when the image of the nameplate is loaded (this ensures the first fit is properly done) +function nameplateLoaded() { + initNameplate() +} \ No newline at end of file