Ver código fonte

新增R03 UNITY

manto07m 3 anos atrás
pai
commit
86dfd92944

BIN
R03/R03Monitor/Build/R03Monitor.data.unityweb


BIN
R03/R03Monitor/Build/R03Monitor.framework.js.unityweb


Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 0
R03/R03Monitor/Build/R03Monitor.loader.js


BIN
R03/R03Monitor/Build/R03Monitor.wasm.unityweb


+ 24 - 0
R03/R03Monitor/TemplateData/UnityProgress.javascript

@@ -0,0 +1,24 @@
+function UnityProgress(gameInstance, progress) {
+  if (!gameInstance.Module)
+    return;
+  if (!gameInstance.logo) {
+    gameInstance.logo = document.createElement("div");
+    gameInstance.logo.className = "logo " + gameInstance.Module.splashScreenStyle;
+    gameInstance.container.appendChild(gameInstance.logo);
+  }
+  if (!gameInstance.progress) {    
+    gameInstance.progress = document.createElement("div");
+    gameInstance.progress.className = "progress " + gameInstance.Module.splashScreenStyle;
+    gameInstance.progress.empty = document.createElement("div");
+    gameInstance.progress.empty.className = "empty";
+    gameInstance.progress.appendChild(gameInstance.progress.empty);
+    gameInstance.progress.full = document.createElement("div");
+    gameInstance.progress.full.className = "full";
+    gameInstance.progress.appendChild(gameInstance.progress.full);
+    gameInstance.container.appendChild(gameInstance.progress);
+  }
+  gameInstance.progress.full.style.width = (100 * progress) + "%";
+  gameInstance.progress.empty.style.width = (100 * (1 - progress)) + "%";
+  if (progress == 1)
+    gameInstance.logo.style.display = gameInstance.progress.style.display = "none";
+}

BIN
R03/R03Monitor/TemplateData/favicon.ico


BIN
R03/R03Monitor/TemplateData/fullscreen.png


BIN
R03/R03Monitor/TemplateData/progressEmpty.Dark.png


BIN
R03/R03Monitor/TemplateData/progressEmpty.Light.png


BIN
R03/R03Monitor/TemplateData/progressFull.Dark.png


BIN
R03/R03Monitor/TemplateData/progressFull.Light.png


BIN
R03/R03Monitor/TemplateData/progressLogo.Dark.png


BIN
R03/R03Monitor/TemplateData/progressLogo.Light.png


+ 77 - 0
R03/R03Monitor/TemplateData/responsive.javascript

@@ -0,0 +1,77 @@
+(function(){
+    console.log('Responsive WebGL Template by SIMMER.io v2019.02.08');
+    console.log('Available at: https://assetstore.unity.com/packages/tools/gui/responsive-webgl-template-117308 for free!');
+    console.log('Host your WebGL Game at SIMMER.io for free!');
+
+    const q = (selector) => document.querySelector(selector);
+
+    const gameContainer = q('#gameContainer');
+
+    const initialDimensions = {width: parseInt(gameContainer.style.width, 10), height: parseInt(gameContainer.style.height, 10)};
+    gameContainer.style.width = '100%';
+    gameContainer.style.height = '100%';
+
+    let gCanvasElement = null;
+
+    const getCanvasFromMutationsList = (mutationsList) => {
+        for (let mutationItem of mutationsList){
+            for (let addedNode of mutationItem.addedNodes){
+                if (addedNode.id === '#canvas'){
+                    return addedNode;
+                }
+            }
+        }
+        return null;
+    }
+
+    const setDimensions = () => {
+        gameContainer.style.position = 'absolute';
+        gCanvasElement.style.display = 'none';
+        var winW = parseInt(window.getComputedStyle(gameContainer).width, 10);
+        var winH = parseInt(window.getComputedStyle(gameContainer).height, 10);
+        var scale = Math.min(winW / initialDimensions.width, winH / initialDimensions.height);
+        gCanvasElement.style.display = '';
+        gCanvasElement.style.width = 'auto';
+        gCanvasElement.style.height = 'auto';
+
+        var fitW = Math.round(initialDimensions.width * scale * 100) / 100;
+        var fitH = Math.round(initialDimensions.height * scale * 100) / 100;
+
+        gCanvasElement.setAttribute('width', fitW);
+        gCanvasElement.setAttribute('height', fitH);
+    }
+
+    window.setDimensions = setDimensions;
+
+    const registerCanvasWatcher = () => {
+        let debounceTimeout = null;
+        const debouncedSetDimensions = () => {
+            if (debounceTimeout !== null) {
+                clearTimeout(debounceTimeout);
+            }
+            debounceTimeout = setTimeout(setDimensions, 200);
+        }
+        window.addEventListener('resize', debouncedSetDimensions, false);
+        setDimensions();
+    }
+
+    window.UnityLoader.Error.handler = function () { }
+
+    const i = 0;
+    new MutationObserver(function (mutationsList) {
+        const canvas = getCanvasFromMutationsList(mutationsList)
+        if (canvas){
+            gCanvasElement = canvas;
+            registerCanvasWatcher();
+
+            new MutationObserver(function (attributesMutation) {
+                this.disconnect();
+                setTimeout(setDimensions, 1)
+                q('.simmer').classList.add('hide');
+            }).observe(canvas, {attributes:true});
+
+            this.disconnect();
+        }
+    }).observe(gameContainer, {childList:true});
+
+})();

+ 63 - 0
R03/R03Monitor/TemplateData/style.css

@@ -0,0 +1,63 @@
+.webgl-content * {border: 0; margin: 0; padding: 0}
+.webgl-content {top: 0; left: 0;}
+
+.webgl-content .logo, .progress {position: absolute; left: 50%; top: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);}
+.webgl-content .logo {background: url('progressLogo.Light.png') no-repeat center / contain; width: 154px; height: 130px;}
+.webgl-content .progress {height: 18px; width: 141px; margin-top: 90px;}
+.webgl-content .progress .empty {background: url('progressEmpty.Light.png') no-repeat right / cover; float: right; width: 100%; height: 100%; display: inline-block;}
+.webgl-content .progress .full {background: url('progressFull.Light.png') no-repeat left / cover; float: left; width: 0%; height: 100%; display: inline-block;}
+
+.webgl-content .logo.Dark {background-image: url('progressLogo.Dark.png');}
+.webgl-content .progress.Dark .empty {background-image: url('progressEmpty.Dark.png');}
+.webgl-content .progress.Dark .full {background-image: url('progressFull.Dark.png');}
+
+.webgl-content .footer {margin-top: 5px; height: 38px; line-height: 38px; font-family: Helvetica, Verdana, Arial, sans-serif; font-size: 18px;} 
+.webgl-content .footer .webgl-logo, .title, .fullscreen {height: 100%; display: inline-block; background: transparent center no-repeat;} 
+.webgl-content .footer .webgl-logo {background-image: url('webgl-logo.png'); width: 204px; float: left;}
+.webgl-content .footer .title {margin-right: 10px; float: right;}
+.webgl-content .footer .fullscreen {background-image: url('fullscreen.png'); width: 38px; float: right;}
+
+body, html{
+    margin:0;
+    padding:0;
+}
+
+#gameContainer canvas{
+    position:absolute;
+    transform:translate(-50%, -50%);
+    top:50%;
+    left:50%;
+
+}
+
+.simmer{
+    position:absolute;
+    bottom:10px;
+    right:10px;
+    color:#aaa;
+    font-size:9px;
+    font-family:sans-serif;
+    font-family:sans-serif;
+
+    /*want to remove the simmer branding? uncomment display:none below!*/
+    /*display:none;*/
+}
+
+.simmer a{
+    color:#cccccc;
+    text-decoration:none;
+    font-size:12px;
+    transition:opacity 3s;
+
+}
+
+.simmer a:hover{
+    color:#fff;
+    text-decoration:underline;
+}
+
+.simmer.hide {
+    opacity:0;
+}
+
+

BIN
R03/R03Monitor/TemplateData/webgl-logo.png


+ 22 - 0
R03/R03Monitor/index.html

@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html lang="en-us">
+<head>
+    <meta charset="utf-8">
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <title>%UNITY_WEB_NAME%</title>
+    <link rel="shortcut icon" href="TemplateData/favicon.ico">
+    <link rel="stylesheet" href="TemplateData/style.css">
+    <script src="TemplateData/UnityProgress.javascript"></script>
+    <script src="%UNITY_WEBGL_LOADER_URL%"></script>
+    <script>
+        var gameInstance = UnityLoader.instantiate("gameContainer", "%UNITY_WEBGL_BUILD_URL%", {onProgress: UnityProgress});
+    </script>
+</head>
+<body>
+<div class="webgl-content">
+    <div id="gameContainer" style="width: %UNITY_WIDTH%px; height: %UNITY_HEIGHT%px"></div>
+</div>
+<div class="simmer">template by: <a href="https://simmer.io" target="_blank">SIMMER.io</a></div>
+<script src="TemplateData/responsive.javascript"></script>
+</body>
+</html>

+ 6 - 6
script/js/unity-loader.js

@@ -3,7 +3,7 @@ var canvas = document.querySelector("#unity-canvas");
 var loadingBar = document.querySelector("#unity-loading-bar");
 var progressBarFull = document.querySelector("#unity-progress-bar-full");
 var warningBanner = document.querySelector("#unity-warning");
-
+var unityName = "C3Dev";
 function unityShowBanner(msg, type) {
     function updateBannerVisibility() {
         warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
@@ -22,12 +22,12 @@ function unityShowBanner(msg, type) {
     updateBannerVisibility();
 }
 
-var buildUrl = "C3Dev/Build";
-var loaderUrl = buildUrl + "/C3Dev.loader.js";
+var buildUrl = unityName + "/Build";
+var loaderUrl = buildUrl + "/" + unityName +".loader.js";
 var config = {
-    dataUrl: buildUrl + "/C3Dev.data.unityweb",
-    frameworkUrl: buildUrl + "/C3Dev.framework.js.unityweb",
-    codeUrl: buildUrl + "/C3Dev.wasm.unityweb",
+    dataUrl: buildUrl + "/" + unityName + ".data.unityweb",
+    frameworkUrl: buildUrl + "/" + unityName + ".framework.js.unityweb",
+    codeUrl: buildUrl + "/" + unityName + ".wasm.unityweb",
     streamingAssetsUrl: "StreamingAssets",
     companyName: "DefaultCompany",
     productName: "C3Monitor",

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff