Photon - Convert C# into JavaScript

Hello,

I’m messing around with the Photon networking plugin demos for Unity, and its all in C#, and I mainly work with JS. So I’m trying to convert the demo scripts into JavaScript, and I’m getting a few errors:

Original C# Script:

using UnityEngine;

public class WorkerInGame : Photon.MonoBehaviour
{

    public void OnLeftRoom()
    {
        Debug.Log("OnLeftRoom (local)");
        
        // back to main menu        
        Application.LoadLevel(WorkerMenu.SceneNameMenu);
    }

    public void OnDisconnectedFromPhoton()
    {
        Debug.Log("OnDisconnectedFromPhoton");

        // back to main menu        
        Application.LoadLevel(WorkerMenu.SceneNameMenu);
    }

    public void OnPhotonInstantiate(PhotonMessageInfo info)
    {
        Debug.Log("OnPhotonInstantiate " + info.sender);    // you could use this info to store this or react
    }

    public void OnPhotonPlayerConnected(PhotonPlayer player)
    {
        Debug.Log("OnPhotonPlayerConnected: " + player);
    }

    public void OnPhotonPlayerDisconnected(PhotonPlayer player)
    {
        Debug.Log("OnPlayerDisconneced: " + player);
    }

    public void OnFailedToConnectToPhoton()
    {
        Debug.Log("OnFailedToConnectToPhoton");

        // back to main menu        
        Application.LoadLevel(WorkerMenu.SceneNameMenu);
    }
}

My JS conversion:

public function OnLeftRoom()
{
    Debug.Log("OnLeftRoom (local)");
    
    // back to main menu        
    Application.LoadLevel(WorkerMenu.SceneNameMenu);
}

public function OnDisconnectedFromPhoton()
{
    Debug.Log("OnDisconnectedFromPhoton");

    // back to main menu        
    Application.LoadLevel(WorkerMenu.SceneNameMenu);
}

public function OnPhotonInstantiate(info : PhotonMessageInfo)
{
    Debug.Log("OnPhotonInstantiate " + info.sender);    // you could use this info to store this or react
}

public function OnPhotonPlayerConnected(player : PhotonPlayer)
{
    Debug.Log("OnPhotonPlayerConnected: " + player);
}

public function OnPhotonPlayerDisconnected(player : PhotonPlayer)
{
    Debug.Log("OnPlayerDisconneced: " + player);
}

public function OnFailedToConnectToPhoton()
{
    Debug.Log("OnFailedToConnectToPhoton");

    // back to main menu        
    Application.LoadLevel(WorkerMenu.SceneNameMenu);
}

But I’m getting 3 errors, based on the function parameters: PhotonMessageInfo and PhotonPlayer

The name ‘PhotonMessageInfo’ does not denote a valid type (“not found”)… same for PhotonPlayer

Turns out this answers my question:

http://answers.unity3d.com/questions/317916/photonnetwork-javascript.html