Пример #1
0
        public void UpgradeClicked()
        {
            MyMessenger.Send(BUILDING_UPGRADED_MESSAGE);

            mBuilding.Level.InitiateUpgradeWithResources(mInventory);

            BackendManager.Backend.MakeUpgradeCall(GenericDataLoader.BUILDINGS, mBuilding.Data.ID, mBuilding.Level.UpgradeData.PropertyName);
        }
Пример #2
0
        public void UpgradeUnitClicked()
        {
            MyMessenger.Send(UNIT_UPGRADED_MESSAGE);

            mBuilding.Unit.Level.InitiateUpgradeWithResources(mInventory);

            BackendManager.Backend.MakeUpgradeCall(GenericDataLoader.UNITS, mBuilding.Unit.GetID(), mBuilding.Unit.Level.UpgradeData.PropertyName);
        }
Пример #3
0
        private void OnCloudSetupSuccess()
        {
            mLoginTimer.StepComplete(LibraryAnalyticEvents.CLOUD_SETUP_TIME);

            MyMessenger.Send <LogTypes, string, string>(MyLogger.LOG_EVENT, LogTypes.Info, "Cloud setup success", "");

            mBackend.MakeCloudCall("onLogin", null, OnLogin);
        }
Пример #4
0
        public void PurchaseClicked()
        {
            MyMessenger.Send(BUY_TRAINER_MESSAGE);

            mTrainerManager.InitiateTrainerPurchase(mResources);

            BackendManager.Backend.MakeTrainerPurchase();
        }
Пример #5
0
        private void OnAuthenticationSucess(IAuthenticationSuccess i_success)
        {
            mLoginTimer.StepComplete(LibraryAnalyticEvents.AUTH_TIME);

            MyMessenger.Send <LogTypes, string, string>(MyLogger.LOG_EVENT, LogTypes.Info, "Authenticate success", "");

            mBackend.MakeCloudCall("onLogin", null, OnLogin);
        }
Пример #6
0
        private void OnAuthenticationSucess(IAuthenticationSuccess i_success)
        {
            mLoginTimer.StepComplete(LibraryAnalyticEvents.AUTH_TIME);

            MyMessenger.Send <LogTypes, string, string>(MyLogger.LOG_EVENT, LogTypes.Info, "Authenticate success", "");

            mBackend.SetUpCloudServices(false);
        }
        public void IncreaseTrainingLevel()
        {
            MyMessenger.Send(ADD_TRAINER_MESSAGE);

            PlayerManager.Data.TrainerManager.InitiateChangeInTraining(mUnit, true);

            BackendManager.Backend.ChangeAssignedTrainers(mUnit.GetID(), 1);
        }
        public void OnSendMessage_CustomAnalyticIsSent()
        {
            IUnityAnalytics okAnalytics = GetAnalyticsForResult(AnalyticsResult.Ok);

            mManagerUnderTest = new UnityAnalyticsManager(okAnalytics);
            MyMessenger.Send <string, IDictionary <string, object> >(LibraryAnalyticEvents.SEND_ANALYTIC_EVENT, ANALYTIC_NAME, ANALYTIC_DATA);

            okAnalytics.Received().SendCustomEvent(ANALYTIC_NAME, ANALYTIC_DATA);
        }
Пример #9
0
        private void SendWorldResetAnalytic(MapData i_map)
        {
            Dictionary <string, object> analyticParams = new Dictionary <string, object>();

            analyticParams.Add(Analytics.MAP_LEVEL, i_map.MapLevel);
            analyticParams.Add(Analytics.MAP_WORLD, i_map.World);

            MyMessenger.Send <string, IDictionary <string, object> >(LibraryAnalyticEvents.SEND_ANALYTIC_EVENT, Analytics.WORLD_RESET_EVENT, analyticParams);
        }
        public void OnSentMessage_OkAnalytic_NoWarningLog()
        {
            IUnityAnalytics okAnalytics = GetAnalyticsForResult(AnalyticsResult.Ok);

            mManagerUnderTest = new UnityAnalyticsManager(okAnalytics);
            MyMessenger.Send <string, IDictionary <string, object> >(LibraryAnalyticEvents.SEND_ANALYTIC_EVENT, ANALYTIC_NAME, ANALYTIC_DATA);

            EasyLogger.Instance.DidNotReceive().Log(LogTypes.Warn, Arg.Any <string>(), Arg.Any <string>());
        }
        public void OnSentMessage_FailedAnalytic_WarningLogSent()
        {
            IUnityAnalytics badAnalytics = GetAnalyticsForResult(AnalyticsResult.InvalidData);

            mManagerUnderTest = new UnityAnalyticsManager(badAnalytics);
            MyMessenger.Send <string, IDictionary <string, object> >(LibraryAnalyticEvents.SEND_ANALYTIC_EVENT, ANALYTIC_NAME, ANALYTIC_DATA);

            EasyLogger.Instance.Received().Log(LogTypes.Warn, Arg.Any <string>(), Arg.Any <string>());
        }
Пример #12
0
        private void SendMapCompletedAnalytic(MapData i_map)
        {
            Dictionary <string, object> analyticParams = new Dictionary <string, object>();

            analyticParams.Add(Analytics.AREAS_COMPLETE, GetAreasCompletedForMap(i_map));
            analyticParams.Add(Analytics.MAP_LEVEL, i_map.MapLevel);
            analyticParams.Add(Analytics.MAP_WORLD, i_map.World);

            MyMessenger.Send <string, IDictionary <string, object> >(LibraryAnalyticEvents.SEND_ANALYTIC_EVENT, Analytics.MAP_COMPLETE_EVENT, analyticParams);
        }
Пример #13
0
        private void OnLogin(Dictionary <string, string> i_result)
        {
            mLoginTimer.StepComplete(LibraryAnalyticEvents.ON_LOGIN_TIME);
            QwfBackend backend = (QwfBackend)mBackend;

            backend.SetLoggedInTime();

            MyMessenger.Send <LogTypes, string, string>(MyLogger.LOG_EVENT, LogTypes.Info, "Login success", "");

            MyMessenger.Send(BackendMessages.LOGIN_SUCCESS);
        }
Пример #14
0
        private void ShowUnlockPopup(string i_unitID)
        {
            string unlockText = StringTableManager.Get(StringKeys.UNLOCK_TEXT);

            unlockText = DrsStringUtils.Replace(unlockText, StringKeys.CLASS_KEY, UnitKeys.GetName(i_unitID));

            ViewModel model = new ViewModel();

            model.SetProperty(InfoPopupProperties.MAIN_IMAGE, UnitKeys.GetIconKey(i_unitID));
            model.SetProperty(InfoPopupProperties.MAIN_TEXT, unlockText);

            MyMessenger.Send <string, ViewModel>(InfoPopupEvents.QUEUE, InfoPopupProperties.STANDARD_POPUP, model);
        }
Пример #15
0
        public void WhenMissionGetsComplete_NotWithAreaIndex_NothingChanges()
        {
            mMissionProgress.Completed = false;
            RecreateArea();

            MissionData testData = new MissionData();

            testData.Index = mAreaUnderTest.Data.Index + 1;
            MyMessenger.Send(MissionKeys.MISSION_COMPLETED, testData);

            bool isAccessible = mAreaUnderTest.ViewModel.GetPropertyValue <bool>(MapViewProperties.AREA_ACCESS);
            bool isComplete   = mAreaUnderTest.ViewModel.GetPropertyValue <bool>(MapViewProperties.AREA_COMPLETED);

            Assert.IsFalse(isComplete);
            Assert.IsTrue(isAccessible);
        }
Пример #16
0
        public void OnUnitSelected(bool i_selected)
        {
            MyMessenger.Send(UNIT_SELECTED);

            // this effectively blocks selection of a unit that is already selected. Why Unity, WHY???
            if (mIsOn && i_selected)
            {
                return;
            }

            mIsOn = i_selected;
            if (UnitSelectedEvent != null)
            {
                mTaskUnitSelection.UnitSelected(i_selected);
                UnitSelectedEvent(mTaskUnitSelection);
            }
        }
Пример #17
0
        public int GetStatBonusFromSource(IUnit i_unit, string i_stat, StatBonusSources i_source)
        {
            int bonus = 0;

            switch (i_source)
            {
            case StatBonusSources.Guilds:
                bonus = GetGuildBonus(i_unit, i_stat);
                break;

            default:
                MyMessenger.Send <LogTypes, string, string>(MyLogger.LOG_EVENT, LogTypes.Error, "No stat calculation for source: " + i_source.ToString(), "UnitModification");
                break;
            }

            return(bonus);
        }
Пример #18
0
        public int GetNumUnitsForRequirement(IUnit i_unit, string i_stat, int i_powerRequirement)
        {
            int totalUnitsRequired = 0;

            int unitPower = GetTotalStatFromUnit(i_unit, i_stat);

            if (unitPower > 0)
            {
                totalUnitsRequired = (int)Math.Ceiling((float)i_powerRequirement / unitPower);
            }
            else
            {
                totalUnitsRequired = int.MaxValue;
                MyMessenger.Send <LogTypes, string, string>(MyLogger.LOG_EVENT, LogTypes.Error, "Attempting to get units required for " + i_unit.GetID() + " for stat " + i_stat + " but that unit's power is 0!", "StatCalculation");
            }

            return(totalUnitsRequired);
        }
Пример #19
0
        public static void LoadDataOfClass <T>(string i_className) where T : GenericData
        {
            if (mBackend == null)
            {
                Debug.LogError("Generic data loader was not inited!");
            }

            mBackend.GetAllTitleDataForClass(i_className, (data) => {
                MyMessenger.Send <LogTypes, string, string>(MyLogger.LOG_EVENT, LogTypes.Info, "Got title data for " + i_className, "");

                Dictionary <string, T> dataAsDictionary = DeserializeData <T>(data, i_className);
                StoreDictionaryDataAsHash <T>(dataAsDictionary, i_className);
            });

            //JsonSerializerSettings settings = new JsonSerializerSettings();
            //settings.TypeNameHandling = TypeNameHandling.All;
            //settings.TypeNameAssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Full;
            //string test = JsonConvert.SerializeObject( m_listCharacters, Formatting.Indented, settings );
            //Debug.Log( test );
        }
Пример #20
0
        public static T GetData <T>(string i_key) where T : GenericData
        {
            string dataType = GetDataType <T>();

            if (!mData.ContainsKey(dataType))
            {
                MyMessenger.Send <LogTypes, string, string>(MyLogger.LOG_EVENT, LogTypes.Fatal, "Trying to get data of unloaded type " + dataType, "");
                return(default(T));
            }

            Hashtable dataOfType = mData[dataType];

            if (dataOfType.ContainsKey(i_key))
            {
                return((T)dataOfType[i_key]);
            }
            else
            {
                MyMessenger.Send <LogTypes, string, string>(MyLogger.LOG_EVENT, LogTypes.Fatal, "Tried to load " + i_key + " from " + dataType + " but there was no data!", "");
                return(default(T));
            }
        }
        private float CalculateBonusValue(IUnit i_unit, string i_stat, int i_modLevel)
        {
            float bonus         = 0;
            float totalModifier = GetTotalModifier(i_modLevel);
            int   baseStatValue = i_unit.GetBaseStat(i_stat);

            switch (ModifierType)
            {
            case ModifierTypes.Flat:
                bonus = totalModifier;
                break;

            case ModifierTypes.Percent:
                bonus = baseStatValue * totalModifier;
                break;

            default:
                MyMessenger.Send <LogTypes, string, string>(MyLogger.LOG_EVENT, LogTypes.Error, "No unit modification handle for " + ModifierType, "UnitModification");
                break;
            }

            return(bonus);
        }
Пример #22
0
 private void SendWorldResetSuccessMessage()
 {
     MyMessenger.Send(MapKeys.WORLD_RESET_SUCCESS);
 }
Пример #23
0
 public void OnMapAreaClicked()
 {
     MyMessenger.Send(AREA_CLICKED_MESSAGE);
     MissionInterfaceManager.Instance.CreateUI(new Mission(mArea.Data.Mission));
 }
Пример #24
0
 private void OnBackendFailure(IBackendFailure i_failure)
 {
     MyMessenger.Send <LogTypes, string, string>(MyLogger.LOG_EVENT, LogTypes.Info, i_failure.GetMessage(), "");
     mLoginTimer.StopTimer();
 }
Пример #25
0
 private void OnCloudSetupSuccess()
 {
     MyMessenger.Send <LogTypes, string, string>(MyLogger.LOG_EVENT, LogTypes.Info, "Cloud setup success", "");
     MyMessenger.Send <IBasicBackend>(LOG_IN_DONE, mBackend);
 }
Пример #26
0
 private void OnAuthenticationSucess(IAuthenticationSuccess i_success)
 {
     MyMessenger.Send <LogTypes, string, string>(MyLogger.LOG_EVENT, LogTypes.Info, "Authenticate success", "");
     mBackend.SetUpCloudServices(false);
 }
Пример #27
0
        protected override void OnDestroy()
        {
            base.OnDestroy();

            MyMessenger.Send(InfoPopupEvents.CLOSE);
        }
Пример #28
0
 public void CompleteMission()
 {
     MyMessenger.Send(COMPLETE_MESSAGE);
     mMission.CompleteMission();
 }
Пример #29
0
 private void OnUnitSelectedForThisTask(TaskUnitSelection i_selection)
 {
     MyMessenger.Send(MissionKeys.UNIT_SELECTED_EVENT, mTaskIndex);
 }
Пример #30
0
 private void SendMissionCompletionMessage()
 {
     MyMessenger.Send(MissionKeys.MISSION_COMPLETED, mData);
 }