void DrawFileSwitch(Rect rect)
        {
            if (thisSystemIsReady)
            {
                IPlayerDataManager playerDataManager = playerDataManagerAdaptor.GetPlayerDataManager();

                string[] filePaths = playerDataManager.GetFilePaths();

                string[] buttonTexts           = CreateFilesNameArray(filePaths);
                int      prevSelectedFileIndex = thisSelectedFileIndex;
                thisSelectedFileIndex = GUI.SelectionGrid(
                    rect,
                    thisSelectedFileIndex,
                    buttonTexts,
                    filePaths.Length
                    );
                if (thisSelectedFileIndex > filePaths.Length - 1)
                {
                    thisSelectedFileIndex = filePaths.Length - 1;
                }

                if (thisSelectedFileIndex != prevSelectedFileIndex)
                {
                    playerDataManager.SetFileIndex(thisSelectedFileIndex);
                }
                prevSelectedFileIndex = thisSelectedFileIndex;
            }
            else
            {
                GUI.Box(
                    rect,
                    "ready the system to load files"
                    );
            }
        }
        void DrawCurrencyControl(Rect rect)
        {
            if (thisSystemIsReady)
            {
                Rect sub_0 = GetHorizontalSubRect(rect, 0, 2);                                //set
                Rect sub_1 = GetHorizontalSubRect(rect, 1, 2);                                //add

                IPlayerDataManager playerDataManager = playerDataManagerAdaptor.GetPlayerDataManager();
                if (GUI.Button(
                        sub_0,
                        "Set Currency"
                        ))
                {
                    playerDataManager.SetCurrency(currency);
                }
                if (GUI.Button(
                        sub_1,
                        "Add 100"
                        ))
                {
                    int currency    = playerDataManager.GetCurrency();
                    int newCurrency = currency + 100;
                    playerDataManager.SetCurrency(newCurrency);
                }
            }
        }
        void SavePlayerData()
        {
            IPlayerDataManager manager = playerDataManagerAdaptor.GetPlayerDataManager();

            manager.SetFileIndex(thisSelectedFileIndex);
            manager.Save();
        }
Example #4
0
 public void CommonInstall()
 {
     MockMessenger        = Substitute.For <IMessageService>();
     MockDamageCalculator = Substitute.For <IDamageCalculator>();
     MockPlayerData       = Substitute.For <IPlayerDataManager>();
     MockBoostUnits       = Substitute.For <ICurrentBoostUnits>();
 }
        public override void SetUpReference()
        {
            base.SetUpReference();
            IResultLabelPane resultLabelPane = resultLabelPaneAdaptor.GetResultLabelPane();

            thisEndGamePane.SetResultLabelPane(resultLabelPane);

            IResultScorePane scorePane = resultScorePaneAdaptor.GetResultScorePane();

            thisEndGamePane.SetResultScorePane(scorePane);

            IResultHighScorePane highScorePane = resultHighScorePaneAdaptor.GetResultHighScorePane();

            thisEndGamePane.SetResultHighScorePane(highScorePane);

            IResultCurrencyPane currencyPane = resultCurrencyPaneAdaptor.GetResultCurrencyPane();

            thisEndGamePane.SetResultCurrencyPane(currencyPane);

            IWatchADButton button = watchADButtonAdaptor.GetWatchADButton();

            thisEndGamePane.SetWatchADButton(button);

            IMainMenuButtonCluster cluster = buttonClusterAdaptor.GetMainMenuButtonCluster();

            thisEndGamePane.SetMainMenuButtonCluster(cluster);

            IPlayerDataManager playerDataManager = playerDataManagerAdaptor.GetPlayerDataManager();

            thisEndGamePane.SetPlayerDataManager(playerDataManager);

            IUIElementGroupScroller rootScroller = (IUIElementGroupScroller)rootScrollerAdaptor.GetUIElement();

            thisEndGamePane.SetRootScroller(rootScroller);
        }
        public string GetGameDataJson(IPlayerDataManager dataManager)
        {
            GameData data = GameData.getGameDataBuilder()
                            .setPlayerData(
                PlayerDataBean.getPlayerDataBeanBuilder()
                .setCurrent_mission_id(dataManager.missionId)
                .setCurrent_mission_percent((int)dataManager.missionPercent > 1 ? 100 : (int)dataManager.missionPercent * 100)
                .setExp(dataManager.exp)
                .setLevel(dataManager.playerLevel)
                .setCrown_count(dataManager.CrownCount)
                .setStarID(dataManager.StarID)
                .setSceneIndex(dataManager.SceneIndex)
                .setPurpieAccessories(dataManager.PurpieAccessories)
                .setDonnyAccessories(dataManager.DonnyAccessories)
                .setNinjiAccessories(dataManager.NinjiAccessories)
                .setSansaAccessories(dataManager.SansaAccessories)
                .setYoyoAccessories(dataManager.YoyoAccessories)
                .setNuoAccessories(dataManager.NuoAccessories)
                .build()
                )
                            .setTimestamp((int)DateUtil.GetTimeStamp())
                            .build();

            string jsonStr = mJsonUtils.Json2String(data);

            return(jsonStr);
        }
Example #7
0
        public override void SetUpReference()
        {
            IPopText gameConfigPopText = gameConfigPopTextAdaptor.GetPopText();

            thisGameConfigWidget.SetGameConfigPopText(gameConfigPopText);
            IPlayerDataManager playerDataManager = playerDataManagerAdaptor.GetPlayerDataManager();

            thisGameConfigWidget.SetPlayerDataManager(playerDataManager);
            IAxisInversionToggleButton[] axisInversionToggleButtons = CollectAxisInversionToggleButtons();
            thisGameConfigWidget.SetAxisInversionToggleButtons(axisInversionToggleButtons);

            ICoreGameplayInputScroller inputScroller = inputScrollerAdaptor.GetInputScroller();

            thisGameConfigWidget.SetInputScroller(inputScroller);

            IAudioManager audioManager = audioManagerAdaptor.GetAudioManager();

            thisGameConfigWidget.SetAudioManager(audioManager);

            IVolumeControlScroller bgmVolumeControlScroller = BGMVolumeControlScrollerAdaptor.GetVolumeControlScroller();

            thisGameConfigWidget.SetBGMVolumeControlScroller(bgmVolumeControlScroller);
            IVolumeControlScroller sfxVolumeControlScroller = SFXVolumeControlScrollerAdaptor.GetVolumeControlScroller();

            thisGameConfigWidget.SetSFXVolumeControlScroller(sfxVolumeControlScroller);
        }
Example #8
0
        public PlayerStatInfoPM(IPlayerDataManager i_manager)
        {
            mPlayerDataManager = i_manager;

            SetVisibleProperty(false);
            SetStatValues();
        }
        void CreateNewPlayerData()
        {
            IPlayerDataManager playerDataManager = playerDataManagerAdaptor.GetPlayerDataManager();
            int newFileIndex = playerDataManager.CreateNewPlayerDataFile();

            thisSelectedAttributeIndex = newFileIndex;
        }
        void DrawBowControl(Rect rect)
        {
            if (thisSystemIsReady)
            {
                IPlayerDataManager playerDataManager = playerDataManagerAdaptor.GetPlayerDataManager();
                if (playerDataManager.PlayerDataIsLoaded())
                {
                    //unlock, equip
                    Rect           sub_0         = GetHorizontalSubRect(rect, 0, 2);
                    Rect           sub_1         = GetHorizontalSubRect(rect, 1, 2);
                    IBowConfigData bowConfigData = playerDataManager.GetBowConfigDataArray()[thisSelectedBowIndex];

                    bool   isUnlocked           = bowConfigData.IsUnlocked();
                    string lockToggleButtonText = isUnlocked ? "Lock" : "Unlock";

                    if (GUI.Button(
                            sub_0,
                            lockToggleButtonText
                            ))
                    {
                        if (isUnlocked)
                        {
                            playerDataManager.LockBow(thisSelectedBowIndex);
                        }
                        else
                        {
                            playerDataManager.UnlockBow(thisSelectedBowIndex);
                        }
                    }

                    int equippedBowIndex = playerDataManager.GetEquippedBowIndex();
                    if (equippedBowIndex == thisSelectedBowIndex)
                    {
                        GUI.Box(
                            sub_1,
                            "Equipped"
                            );
                    }
                    else
                    {
                        if (GUI.Button(
                                sub_1,
                                "Equip"
                                ))
                        {
                            playerDataManager.SetEquippedBow(thisSelectedBowIndex);
                        }
                    }
                }
                else
                {
                    GUI.Box(
                        rect,
                        "bow control\n" +
                        "playerData not ready"
                        );
                }
            }
        }
Example #11
0
 public PlayerService(IOptions <PlayerServiceConfiguration> settings, IOptions <ResponseConfiguration> responseSettings, IPlayerDataManager playerDataManager, IPositionDataManager positionDataManager, ITeamDataManager teamDataManager)
 {
     _settings            = settings;
     _responseSettings    = responseSettings;
     _playerDataManager   = playerDataManager;
     _positionDataManager = positionDataManager;
     _teamDataManager     = teamDataManager;
 }
        void LoadPlayerData()
        {
            IPlayerDataManager manager = playerDataManagerAdaptor.GetPlayerDataManager();

            manager.SetFileIndex(thisSelectedFileIndex);
            manager.Load();
            CalculateShootingData();
        }
 //初始化类型数据
 public void Initialize(IPrefabRoot prefabRoot, IPlayerDataManager playerDataManager, IAccessoryDataManager accessoryDataManager, ILocalPetAccessoryAgent localPetAccessoryAgent, II18NConfig i18nConfig)
 {
     this.prefabRoot             = prefabRoot;
     this.playerDataManager      = playerDataManager;
     this.accessoryDataManager   = accessoryDataManager;
     this.localPetAccessoryAgent = localPetAccessoryAgent;
     this.i18nConfig             = i18nConfig;
 }
        void DecreaseAttributeLevel(
            int attributeIndex
            )
        {
            IPlayerDataManager playerDataManager = playerDataManagerAdaptor.GetPlayerDataManager();

            playerDataManager.DecreaseAttributeLevel(attributeIndex);
        }
Example #15
0
        public GamePlayer(IMessageService i_messenger, ICurrentBoostUnits i_boostUnits, IDamageCalculator i_damageCalculator, IPlayerDataManager i_playerDataManager)
        {
            mDamageCalculator  = i_damageCalculator;
            mPlayerDataManager = i_playerDataManager;
            mBoostUnits        = i_boostUnits;
            Messenger          = i_messenger;

            SetStartingHP();
        }
        void DeletePlayerData()
        {
            IPlayerDataManager playerDataManager = playerDataManagerAdaptor.GetPlayerDataManager();
            string             playerDataPath    = playerDataManager.GetDirectory();

            string[] filePaths    = System.IO.Directory.GetFiles(playerDataPath);
            string   pathToDelete = filePaths[thisSelectedFileIndex];

            System.IO.File.Delete(pathToDelete);
        }
Example #17
0
        public override void SetUpReference()
        {
            base.SetUpReference();
            IPlayerDataManager playerDataManager = CollectPlayerDataManager();

            thisShootingDataManager.SetPlayerDataManager(playerDataManager);

            IBowDataCalculator bowDataCalculator = new BowDataCalculator(playerDataManagerAdaptor);

            thisShootingDataManager.SetBowDataCalculator(bowDataCalculator);
        }
 void DrawPlayerData(Rect rect)
 {
     if (thisSystemIsReady)
     {
         IPlayerDataManager manager = playerDataManagerAdaptor.GetPlayerDataManager();
         GUI.Label(
             rect,
             manager.GetDebugString()
             );
     }
 }
Example #19
0
        public PlayerSummaryPM(IPlayerDataManager i_playerManager, ITreasureDataManager i_treasureManager, IMessageService i_messenger)
        {
            mMessenger       = i_messenger;
            mPlayerManager   = i_playerManager;
            mTreasureManager = i_treasureManager;

            ListenForMessages(true);

            SetGoldProperty();
            SetTreasureLevelProperty();
            SetTreasureLevelProgressProperty();
        }
        // void IncrementBowLevelAt(int attributeIndex){
        //  IPlayerDataManager dataManager = playerDataManagerAdaptor.GetPlayerDataManager();
        //  int equippedBowIndex = dataManager.GetEquippedBowIndex();
        //  dataManager.IncrementBowLevel(equippedBowIndex, attributeIndex);
        //  CalculateShootingData();
        // }
        void ClearAllBowConfigData()
        {
            IPlayerDataManager dataManager = playerDataManagerAdaptor.GetPlayerDataManager();

            IBowConfigData[] configData = dataManager.GetBowConfigDataArray();
            int arrayLength             = configData.Length;

            for (int i = 0; i < arrayLength; i++)
            {
                dataManager.ClearBowConfigData(i);
            }
            CalculateShootingData();
        }
        public void WhenCreated_StatsSetAsExpected()
        {
            IPlayerDataManager mockManager = Substitute.For <IPlayerDataManager>();

            mockManager.GetStat(PlayerStats.HP).Returns(100);
            mockManager.GetStat(PlayerStats.PHY_ATK).Returns(10);
            mockManager.GetStat(PlayerStats.PHY_DEF).Returns(5);

            PlayerStatInfoPM systemUnderTest = new PlayerStatInfoPM(mockManager);

            Assert.AreEqual("100", systemUnderTest.ViewModel.GetPropertyValue <string>(PlayerStatInfoPM.HP_PROPERTY));
            Assert.AreEqual("10", systemUnderTest.ViewModel.GetPropertyValue <string>(PlayerStatInfoPM.ATK_PROPERTY));
            Assert.AreEqual("5", systemUnderTest.ViewModel.GetPropertyValue <string>(PlayerStatInfoPM.DEF_PROPERTY));
        }
 void DrawAttributeControl(Rect rect)
 {
     if (thisSystemIsReady)
     {
         IPlayerDataManager playerDataManager = playerDataManagerAdaptor.GetPlayerDataManager();
         if (playerDataManager.PlayerDataIsLoaded())
         {
             Rect sub_0 = GetHorizontalSubRect(rect, 0, 3);
             Rect sub_1 = GetHorizontalSubRect(rect, 1, 3);
             Rect sub_2 = GetHorizontalSubRect(rect, 2, 3);
             if (GUI.Button(
                     sub_0,
                     "Up"
                     ))
             {
                 int equippedBowIndex = playerDataManager.GetEquippedBowIndex();
                 IncreaseAttributeLevel(
                     thisSelectedAttributeIndex
                     );
                 CalculateShootingData();
             }
             if (GUI.Button(
                     sub_1,
                     "Down"
                     ))
             {
                 int equippedBowIndex = playerDataManager.GetEquippedBowIndex();
                 DecreaseAttributeLevel(
                     thisSelectedAttributeIndex
                     );
                 CalculateShootingData();
             }
             if (GUI.Button(
                     sub_2,
                     "Clear All"
                     ))
             {
                 ClearAllBowConfigData();
             }
         }
         else
         {
             GUI.Box(
                 rect,
                 "attributeControl" + "\n" +
                 "playerData not ready"
                 );
         }
     }
 }
        void SetInputScrollerAxisInversion()
        {
            IPlayerDataManager         playerDataManager = playerDataManagerAdaptor.GetPlayerDataManager();
            ICoreGameplayInputScroller inputScroller     = coreGameplayInputScrollerAdaptor.GetInputScroller();

            if (!playerDataManager.PlayerDataIsLoaded())
            {
                playerDataManager.Load();
            }
            for (int i = 0; i < 2; i++)
            {
                bool inverts = playerDataManager.GetAxisInversion(i);
                inputScroller.SetAxisInversion(i, inverts);
            }
        }
        void DrawFileClear(Rect rect)
        {
            IPlayerDataManager playerDataManager = playerDataManagerAdaptor.GetPlayerDataManager();

            if (playerDataManager != null)
            {
                if (GUI.Button(
                        rect,
                        "Clear Bow Config Data"
                        ))
                {
                    playerDataManager.ClearAllBowConfigData();
                }
            }
        }
        void SetVolume()
        {
            IAudioManager      audioManager      = audioManagerAdaptor.GetAudioManager();
            IPlayerDataManager playerDataManager = playerDataManagerAdaptor.GetPlayerDataManager();

            if (!playerDataManager.PlayerDataIsLoaded())
            {
                playerDataManager.Load();
            }
            float bgmVolume = playerDataManager.GetBGMVolume();

            audioManager.SetBGMVolume(bgmVolume);
            float sfxVolume = playerDataManager.GetSFXVolume();

            audioManager.SetSFXVolume(sfxVolume);
        }
Example #26
0
        public override void SetUpReference()
        {
            base.SetUpReference();
            IPopText popText = labelPopTextAdaptor.GetPopText();

            thisTutorialPane.SetTutorialLabelPopText(popText);
            ICoreGameplayInputScroller scroller = inputScrollerAdaptor.GetInputScroller();

            thisTutorialPane.SetCoreGameplayInputScroller(scroller);
            ITutorialPaneInvertAxisButton[] buttons = CollectInvertButtons();
            thisTutorialPane.SetTutorialPaneInvertAxisButtons(buttons);
            IPlayerDataManager playerDataManager = playerDataManagerAdaptor.GetPlayerDataManager();

            thisTutorialPane.SetPlayerDataManager(playerDataManager);
            IGameplayWidget gameplayWidget = gameplayWidgetAdaptor.GetGameplayWidget();

            thisTutorialPane.SetGameplayWidget(gameplayWidget);
        }
        public override void SetUpReference()
        {
            IUIElementGroupScroller bowPanelScroller = (IUIElementGroupScroller)bowPanelGroupScrollerAdaptor.GetUIElement();

            thisWidget.SetBowPanelGroupScroller(bowPanelScroller);

            IBowPanel[] bowPanels = CollectBowPanels();
            thisWidget.SetBowPanels(bowPanels);
            foreach (IBowPanel bowPanel in bowPanels)
            {
                bowPanel.SetBowConfigWidget(thisWidget);
            }

            IPlayerDataManager playerDataManager = playerDataManagerAdaptor.GetPlayerDataManager();

            thisWidget.SetPlayerDataManager(playerDataManager);

            IBowDataCalculator bowDataCalculator = new BowDataCalculator(playerDataManagerAdaptor);

            thisWidget.SetBowDataCalculator(bowDataCalculator);

            IResourcePanel resourcePanel = resourcePanelAdaptor.GetResourcePanel();

            thisWidget.SetResourcePanel(resourcePanel);

            ICurrencyPane currencyPane = currencyPaneAdaptor.GetCurrencyPane();

            thisWidget.SetCurrencyPane(currencyPane);

            IBowUnlockButton[] unlockButtons = CollectBowUnlockButtons();
            thisWidget.SetBowUnlockButtons(unlockButtons);
            foreach (IBowUnlockButton button in unlockButtons)
            {
                button.SetBowConfigWidget(thisWidget);
            }
            IPopText popText = bowConfigLabelPopTextAdaptor.GetPopText();

            thisWidget.SetBowConfigLabelPopText(popText);
        }
        // public void OnSceneChange(Scene from, Scene to){
        //  Debug.Log("from: " + from.buildIndex.ToString() + ", to: " + to.buildIndex.ToString());
        //  if(to.buildIndex ==  1){
        //      StartUp();
        //  }
        // }
        // public void Start(){
        //  StartUp();
        // }
        public void StartUp()
        {
            SetActiveUIRoots();
            SetUp();
            ActivateRootUI();
            WarmUp();
            IPlayerDataManager playerDataManager = playerDataManagerAdaptor.GetPlayerDataManager();

            playerDataManager.MakeSurePlayerDataFileExists();

            SetInputScrollerAxisInversion();
            SetVolume();

            IStartupManager startupManager = startupManagerAdaptor.GetStartupManager();

            startupManager.StartStartupSequence();

            // InitializeAD();
            ResetInterstitialADManager();

            PlayBGM();

            thisGameIsReady = true;
        }
Example #29
0
 public void SetPlayerDataManager(IPlayerDataManager manager)
 {
     thisPlayerDataManager = manager;
 }
        public override void SetUpReference()
        {
            IGameplayUIElement gameplayUIElement = gameplayUIElementAdaptor.GetGameplayUIElement();

            thisWidget.SetGameplayUIElement(gameplayUIElement);

            IPlayerCharacterWaypointsFollower follower = playerCharacterWaypointsFollowerAdaptor.GetPlayerCharacterWaypointsFollower();

            thisWidget.SetPlayerCharacterWaypointsFollower(follower);

            IGameStatsTracker tracker = gameStatsTrackerAdaptor.GetTracker();

            thisWidget.SetGameStatsTracker(tracker);

            IHeadUpDisplay hud = headUpDisplayAdaptor.GetHeadUpDisplay();

            thisWidget.SetHeadUpDisplay(hud);

            IUIElementGroupScroller rootScroller = (IUIElementGroupScroller)rootScrollerAdaptor.GetUIElement();

            thisWidget.SetRootScroller(rootScroller);

            // IFrostGlass frostGlass = rootElementFrostGlassAdaptor.GetFrostGlass();
            // thisWidget.SetRootElementFrostGlass(frostGlass);

            IResourcePanel resourcePanel = resourcePanelAdaptor.GetResourcePanel();

            thisWidget.SetResourcePanel(resourcePanel);

            IMainMenuUIElement mainMenuUIElement = mainMenuUIAdaptor.GetMainMenuUIElement();

            thisWidget.SetMainMenuUIElement(mainMenuUIElement);

            IEndGamePane endGamePane = endGamePaneAdaptor.GetEndGamePane();

            thisWidget.SetEndGamePane(endGamePane);

            ITitlePane titlePane = titlePaneAdaptor.GetTitlePane();

            thisWidget.SetTitlePane(titlePane);

            IPlayerDataManager playerDataManager = playerDataManagerAdaptor.GetPlayerDataManager();

            thisWidget.SetPlayerDataManager(playerDataManager);

            IShootingDataManager shootingDataManager = shootingDataManagerAdaptor.GetShootingDataManager();

            thisWidget.SetShootingDataManager(shootingDataManager);

            IScoreManager scoreManager = scoreManagerAdaptor.GetScoreManager();

            thisWidget.SetScoreManager(scoreManager);

            ICurrencyManager currencyManager = currencyManagerAdaptor.GetCurrencyManager();

            thisWidget.SetCurrencyManager(currencyManager);

            IHeatManager heatManager = heatManagerAdaptor.GetHeatManager();

            thisWidget.SetHeatManager(heatManager);

            ICoreGameplayInputScroller inputScroller = inputScrollerAdaptor.GetInputScroller();

            thisWidget.SetCoreGameplayInputScroller(inputScroller);

            IGameplayPause gameplayPause = gameplayPauseAdaptor.GetGameplayPause();

            thisWidget.SetGameplayPause(gameplayPause);

            IPlayerInputManager playerInputManager = playerInputManagerAdaptor.GetInputManager();

            thisWidget.SetPlayerInputManager(playerInputManager);

            IFrostManager frostManager = frostManagerAdaptor.GetFrostManager();

            thisWidget.SetFrostManager(frostManager);

            ITutorialPane tutorialPane = tutorialPaneAdaptor.GetTutorialPane();

            thisWidget.SetTutorialPane(tutorialPane);

            IColorSchemeManager colorSchemeManager = colorSchemeManagerAdaptor.GetColorSchemeManager();

            thisWidget.SetColorSchemeManager(colorSchemeManager);

            IInterstitialADManager interstitialADManager = interstitialADManagerAdaptor.GetInterstitialADManager();

            thisWidget.SetInterstitialADManager(interstitialADManager);
        }