Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
syui committed Mar 22, 2024
1 parent b347a16 commit 147289b
Show file tree
Hide file tree
Showing 17 changed files with 4 additions and 2,713 deletions.
Binary file removed dist/obj/ai.vrm
Binary file not shown.
Binary file removed dist/obj/ai_card_7.vrm
Binary file not shown.
Binary file removed dist/obj/ai_fly.vrm
Binary file not shown.
Binary file removed dist/obj/ai_hotaru.vrm
Binary file not shown.
Binary file removed dist/obj/ai_mode_ai.vrm
Binary file not shown.
Binary file removed dist/obj/ai_mode_card.vrm
Binary file not shown.
Binary file removed dist/obj/ai_mode_normal.vrm
Binary file not shown.
Binary file removed dist/obj/ai_mode_sword.vrm
Binary file not shown.
Binary file removed dist/obj/ai_mode_sword_hand.vrm
Binary file not shown.
Binary file removed dist/obj/ai_mode_ten.vrm
Binary file not shown.
Binary file removed dist/obj/ai_mode_zen_light.vrm
Binary file not shown.
Binary file removed dist/obj/fly.vmd
Binary file not shown.
331 changes: 0 additions & 331 deletions dist/obj/motion_v0.bvh

This file was deleted.

1,081 changes: 0 additions & 1,081 deletions dist/obj/motion_v1.bvh

This file was deleted.

1,050 changes: 0 additions & 1,050 deletions dist/obj/pose_a.vpd

This file was deleted.

11 changes: 0 additions & 11 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,6 @@
<div class="ts-content">
<div class="ts-app-navbar is-unlabeled is-fluid">
<button id='btn-models_d' value="normal"><span class="icon-ai"></span></button>
<div class="button_menu">
<button id='btn-menu' value="card"><i class="fa-regular fa-address-card"></i></button>
</div>
<!--
<button id='btn-models_c' value="ai" >モード</button>
<button id='btn-models_b' value="sword" >アタック</button>
<button id='btn-models' value="ten" >スキル</button>
<button id='btn-models_a' value="card" >バースト</button>
<button id='btn-models_fly' value="fly" >フライ</button>
-->
<button id='btn-models_tel' value="tel" >テレポート</button>
<button id='btn-light'><span class="icon-moon"/></button>
</div>
</div>
Expand Down
244 changes: 4 additions & 240 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ if (animUrl)
animType = 'vmd';
else if (animUrl.endsWith('.bvh'))
animType = 'bvh';
else if (animUrl.endsWith('.vrma'))
animType = 'vrma';
else
animType = 'vmd';
}
Expand All @@ -115,10 +117,6 @@ let api_url_local = "https://api.syui.ai/users/"
let url = new URL(window.location.href);
const params = new URLSearchParams(window.location.search);

if(url.hostname == "vrm.syui.ai"){
var api_url = "";
}

if(url.hostname == "localhost"||url.hostname == "192.168.11.10"){
if(params.get('id') != null){
var api_url = "/api/users/" + params.get('id');
Expand All @@ -142,26 +140,11 @@ if(params.get('card_su') != null){

let date = new Date();
var num_h = date.getHours();
//var test_url = "https://card.syui.ai/obj/"
var test_url = "./obj/"
var model_url = test_url + "ai.vrm";
var model_url_default = test_url + "ai.vrm";
var model_url_light = test_url + "ai_mode_zen_light.vrm";
var model_url_ten = test_url + "ai_mode_ten.vrm";
var model_url_sword = test_url + "ai_mode_sword.vrm";
var model_url_sword_hand = test_url + "ai_mode_sword_hand.vrm";
var model_url_normal = test_url + "ai_mode_normal.vrm";
var model_url_ai = test_url + "ai_mode_ai.vrm";
var model_url_card = test_url + "ai_mode_card.vrm";
var model_url_hotaru = test_url + "ai_hotaru.vrm";
var model_url_fly = test_url + "ai_fly.vrm";
var anime_url = test_url + "motion_v0.bvh";
var item_url = test_url + "ai_mode_sword.vrm";
let num_model = Math.floor(Math.random() * 12) + 1
var model_url = "https://vrm.syui.ai/vrma/model/ai.vrm"

import axios, {isCancel, AxiosError} from 'axios';
function model_load(){
axios.get(model_url_hotaru, {
axios.get(model_url, {
responseType: "blob"
})
.then(response => {
Expand All @@ -174,113 +157,8 @@ function model_load(){
})
}

function anime_load(anime_url:any){
axios.get(anime_url, {
responseType: "blob"
})
.then(response_anime => {
loadingPromises.push(loadAnimation(response_anime.data, "bvh"));
hasLoadModel = true;
triggerLoading();
const blob = new Blob([response_anime.data], {
type: response_anime.data.type
});
})
}

function item_load(){
axios.get(item_url, {
responseType: "blob"
})
.then(response_item => {
loadingPromises.push(loadModel(response_item.data));
hasLoadModel = false;
triggerLoading();
const blob = new Blob([response_item.data], {
type: response_item.data.type
});
})
}

function card_seven_load(){
if (params.get('card') != null){
var card_model_url = "./obj/ai_card_7.vrm";
axios.get(card_model_url, {
responseType: "blob"
})
.then(response_item => {
loadingPromises.push(loadModel(response_item.data));
hasLoadModel = false;
triggerLoading();
const blob = new Blob([response_item.data], {
type: response_item.data.type
});
})
}
}

function status_load(){
axios.get(api_url, {
responseType: "json"
})
.then(res => {
let html_menu = document.querySelector('#menu') as HTMLInputElement | null;
let html_model = document.getElementById('btn-models') as HTMLInputElement | null
let html_model_a = document.getElementById('btn-models_a') as HTMLInputElement | null
let html_model_b = document.getElementById('btn-models_b') as HTMLInputElement | null
let html_model_c = document.getElementById('btn-models_c') as HTMLInputElement | null
let html_model_d = document.getElementById('btn-models_d') as HTMLInputElement | null
let html_model_fly = document.getElementById('btn-models_fly') as HTMLInputElement | null

//if (res.data.model === true){
// model_load();
//}

if (res.data.model === false && html_menu != null){
html_menu.insertAdjacentHTML('afterbegin', "<li>model : " + res.data.model + "</li>");
html_menu.insertAdjacentHTML('afterbegin', "<li>@" + res.data.username + "</li>");
}

if (res.data.model === true && html_menu != null){
html_menu.insertAdjacentHTML('afterbegin', "<br/><li><a href='https://card.syui.ai/vr' target='_blank'>docs</a></li>");

//html_menu.insertAdjacentHTML('afterbegin', "<br/><p># 動作環境</p><p>[ok] ... ios17.x</p><p>[no] ... ios16.x</p></li><br/>");
html_menu.insertAdjacentHTML('afterbegin', "<li>会心ダメージ : " + res.data.model_critical_d + "%</li>");
html_menu.insertAdjacentHTML('afterbegin', "<li>会心率 : " + res.data.model_critical + "%</li>");
html_menu.insertAdjacentHTML('afterbegin', "<li>原子バースト : Lv " + res.data.model_limit + "</li>");
html_menu.insertAdjacentHTML('afterbegin', "<li>原子スキル : Lv " + res.data.model_skill + "</li>");
html_menu.insertAdjacentHTML('afterbegin', "<li>通常攻撃 : Lv " + res.data.model_attack + "</li>");
html_menu.insertAdjacentHTML('afterbegin', "<li>アイ・モード : Lv " + res.data.model_mode + "</li>");
//html_menu.insertAdjacentHTML('afterbegin', "<li>model : " + res.data.model + "</li>");
if (params.get('card') != null){
html_menu.insertAdjacentHTML('afterbegin', "<li><img src='https://card.syui.ai/card/card_" + card + ".png'></li>");
}
html_menu.insertAdjacentHTML('afterbegin', "<li>@" + res.data.username + " [Lv " + card_su + "]</li>");
}

//if (res.data.model_skill === 0 && html_model != null){
// html_model.style.display = "none";
//}
//if (res.data.model_limit === 0 && html_model_a != null){
// html_model_a.style.display = "none";
//}
//if (res.data.model_attack === 0 && html_model_b != null){
// html_model_b.style.display = "none";
//}
//if (res.data.model_mode === 0 && html_model_c != null){
// html_model_c.style.display = "none";
//}
//if (res.data.model === false && html_model_d != null){
// html_model_d.style.display = "none";
//}
//if (res.data.model_mode === 0 && html_model_fly != null){
// html_model_fly.style.display = "none";
//}
})
}

if (model_url !== null) {
status_load();
model_load();
}

Expand All @@ -290,42 +168,8 @@ const listener = new THREE.AudioListener();
camera.add( listener );
const sound = new THREE.Audio( listener );
const audioLoader = new THREE.AudioLoader();
function audio_sword() {
audioLoader.load( './audio/sword.mp3', function( buffer ) {
sound.setBuffer( buffer );
sound.setLoop( false );
sound.setVolume( 0.2 );
sound.play();
});
}

function audio_card_seven() {
audioLoader.load( './audio/card_7.mp3', function( buffer ) {
sound.setBuffer( buffer );
sound.setLoop( false );
sound.setVolume( 0.2 );
sound.play();
});
}

function getModels(a?:string){
if (a == "card"){
var model_url = model_url_card;
} else if (a == "ten"){
var model_url = model_url_ten;
} else if (a == "fly"){
var model_url = model_url_fly;
} else if (a == "sword"){
var model_url = model_url_sword_hand;
} else if (a == "sword_out"){
var model_url = model_url_sword;
} else if (a == "ai"){
var model_url = model_url_light;
} else if (a == "ai_normal"){
var model_url = model_url_ai;
} else {
var model_url = model_url_default;
}
axios.get(model_url, {
responseType: "blob"
})
Expand All @@ -350,86 +194,6 @@ function getMenus() {
}
}

// 原子スキル
const el = document.querySelector('#btn-models') as HTMLInputElement | null;
if(el != null) {
el.addEventListener('click', (e:Event) => getModels(el.value));
}

// 原子バースト
const ela = document.querySelector('#btn-models_a') as HTMLInputElement | null;
if(ela != null) {
//ela.addEventListener('click', (e:Event) => getModels(ela.value));
ela.addEventListener('click', function(){
card_seven_load();
setTimeout(() => {
audio_card_seven();
toggleFloorGrid();
toggleLights();
}, 1000);
setTimeout(() => {
toggleTickSky();
}, 2000);
setTimeout(() => {
toggleTickSky();
}, 4000);
setTimeout(() => {
toggleLights();
}, 7000);
setTimeout(() => {
model_load();
}, 10000);
});
}

// 武器, 通常攻撃
const elb = document.querySelector('#btn-models_b') as HTMLInputElement | null;
if(elb != null) {
elb.addEventListener('click', (e:Event) => getModels(elb.value));
elb.addEventListener('click', function(){
toggleTickSkySword();
audio_sword();
setTimeout(() => {
item_load();
}, 7000);
});
}

const elc = document.querySelector('#btn-models_c') as HTMLInputElement | null;
if(elc != null) {
elc.addEventListener('click', (e:Event) => getModels(elc.value));
}
const eld = document.querySelector('#btn-models_d') as HTMLInputElement | null;
if(eld != null) {
eld.addEventListener('click', (e:Event) => getModels(eld.value));
}

const el_menu = document.querySelector('#btn-menu') as HTMLInputElement | null;
if(el_menu != null) {
el_menu.addEventListener('click', (e:Event) => getMenus());
}

const el_light = document.querySelector('#btn-light') as HTMLInputElement | null;
if(el_light != null) {
el_light.addEventListener('click', function(){
toggleLights();
});
}

const el_fly = document.querySelector('#btn-models_fly') as HTMLInputElement | null;
if(el_fly != null) {
el_fly.addEventListener('click', (e:Event) => getModels(el_fly.value));
}

// 量子テレポーテーション
const el_tel = document.querySelector('#btn-models_tel') as HTMLInputElement | null;
if(el_tel != null) {
el_tel.addEventListener('click', (e:Event) => toggleTickTen());
el_tel.addEventListener('click', function(){
toggleTel(1);
});
}

//背景のキラキラ(モバイルでは重い)
//toggleTick();

Expand Down

0 comments on commit 147289b

Please sign in to comment.