Unity之webgl端通过vue3接入腾讯云联络中心SDK

news2024/10/6 8:22:38

腾讯云联络中心SDK:云联络中心 Web-SDK 开发指南-文档中心-腾讯云 (tencent.com)

1 首先下载Demo

 1.1 对其进行解压

 1.2根据文档操作

查看README.md,根据说明设置server下的dev.js里的相关参数。

然后打开电脑终端,cd到项目的路径:

安装依赖

 

运行

​ 

1.3 运行demo

复制http://127.0.0.1:5173/在浏览器里输入,这时候会显示如下画面:

输入电话号码,点击拨打就会把电话打出去。

​ 

 2 在Unity端的操作

2.1 创建Unity工程

 新建一个Unity工程,在Assets/Plugins/WebGl下创建一个后缀为jslib的文件,记事本打开编写脚本如下:

mergeInto(LibraryManager.library, {
	ReportReady: function () {
		window.ReportReady()
	},
         
        TellPhone:function(typeName, phone){
             SendPhone(UTF8ToString(typeName), UTF8ToString(phone))
        }

});

 2.2 编写挂载对象UIPanel上的脚本

using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine.UI;
using TMPro;

public class UIPanel : MonoBehaviour
{ 
    [DllImport("__Internal")]
    private static extern string ReportReady();
    [DllImport("__Internal")]
    private static extern string TellPhone(string type,string phone);
    public TextMeshProUGUI text;
    public TMP_InputField inputField;
    void Start()
    {
        ReportReady();//向vue报告脚本初始化完成
    }
    public void OpenPhone()
    {
        TellPhone("tellphone",inputField.text);
    }
    public void receiveMsgFromVue(string token) {
        text.text = token;
        Debug.Log("接受来自vue的消息 == " + token);
    }
}

2.3 Unity的UI界面

2.4最后打包webgl的包

放在tccc-demo-vue\src\路径下,如下图所示:

 

2.5改写index.html

打开index.html:

SendPhone是Unity发送给网页的方法,sendMsgToUnity方法是网页发送个Unity的方法。

index.html完整代码如下:

<!DOCTYPE html>
<html lang="en-us">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Unity WebGL Player | Web731</title>
    <link rel="shortcut icon" href="TemplateData/favicon.ico">
    <link rel="stylesheet" href="TemplateData/style.css">
  </head>
  <body>
    <div id="unity-container" class="unity-desktop">
      <canvas id="unity-canvas" width=1920 height=1080></canvas>
      <div id="unity-loading-bar">
        <div id="unity-logo"></div>
        <div id="unity-progress-bar-empty">
          <div id="unity-progress-bar-full"></div>
        </div>
      </div>
      <div id="unity-warning"> </div>
      <div id="unity-footer">
        <div id="unity-webgl-logo"></div>
        <div id="unity-fullscreen-button"></div>
        <div id="unity-build-title">Web731</div>
      </div>
    </div>
    <script>
      var container = document.querySelector("#unity-container");
      var canvas = document.querySelector("#unity-canvas");
      var loadingBar = document.querySelector("#unity-loading-bar");
      var progressBarFull = document.querySelector("#unity-progress-bar-full");
      var fullscreenButton = document.querySelector("#unity-fullscreen-button");
      var warningBanner = document.querySelector("#unity-warning");

      // Shows a temporary message banner/ribbon for a few seconds, or
      // a permanent error message on top of the canvas if type=='error'.
      // If type=='warning', a yellow highlight color is used.
      // Modify or remove this function to customize the visually presented
      // way that non-critical warnings and error messages are presented to the
      // user.
      function unityShowBanner(msg, type) {
        function updateBannerVisibility() {
          warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
        }
        var div = document.createElement('div');
        div.innerHTML = msg;
        warningBanner.appendChild(div);
        if (type == 'error') div.style = 'background: red; padding: 10px;';
        else {
          if (type == 'warning') div.style = 'background: yellow; padding: 10px;';
          setTimeout(function() {
            warningBanner.removeChild(div);
            updateBannerVisibility();
          }, 5000);
        }
        updateBannerVisibility();
      }

      var buildUrl = "Build";
      var loaderUrl = buildUrl + "/web0803.loader.js";
      var config = {
        dataUrl: buildUrl + "/web0803.data.unityweb",
        frameworkUrl: buildUrl + "/web0803.framework.js.unityweb",
        codeUrl: buildUrl + "/web0803.wasm.unityweb",
        streamingAssetsUrl: "StreamingAssets",
        companyName: "DefaultCompany",
        productName: "Web731",
        productVersion: "0.1",
        showBanner: unityShowBanner,
      };

      // By default Unity keeps WebGL canvas render target size matched with
      // the DOM size of the canvas element (scaled by window.devicePixelRatio)
      // Set this to false if you want to decouple this synchronization from
      // happening inside the engine, and you would instead like to size up
      // the canvas DOM size and WebGL render target sizes yourself.
      // config.matchWebGLToCanvasSize = false;

      if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
        container.className = "unity-mobile";
        // Avoid draining fillrate performance on mobile devices,
        // and default/override low DPI mode on mobile browsers.
        config.devicePixelRatio = 1;
        unityShowBanner('WebGL builds are not supported on mobile devices.');
      } else {
        canvas.style.width = "1920px";
        canvas.style.height = "1080px";
      }
      loadingBar.style.display = "block";

      var script = document.createElement("script");
      script.src = loaderUrl;
      script.onload = () => {
        createUnityInstance(canvas, config, (progress) => {
          progressBarFull.style.width = 100 * progress + "%";
        }).then((unityInstance) => {
          loadingBar.style.display = "none";
          fullscreenButton.onclick = () => {
            unityInstance.SetFullscreen(1);
          };
          unityInstanceV = unityInstance;
        }).catch((message) => {
          alert(message);
        });
      };
      document.body.appendChild(script);

  var unityInstanceV;
  function ReportReady() {
    window.parent.postMessage({guid:"",event:"ReportReady"}, "*");
  }
  function SendPhone(_type,_phone)
  {
    // alert(s);
    if (_type == "tellphone"){
      window.parent.postMessage({guid:"",event:_type,phone:_phone}, "*");
    }else {
      window.parent.postMessage({guid:_type,event:"guid"}, "*");
    }
  }

  function sendMsgToUnity(obj) {
    unityInstanceV.SendMessage('UIPanel','receiveMsgFromVue',JSON.stringify(obj))
  }

    </script>
  </body>
</html>

2.6 修改Container.vue脚本

增加和Unity交互的方法

 把原先显示的界面代码删除掉<div class="container"> </div>

 style 部分也删掉

对Vue不熟悉,我的理解是这样的(理解不对请留言指正)

其中 

onMounted(()=>{
        window.addEventListener('message', unityWatch,true)
    }) 

是事件,对Unity发送来的消息进行监听。

function  vueSendToUnity(){
      console.log(statusMap[status.value])
      unityIframe.value.contentWindow.sendMsgToUnity({userId:'****',状态:status.value|| '加载中...'})  
}

是vue把消息发送到Unity端。

<template>
  <div >
<iframe id="iframe" ref="unityIframe" src="/src/unity/index.html" style="width:100%;height:100vh" frameborder="0" scrolling="auto" /> 
  </div>
</template>

是Unity部分进行显示(其中stytle的height:100% 不起作用,有知道的请留言,谢谢,所以我改为了height:100vh)。

Container.vue修改后代码如下:

<script setup>
import { ref, onMounted } from 'vue'
const wechatGroupImg = 'https://tccc.qcloud.com/assets/wechatGroup.png';
const arrowImg = 'https://tccc.qcloud.com/assets/arrow.png';

const seat = ref('')
const status = ref('')
const number = ref('')
const loading = ref(false)
const isError = ref(false)
const errorField = ref('')

const statusMap = {
  offline: '已下线',
  disconnect: '网络断开,重连中',
  free: '空闲中',
  busy: '忙碌中',
  rest: '小休中',
  countdown: '话后倒计时',
  arrange: '话后整理中',
  notReady: '示忙中',
}

const errorFieldMap = {
  'InvalidParameterValue.InstanceNotExist': 'sdkAppId',
  'InvalidParameterValue.AccountNotExist': 'userId',
  'AuthFailure.SignatureFailure': 'secretKey或secretId',
  'AuthFailure.SecretIdNotFound': 'secretId',
};

const injectTCCC = ({ token, sdkAppId, userId, sdkUrl }) => {
  const scriptDom = document.createElement('script')
  scriptDom.setAttribute('crossorigin', 'anonymous')
  scriptDom.dataset.token = token
  scriptDom.dataset.sdkAppId = sdkAppId
  scriptDom.dataset.userid = userId
  scriptDom.src = sdkUrl
  document.body.appendChild(scriptDom)
  scriptDom.addEventListener('load', () => {
    // ready事件必须监听,否则容易发生tccc不存在的错误,所有呼入呼出的逻辑必须在ready事件触发后才可以调用
    window.tccc.on('ready', () => {
      // 以下为Demo逻辑,非业务必须。业务代码主要实现都在这个部分
      const statusVal = window.tccc.Agent.getStatus()
      status.value = statusVal;
      seat.value = userId;
    })
    // 以下为Demo逻辑,非接入必须
    setInterval(() => {
      const statusVal = window.tccc.Agent.getStatus()
      status.value = statusVal;
    }, 200)
  })
}

onMounted(() => {
  // 获取Token的方法必须在页面初始化时第一优先级调用
  fetch('/loginTCCC')
    .then((res) => res.json())
    .then((res) => {
      // 以下为Demo逻辑,需要替换为业务逻辑
      if (res.code) {
        if (res.type) {
          isError.value = true;
          errorField.value = errorFieldMap[res.code]
        } else {
          isError.value = true;
          if (errorFieldMap[res.code]) {
            errorField.value = errorFieldMap[res.code]
          } else {
            alert(res.errMsg);
          }
          return;
        }
      }
      // 调用成功后才可以开始执行TCCC的注入
      injectTCCC({
        token: res.token,
        userId: res.userId,
        sdkUrl: res.sdkUrl,
        sdkAppId: res.sdkAppId,
      })
    })
    .catch((error) => {
      console.error(`获取Token失败:${error.message}`)
    })
})

const handleCallout = async () => {
  if (loading.value) {
    return
  }
  loading.value = true
  // 调用呼出方法的核心代码
  try {
    await window.tccc.Call.startOutboundCall({ phoneNumber: number.value })
  } catch (error) {
    console.error(`呼出失败:${error.message}`)
  } finally {
    loading.value = false
  }
}


 onMounted(()=>{
        window.addEventListener('message', unityWatch,true)
    }) 
  function unityWatch(e){
      console.log('unityWatch方法调用 e==' + e.data.guid + '    event=' + e.data.event)
      if(e.data.event=='tellphone'){
            handleCalloutByUnity(e.data.phone)  
            vueSendToUnity()  
      }
} 
  //Unity端调用vue里的打电话功能
const handleCalloutByUnity = async (phone) => {
  if (loading.value) {
    return
  }
  loading.value = true
  // 调用呼出方法的核心代码
  try {
    await window.tccc.Call.startOutboundCall({ phoneNumber: phone })
  } catch (error) {
    console.error(`呼出失败:${error.message}`)
  } finally {
    loading.value = false
  }
}

const unityIframe = ref('unityIframe')
function  vueSendToUnity(){
      console.log(statusMap[status.value])
      unityIframe.value.contentWindow.sendMsgToUnity({userId:'****',状态:status.value|| '加载中...'})      
}

</script>

<template>
  <div >
<iframe id="iframe" ref="unityIframe" src="/src/unity/index.html" style="width:100%;height:100vh" frameborder="0" scrolling="auto" /> 
  </div>
</template>

2.7 测试运行

测试运行时得保证终端npm run dev在运行中

 在Unity 的界面上输入手机号点击拨打,电话打了出去,同时Unity端收到了vue发送过来的消息。

2.8 网页内全屏

这时候如果需要Unity在网页内全屏,且不显示滚动条,需要打开Unity的index.html进行再次修改:

 

 

 

 

 index.html的修改后如下:

<!DOCTYPE html>
<html lang="en-us">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Unity WebGL Player | Web731</title>
    <link rel="shortcut icon" href="TemplateData/favicon.ico">
    <link rel="stylesheet" href="TemplateData/style.css">
  </head>
  <body>
    <div id="unity-container" style="width: 100%;height:100%">
      <canvas id="unity-canvas" width=auto height=auto></canvas>
      <div id="unity-loading-bar">
        <div id="unity-logo"></div>
        <div id="unity-progress-bar-empty">
          <div id="unity-progress-bar-full"></div>
        </div>
      </div>
      <div id="unity-warning"> </div>
     
    </div>
    <script>
      var container = document.querySelector("#unity-container");
      var canvas = document.querySelector("#unity-canvas");
      var loadingBar = document.querySelector("#unity-loading-bar");
      var progressBarFull = document.querySelector("#unity-progress-bar-full");
      //var fullscreenButton = document.querySelector("#unity-fullscreen-button");
      var warningBanner = document.querySelector("#unity-warning");

      // Shows a temporary message banner/ribbon for a few seconds, or
      // a permanent error message on top of the canvas if type=='error'.
      // If type=='warning', a yellow highlight color is used.
      // Modify or remove this function to customize the visually presented
      // way that non-critical warnings and error messages are presented to the
      // user.
      function unityShowBanner(msg, type) {
        function updateBannerVisibility() {
          warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
        }
        var div = document.createElement('div');
        div.innerHTML = msg;
        warningBanner.appendChild(div);
        if (type == 'error') div.style = 'background: red; padding: 10px;';
        else {
          if (type == 'warning') div.style = 'background: yellow; padding: 10px;';
          setTimeout(function() {
            warningBanner.removeChild(div);
            updateBannerVisibility();
          }, 5000);
        }
        updateBannerVisibility();
      }

      var buildUrl = "Build";
      var loaderUrl = buildUrl + "/web0803.loader.js";
      var config = {
        dataUrl: buildUrl + "/web0803.data.unityweb",
        frameworkUrl: buildUrl + "/web0803.framework.js.unityweb",
        codeUrl: buildUrl + "/web0803.wasm.unityweb",
        streamingAssetsUrl: "StreamingAssets",
        companyName: "DefaultCompany",
        productName: "Web731",
        productVersion: "0.1",
        showBanner: unityShowBanner,
      };

      // By default Unity keeps WebGL canvas render target size matched with
      // the DOM size of the canvas element (scaled by window.devicePixelRatio)
      // Set this to false if you want to decouple this synchronization from
      // happening inside the engine, and you would instead like to size up
      // the canvas DOM size and WebGL render target sizes yourself.
      // config.matchWebGLToCanvasSize = false;

      if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
        var meta = document.createElement('meta');
           meta.name = 'viewport';
           meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
           document.getElementsByTagName('head')[0].appendChild(meta);
           container.className = "unity-mobile";
         
           canvas.style.width = window.innerWidth + 'px';
           canvas.style.height = window.innerHeight + 'px';


       unityShowBanner('暂不支持移动端...');
     } else {	  
      canvas.style.height= document.documentElement.clientHeight+"px";
      canvas.style.width = document.documentElement.clientWidth+"px"; 	  
     }
      loadingBar.style.display = "block";

      var script = document.createElement("script");
      script.src = loaderUrl;
      script.onload = () => {
        createUnityInstance(canvas, config, (progress) => {
          progressBarFull.style.width = 100 * progress + "%";
        }).then((unityInstance) => {
          loadingBar.style.display = "none";
          //fullscreenButton.onclick = () => {
          //  unityInstance.SetFullscreen(1);
          //};
          unityInstanceV = unityInstance;
        }).catch((message) => {
          alert(message);
        });
      };
      document.body.appendChild(script);

  var unityInstanceV;
  function ReportReady() {
    window.parent.postMessage({guid:"",event:"ReportReady"}, "*");
  }
  function SendPhone(_type,_phone)
  {
    // alert(s);
    if (_type == "tellphone"){
      window.parent.postMessage({guid:"",event:_type,phone:_phone}, "*");
    }else {
      window.parent.postMessage({guid:_type,event:"guid"}, "*");
    }
  }

  function sendMsgToUnity(obj) {
    unityInstanceV.SendMessage('UIPanel','receiveMsgFromVue',JSON.stringify(obj))
  }

    </script>
  </body>
</html>

打开Unity\TemplateData路径下的style.css增加:

html,body{width:100%;height:100%;margin:0;padding:0;overflow:hidden;}
.webgl-content{width: 100%; height: 100%;}
.unityContainer{width: 100%; height: 100%;}

style.css完整脚本如下:

body { padding: 0; margin: 0 }
#unity-container { position: absolute }
#unity-container.unity-desktop { left: 50%; top: 50%; transform: translate(-50%, -50%) }
#unity-container.unity-mobile { width: 100%; height: 100% }
#unity-canvas { background: #231F20 }
.unity-mobile #unity-canvas { width: 100%; height: 100% }
#unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none }
#unity-logo { width: 154px; height: 130px; background: url('unity-logo-dark.png') no-repeat center }
#unity-progress-bar-empty { width: 141px; height: 18px; margin-top: 10px; background: url('progress-bar-empty-dark.png') no-repeat center }
#unity-progress-bar-full { width: 0%; height: 18px; margin-top: 10px; background: url('progress-bar-full-dark.png') no-repeat center }
#unity-footer { position: relative }
.unity-mobile #unity-footer { display: none }
#unity-webgl-logo { float:left; width: 204px; height: 38px; background: url('webgl-logo.png') no-repeat center }
#unity-build-title { float: right; margin-right: 10px; line-height: 38px; font-family: arial; font-size: 18px }
#unity-fullscreen-button { float: right; width: 38px; height: 38px; background: url('fullscreen-button.png') no-repeat center }
#unity-warning { position: absolute; left: 50%; top: 5%; transform: translate(-50%); background: white; padding: 10px; display: none }


html,body{width:100%;height:100%;margin:0;padding:0;overflow:hidden;}
.webgl-content{width: 100%; height: 100%;}
.unityContainer{width: 100%; height: 100%;}

 但是vue的这个右侧还是有滚动条,还没找到隐藏的方法,有知道的同学请留言,谢谢。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/831510.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

喜报 | 《中国AIOps现状调查报告(2023)》发布!擎创科技案例再度入选

&#xff08;本文部分内容来自《中国AIOps现状调查报告&#xff08;2023&#xff09;》&#xff0c;丝小编扣1&#xff0c;领取完整版报告&#xff09; 2023年7月18日&#xff0c;信通院Xops产业创新发展论坛于北京成功举办。大会旨在提高企业研发运营水平&#xff0c;加强XOp…

243. 一个简单的整数问题2(树状数组)

输入样例&#xff1a; 10 5 1 2 3 4 5 6 7 8 9 10 Q 4 4 Q 1 10 Q 2 4 C 3 6 3 Q 2 4输出样例&#xff1a; 4 55 9 15 解析&#xff1a; 一般树状数组都是单点修改、区间查询或者单点查询、区间修改。这道题都是区间操作。 1. 区间修改用数组数组维护差分数组 2. 区间查询&am…

实现弧形切角两种方式

1、css 的 radial-gradient <view style"padding:30px; background: #ccc;"><view class"navActive"></view> </view>.navActive{width: 200px;height: 40px;background-color: #fff;color: rgb(0,63,136);position: relative;bor…

windows环境下安装elasticsearch、kibana

通过本文可以快速在windows系统上安装elasticsearch、kibana环境。 当你用Integer类型的时候&#xff0c;要非常小心&#xff0c;因为100等于100、但是200不等于200&#xff0c;当然&#xff0c;如果你会一点小花招&#xff0c;也可以让100不等于100、让200等于200。(运算符比较…

优化供应链和库存管理:PDM系统的物料控制之道

在现代制造业中&#xff0c;优化供应链和库存管理是企业实现高效运营和降低成本的重要目标。PDM系统作为一款强大的数字化工具&#xff0c;扮演着物料控制之道的角色&#xff0c;帮助企业实现优化供应链和库存管理的目标。让我们一同深入探讨&#xff0c;看看PDM系统是如何通过…

git clone 登录 github

git clone 登录 github 目录概述需求&#xff1a; 设计思路实现思路分析1.github 设置setting2.输入passwd 参考资料和推荐阅读 Survive by day and develop by night. talk for import biz , show your perfect code,full busy&#xff0c;skip hardness,make a better result…

mac切换jdk版本

查询mac已有版本 1、打开终端&#xff0c;输入&#xff1a; /usr/libexec/java_home -V注意&#xff1a;输入命令参数区分大小写(必须是-V) 2.目前本地装有两个版本的jdk xxxxedydeMacBook-Pro-9 ~ % /usr/libexec/java_home -V Matching Java Virtual Machines (2):20.0.1 (…

Cocos Creator不规则按钮

实现该功能需要用到组件PolygonCollider2D&#xff0c;官方链接&#xff1a; https://docs.cocos.com/creator/3.4/manual/zh/physics-2d/physics-2d-collider.html 创建组件 创建一个精灵节点&#xff1a; 创建碰撞组件PolygonColider2D&#xff0c;如图 给按钮添加多边形碰…

【Axure教程】移动端二级滑动选择器

今天教大家制作移动端二级滑动选择器的原型模板&#xff0c;该原型已全国一二级省市选择器为案例&#xff0c;因为该原型用中继器做的&#xff0c;所以制作完成之后使用也很方便&#xff0c;只需修改中继器表格里的内容即可 一、效果展示 1. 拖动选择 2. 快捷选择 【原型预览…

超全整理——116道网络安全工程师面试真题(附答案),建议收藏!

随着国家对网络安全的重视度&#xff0c;促使这个职业也变得炙手可热&#xff0c;越来越多的年轻人为进入安全领域在做准备。 数以百计的面试&#xff0c;为何迟迟无法顺利入职&#xff1f;能力无疑是至关重要的&#xff0c;可却有不少能力不比已入职的同事差却应聘失败的人&a…

vite babel 获取组件的 children 代码, 填写到 jsxCode 属性中

最终效果 <DocsModule title"类型"><Button>默认按钮</Button><Button type"primary">主要按钮</Button><Button type"success">成功按钮</Button><Button type"danger">危险按钮&l…

【Jmeter】 Report Dashboard 生成html图形测试报告

目录 背景 生成图形报告的方式 1、直接使用一个已存在的 CSV文件生成 2、负载测试完成后自动生成 使用示例 报告内容详情 测试报告摘要图 响应时间随时间变化曲线 活跃线程随时间变化曲线 I/O&#xff08;Bytes&#xff09;随时间变化曲线(忽略事务控制器示例结果) …

【阻止IE强制跳转到Edge浏览器】

由于微软开始限制用户使用Internet Explorer浏览网站&#xff0c;IE浏览器打开一些网页时会自动跳转到新版Edge浏览器&#xff0c;那应该怎么禁止跳转呢&#xff1f; 1、点击电脑左下角的“搜索框”或者按一下windows键。 2、输入“internet”&#xff0c;点击【Internet选项…

促进跨部门协作:PDM系统的多用户协同编辑

在现代企业中&#xff0c;跨部门协作是推动创新和高效工作的关键。PDM系统&#xff08;Product Data Management&#xff0c;产品数据管理&#xff09;作为一款强大的数字化工具&#xff0c;提供了多用户协同编辑功能&#xff0c;有效促进了跨部门之间的协作与沟通。让我们一同…

学术简讯 | CN-Celeb-AV: 多场景视听多模态数据集发布

近日&#xff0c;清华大学语音和语言技术团队联合北京邮电大学发布了中国明星多场景音视频多模态数据集 (CN-Celeb-AV)&#xff0c;供音视频多模态身份识别 (AVPR) 等领域的研究者使用。本数据集包含来自1,136名中国明星&#xff0c;超过419,000个视频片段&#xff0c;涵盖11种…

SpringBoot搭建WebSocket初始化

1.java后端的maven添加websocket依赖 <!-- websocket依赖--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-websocket</artifactId></dependency>2.实例化ServerEndpointExport…

[C++] 类与对象(中)类中六个默认成员函数(1)

1、类的六个默认成员函数 如果一个类中什么成员都没有&#xff0c;简称为空类。空类中真的什么都没有吗&#xff1f;并不是&#xff0c;任何类在什么都不写时&#xff0c;编译器会自动生成以下6个默认成员函数。 2、构造函数 2.1 构造函数的概念 我们这里来看看日期类的初始…

ESP32 LVGL:无法显示过大的GIF图片(修改VLGL RAM缓存大小)

文章目录 问题描述&#xff1a;问题解决更改LVGL RAM缓存大小看ESP32的RAM使用情况 参考链接 问题描述&#xff1a; 使用LVGL可显示64 * 64的GIF&#xff0c;但是却无法显示120*120的GIF。 问题解决 更改LVGL RAM缓存大小 分析原因&#xff1a;在用LVGL显示GIF图片时&#…

【JavaEE】Spring Boot - 项目的创建和使用

【JavaEE】Spring Boot 开发要点总结&#xff08;1&#xff09; 文章目录 【JavaEE】Spring Boot 开发要点总结&#xff08;1&#xff09;1. Spring Boot 的优点2. Spring Boot 项目创建2.1 下载安装插件2.2 创建项目过程2.3 加载项目2.4 启动项目2.5 删除一些没用的文件 3. Sp…

安全基础 --- html标签 + 编码(01)

html标签 &#xff08;1&#xff09;detail标签 <details>标签用来折叠内容&#xff0c;浏览器会折叠显示该标签的内容。 <1> 含义&#xff1a; <details> 这是一段解释文本。 </details> 用户点击这段文本&#xff0c;折叠的文本就会展开&#x…