美文网首页
vue和unity交互

vue和unity交互

作者: 码农界四爷__King | 来源:发表于2022-10-27 15:54 被阅读0次
<template>
    <div
        style="display: flex;flex-direction: column;align-items: center;width: 300px;background-color: red;margin: 24px auto;padding: 12px;box-sizing: border-box;">
        {{name}}
        <div @click="sayHello">按钮</div>
        <button onclick="ChangeToEditorScene()">ChangeToEditorScene</button>
        <button onclick="ChangeToMainScene()">ChangeToMainScene</button>
        <button onclick="QuitProgram()">QuitProgram</button>
        <button onclick="ClearAllIcons()">ClearAllIcons</button>
        <button onclick="OpenCameraControl()">OpenCameraControl</button>
        <button onclick="CloseCameraControl()">CloseCameraControl</button>
        <button onclick="OpenRaycastTarget()">OpenRaycastTarget</button>
        <button onclick="CloseRaycastTarget()">CloseRaycastTarget</button>
        <button onclick="ResetAllHightlight()">ResetAllHightlight</button>
        <button @click="ShowIcons()">ShowIcons</button>
        <button @click="SetAllHightlightsConstant()">SetAllHightlightsConstant</button>
        <button @click="SetAllHighlightFlashing()">SetAllHighlightFlashing</button>
    </div>
</template>

<script>
    export default {
        name: 'App',
        data() {
            return {
                ShowIconsData: {
                    "picType": "dyh.png",
                    "names": ["三个方块:1004:1111", "测试方块1:1002:1112"]
                },
                SetAllHightlightsConstantData: {
                    "colorString": "FFFFFF",
                    "names": [
                        "三个方块:1004:1111",
                        "测试方块1:1002:1112"
                    ]
                },
                SetAllHighlightFlashingData: {
                    "startColorString": "000000",
                    "endColorString": "FFFFFF",
                    "names": [
                        "三个方块:1004:1111",
                        "测试方块1:1002:1112"
                    ]
                }
            }

        },
        mounted() {
            window.OnClickReturnMessage = function(e) {
                console.log(e)
                console.log('======================OnDoubleClickReturnMessage')
            }
            window.OnDoubleClickReturnMessage = function(e) {
                console.log(e)
                console.log('======================OnDoubleClickReturnMessage')
            }

        },
        methods: {
            ShowIcons() {
                // window.ShowIcons(JSON.stringify(this.str))
                window.ShowIcons(this.ShowIconsData)
            },
            SetAllHightlightsConstant() {
                // window.ShowIcons(JSON.stringify(this.str))
                window.SetAllHightlightsConstant(this.SetAllHightlightsConstantData)
            },
            SetAllHighlightFlashing() {
                // window.ShowIcons(JSON.stringify(this.str))
                window.SetAllHighlightFlashing(this.SetAllHighlightFlashingData)
            }
        },
        /* setup() {
            let name = "zhangsan"

            function sayHello() {
                alert(`我叫${name}212`, )
            }

            // sayHello()
            return {
                name,
                sayHello
            }
        } */
    }
</script>

<style>

</style>


相关文章

网友评论

      本文标题:vue和unity交互

      本文链接:https://www.haomeiwen.com/subject/wzsttdtx.html