You've already forked Pandona-Engine
初始化提交
This commit is contained in:
12
template-example/index.html
Normal file
12
template-example/index.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>PE Template Example</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
11
template-example/main.js
Normal file
11
template-example/main.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import './style/base.less'
|
||||
import './style/scene-styles.css'
|
||||
import PE from '../src/index.js'
|
||||
|
||||
export function createApp() {
|
||||
const game = PE.create()
|
||||
return { game }
|
||||
}
|
||||
|
||||
// 启动应用
|
||||
const { game } = createApp()
|
||||
53
template-example/sence/sence1/index.less
Normal file
53
template-example/sence/sence1/index.less
Normal file
@@ -0,0 +1,53 @@
|
||||
.test-sprite {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color: #ff5722;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
left: 50px;
|
||||
border: 2px solid #e64a19;
|
||||
}
|
||||
|
||||
.test-box {
|
||||
width: 200px;
|
||||
height: 50px;
|
||||
background-color: #2196f3;
|
||||
color: white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
top: 200px;
|
||||
left: 50px;
|
||||
border: 2px solid #1976d2;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.test-text {
|
||||
position: absolute;
|
||||
top: 300px;
|
||||
left: 50px;
|
||||
color: #333;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.menu-item {
|
||||
width: 150px;
|
||||
height: 40px;
|
||||
background-color: #9c27b0;
|
||||
color: white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
left: 50px;
|
||||
border: 2px solid #7b1fa2;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 16px;
|
||||
}
|
||||
37
template-example/sence/sence1/index.pe
Normal file
37
template-example/sence/sence1/index.pe
Normal file
@@ -0,0 +1,37 @@
|
||||
<sence>
|
||||
<sprite class="test-sprite" @click="console.log('Sprite clicked!')"></sprite>
|
||||
<box class="test-box">Hello PE!</box>
|
||||
<text class="test-text">Welcome to PE Engine</text>
|
||||
<box for="{label,action} in boxList" @click="onMenuClick(action)" class="menu-item">
|
||||
{{ label }}
|
||||
</box>
|
||||
<text for="{label} in boxList">
|
||||
{{label}}
|
||||
</text>
|
||||
</sence>
|
||||
|
||||
<script>
|
||||
const boxList = [{
|
||||
label:"开始游戏",
|
||||
action:"start"
|
||||
},
|
||||
{
|
||||
label:"读取存档",
|
||||
action:"loadgame"
|
||||
}]
|
||||
|
||||
let count = 0
|
||||
|
||||
onLoad(()=>{
|
||||
console.log("Scene loaded - Lifecycle callback working!")
|
||||
})
|
||||
|
||||
onShow(()=>{
|
||||
console.log("Scene shown - Lifecycle callback working!")
|
||||
})
|
||||
|
||||
function onMenuClick(act){
|
||||
count++;
|
||||
console.log("Menu action:", act, count)
|
||||
}
|
||||
</script>
|
||||
0
template-example/sence/sence2/index.less
Normal file
0
template-example/sence/sence2/index.less
Normal file
29
template-example/sence/sence2/index.pe
Normal file
29
template-example/sence/sence2/index.pe
Normal file
@@ -0,0 +1,29 @@
|
||||
<sence>
|
||||
<div class="test-element">Hello PE Engine!</div>
|
||||
</sence>
|
||||
|
||||
<script>
|
||||
window.onLoad(()=>{
|
||||
console.log("Simple test scene loaded")
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.test-element {
|
||||
width: 200px;
|
||||
height: 100px;
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
top: 100px;
|
||||
left: 100px;
|
||||
border: 2px solid #45a049;
|
||||
border-radius: 4px;
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
32
template-example/sence/sence2/sence2_1/index.pe
Normal file
32
template-example/sence/sence2/sence2_1/index.pe
Normal file
@@ -0,0 +1,32 @@
|
||||
<sence>
|
||||
<box class="test-box">测试盒子</box>
|
||||
<sprite class="test-sprite"></sprite>
|
||||
</sence>
|
||||
|
||||
<script>
|
||||
window.onLoad(()=>{
|
||||
console.log("测试场景加载完成")
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.test-box {
|
||||
width: 200px;
|
||||
height: 100px;
|
||||
background-color: green;
|
||||
border: 2px solid darkgreen;
|
||||
color: white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.test-sprite {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color: purple;
|
||||
border-radius: 50%;
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
13
template-example/sences.json
Normal file
13
template-example/sences.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"sence": [
|
||||
{
|
||||
"path": "/sence1",
|
||||
"title": "主场景"
|
||||
},
|
||||
{
|
||||
"path": "/sence2",
|
||||
"title": "测试场景"
|
||||
}
|
||||
],
|
||||
"platform": "PC"
|
||||
}
|
||||
3
template-example/style/base.less
Normal file
3
template-example/style/base.less
Normal file
@@ -0,0 +1,3 @@
|
||||
* {
|
||||
background: white;
|
||||
}
|
||||
57
template-example/style/scene-styles.css
Normal file
57
template-example/style/scene-styles.css
Normal file
@@ -0,0 +1,57 @@
|
||||
/* Auto-generated scene styles */
|
||||
|
||||
/* Scene style for sence1\index */
|
||||
.test-sprite {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color: #ff5722;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
left: 50px;
|
||||
border: 2px solid #e64a19;
|
||||
}
|
||||
.test-box {
|
||||
width: 200px;
|
||||
height: 50px;
|
||||
background-color: #2196f3;
|
||||
color: white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
top: 200px;
|
||||
left: 50px;
|
||||
border: 2px solid #1976d2;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.test-text {
|
||||
position: absolute;
|
||||
top: 300px;
|
||||
left: 50px;
|
||||
color: #333;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.menu-item {
|
||||
width: 150px;
|
||||
height: 40px;
|
||||
background-color: #9c27b0;
|
||||
color: white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
left: 50px;
|
||||
border: 2px solid #7b1fa2;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
|
||||
/* Scene style for sence2\index */
|
||||
|
||||
15
template-example/vite.config.js
Normal file
15
template-example/vite.config.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import { resolve } from 'path'
|
||||
import { readFileSync, writeFileSync } from 'fs'
|
||||
import dotenv from 'dotenv'
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
minify: 'terser',
|
||||
terserOptions: {
|
||||
compress: {
|
||||
drop_console: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user