public void UpgradeClicked() { MyMessenger.Send(BUILDING_UPGRADED_MESSAGE); mBuilding.Level.InitiateUpgradeWithResources(mInventory); BackendManager.Backend.MakeUpgradeCall(GenericDataLoader.BUILDINGS, mBuilding.Data.ID, mBuilding.Level.UpgradeData.PropertyName); }
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); }
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); }
public void PurchaseClicked() { MyMessenger.Send(BUY_TRAINER_MESSAGE); mTrainerManager.InitiateTrainerPurchase(mResources); BackendManager.Backend.MakeTrainerPurchase(); }
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); }
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); }
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>()); }
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); }
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); }
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); }
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); }
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); } }
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); }
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); }
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 ); }
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); }
private void SendWorldResetSuccessMessage() { MyMessenger.Send(MapKeys.WORLD_RESET_SUCCESS); }
public void OnMapAreaClicked() { MyMessenger.Send(AREA_CLICKED_MESSAGE); MissionInterfaceManager.Instance.CreateUI(new Mission(mArea.Data.Mission)); }
private void OnBackendFailure(IBackendFailure i_failure) { MyMessenger.Send <LogTypes, string, string>(MyLogger.LOG_EVENT, LogTypes.Info, i_failure.GetMessage(), ""); mLoginTimer.StopTimer(); }
private void OnCloudSetupSuccess() { MyMessenger.Send <LogTypes, string, string>(MyLogger.LOG_EVENT, LogTypes.Info, "Cloud setup success", ""); MyMessenger.Send <IBasicBackend>(LOG_IN_DONE, mBackend); }
private void OnAuthenticationSucess(IAuthenticationSuccess i_success) { MyMessenger.Send <LogTypes, string, string>(MyLogger.LOG_EVENT, LogTypes.Info, "Authenticate success", ""); mBackend.SetUpCloudServices(false); }
protected override void OnDestroy() { base.OnDestroy(); MyMessenger.Send(InfoPopupEvents.CLOSE); }
public void CompleteMission() { MyMessenger.Send(COMPLETE_MESSAGE); mMission.CompleteMission(); }
private void OnUnitSelectedForThisTask(TaskUnitSelection i_selection) { MyMessenger.Send(MissionKeys.UNIT_SELECTED_EVENT, mTaskIndex); }
private void SendMissionCompletionMessage() { MyMessenger.Send(MissionKeys.MISSION_COMPLETED, mData); }