예제 #1
0
    private void SetupLoadGuiDialog(ITopLevel topLevel)
    {
        mLoadGuiDialog = topLevel;
        ((Window)mLoadGuiDialog).InFront = true;
        mLoadGuiDialog.Showing           = false;
        mLoadGuiFilterText = mLoadGuiDialog.SelectSingleElement <Textbox>("MainFrame/FilterText");

        mGuiListFrame           = mLoadGuiDialog.SelectSingleElement <IGuiFrame>("MainFrame/GuiList");
        mLoadGuiButtonPrototype = mGuiListFrame.SelectSingleElement <Button>("OpenGuiPrototype");
        mGuiListFrame.RemoveChildWidget(mLoadGuiButtonPrototype);

        // Keep the load file button disabled until it points to a valid file
        mLoadGuiFilterText.AddTextChangedCallback(LayoutGuiListings);

        LayoutGuiListings();
    }
예제 #2
0
        private void SetupHireFriendFrame(IGuiFrame hireFrame, Jobs job)
        {
            mStartLevelButton.Disable();

            mHireFrame         = hireFrame;
            mJobToHireFor      = job;
            mUserNameFilterBox = hireFrame.GetContainer <ITopLevel>().SelectSingleElement <Textbox>("**/FriendSearchBox");
            // Hide the feedback label until after the hiring is complete.
            mHireFeedbackLabel         = hireFrame.GetContainer <ITopLevel>().SelectSingleElement <Label>("**/HireFeedbackLabel");
            mHireFeedbackLabel.Showing = false;
            if (mUserNameFilterBox != null)
            {
                mUserNameFilterBox.AddTextChangedCallback(LayoutFriends);
            }

            mFriendHired = false;
            mHireFriendPrototypeFrame = hireFrame.SelectSingleElement <IGuiFrame>("HireFriendPrototypeFrame");
            if (mHireFriendPrototypeFrame == null)
            {
                throw new Exception("No HireFriendPrototypeFrame was found in the level GUI for this level");
            }
            mFriendListingStartPosition = hireFrame.GetChildPosition(mHireFriendPrototypeFrame);
            hireFrame.RemoveChildWidget(mHireFriendPrototypeFrame);

            GetFriendsToHire(job, delegate(IDictionary <long, FacebookFriendInfo> possibleHires)
            {
                // SortedList doesn't support multiple keys with the same value, so to support
                // friends that have the same name, we need to make the last name fields unique
                int uniqueifyingKeySuffix = 0;

                foreach (KeyValuePair <long, FacebookFriendInfo> possibleHire in possibleHires)
                {
                    mPossibleHires.Add(possibleHire.Value.FirstName + possibleHire.Value.LastName + uniqueifyingKeySuffix++, possibleHire.Value);
                }

                LayoutFriends();

                Scrollbar scrollbar = ((IGuiContainer)hireFrame.Parent).SelectSingleElement <Scrollbar>("ScrollBar");
                if (scrollbar != null)
                {
                    scrollbar.Percent = 0.0f;
                }
            });
        }