void Start()
 {
     ui = new DirectViewerSampleUi(
         debugUi,
         debugServerPort,
         OnClickPlay,
         OnClickStop,
         OnClickNext);
     debugServer = new DebugServer(debugServerPort, "/upload/", OnDebugFileServiceChanged);
     debugServer.RegisterRequestCallback("/", OnAccessRoot);
     debugServer.RegisterRequestCallback("/ping", OnAccessPing);
     debugServer.RegisterRequestCallback("/toggle-debug-ui", OnAccessToggleDebugUi);
     shaderReplacer = new IncompatibleShaderReplacer();
 }
Example #2
0
    void Start()
    {
        Application.logMessageReceived += OnLogReceived;
        debugServerIndexHtml            = debugServerIndexHtmlAsset.text;

        debugServer = new DebugServer(debugServerPort, "/assets/", OnFileChanged);

        // 上書き検出
        debugServer.RegisterRequestCallback("/", OnWebRequestRoot);
        debugServer.RegisterRequestCallback("/api/file/upload", OnWebRequestUploadFile);
        debugServer.RegisterRequestCallback("/api/file/delete", OnWebRequestDeleteFile);
        debugServer.RegisterRequestCallback("/api/file/delete-all", OnWebRequestDeleteAllFile);
        loadRequested = true;
    }
Example #3
0
    IEnumerator Start()
    {
        var ipAddress = DebugServer.GetLanIpAddress();

        debugServerIndexHtml = debugServerIndexHtmlAsset.text;
        debugServerIndexHtml = debugServerIndexHtml.Replace(
            "__TO_BE_REPLACED_WITH_ACTUAL_IP_ADDRESS_IN_RUNTIME__",
            ipAddress);

        debugServer = new DebugServer(debugServerPort);

        // 上書き検出
        debugServer.RegisterRequestCallback("/", OnWebRequestRoot);
        debugServer.RegisterRequestCallback("/upload-file", OnWebRequestUploadFile);
        debugServer.RegisterRequestCallback("/delete-file", OnWebRequestDeleteFile);
        debugServer.RegisterRequestCallback("/delete-all-file", OnWebRequestDeleteAllFile);
        yield return(CoLoad());
    }
Example #4
0
    public DebugService(
        World world,
        int serverPort,
        Camera camera,
        Shader textShader,
        Shader texturedShader,
        Font font,
        Sprite tapMark,
        string debugServerIndexHtml)
    {
        var decodedToken = DebugSlack.DecryptXor(slackKey, slackEncodedToken);

        if (decodedToken != null)
        {
            slack = new DebugSlack(decodedToken, "テキトーなチャンネル名");
        }
        // ログできるだけ速く欲しいので、こいつのコンストラクトだけ先にやる
        Log         = new DebugUiLogWindow(12f, 380f, 700f, borderEnabled: true, captureUnityLog: true);
        Log.enabled = false;

        this.world = world;
        this.debugServerIndexHtml = debugServerIndexHtml;
        server = new DebugServer(serverPort, "/assets/", OnFileChanged);

        uiManager = DebugUiManager.Create(
            camera,
            textShader,
            texturedShader,
            font,
            432,
            768,
            1f,
            8192);
        uiManager.safeAreaVisualizationEnabled = true;
        var frameTimeGauge = new FrameTimeGauge(100f, 15f, null);

        uiManager.Add(frameTimeGauge, 0f, 0f, DebugUi.AlignX.Right, DebugUi.AlignY.Bottom);
        menu = new DebugUiMenu(100f, 40f, DebugUi.Direction.Down, "DebugMenu");
        uiManager.Add(menu);
        menu.AddItem("LogWindow", () =>
        {
            Log.enabled = !Log.enabled;
        });
        uiManager.Add(Log, 0, 40f, DebugUi.AlignX.Center, DebugUi.AlignY.Top);

        var dataSubMenu = new DebugUiSubMenu("Data", 100f, 40f, DebugUi.Direction.Down);

        menu.AddSubMenu(dataSubMenu, DebugUi.Direction.Right);
        dataSubMenu.AddItem("SendJsons", () =>
        {
            world.StartCoroutine(CoSendJsons());
        });
        dataSubMenu.AddItem("Reload\nGlobalParams", () =>
        {
            world.ReloadGlobalParams();
        });

        var debugSubMenu = new DebugUiSubMenu("Debug", 100f, 40f, DebugUi.Direction.Down);

        menu.AddSubMenu(debugSubMenu, DebugUi.Direction.Right);

        debugSubMenu.AddItem("HideDebug", () =>
        {
            ToggleUiEnabled();
        });

        debugSubMenu.AddItem("AutoTap", () =>
        {
            tapper.enabled = !tapper.enabled;
        });

        var resoSubMenu = new DebugUiSubMenu("Resolution", 100f, 40f, DebugUi.Direction.Down);

        menu.AddSubMenu(resoSubMenu, DebugUi.Direction.Right);
        var text = string.Format("{0}x{1}", Screen.width, Screen.height);

        resoButton = resoSubMenu.AddItem(text, () =>
        {
            var w = Screen.width * 70 / 100;
            var h = Screen.height * 70 / 100;
            if (w < (16 * 9))
            {
                w = 720;
                h = 1280;
            }
            Screen.SetResolution(w, h, false, 60);
            resoButton.text = w.ToString() + "x" + h.ToString();
        });
        resoSubMenu.AddItem("Aspect\n4:3", () =>
        {
            ScreenSettings.Save(1536, 2048, 0, 0, 0, 0);
        });
        resoSubMenu.AddItem("Aspect\n16:9", () =>
        {
            ScreenSettings.Save(1080, 1920, 0, 0, 0, 0);
        });
        resoSubMenu.AddItem("Aspect\niPhoneX", () =>
        {
            ScreenSettings.Save(1242, 2688, 0, 0, 132, 102);
        });
        resoSubMenu.AddItem("Aspect\nDefault", () =>
        {
            ScreenSettings.SaveDefault();
        });

        menu.AddItem(DebugServerUtil.GetLanIpAddress(), () =>
        {
            var url = string.Format("http://{0}:{1}/", DebugServerUtil.GetLanIpAddress(), serverPort);
            Application.OpenURL(url);
        });
//		uiManager.enabled = false; // 初期状態は無効

        server.RegisterRequestCallback("/", OnWebRequestRoot);
        server.RegisterRequestCallback("/api/upload-file", OnWebRequestUploadFile);
        server.RegisterRequestCallback("/api/delete-file", OnWebRequestDeleteFile);
        server.RegisterRequestCallback("/api/delete-all-file", OnWebRequestDeleteAllFile);
        server.RegisterRequestCallback("/api/toggle-debug", OnWebRequestToggleDebug);

        var go = new GameObject("DebugTapper");

        tapper = go.AddComponent <DefaultDebugTapper>();
        tapper.ManualStart(8, tapMark);
        tapper.enabled = false;
    }
Example #5
0
 void Start()
 {
     debugServer = new DebugServer(8080, "/upload/", OnDebugFileServiceChanged);
     debugServer.RegisterRequestCallback("/", OnAccessRoot);
     ipAddress = DebugServerUtil.GetLanIpAddress();
 }