상속: MonoBehaviour
예제 #1
0
        /// <summary>
        /// 加载某个房间的邻居
        /// 进入某个房间正在加载,而又有了加载Neibor的请求
        /// </summary>
        /// <returns>The current room neibor.</returns>
        public IEnumerator LoadRoomNeibor()
        {
            Log.Sys("LoadRoomNeibor");
            var nextRoom = currentRoomIndex + 1;

            if (loadedRoom.Contains(nextRoom) || configLists.Count <= nextRoom)
            {
                yield break;
            }
            if (inLoad)
            {
                loadRequest.Add(currentRoomIndex + 1);
                yield break;
            }

            inLoad = true;
            //InitNamePieces();

            currentRoomIndex++;
            loadedRoom.Add(currentRoomIndex);

            var root = new GameObject("Root_" + currentRoomIndex); //FirstRoom

            Util.InitGameObject(root);

            var first       = configLists [currentRoomIndex];
            var firstOffset = new Vector3(first.x * 96, 9, first.y * 96 + 48);

            Log.Sys("FirstRoom " + first.room);
            root.transform.localPosition = firstOffset;
            if (first.flip)
            {
                root.transform.localScale = new Vector3(-1, 1, 1);
            }

            //var piece = namePieces [first.room];
            //var roomConfig = Resources.Load<GameObject>("room/" + piece);
            var roomConfig = RoomList.GetStaticObj(first.type, first.room);

            yield return(StartCoroutine(LoadRoom(roomConfig, true)));

            yield return(null);

            yield return(StartCoroutine(LoadLight(roomConfig, true)));

            yield return(StartCoroutine(LoadProps(roomConfig, true)));

            yield return(StartCoroutine(LoadZone()));

            yield return(null);

            inLoad = false;

            if (loadRequest.Count > 0)
            {
                Log.Sys("Cache Load Request");
                loadRequest.RemoveAt(0);
                StartCoroutine(LoadRoomNeibor());
            }
        }
예제 #2
0
        public async Task GetRoomListAsync_Uses_Given_CancellationToken(RoomList rooms, CancellationToken cancellationToken)
        {
            var conn = new Mock <IMessageConnection>();

            conn.Setup(m => m.State)
            .Returns(ConnectionState.Connected);

            var key    = new WaitKey(MessageCode.Server.RoomList);
            var waiter = new Mock <IWaiter>();

            waiter.Setup(m => m.Wait <RoomList>(It.Is <WaitKey>(k => k.Equals(key)), It.IsAny <int?>(), It.IsAny <CancellationToken?>()))
            .Returns(Task.FromResult(rooms));

            using (var s = new SoulseekClient(serverConnection: conn.Object, waiter: waiter.Object))
            {
                s.SetProperty("State", SoulseekClientStates.Connected | SoulseekClientStates.LoggedIn);

                RoomList response;

                response = await s.GetRoomListAsync(cancellationToken);

                Assert.Equal(rooms, response);
            }

            conn.Verify(m => m.WriteAsync(It.IsAny <IOutgoingMessage>(), cancellationToken), Times.Once);
        }
예제 #3
0
    private void RoomReceived(RoomInfo room)
    {
        // 룸네임을 체크하여 리스트에 있는 방인지 확인.
        int index = roomListingButtons.FindIndex(x => x.RoomName == room.Name);

        // 리스트에 방이 없다면 화면에 생성하고 리스트에 등록
        if (index == -1)
        {
            if (room.IsVisible)
            {
                GameObject roomListingObj = Instantiate(roomListingPrefab);
                roomListingObj.transform.SetParent(transform, false);

                RoomList roomListing = roomListingObj.GetComponent <RoomList>();
                roomListingButtons.Add(roomListing);

                index = (roomListingButtons.Count - 1);
            }
        }

        // 리스트에 방이 있다면 방 이름을 갱신, 업데이트를 체크해줌
        if (index != -1)
        {
            RoomList roomListing = roomListingButtons[index];
            roomListing.SetRoomText(room);
            roomListing.Updated = true;
        }
    }
예제 #4
0
        public async void TestPutRoomMessagesReadAsync()
        {
            var roomId = RoomList != null && RoomList.Any() ? RoomList.First() : Room;
            var getMessagesParameters = new MessagesParameters {
                Force = true
            };
            var messagesResponse = await Client.GetRoomMessagesAsync(roomId, getMessagesParameters)
                                   .ConfigureAwait(false);

            AssertGetRoomMessagesResponse(messagesResponse);

            if (messagesResponse.Data == null || !messagesResponse.Data.Any())
            {
                WarnSkip("TestPutRoomMessagesReadAsync");
                return;
            }

            var messages  = messagesResponse.Data;
            var messageId = messages.LastOrDefault(x => x.Body != "[deleted]").MessasgeId;

            if (string.IsNullOrEmpty(messageId))
            {
                WarnSkip("TestPutRoomMessagesReadAsync");
                return;
            }

            var parameters = new TargetMessageParameters {
                MessageId = messageId
            };
            var response = await Client
                           .PutRoomMessagesReadAsync(roomId, parameters)
                           .ConfigureAwait(false);

            AssertPutRoomMessagesReadResponse(response);
        }
예제 #5
0
        public void TestStaticPutRoomMessagesRead()
        {
            var roomId = RoomList != null && RoomList.Any() ? RoomList.First() : Room;
            var getMessagesParameters = new MessagesParameters {
                Force = true
            };
            var messagesResponse = ChatworkClient.GetRoomMessages(Token, roomId, getMessagesParameters);

            AssertGetRoomMessagesResponse(messagesResponse);

            if (messagesResponse.Data == null || !messagesResponse.Data.Any())
            {
                WarnSkip("TestStaticPutRoomMessagesRead");
                return;
            }

            var messages  = messagesResponse.Data;
            var messageId = messages.LastOrDefault(x => x.Body != "[deleted]").MessasgeId;

            if (string.IsNullOrEmpty(messageId))
            {
                WarnSkip("TestStaticPutRoomMessagesRead");
                return;
            }

            var parameters = new TargetMessageParameters {
                MessageId = messageId
            };
            var response = ChatworkClient.PutRoomMessagesRead(Token, roomId, parameters);

            AssertPutRoomMessagesReadResponse(response);
        }
예제 #6
0
    public void addroom(SocketIOEvent obj)
    {
        Debug.Log("Add Room" + 3);
        string Jsonroom = fixJson(obj.data.ToString());

        Debug.Log(Jsonroom);
        RoomList roomslist = new RoomList();

        roomslist = JsonUtility.FromJson <RoomList>(Jsonroom);
        foreach (Room item in roomslist.rooms)
        {
            Debug.Log(item.roomname);
            RoomController room = Instantiate(roomController, content) as RoomController;
            room.room = item;
            Button roomclick = room.GetComponent <Button>();
            roomclick.onClick.AddListener(() =>
            {
                if (room.room.playerinroom == 5)
                {
                    roomfulMsg.gameObject.SetActive(true);
                }
                else
                {
                    Debug.Log(room.room.id + " is click ");
                    Onclick_join(room.room);
                }
            });
            roomList.Add(room);
        }
    }
예제 #7
0
 public Controller(int RoomSize)
 {
     for (int i = 0; i < RoomSize; i++)
     {
         RoomList.Add(new Room());
     }
 }
예제 #8
0
    private void GenerateRoom(IPoint lastLocation)
    {
        if (Rooms.Count >= NumberOfRooms || !RoomList.Rooms.Any())
        {
            return;
        }

        var dir = Random.Range(0, 4);

        for (int i = 0; i < 4; i++)
        {
            var    d           = (dir + i) % 4;
            IPoint newLocation = new IPoint(0, 0);
            switch (d)
            {
            case 0:
                newLocation = new IPoint(lastLocation.X, lastLocation.Z + 1);
                break;

            case 1:
                newLocation = new IPoint(lastLocation.X + 1, lastLocation.Z);
                break;

            case 2:
                newLocation = new IPoint(lastLocation.X, lastLocation.Z - 1);
                break;

            case 3:
                newLocation = new IPoint(lastLocation.X - 1, lastLocation.Z);
                break;

            default:
                Debug.Log(d);
                break;
            }

            if (!Rooms.ContainsKey(newLocation))
            {
                var rd     = RoomList.GetRandomRoom();
                var prefab = Resources.Load <Room>("Rooms/" + rd.PrefabName);
                var room   = Instantiate(prefab, transform);
                room.RoomUI = Instantiate(_roomCanvasPrefab, room.transform);
                room.RoomUI.AttachedRoom = room;
                room.RoomUI.GetComponentInChildren <Canvas>().worldCamera = Camera.main;
                room.name = Rooms.Count.ToString() + " " + newLocation.X.ToString() + "," + newLocation.Z.ToString();
                room.transform.position = new Vector3(newLocation.X, 0, newLocation.Z);
                room.Data = rd;

                room.gameObject.SetActive(false);
                Rooms.Add(newLocation, room);

                GenerateRoom(newLocation);

                if (Rooms.Count >= NumberOfRooms || !RoomList.Rooms.Any())
                {
                    return;
                }
            }
        }
    }
예제 #9
0
        /// <summary>
        /// 加载第一个房间
        /// </summary>
        /// <returns>The first room.</returns>
        public IEnumerator LoadFirstRoom()
        {
            Log.Sys("LoadFirstRoom");
            currentRoomIndex = 0;
            loadedRoom.Add(currentRoomIndex);

            var root = new GameObject("Root_0"); //FirstRoom

            Util.InitGameObject(root);

            var first       = configLists [0];
            var firstOffset = new Vector3(first.x * 96, 9, first.y * 96 + 48);

            root.transform.localPosition = firstOffset;

            Log.Sys("First Room NamePices " + first.room);
            var roomConfig = RoomList.GetStaticObj(first.type, first.room);

            yield return(StartCoroutine(LoadRoom(roomConfig)));

            yield return(null);

            yield return(StartCoroutine(LoadLight(roomConfig)));

            yield return(StartCoroutine(LoadProps(roomConfig)));

            yield return(StartCoroutine(LoadZone()));

            var zone            = loadedZone [currentRoomIndex];
            var zoneConfigStart = zone.transform.FindChild("PlayerStart");

            var g = new GameObject("PlayerStart");

            g.transform.position = zoneConfigStart.transform.position;
        }
        public void TestStaticGetRoomMembers()
        {
            var roomId   = RoomList != null && RoomList.Any() ? RoomList.First() : Room;
            var response = ChatworkClient.GetRoomMembers(Token, roomId);

            AssertGetRoomMembersResponse(response, AccountId);
        }
예제 #11
0
    private void OnRoomListReturn(CmdMsg msg)
    {
        RoomList res = ProtoMan.ProtobufDeserialize <RoomList>(msg.body);

        GameInfo.Instance.RoomListInfo = res.room_list;
        ModuleManager.Instance.Invoke("SyncRoomList", null);
    }
예제 #12
0
        //выгрузка из файла базы
        private void Load()
        {
            сохранитьToolStripMenuItem.Enabled = true;

            using (OpenFileDialog dialog = new OpenFileDialog())
            {
                dialog.Filter = "txt файлы|*.txt";
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        roomList = new RoomList();
                        BinaryFormatter formatter = new BinaryFormatter();
                        using (FileStream file = new FileStream(dialog.FileName, FileMode.Open))
                        {
                            roomList = (RoomList)formatter.Deserialize(file);
                        }
                        roomList.DeleteDelayed();
                        currentFile = dialog.FileName;
                        //visitorList = new VisitorList(roomList);
                    }
                    catch (Exception excep)
                    {
                        MessageBox.Show(excep.Message, "Error", MessageBoxButtons.OK);
                    }
                }
            }
            RefreshInfo();
            FillTable();
        }
예제 #13
0
파일: MainMenu.cs 프로젝트: jkapi/Kakoi
 public override void Initialize()
 {
     MovingBackground.Init(Content);
     KakoiLogo        = Content.Load <Texture2D>("roomselect/menukakoilogo");
     StrangerCadeLogo = Content.Load <Texture2D>("strangercade");
     MenuSolo         = Content.Load <Texture2D>("roomselect/menusolo");
     MenuSettings     = Content.Load <Texture2D>("roomselect/menusettings");
     MenuQuit         = Content.Load <Texture2D>("roomselect/menuquit");
     OpenSans         = Content.Load <SpriteFont>("opensans13");
     multiEnabled     = SocketHandler.Connected;
     if (multiEnabled)
     {
         MenuMulti = Content.Load <Texture2D>("roomselect/menuonline");
     }
     else
     {
         MenuMulti = Content.Load <Texture2D>("roomselect/menuonlinedisabled");
     }
     offsetMenuSettings = new Vector2(-settingsMenuWidth, 0);
     roomList           = new RoomList();
     gameList           = new GameList(new Vector2(1900, 0), 6, false);
     Objects.Add(roomList);
     Objects.Add(gameList);
     View.Scale = new Vector2(roomSize.Width / 1920f, roomSize.Height / 1080f);
 }
예제 #14
0
 public RoomTileSpace(int xSpace, int ySpace, RoomList inputList)
 {
     roomListsList = new List <RoomList>();
     x             = xSpace;
     y             = ySpace;
     roomListsList.Add(inputList);
 }
예제 #15
0
        public RandomRoom CreateRoom(WaitUser[] members)
        {
            string roomID;

            do
            {
                // create a random string of 8 characters
                string chars       = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
                char[] stringChars = new char[8];
                Random random      = new Random();
                for (int i = 0; i < stringChars.Length; i++)
                {
                    stringChars[i] = chars[random.Next(chars.Length)];
                }
                roomID = new String(stringChars);
            } while (SearchRoom(roomID) != null);

            RandomRoom room = new RandomRoom
            {
                ID      = roomID,
                Members = members
            };

            RoomList.Add(room);
            return(room);
        }
예제 #16
0
        private void button1_Click(object sender, EventArgs e)
        {
            LessonSchool lesson = new LessonSchool();
            // bool check= ValidateForm();
            // if (check == true)
            // {
            string nameNew = LessonsName.Text;
            string nameEx  = LessonsList.GetItemText(LessonsList.SelectedItem);

            string date = DateTbx.Text;
            string time = TimeTbx.Text;
            // var date = DateTime.ParseExact(dateS, "yyyyMMdd", null);
            //DateTime date = DateTime.Parse(DateTbx.Text);
            //DateTime time = DateTime.Parse(TimeTbx.Text);
            string groupName  = GroupList.GetItemText(GroupList.SelectedItem);
            string courseName = CourseList.GetItemText(CourseList.SelectedItem);
            string roomName   = RoomList.GetItemText(RoomList.SelectedItem);

            if (choose == 2)
            {
                ValidateForm();
                string text = lesson.addNewLesson(nameNew, date, time, courseName, groupName, roomName);
                MessageBox.Show(text);
            }
            if (choose == 1)
            {
                ValidateForm();
                string text = lesson.changeLesson(nameEx, date, time, courseName, groupName, roomName);
                MessageBox.Show(text);
            }


            //}
        }
예제 #17
0
        private void navLink2_Click(object sender, EventArgs e)
        {
            Program  app       = Program.GetInstance();
            RoomList newScreen = app.GetScreen <RoomList>("roomList");

            app.ShowScreen(newScreen);
        }
예제 #18
0
        private void InitRoomListInfo()
        {
            Task roomListInfo = new Task(() =>
            {
                while (true)
                {
                    RoomList roomList = new RoomList();
                    lock (_roomList)
                    {
                        roomList.RoomList_.AddRange(_roomList.Select(x => x.ToNetworkModel()));
                    }
                    MainMessage msg      = new MainMessage();
                    msg.RoomMsg          = new RoomMsg();
                    msg.RoomMsg.RoomList = roomList;
                    _api.OpenAPI.Networking.SendAsync(msg, _api.OpenAPI.Config.MainServer, (response) =>
                    {
                        if (response.MessageTypeCase != MainMessage.MessageTypeOneofCase.SystemMsg)
                        {
                            _log.Error("Unexpected response from Provider Server.");
                        }
                        else if (response.SystemMsg.SystemMsgTypeCase == SystemMsg.SystemMsgTypeOneofCase.ErrorMsg)
                        {
                            _log.Error(response.SystemMsg.ErrorMsg.ErrorMsg_);
                        }
                    }, (ex) => _log.Error(ex));
                    Thread.Sleep(ROOM_INFO_INTERVAL);
                }
            }, TaskCreationOptions.LongRunning);

            roomListInfo.Start();
        }
예제 #19
0
        public void InitGame()
        {
            /*
             *                  Main Bar[7]
             *                     |
             *      Men's Room[4] - Lobby[5] - Dinning Room[6]
             *                     |
             *                  Front Door[3]
             *                     |
             *     West Patio[1] - Street[0] - East Patio[2]
             */

            _map = new RoomList
            {
                { Rm.Street, new Room("Street", "A City Street", Rm.FrontDoor, Rm.NOEXIT, Rm.WestPatio, Rm.EastPatio) },
                { Rm.WestPatio, new Room("West Patio", "You can see the sunset from here. It's beautiful.", Rm.NOEXIT, Rm.NOEXIT, Rm.NOEXIT, Rm.Street) },
                { Rm.EastPatio, new Room("East Patio", "There are two pigeons fighting over a french fry. Gross!", Rm.NOEXIT, Rm.NOEXIT, Rm.Street, Rm.NOEXIT) },
                { Rm.FrontDoor, new Room("Front Door", "An entry way to wing heaven. There's an ATM here", Rm.Lobby, Rm.Street, Rm.NOEXIT, Rm.NOEXIT) },
                { Rm.MensRoom, new Room("Men's Room", "Employees must wash hands.", Rm.NOEXIT, Rm.NOEXIT, Rm.NOEXIT, Rm.Lobby) },
                { Rm.Lobby, new Room("Lobby", "There is a friendly Hostest waiting to seat you.", Rm.MainBar, Rm.FrontDoor, Rm.MensRoom, Rm.DinningRoom) },
                { Rm.DinningRoom, new Room("Dinning Room", "It's hella family friendly up in here.", Rm.NOEXIT, Rm.NOEXIT, Rm.Lobby, Rm.NOEXIT) },
                { Rm.MainBar, new Room("Main Bar", "A room full of bar stools and beer taps A.K.A. heaven.", Rm.NOEXIT, Rm.Lobby, Rm.NOEXIT, Rm.NOEXIT) }
            };

            _player = new Actor("Matt", "A man on a quest for buffalo wings", _map.RoomAt(Rm.Street));
        }
예제 #20
0
    private void RoomReceived(RoomInfo room)
    {
        int index = RoomListButtons.FindIndex(x => x.RoomName == room.Name);

        if (index == -1)
        {
            if (room.IsVisible && room.PlayerCount < room.MaxPlayers)
            {
                GameObject roomListingObj = Instantiate(RoomPrefab);
                roomListingObj.transform.SetParent(transform, false);

                RoomList roomListing = roomListingObj.GetComponent <RoomList>();
                RoomListButtons.Add(roomListing);

                index = (RoomListButtons.Count - 1);
            }
        }

        if (index != -1)
        {
            RoomList roomListing = RoomListButtons[index];
            roomListing.SetRoomNameText(room.Name);
            roomListing.Updated = true;
        }
    }
예제 #21
0
    //룸옵션 IsVisible 이 true, 룸에 플레이어가 맥스플레이어보다 작을때, 방리스트 프리팹 생성
    private void RoomReceived(RoomInfo room)
    {
        // 생성된 방 중에 리스트에 있는 방이 있는지 체크
        int index = roomListingButtons.FindIndex(x => x.RoomName == room.Name);

        // 리스트에 방이 없다면 화면에 생성하고 리스트에 등록
        if (index == -1)
        {
            //room.PlayerCount < room.MaxPlayers (열린방보기)
            if (room.IsVisible)
            {
                GameObject roomListingObj = Instantiate(roomListingPrefab);
                roomListingObj.transform.SetParent(transform, false);

                RoomList roomListing = roomListingObj.GetComponent <RoomList>();
                roomListingButtons.Add(roomListing);

                index = (roomListingButtons.Count - 1);
            }
        }

        // 리스트에 방이 있다면 해당 값(포인터)를 받아 방 이름을 갱신, 업데이트를 체크해줌
        if (index != -1)
        {
            RoomList roomListing = roomListingButtons[index];
            roomListing.SetRoomText(room);
            roomListing.Updated = true;
        }
    }
예제 #22
0
 void initializeALLservants()
 {
     menu = new Menu();
     servants.Add(menu);
     setting = new Setting();
     servants.Add(setting);
     selectDeck = new selectDeck();
     servants.Add(selectDeck);
     room = new Room();
     servants.Add(room);
     cardDescription = new CardDescription();
     deckManager     = new DeckManager();
     servants.Add(deckManager);
     ocgcore = new Ocgcore();
     servants.Add(ocgcore);
     selectServer = new SelectServer();
     servants.Add(selectServer);
     roomList = new RoomList();
     servants.Add(roomList);
     book = new Book();
     servants.Add(book);
     selectReplay = new selectReplay();
     servants.Add(selectReplay);
     puzzleMode = new puzzleMode();
     servants.Add(puzzleMode);
     aiRoom = new AIRoom();
     servants.Add(aiRoom);
 }
예제 #23
0
 //广播状态更改了的room
 public void BroadCastRoom(Room room)
 {
     lock (this)
     {
         RoomList.Instance().AddRoom(room.RoomId, room.Setting.Name, !string.IsNullOrEmpty(room.Setting.PassWord),
                                     room.Setting.GameMode, room.GameStarted, room.Clients.Count, room.Setting.PlayerNum);
         MyData data = new MyData
         {
             Description = PacketDescription.Hall2Cient,
             Protocol    = protocol.UPdateRoomList,
             Body        = new List <string>
             {
                 room.RoomId.ToString(),
                room.Setting.Name,
                 (!string.IsNullOrEmpty(room.Setting.PassWord)).ToString(),
                 room.Setting.GameMode,
                 room.GameStarted.ToString(),
                 room.Clients.Count.ToString(),
                 room.Setting.PlayerNum.ToString()
             }
         };
         foreach (Client client in UId2ClientTable.Values)
         {
             client.SendProfileReply(data);
         }
     }
 }
예제 #24
0
        public async ValueTask HandleAsync(Msg msg, CancellationToken cancellationToken)
        {
            m_Logger.LogInformation($"RoomList received.");

            var packet = QueuePacket.Parser.ParseFrom(msg.Data);

            var rooms = m_ListRoomService.QueryAsync(new RoomListQuery());

            var response = new RoomList();

            response.Rooms.AddRange(rooms
                                    .Select(info => new Room
            {
                Name        = info.Name,
                HasPassword = info.HasPassword
            }).ToEnumerable());

            var sendMsg = new SendPacket
            {
                Subject = "chat.room.list"
            };

            sendMsg.SessionIds.Add(packet.SessionId);
            sendMsg.Payload = response.ToByteString();

            await m_MessageQueueService
            .PublishAsync("connect.send", sendMsg.ToByteArray())
            .ConfigureAwait(false);
        }
예제 #25
0
        public void Parse_Returns_Expected_Data()
        {
            var rooms = new List <Room>()
            {
                new Room("larry", 1),
                new Room("moe", 2),
                new Room("curly", 3),
                new Room("shemp", 4),
            };

            var builder = new MessageBuilder()
                          .Code(MessageCode.ServerRoomList)
                          .WriteInteger(rooms.Count);

            rooms.ForEach(room => builder.WriteString(room.Name));
            builder.WriteInteger(rooms.Count);
            rooms.ForEach(room => builder.WriteInteger(room.UserCount));

            var response = RoomList.Parse(builder.Build()).ToList();

            Assert.Equal(rooms.Count, response.Count);

            for (int i = 0; i < rooms.Count; i++)
            {
                Assert.Equal(rooms[i].Name, response[i].Name);
                Assert.Equal(rooms[i].UserCount, response[i].UserCount);
            }
        }
예제 #26
0
    private void RoomReceived(RoomInfo room)
    {
        int index = _roomList.FindIndex(x => x.RoomName == room.Name);

        if (index == -1)
        {
            if (room.IsVisible && room.PlayerCount < room.MaxPlayers)
            {
                GameObject roomListingObj = Instantiate(_roomPrefab);
                roomListingObj.transform.SetParent(_roomContent.transform, false);

                RoomList roomListing = roomListingObj.GetComponent <RoomList>();
                _roomList.Add(roomListing);

                index = (_roomList.Count - 1);
            }
        }

        if (index != -1)
        {
            RoomList roomListing = _roomList[index];
            roomListing.SetRoomNameText(room.Name);
            roomListing.SetRoomNbPlayers(room.PlayerCount);
            if (room.PlayerCount != 0)
            {
                roomListing.SetLocked((bool)room.CustomProperties["Locked"]);
                if ((bool)room.CustomProperties["Locked"])
                {
                    roomListing.SetPassword((string)room.CustomProperties["Password"]);
                }
            }
            roomListing.Updated = true;
        }
    }
예제 #27
0
 protected void button_filter_Close(object sender, EventArgs e)
 {
     FiltrTable.Visible = false;
     OtdelenList.DataBind();
     RoomList.DataBind();
     PersonList.DataBind();
 }
예제 #28
0
        public void InterHall(Client client, bool reconnect)
        {
            try
            {
                //update user profile
                //bring to hall
                bool proceed = client.GetProfile(!reconnect);
                if (!proceed)
                {
                    return;
                }

                clientList.TryAdd(client.UserID, client.Profile.NickName);
                //更新到form1
                Dictionary <int, string> client_list = clientList.ToDictionary(entry => entry.Key, entry => entry.Value);
                UpdateUsers(client_list);

                UId2ClientTable.TryGetValue(client.UserID, out Client temp);

                MyData data = new MyData();
                if (!reconnect)
                {
                    //发送当前已登录的其他玩家信息和游戏房间信息
                    Dictionary <int, RoomInfoStruct> ds = RoomList.Instance().GetRoomList();
                    data = new MyData
                    {
                        Description = PacketDescription.Hall2Cient,
                        Protocol    = Protocol.GetProfile,
                        Body        = new List <string> {
                            JsonUntity.Dictionary2Json(client_list), JsonUntity.Object2Json(ds)
                        }
                    };
                    client.SendProfileReply(data);
                }

                //通知其他客户端更新
                data = new MyData()
                {
                    Description = PacketDescription.Hall2Cient,
                    Protocol    = Protocol.UpdateHallJoin,
                    Body        = new List <string> {
                        client.UserID.ToString(), client.Profile.NickName, "0"
                    }
                };

                List <Client> clients = new List <Client>(UId2ClientTable.Values);
                foreach (Client other in clients)
                {
                    if (other != client)
                    {
                        other.SendProfileReply(data);
                    }
                }
            }
            catch (Exception e)
            {
                LogHelper.WriteLog(null, e);
                Debug(string.Format("error on inter hall {0} {1}", e.Message, e.TargetSite));
            }
        }
예제 #29
0
        private RoomList getRoomList()
        {
            // remove empty rooms
            this.rooms.RemoveAll(r =>
            {
                // check if there are players in the room
                var totalPlayerCount = this.getPlayers(r).Count();
                if (totalPlayerCount == 0)
                {
                    r.RoundInfo.WordUpdateTimer?.Stop();
                }
                return(totalPlayerCount == 0);
            });

            RoomList roomList = new RoomList();

            foreach (var roomInfo in this.rooms)
            {
                roomList.Items.Add(new RoomListItem
                {
                    Name           = roomInfo.Name,
                    PlayersInLobby = this.getPlayersInLobby(roomInfo).Count(),
                    PlayersInGame  = this.getPlayersInGame(roomInfo).Count()
                });
            }
            return(roomList);
        }
        public void TestGetRoomMembersAsyncCallback()
        {
            var roomId = RoomList != null && RoomList.Any() ? RoomList.First() : Room;

            Client.GetRoomMembersAsync(
                response => AssertGetRoomMembersResponse(response, AccountId),
                roomId);
        }
예제 #31
0
파일: Program.cs 프로젝트: strotz/Connector
			public static bool TryParse(string room, out RoomList output)
			{
				var props = Properties.Settings.Default;
				var regex = new Regex(props.regex);

				Console.Write($"Roomlist found: {room}...   ");
				var match = regex.Match(room);
				if (!match.Success)
				{
					Console.WriteLine("Did not match");
					output = null;
					return false;
				}

				output = new RoomList
				{
					Id = match.Groups[0].Value,
					Site = match.Groups["site"].Value,
					Building = match.Groups["building"].Value,
					Floor = match.Groups["floor"].Value
				};
				return true;
			}
예제 #32
0
파일: Game.cs 프로젝트: sonneveld/agscj
        public Game()
        {
            _guis = new List<GUI>();
            _inventoryItems = new List<InventoryItem>();
            _cursors = new List<MouseCursor>();
            _dialogs = new List<Dialog>();
            _fonts = new List<Font>();
            _characters = new List<Character>();
            _plugins = new List<Plugin>();
            _translations = new List<Translation>();
            _rooms = new RoomList();
            _oldInteractionVariables = new List<OldInteractionVariable>();
            _settings = new Settings();
            _palette = new PaletteEntry[PALETTE_SIZE];
            _sprites = new SpriteFolder("Main");
            _views = new ViewFolder("Main");
            _audioClips = new AudioClipFolder("Main");
            _audioClipTypes = new List<AudioClipType>();
            _textParser = new TextParser();
            _lipSync = new LipSync();
            _propertySchema = new CustomPropertySchema();
            _globalVariables = new GlobalVariables();
            _globalMessages = new string[NUMBER_OF_GLOBAL_MESSAGES];
            _deletedViewIDs = new Dictionary<int, object>();
            _scripts = new Scripts();
            _scriptsToCompile = new Scripts();
            _scripts.Add(new Script(Script.GLOBAL_HEADER_FILE_NAME, "// script header\r\n", true));
            _scripts.Add(new Script(Script.GLOBAL_SCRIPT_FILE_NAME, "// global script\r\n", false));
            _playerCharacter = null;

            for (int i = 0; i < _globalMessages.Length; i++)
            {
                _globalMessages[i] = string.Empty;
            }

            InitializeDefaultPalette();
        }
예제 #33
0
 bool AddToQueue(Room last, Vector2 position, RoomList size, Directions direction)
 {
     if(!CollideRooms(position.x, position.y, size.width, size.height)){
         Room room = size.rooms[Random.Range(0, size.rooms.Length-1)];
         RoomSpawn spawn = new RoomSpawn(position, size.width, size.height, room, last, direction);
         queue.Add(spawn);
         return true;
     }
     
     return false;
 }