upd | clearance
This commit is contained in:
parent
34dd2172c7
commit
46e55f6667
@ -5,17 +5,17 @@ function App() {
|
|||||||
const [data, setData] = useState('')
|
const [data, setData] = useState('')
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fw.event.register('customCefEvent', ([test]) => {
|
fw.event.register('customCefEvent', async ([test]) => {
|
||||||
setData(test)
|
setData(p => p + ' ' + test)
|
||||||
return 'response from cef'
|
return 'from cef'
|
||||||
})
|
})
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div style={{ width: '100%', color: 'white', textAlign: 'center' }}>
|
||||||
<h1>Hello World!</h1>
|
<h1>Hello World!</h1>
|
||||||
<h2>{data}</h2>
|
<h2>{data}</h2>
|
||||||
</>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
import { fw } from 'rage-fw-client'
|
import { fw } from 'rage-fw-client'
|
||||||
|
|
||||||
fw.browser.registerBrowser(mp.browsers.new('package://cef/index.html'))
|
fw.player.registerBrowser(mp.browsers.new('package://cef/index.html'))
|
||||||
|
|
||||||
fw.event.register('customClientEvent', async ([greetings]) => {
|
fw.event.register('cefReady', async () => {
|
||||||
fw.system.log.info(greetings)
|
fw.system.log.info('cefReady')
|
||||||
|
|
||||||
const data = await fw.player.triggerBrowser('customCefEvent', ['str'])
|
const responseCef = await fw.player.triggerBrowser('customCefEvent', [
|
||||||
fw.system.log.info(`CEF RESPONSE: ${data}`)
|
'from client',
|
||||||
|
])
|
||||||
|
fw.system.log.info(responseCef)
|
||||||
|
|
||||||
return 'Hola from client!'
|
await fw.player.triggerServer('customServerEvent', ['from client'])
|
||||||
})
|
})
|
||||||
|
@ -2,12 +2,17 @@ import { fw } from 'rage-fw-server'
|
|||||||
|
|
||||||
fw.event.register('playerJoin', async ([player]) => {
|
fw.event.register('playerJoin', async ([player]) => {
|
||||||
fw.system.log.info(`Connected: ${player.socialClub}`)
|
fw.system.log.info(`Connected: ${player.socialClub}`)
|
||||||
|
})
|
||||||
const response = await fw.player.triggerClient(
|
|
||||||
player,
|
fw.event.register('customServerEvent', async ([player, msg]) => {
|
||||||
'customClientEvent',
|
fw.system.log.info(player.socialClub + ' ' + msg)
|
||||||
['Hi from server!'],
|
|
||||||
)
|
const resFromCef = await fw.player.triggerBrowser(
|
||||||
|
player,
|
||||||
fw.system.log.info(`Response from client: ${response}`)
|
'customCefEvent',
|
||||||
|
['from server'],
|
||||||
|
)
|
||||||
|
fw.system.log.info(player.socialClub + ' ' + resFromCef)
|
||||||
|
|
||||||
|
return 'from server'
|
||||||
})
|
})
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
declare module 'rage-fw-shared-types' {
|
declare module 'rage-fw-shared-types' {
|
||||||
export interface RageFW_ICustomClientEvent {
|
export interface RageFW_ICustomClientEvent {}
|
||||||
customClientEvent(greetings: string): Promise<string>
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RageFW_ICustomServerEvent {
|
export interface RageFW_ICustomServerEvent {
|
||||||
customServerEvent(greetings: string): string
|
customServerEvent(greetings: string): string
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
{
|
{
|
||||||
"maxplayers" : 100,
|
"maxplayers" : 100,
|
||||||
"name" : "RAGE FW Server powered by Entity Seven Group",
|
"name" : "RageFW Example Server. Powered by Entity Seven Group",
|
||||||
"gamemode" : "freeroam",
|
"gamemode" : "freeroam",
|
||||||
"stream-distance" : 300.0,
|
"stream-distance" : 300.0,
|
||||||
"announce" : false,
|
"announce" : false,
|
||||||
"csharp" : "disabled",
|
"csharp" : "disabled",
|
||||||
|
"allow-cef-debugging": true,
|
||||||
"port": 22005
|
"port": 22005
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user