OpCustom

Hello,

Writing my own class that inherits from PhotonPeer connected to a simple PhotonServer (PeerBase) Connect works fine, now im trying to send my first test message
	public bool doLogin(string username,string password) {
		Hashtable login_details = new Hashtable();
	        login_details.Add((byte)DataFields.LOGIN_PASS, "test");
                return OpCustom((byte)OpCode.Login,login_details,true);
	}

Results in a compiling error of:

Argument `#2' cannot convert `System.Collections.Hashtable' expression to type `System.Collections.Generic.Dictionary<byte,object>'

Any ideas? I've looked thru LitePeer that implements it this way so I am unsure what I am missing

Thanks for the help

Comments

  • Most likely you are looking at an outdated LitePeer.cs.

    In Photon v3 we changed some methods to make them better fit with the server side and to be more expressive. In one of those changes, OpCustom() was changed from Hashtable to Dictionary<byte, object>.

    The compiler message explains just that: The OpCustom parameter is now the Dictionary<byte, object> and your Hashtable doesn't fit in.
    This should do the trick:
       public bool doLogin(string username,string password) {
          Dictionary&lt;byte, object&gt; login_details = new Dictionary&lt;byte, object&gt;();
               login_details.Add((byte)DataFields.LOGIN_PASS, "test");
                    return OpCustom((byte)OpCode.Login,login_details,true);
       }
    
Sign In or Register to comment.