<html>

<head>
    <title>CatHouse</title>
    <meta charset='utf-8' />
    <meta name='renderer' content='webkit' />
    <meta name='viewport' content='width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no' />
    <meta name='apple-mobile-web-app-capable' content='yes' />
    <meta name='full-screen' content='true' />
    <meta name='x5-fullscreen' content='true' />
    <meta name='360-fullscreen' content='true' />
    <meta name='laya' screenorientation='portrait' />
    <meta http-equiv='expires' content='0' />
    <meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1' />
    <meta http-equiv='Cache-Control' content='no-siteapp' />
    <link rel="icon" type="image/png" href="./favicon.png">
</head>

<body style="background-color: #464646" onload="loadIndex()">
    <script type="text/javascript">
        try {
            eval('"use strict"; class foo {}');
        } catch (e) {
            alert("您的浏览器不支持ES6语法格式,不能正常运行游戏");
        }
        var time = Date.now();
        window._gameLog = function(value) {
                var now = Date.now();
                console.warn('启动日志：[' + (now - time) + ']' + value);
            }
            //外网CDN
        window.basePath = "http://app-cathouse-cdn.jinkejoy.com/";

        function loadLib(url) {
            var script = document.createElement("script");
            script.async = false;
            script.src = url;
            document.body.appendChild(script);
        }
        var getClientWidth = function() {
            return window.innerWidth || window.document.body.clientWidth;
        }
        var getClientHeight = function() {
            return window.innerHeight || window.document.body.clientHeight || window.document.documentElement.clientHeight;
        }

        var drawStatusBar = function() {
            var layaCanvas = document.querySelector('#layaCanvas');
            if (!layaCanvas)
                return;
            var canvas = document.getElementById('statusBar');
            if (!canvas)
                return;
            var ctx = canvas.getContext('2d');
            var w = canvas.width = getClientWidth() * 0.5;
            var h = canvas.height;
            canvas.style.left = (getClientWidth() - w) * 0.5;
            var r = 20;
            ctx.clearRect(0, 0, canvas.width, canvas.height);
            ctx.save();
            ctx.beginPath();
            ctx.moveTo(0, 0);
            ctx.lineTo(w, 0);
            ctx.lineTo(w, h - r);
            ctx.quadraticCurveTo(w, h, w - r, h);
            ctx.lineTo(r, h);
            ctx.quadraticCurveTo(0, h, 0, h - r);
            ctx.lineTo(0, 0);
            ctx.fillStyle = "#000000";
            ctx.fill();
            ctx.lineWidth = 1;
            ctx.strokeStyle = '#ffffff';
            ctx.stroke();
            ctx.restore();
        }

        var drawMenuBar = function() {
            var layaCanvas = document.querySelector('#layaCanvas');
            if (!layaCanvas)
                return;
            var canvas = document.getElementById('menuBar');
            if (!canvas)
                return;
            var ctx = canvas.getContext('2d');
            var w = canvas.width;
            var h = canvas.height;
            canvas.style.left = canvas.boundingRect.left;
            var r = 20;
            ctx.clearRect(0, 0, canvas.width, canvas.height);
            ctx.save();
            ctx.beginPath();
            ctx.moveTo(r, 0);
            ctx.lineTo(w - r, 0);
            ctx.quadraticCurveTo(w, 0, w, r);
            ctx.lineTo(w, h - r);
            ctx.quadraticCurveTo(w, h, w - r, h);
            ctx.lineTo(r, h);
            ctx.quadraticCurveTo(0, h, 0, h - r);
            ctx.lineTo(0, r);
            ctx.quadraticCurveTo(0, 0, r, 0);
            ctx.fillStyle = "#000000";
            ctx.fill();
            ctx.lineWidth = 1;
            ctx.strokeStyle = '#ffffff';
            ctx.stroke();
            ctx.restore();

            ctx.save();
            ctx.beginPath();
            ctx.moveTo(w * 0.5, 0);
            ctx.lineTo(w * 0.5, h);
            ctx.lineWidth = 1;
            ctx.strokeStyle = '#ffffff';
            ctx.stroke();
            ctx.restore();

            fillCircle(ctx, w * 0.25, h * 0.5, 5, '#ffffff');
            fillCircle(ctx, w * 0.25 - 10, h * 0.5, 3, '#ffffff');
            fillCircle(ctx, w * 0.25 + 10, h * 0.5, 3, '#ffffff');

            fillCircle(ctx, w * 0.75, h * 0.5, 4.5, '#ffffff');
            fillCircle(ctx, w * 0.75, h * 0.5, 8, null, '#ffffff', 2);
        }

        function fillCircle(ctx, x, y, radius, fillColor, lineColor, lineWidth) {
            ctx.save();
            ctx.beginPath();
            ctx.arc(x, y, radius, 0, 2 * Math.PI, false);
            if (fillColor) {
                ctx.fillStyle = fillColor;
                ctx.fill();
            }
            if (lineColor) {
                ctx.lineWidth = lineWidth;
                ctx.strokeStyle = lineColor;
                ctx.stroke();
            }
            ctx.restore();
        }

        window.debugStatusBar = function(height) {
            var statusBar = document.querySelector('#statusBar');
            if (statusBar != null)
                return;
            statusBar = document.createElement('canvas');
            document.body.appendChild(statusBar);
            statusBar.id = 'statusBar';
            statusBar.style.zIndex = '200000';
            statusBar.style.position = 'absolute';
            statusBar.height = height;
            setInterval(drawStatusBar, 500);
        }

        window.debugMenuButton = function(width, height, left, top) {
            var menuBar = document.querySelector('#menuBar');
            if (menuBar != null)
                return;
            menuBar = document.createElement('canvas');
            document.body.appendChild(menuBar);
            menuBar.id = 'menuBar';
            menuBar.style.zIndex = '200000';
            menuBar.style.position = 'absolute';
            menuBar.width = width;
            menuBar.height = height;
            menuBar.style.top = top;
            menuBar.boundingRect = {
                width: width,
                height: height,
                left: left,
                top: top
            };
            setInterval(drawMenuBar, 500);
        }

        loadLib("tgui.js");
        loadLib("launchview.js");

        function loadIndex() {
            var param = launchView.readParams();
            var indexName = (param.version ? ("index_" + param.version + ".js") : "index_v1.0.7web.js");
            window.__version__ = indexName.split("_").pop().replace(".js", "");
            loadLib(indexName);
        }
    </script>
</body>

</html>