Init() public method

public Init ( ) : void
return void
Exemplo n.º 1
0
    void Awake()
    {
        facebook_ = GameObject.Find("SocialNetwork").GetComponent<FacebookConnector>();
        //facebook_.auto_request_picture = false;

        facebook_.EventCallback += new SnEventHandler(OnEventHandler);

        facebook_.Init();
    }
    void Awake()
    {
        instance = gameObject.GetComponent<NetworkController>();

        // facebook
        facebook = GameObject.Find("Play Controller").GetComponent<FacebookConnector>();
        facebook.EventCallback += new SnEventHandler(OnFacebookEvent);
        facebook.Init();

        // funapi network
        network = new FunapiNetwork(false);
        network.OnSessionInitiated += new FunapiNetwork.SessionInitHandler(OnSessionInitiated);
        network.OnSessionClosed += new FunapiNetwork.SessionCloseHandler(OnSessionClosed);

        FunapiTcpTransport transport = new FunapiTcpTransport(kServerIp, 8022, FunEncoding.kProtobuf);
        transport.AutoReconnect = true;
        network.AttachTransport(transport);

        network.RegisterHandler("sc_spawn_self", this.OnSpawnSelf);
        network.RegisterHandler("sc_spawn_other", this.OnSpawnOther);
        network.RegisterHandler("sc_update", this.OnUpdate);
        network.RegisterHandler("sc_killed", this.OnKilled);
        network.RegisterHandler("sc_face", this.OnFaceUpdate);
    }