예제 #1
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()));
        }
예제 #2
0
        private IEnumerator <IYieldInstruction> ProcessLoadingInfo(Message loadingInfoMessage)
        {
            if (loadingInfoMessage.Data.Count < 7)
            {
                throw new Exception("Loading Info Message does not contain all the expected data");
            }

            FashionGameInput input = new FashionGameInput();

            GameFacade.Instance.RegisterMediator(input);

            FashionGameGui gui = new FashionGameGui();

            gui.SetEnergy
            (
                (float)loadingInfoMessage.Data[2],
                (float)loadingInfoMessage.Data[3],
                DateTime.Parse((string)loadingInfoMessage.Data[4])
            );
            gui.SetWave(1, 1);
            gui.SetLevel("Loading...");
            gui.EnableNextWave(false);
            GameFacade.Instance.RegisterMediator(gui);

            PlayerProgression progression = new PlayerProgression((uint)loadingInfoMessage.Data[5], (uint)loadingInfoMessage.Data[6]);

            progression.UpdateProgressGUI(false);
            GameFacade.Instance.RegisterMediator(progression);

            XmlDocument modelClothesXml = new XmlDocument();

            modelClothesXml.LoadXml((string)loadingInfoMessage.Data[0]);

            XmlDocument stationWorkerClothesXml = new XmlDocument();

            stationWorkerClothesXml.LoadXml((string)loadingInfoMessage.Data[1]);

            FashionNpcMediator npcFactory = new FashionNpcMediator();

            GameFacade.Instance.RegisterMediator(npcFactory);

            IEnumerable <Asset>   modelClothes    = null;
            ClientAssetRepository clientAssetRepo = GameFacade.Instance.RetrieveProxy <ClientAssetRepository>();

            clientAssetRepo.GetAssets <Asset>
            (
                ClientAssetInfo.Parse(modelClothesXml),
                delegate(IEnumerable <Asset> downloadedAssets)
            {
                modelClothes = downloadedAssets;
            }
            );

            IEnumerable <Asset> stationWorkerClothes = null;

            clientAssetRepo.GetAssets <Asset>
            (
                ClientAssetInfo.Parse(stationWorkerClothesXml),
                delegate(IEnumerable <Asset> downloadedAssets)
            {
                stationWorkerClothes = downloadedAssets;
            }
            );

            yield return(new YieldWhile(delegate()
            {
                return modelClothes == null || stationWorkerClothes == null;
            }));

            npcFactory.SetModelDefaultClothes(modelClothes);
            npcFactory.SetStationWorkerDefaultClothes(stationWorkerClothes);

            GameFacade.Instance.RegisterMediator(new ClothingMediator());
            input.StartListeningForInput();

            mOnInitialInfoLoaded();
        }