KBEngine學習——服務端暴露接口給客戶端調用

1.在對應的文件def中添加方法類型與屬性

例如:在accounts.def中加入屬性playerName,與UserTest方法

<root>
	<Properties>
        <playerName>
			<Type>	UNICODE					</Type>
			<Flags>	BASE					</Flags>
			<Persistent>	true						</Persistent>
			<Index> 	UNIQUE 					</Index>
			<Default>						</Default>
		</playerName>
	</Properties>

	<ClientMethods>
         
	</ClientMethods>

	<BaseMethods>
        <UserTest>
            <Exposed/>
        </UserTest>		
	</BaseMethods>

	<CellMethods>
	</CellMethods>

</root>

聲明後再對應的Accounts.py文件中加入方法

    def UserTest(self):
		print("call success!");

2.找到服務端目錄中的Assets/gensdk.bat打開修改生成的目錄位置

注:此處使用的是unity的客戶端

3.執行gensdk之後就可以在客戶端調用該方法與該屬性

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章