PIDL 결과물 사용법을 설명 합니다.
10. Mono에서 PIDL 컴파일 설정하기
를 하시면, 편하게 결과물을 만드 실수 있습니다.
C++버젼과는 다르게, DotNet버젼에서는 Stub이 delegate로 되어 있습니다.
먼저, PIDL 컴파일 결과물을 프로젝트에 포함합니다.
결과물에 포함된 Proxy,Stub등의 클래스를 생성합니다.
위의 생성된 클래스들중 Stub객체는 함수 별로 delegate를 세팅하여 줍니다.
사용예
//PIDL 컴파일 결과물을 포함 하여 생성합니다. SynchWorldC2C.Proxy c2cProxy = new SynchWorldC2C.Proxy(); SynchWorldC2S.Proxy c2sProxy = new SynchWorldC2S.Proxy(); SynchWorldS2C.Stub s2cStub = new SynchWorldS2C.Stub(); SynchWorldC2C.Stub c2cStub = new SynchWorldC2C.Stub(); ... void Start () //꼭 Start에서 해야 하는 것은 아니지만, 여기서 하는것이 편합니다. { //netclient의 Event delegate들을 세팅합니다. netClient.JoinServerCompleteHandler = OnJoinServerComplete; ... //stub를 처리할 delegate를 세팅합니다. s2cStub.NotifyLocalHeroViewersGroupID = NotifyLocalHeroViewersGroupID; //<- 아래의 함수를 세팅합니다. //똑같이 아래 함수들을 만들어 세팅합니다. s2cStub.RemoteHero_Appear = RemoteHero_Appear; s2cStub.RemoteHero_Disappear = RemoteHero_Disappear; c2cStub.P2P_LocalHero_Move = P2P_LocalHero_Move; //client에 proxy,stub들을 attach합니다. //주의!!! attach를 하지 않으면 작동하지 않습니다. netClient.AttachProxy(c2cProxy); netClient.AttachProxy(c2sProxy); netClient.AttachStub(s2cStub); netClient.AttachStub(c2cStub); ... } //delegate에 맞게 함수를 만들어 줍니다. bool NotifyLocalHeroViewersGroupID(Nettention.Proud.HostID remote,Nettention.Proud.RmiContext rmiContext, Nettention.Proud.HostID localHeroViewersGroupID) { ... return true; }