Example #1
0
    //private Dictionary<SFSUser, GameObject> remotePlayers = new Dictionary<SFSUser, GameObject>();

    //----------------------------------------------------------
    // Unity calback methods
    //----------------------------------------------------------

    void Start()
    {
        if (!SmartFoxConnection.IsInitialized)
        {
            SceneManager.LoadScene("Connection");
            return;
        }

        sfs = SmartFoxConnection.Connection;

        // Register callback delegates
        sfs.AddEventListener(DoraemonEvent.CONNECTION_LOST, OnConnectionLost);
        sfs.AddEventListener(DoraemonEvent.USER_VARIABLES_UPDATE, OnUserVariableUpdate);
        sfs.AddEventListener(DoraemonEvent.PROXIMITY_LIST_UPDATE, OnProximityListUpdate);

        // Get random avatar and color and spawn player
        int numModel    = UnityEngine.Random.Range(0, playerModels.Length);
        int numMaterial = UnityEngine.Random.Range(0, playerMaterials.Length);

        SpawnLocalPlayer(numModel, numMaterial);

        // Update settings panel with the selected model and material
        GameUI ui = GameObject.Find("UI").GetComponent("GameUI") as GameUI;

        ui.SetAvatarSelection(numModel);
        ui.SetColorSelection(numMaterial);
    }
Example #2
0
    //----------------------------------------------------------
    // Public interface methods for UI
    //----------------------------------------------------------

    public void OnLoginButtonClick()
    {
        enableLoginUI(false);


        doraemon = new Doraemon();
        doraemon.AddEventListener(DoraemonEvent.CONNECTION, OnConnection);
        doraemon.AddEventListener(DoraemonEvent.CONNECTION_LOST, OnConnectionLost);
        doraemon.AddEventListener(DoraemonEvent.LOGIN, OnLogin);
        doraemon.AddEventListener(DoraemonEvent.LOGIN_ERROR, OnLoginError);
        doraemon.AddEventListener(DoraemonEvent.ROOM_JOIN, OnRoomJoin);
        doraemon.AddEventListener(DoraemonEvent.ROOM_JOIN_ERROR, OnRoomJoinError);

        // Connect to SFS2X
        doraemon.Connect(Host, TcpPort);
    }
Example #3
0
            public void viewComic(string comicType)
            {
                Comic comic;

                if (comicType.Equals("Doraemon"))
                {
                    comic = new Doraemon();
                    comic.view();
                }
                else if (comicType.Equals("Conan"))
                {
                    comic = new Conan();
                    comic.view();
                }
                else if (comicType.Equals("Shinoshuke"))
                {
                    comic = new Shinoshuke();
                    comic.view();
                }
            }
Example #4
0
            public void viewDoraemon()
            {
                Doraemon doraemon = new Doraemon();

                doraemon.view();
            }