I'm not entirely sure what this error (see error below) is referring to in my C# script.
Error:
Code: Select all
Assets/Scripts/Connect.cs(15,7): error CS0123: A method or delegate `Connect.onLogin()' parameters do not match delegate `Sfs2X.Core.EventListenerDelegate(Sfs2X.Core.BaseEvent)' parameters
Full Code for connect.cs:
Code: Select all
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Sfs2X;
using Sfs2X.Core;
using Sfs2X.Requests;
using UnityEngine.UI;
public class Connect : MonoBehaviour {
SmartFox sfs = new SmartFox ();
// Use this for initialization
void Start () {
sfs.Connect ("127.0.0.1", 9933);
sfs.AddEventListener (SFSEvent.CONNECTION, onConnect);
sfs.AddEventListener (SFSEvent.CONNECTION_LOST, onConnectFail);
sfs.AddEventListener (SFSEvent.LOGIN, onLogin);
}
// Update is called once per frame
void Update () {
}
void onConnect (BaseEvent evt) {
Debug.Log ("It works");
}
void onConnectFail(BaseEvent evt) {
Debug.LogError ("It didn't work.");
}
void loginPress() {
bool loginpress = Input.GetButtonDown ("loginbtn");
if (loginpress) {
sfs.Send (new Sfs2X.Requests.LoginRequest ("Username.text", "Password.text", "SimpleMMOWorld"));
}
}
void onLogin() {
Debug.Log ("Login Succesful");
}
}
If you guys could point me to where I've gone wrong, it would be super helpful.
Thanks, Zach.