Exemple #1
0
        public void ListRooms(Dictionary <RoomId, List <object> > availableRooms)
        {
            mAvailableRooms = availableRooms;
            mMyRoomListScrollFrame.ClearChildWidgets();

            //we need to procedurally populate the scroll frame with the names of the available rooms from the server
            foreach (KeyValuePair <RoomId, List <object> > room in availableRooms)
            {
                IGuiFrame roomListing = (IGuiFrame)mMyRoomListingFramePrototype.Clone();

                RoomId newRoomId = new RoomId(room.Key);

                Button deleteRoomButton = roomListing.SelectSingleElement <Button>("DeleteRoomButton");
                deleteRoomButton.AddOnPressedAction(
                    delegate()
                {
                    DeleteRoom(newRoomId);
                }
                    );

                Button joinRoomButton = roomListing.SelectSingleElement <Button>("JoinRoomButton");
                joinRoomButton.AddOnPressedAction(
                    delegate()
                {
                    JoinRoom(newRoomId);
                }
                    );

                Label roomNameLabel = roomListing.SelectSingleElement <Label>("RoomName");
                roomNameLabel.Text = room.Value + " - id: " + room.Key.ToString();

                mMyRoomListScrollFrame.AddChildWidget(roomListing, new HorizontalAutoLayout());
            }
        }
Exemple #2
0
        /// <summary>
        /// List<Pair<string, string>>, the first string is the facebook friend name, the second string is the facebook friend image url
        /// </summary>
        /// <param name="receivedFriends"></param>
        public void ListEntourage(List <Pair <string, string> > receivedFriends)
        {
            mEntourageListScrollFrame.ClearChildWidgets();
            ClientAssetRepository clientAssetRepository = GameFacade.Instance.RetrieveProxy <ClientAssetRepository>();

            // Show the bonus
            int percentBonus = (int)(Rewards.GetEntourageExperienceBonusPercent(receivedFriends.Count) * 100);

            mMemberCountLabel.Text = String.Format(Translation.ENTOURAGE_MEMBER_COUNT, percentBonus);

            //sort by facebook friend name
            Comparison <Pair <string, string> > sortAlphabetically = new Comparison <Pair <string, string> >(SortNamesAlphabetically);

            receivedFriends.Sort(sortAlphabetically);


            foreach (Pair <string, string> friendNameAndImageUrl in receivedFriends)
            {
                IGuiFrame friendListing = (IGuiFrame)mEntourageListingPrototypeFrame.Clone();

                string facebookFriendPictureUrl = friendNameAndImageUrl.Second;
                clientAssetRepository.LoadAssetFromPath <ImageAsset>(facebookFriendPictureUrl,
                                                                     delegate(ImageAsset friendImageTexture)
                {
                    Image friendImage   = friendListing.SelectSingleElement <Image>("FriendImage");
                    friendImage.Texture = friendImageTexture.Texture2D;
                });

                Label friendNameLabel = friendListing.SelectSingleElement <Label>("FriendName");
                friendNameLabel.Text = friendNameAndImageUrl.First;

                mEntourageListScrollFrame.AddChildWidget(friendListing, new HorizontalAutoLayout());
            }
        }
Exemple #3
0
        public void ListFriends(List <string> receivedFriends)
        {
            foreach (string friendName in receivedFriends)
            {
                IGuiFrame friendListing = (IGuiFrame)mFriendListingPrototypeFrame.Clone();
                //Image friendImage = friendListing.SelectSingleElement<Image>("FriendImage");
                Label friendNameLabel = friendListing.SelectSingleElement <Label>("FriendName");
                friendNameLabel.Text = friendName;

                //Button chatButton = friendListing.SelectSingleElement<Button>("ChatButton");
                //Button gotoButton = friendListing.SelectSingleElement<Button>("GotoButton");

                mFriendListScrollFrame.AddChildWidget(friendListing, new HorizontalAutoLayout());
            }
        }