예제 #1
0
    private void SetupOpenWindowsList(ITopLevel topLevel)
    {
        mOpenWindowsList = topLevel;
        ((Window)mOpenWindowsList).InFront = true;
        mWindowListFrame = mOpenWindowsList.SelectSingleElement <IGuiFrame>("MainFrame/WindowList");
        Button hideShowButton = mOpenWindowsList.SelectSingleElement <Button>("MainFrame/HideShowButton");

        hideShowButton.AddOnPressedAction(delegate()
        {
            Vector2 currentPosition = mManager.GetTopLevelPosition(mOpenWindowsList).GetPosition(mOpenWindowsList);
            float shiftAmount       = mWindowListFrame.ExternalSize.x - (hideShowButton.ExternalSize.x * 0.5f);
            if (!mOpenWindowsListShowing)
            {
                shiftAmount *= -1.0f;
            }

            mManager.SetTopLevelPosition
            (
                mOpenWindowsList,
                new FixedPosition
                (
                    currentPosition - new Vector2(shiftAmount, 0.0f)
                )
            );

            mOpenWindowsListShowing = !mOpenWindowsListShowing;
        });

        mWindowListingPrototype = mWindowListFrame.SelectSingleElement <Button>("WindowListingPrototype");
        mWindowListFrame.RemoveChildWidget(mWindowListingPrototype);
    }
예제 #2
0
        public void ArrivedAtStation(ModelStation station)
        {
            if (mNeeds != null)
            {
                if (mStationInUseAtStartWalk && !station.InUse)
                {
                    GameFacade.Instance.SendNotification
                    (
                        FashionMinigame.EARNED_EXPERIENCE_NOTIFICATION,
                        new ExperienceInfo
                        (
                            ExperienceType.CloseSave,
                            station.UnityGameObject.transform.position + Vector3.up
                        )
                    );
                }

                IWidget widget;
                if (station.InUse)
                {
                    // Play a gentle error sfx
                    if (mErrorSfx != null)
                    {
                        AudioSource.PlayClipAtPoint(mErrorSfx, station.UnityGameObject.transform.position, 0.8f);
                    }
                    mStateMachine.TransitionToState(mStateMachine.WalkToCenterState);
                }
                else if (station is HoldingStation)
                {
                    mStateMachine.TransitionToStayAtStation(station);
                }
                else if (mDesiredStations.TryGetValue(station, out widget))
                {
                    mStationInUseAtStartWalk = station.InUse;
                    mDesiredClothingFrame.RemoveChildWidget(widget);
                    mDesiredStations.Remove(station);
                    mNeeds.Remove(station);

                    mStateMachine.TransitionToStayAtStation(station);
                    mStateMachine.RemoveStation(station);
                }
            }
        }
예제 #3
0
        public FashionGameGui()
            : base(GameFacade.Instance.RetrieveMediator <RuntimeGuiManager>(), FASHION_GUI_PATH)
        {
            mInput = GameFacade.Instance.RetrieveMediator <FashionGameInput>();

            mScheduler           = GameFacade.Instance.RetrieveMediator <SchedulerMediator>().Scheduler;
            this.MainGui.Showing = true;

            foreach (ITopLevel topLevel in AllGuis)
            {
                switch (topLevel.Name)
                {
                case "FashionGameGui":
                    mMainWindow         = (Window)topLevel;
                    mMainWindow.Showing = true;
                    break;

                case "FashionScoreGui":
                    mScoreWindow         = (Window)topLevel;
                    mScoreWindow.Showing = true;
                    break;
                }
            }

            mMainFrame = mMainWindow.SelectSingleElement <IGuiFrame>("MainFrame");
            mClothingButtonPrototype = mMainFrame.SelectSingleElement <PushButton>("ButtonPrototype");

            // Initialize the clothing stack slots
            uint clothingStacks = (uint)(mMainFrame.InternalSize.x / mClothingButtonPrototype.ExternalSize.x);

            for (uint i = 0; i < clothingStacks; ++i)
            {
                mActiveClothes.Add(new List <Pair <ClothingItem, PushButton> >());
            }

            mMainFrame.RemoveChildWidget(mClothingButtonPrototype);

            mWaveLabel              = mScoreWindow.SelectSingleElement <Label>("**/WaveLabel");
            mWaveString             = mWaveLabel.Text;
            mNextWaveButton         = mScoreWindow.SelectSingleElement <Button>("**/NextWaveButton");
            mNextWaveButton.Enabled = false;
            mLevelLabel             = mScoreWindow.SelectSingleElement <Label>("**/LevelLabel");
            mExperienceMeter        = mScoreWindow.SelectSingleElement <ProgressIndicator>("**/ExperienceMeter");
            mExperienceLabel        = mScoreWindow.SelectSingleElement <Label>("**/ExperienceLabel");
            mProgressStyle          = GetNamedStyle("Progress");
            mProgressCompleteStyle  = GetNamedStyle("ProgressComplete");
            mEnergyLabel            = mScoreWindow.SelectSingleElement <Label>("**/EnergyLabel");
            mEnergyTimerLabel       = mScoreWindow.SelectSingleElement <Label>("**/EnergyTimerLabel");
            mEnergyMeter            = mScoreWindow.SelectSingleElement <ProgressIndicator>("**/EnergyMeter");

            mTasks.Add(mScheduler.StartCoroutine(UpdateEnergyDisplay()));
        }
예제 #4
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();
    }
예제 #5
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;
                }
            });
        }
예제 #6
0
        public RoomPickerGui(IGuiManager guiManager, System.Action <RoomType> sendSwitchingToRoomTypeNotification)
            : base(guiManager, mResourcePath)
        {
            mSendSwitchingToRoomTypeNotification = sendSwitchingToRoomTypeNotification;
            foreach (IGuiElement element in this.AllElements)
            {
                if (element.Name == "RoomPickerGui" && element is Window)
                {
                    mMainWindow = (Window)element;
                    mMainWindow.OnShowing(OnShowingCallback);

                    mTitleLabel = mMainWindow.SelectSingleElement <Label>("MainFrame/RoomListingsFrame/TitleBarLabel");
                    //we're going to initially display the client's rooms so the "My Rooms" title should be displayed first
                    mTitleLabel.Text = Translation.ROOM_PICKER_MY_ROOMS;

                    Button closeButton = mMainWindow.SelectSingleElement <Button>("MainFrame/RoomListingsFrame/CancelButton");
                    closeButton.AddOnPressedAction(
                        delegate()
                    {
                        mMainWindow.Showing = false;
                    }
                        );

                    //setup the buttons for displaying the various types of rooms
                    Button clientOwnedRoomsButton   = mMainWindow.SelectSingleElement <Button>("MainFrame/RoomListingButtons/ClientOwnedRoomsButton");
                    Button friendsRoomsButton       = mMainWindow.SelectSingleElement <Button>("MainFrame/RoomListingButtons/FriendsRoomsButton");
                    Button hangoutPublicRoomsButton = mMainWindow.SelectSingleElement <Button>("MainFrame/RoomListingButtons/HangoutPublicRoomsButton");

                    clientOwnedRoomsButton.AddOnPressedAction
                    (
                        delegate()
                    {
                        ClearRoomsWindow();
                        UpdateWindowTitleLabel(MessageSubType.ClientOwnedRooms);
                        RoomAPICommands.RequestRoomsFromServer(MessageSubType.ClientOwnedRooms);
                        mCurrentRoomRequestType = MessageSubType.ClientOwnedRooms;
                    }
                    );
                    friendsRoomsButton.AddOnPressedAction
                    (
                        delegate()
                    {
                        ClearRoomsWindow();
                        UpdateWindowTitleLabel(MessageSubType.FriendsRooms);
                        RoomAPICommands.RequestRoomsFromServer(MessageSubType.FriendsRooms);
                        mCurrentRoomRequestType = MessageSubType.FriendsRooms;
                    }
                    );
                    hangoutPublicRoomsButton.AddOnPressedAction
                    (
                        delegate()
                    {
                        ClearRoomsWindow();
                        UpdateWindowTitleLabel(MessageSubType.PublicRooms);
                        RoomAPICommands.RequestRoomsFromServer(MessageSubType.PublicRooms);
                        mCurrentRoomRequestType = MessageSubType.PublicRooms;
                    }
                    );

                    //set up the grid view / scroll area where the rooms are listed
                    mRoomListScrollFrame       = mMainWindow.SelectSingleElement <IGuiFrame>("MainFrame/RoomListingsFrame/RoomListScrollFrame");
                    mRoomListingPrototypeFrame = mMainWindow.SelectSingleElement <IGuiFrame>("MainFrame/RoomListingsFrame/RoomListScrollFrame/RoomListingPrototypeFrame");
                    mRoomListScrollFrame.RemoveChildWidget(mRoomListingPrototypeFrame);
                }
            }
        }