Esempio n. 1
0
 public void Deserialize(byte[] bytes, ref int offset)
 {
     this.action  = (ConfigAction)ByteSerializer.DeserializeInt(bytes, ref offset);
     this.userCap = ByteSerializer.DeserializeInt(bytes, ref offset);
     this.acceptingConnections = ByteSerializer.DeserializeBool(bytes, ref offset);
     this.newPassword          = ByteSerializer.DeserializeString(bytes, ref offset);
     this.lobbyMode            = (LobbyMode)ByteSerializer.DeserializeInt(bytes, ref offset);
 }
Esempio n. 2
0
 public void Deserialize(byte[] bytes, ref int offset)
 {
     this.userCount            = ByteSerializer.DeserializeInt(bytes, ref offset);
     this.userCap              = ByteSerializer.DeserializeInt(bytes, ref offset);
     this.acceptingConnections = ByteSerializer.DeserializeBool(bytes, ref offset);
     this.lobbyMode            = (LobbyMode)ByteSerializer.DeserializeInt(bytes, ref offset);
     this.isFrozen             = ByteSerializer.DeserializeBool(bytes, ref offset);
     this.playerNames          = ByteSerializer.DeserializeStrings(bytes, ref offset);
 }
Esempio n. 3
0
        public frmGameLobby(YmfasClient _client, YmfasServer _server)
        {
            client    = _client;
            server    = _server;
            lobbyMode = LobbyMode.Hosting;
            Initialize();

            chkReady.Visible    = false;
            cmbGameMode.Enabled = true;
            idTicketCounter     = 1;
        }
Esempio n. 4
0
        public frmGameLobby(YmfasClient _client, YmfasServer _server)
        {
            client = _client;
            server = _server;
            lobbyMode = LobbyMode.Hosting;
            Initialize();

            chkReady.Visible = false;
            cmbGameMode.Enabled = true;
            idTicketCounter = 1;
        }
        /// <summary>
        /// Turns on the UI elements for a specified "lobby mode", and turns off UI elements for all other modes.
        /// It can also disable/enable the lobby seats and the "Ready" button if they are inappropriate for the
        /// given mode.
        /// </summary>
        private void ConfigureUIForLobbyMode(LobbyMode mode)
        {
            // first the easy bit: turn off all the inappropriate ui elements, and turn the appropriate ones on!
            foreach (var list in m_LobbyUIElementsByMode.Values)
            {
                foreach (var uiElement in list)
                {
                    uiElement.SetActive(false);
                }
            }

            foreach (var uiElement in m_LobbyUIElementsByMode[mode])
            {
                uiElement.SetActive(true);
            }

            // that finishes the easy bit. Next, each lobby mode might also need to configure the lobby seats and class-info box.
            bool isSeatsDisabledInThisMode = false;

            switch (mode)
            {
            case LobbyMode.ChooseSeat:
                m_ClassInfoBox.ConfigureForNoSelection();
                break;

            case LobbyMode.SeatChosen:
                isSeatsDisabledInThisMode = true;
                m_ClassInfoBox.ConfigureForLockedIn();
                break;

            case LobbyMode.FatalError:
                isSeatsDisabledInThisMode = true;
                m_ClassInfoBox.ConfigureForNoSelection();
                break;

            case LobbyMode.LobbyEnding:
                isSeatsDisabledInThisMode = true;
                m_ClassInfoBox.ConfigureForNoSelection();
                break;
            }

            if (isSeatsDisabledInThisMode)
            {
                // go through all our seats and tell them to stop acting like they're clickable buttons
                foreach (var seat in m_PlayerSeats)
                {
                    seat.PermanentlyDisableInteraction();
                }
            }
        }
    public virtual void Initialize(List<string> arguments)
    {
        lobbyMode = arguments[0].Equals("new game") ? LobbyMode.NEW_GAME :
            arguments[0].Equals("load game") ? LobbyMode.LOAD_GAME : LobbyMode.ONLY_SERVER;
        if (lobbyMode == LobbyMode.LOAD_GAME) {
            allProfiles = new List<List<string>>();
            for (int i = 2; i < arguments.Count; i++) {
                List<string> toAdd = new List<string>();
                toAdd.AddRange(arguments[i].Split(new []{'|'}, StringSplitOptions.RemoveEmptyEntries));
                allProfiles.Add(toAdd);
            }
        }
        else {
            profile = new GameProfile().Serialize();
            profileName = "Player " + GameManager.rnd.Next();
        }

        if (!NetworkManagerCustom.IsServer) {
            foreach (GameObject go in ((NetworkManagerCustom)NetworkManager.singleton).RegisteredPrefabs)
                ClientScene.RegisterSpawnHandler(go.GetComponent<NetworkIdentity>().assetId, GameManager.SpawnObjectsDefault, GameManager.UnSpawnObjectsDefault);
        }
    }
Esempio n. 7
0
 public LobbyControll()
 {
     mLobbyMode = new LobbyMode();
     AddListener();
 }
Esempio n. 8
0
 public frmGameLobby(YmfasClient _client)
 {
     client    = _client;
     lobbyMode = LobbyMode.ClientOnly;
     Initialize();
 }
Esempio n. 9
0
 public frmGameLobby(YmfasClient _client)
 {
     client = _client;
     lobbyMode = LobbyMode.ClientOnly;
     Initialize();
 }