Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Guan Yu chanRPCDe Diao Yong (go leafKuang Jia De rpcDiao Yong De Xiang Xi Shuo Ming ) #206

Open
Open
Guan Yu chanRPCDe Diao Yong (go leafKuang Jia De rpcDiao Yong De Xiang Xi Shuo Ming )#206

Description

gameMo Kuai :

skeleton.RegisterChanRPC("EventNameAbc", rpcEventFunc)// Zai gameMo Kuai De init()Han Shu Zhong Zhu Ce

//Zhe Ge Shi Shang Mian Jian Ting De Hui Diao Han Shu , Zhu Yi :Zhe Ge Shi Zhi Jie Diao Yong Mei You Fan Hui De
func rpcEventFunc(args interface{}) {
byteData, _ := json.Marshal(args)
log.Debug(string(byteData))
}

//Zhe Ge Shi Shang Mian Jian Ting De Hui Diao Han Shu , Zhu Yi :Zhe Ge Shi Fan Hui 1Ge Can Shu De
func rpcEventFunc(args interface{}) interface{} {
byteData, _ := json.Marshal(args)
log.Debug(string(byteData))
return 1
}

//Zhe Ge Shi Shang Mian Jian Ting De Hui Diao Han Shu , Zhu Yi :Zhe Ge Shi Fan Hui 2Ge Yi Shang Can Shu De
func rpcEventFunc(args interface{}) interface{} {
byteData, _ := json.Marshal(args)
log.Debug(string(byteData))
return []interface{}{1, 2}
}

//---------------------Xia Mian Shi Xiang gameMo Kuai Fa Song Shang Mian De Shi Jian -------------------------------
//Zai Ren Yi Chu gameMo Kuai Zhong Shi Yong game.ChanRPC.Call1Lai Fa Song Shu Ju
type Req struct {
ParamA int32 json:"param_a"
}

//Zhen Dui Bu Fan Hui De Fa Song 1Ge Can Shu De
game.ChanRPC.Go("EventNameAbc", &Req{ParamA: 1})
//Zhen Dui Bu Fan Hui De Fa Song 2Ge Can Shu De
game.ChanRPC.Go("EventNameAbc", &Req{ParamA: 1}, &Req{ParamA: 1})

//Zhen Dui Fan Hui 1Ge Yi Shang De Shu Ju De
resp, err := game.ChanRPC.Call1("EventNameAbc", &Req{ParamA: 1})
if err!=nil {
log.Debug("Fan Hui Cuo Wu ",err)
}
log.Debug("Fan Hui De Shu Ju Shi int %s",resp) //Ru Guo Shi Fan Hui Duo Ge ,Ze respShi [ ]interface{}

Shuo Ming , Zhe Ge CallYou Call0, Call1, CallN Yong Fa Yi Yang , Zhen Dui Qi Ta Mo Kuai Zhu Ce De Jian Ting Han Shu De Fan Hui Zhi Jin Xing Shi Yong

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions