示例#1
0
        public bool OpCreateRoomWithProperties(string roomName, RoomOptions options, TypedLobby lobby, string startingScene = "lobby")
        {
            options.CustomRoomPropertiesForLobby = new[] { PhotonConstants.propScene };
            options.CustomRoomProperties         = new Hashtable()
            {
                { PhotonConstants.propScene, startingScene }
            };

            ClientEntity.CreatePlayerHashtable();

            return(OpCreateRoom(roomName, options, lobby));
        }
示例#2
0
    private IEnumerator Start()
    {
        ClientEntity.CreatePlayerHashtable();

        // initialize
        Transform t;

        t = transform.Find("Players");
        playerTranformLeft   = t.Find("Clients_Left");
        playerTransformRight = t.Find("Clients_Right");

        playerPrefab = playerTranformLeft.GetChild(0).gameObject;
        playerPrefab.SetActive(false);

        playerDictionary = new Dictionary <int, CharacterSelectPortrait>();

        // Create buttons based on the existing prefab
        t = transform.Find("Buttons");
        var buttonPrefab     = t.GetComponentInChildren <ButtonCS>().gameObject;
        var buttonTransform  = t.Find("Characters");
        var characters       = CharacterManager.Instance.GetCharacters;
        var charactersLength = characters.Length;

        for (var i = 0; i < charactersLength; i++)
        {
            var gobject = Instantiate(buttonPrefab, buttonTransform);
            var comp    = gobject.GetComponent <ButtonCS>();
            comp.SetCharacter(characters[i], i);
        }

        buttonPrefab.SetActive(false);
        buttonPrefab.transform.parent = null;

        // wait for mode choice
        while (ModeSelect.Mode == 0)
        {
            yield return(null);
        }

        // Online
        // Create portraits based on who's connected
        if (ModeSelect.Mode == 2)
        {
            var players = NetworkManager.getSortedPlayers;
            foreach (var p in players)
            {
                AddPlayer(p.ID);
            }
        }
    }