public override void EnterScene() { TransitionEngine.onTransitionComplete += OnTransitionComplete; TransitionEngine.onScreenObscured += OnScreenObscured; UserData user = UserManager.GetInstance().user; DisassemblygirlDungeonConfig config = ConfigMgr.GetInstance().DisassemblygirlDungeon.GetConfigById(currentDungeonIndex); dungeon = DungeonData.FromConfig(config); CreateMap(dungeon.resourceID); girlEntity = CreateGirlEntity(user.girl); girlEntity.Play(AnimationDefs.Idle.ToString().ToLower()); petEntity = CreatePetEntity(user.GetActivePet()); if (petEntity != null) { petEntity.Flip(); } LayerManager.GetInstance().AddPopUpView <DungeonWindow>(); LayerManager.GetInstance().AddPopUpView <DungeonReadyBar>(); }
private void OnTrophyUpdate(object data) { Action <KeyValuePair <TrophyType, float> > functor = (input) => { IList <TrophyData> trophyDatas = UserManager.GetInstance().user.trophyDatas; foreach (TrophyData trophyData in trophyDatas) { if (trophyData.type == input.Key && !trophyData.isCompleted) { if (trophyData.conditionType == TrophyConditionType.Value) { trophyData.value = input.Value; } else if (trophyData.conditionType == TrophyConditionType.Frequency) { trophyData.value += input.Value; } if (trophyData.value >= trophyData.threshold) { trophyData.isCompleted = true; alertTrophyDatas.Enqueue(trophyData); LayerManager.GetInstance().AddPopUpView <TrophyAlertBar>(alertTrophyDatas.Dequeue()); } } } }; KeyValuePair <TrophyType, float> source = (KeyValuePair <TrophyType, float>)data; functor(source); }
private void OnPetLevelUp(object data) { PetData petData = data as PetData; if (petEntity != null) { if (UserManager.GetInstance().user.activePetID == petData.id) { petEntity.Dispose(); petEntity = null; petEntity = CreatePetEntity(petData); } } }
public override void EnterScene() { CameraManager.GetInstance().openCamera(CameraType.Guide); UserData user = UserManager.GetInstance().user; TransitionEngine.onTransitionComplete += OnTransitionComplete; TransitionEngine.onScreenObscured += OnScreenObscured; CreateMap(); girlEntity = CreateGirlEntity(user.girl); girlEntity.Flip(); petEntity = CreatePetEntity(user.GetActivePet()); LayerManager.GetInstance().AddPopUpView <HomeWindow>(); SoundManager.GetInstance().PlayBackgroundMusic(AudioRepository.BG_HOME.AsAudioClip(), 1.0f); EventBox.Send(CustomEvent.HOME_SHOW_FUNCTIONS); GuideManager.GetInstance().Trigger(GuideScriptID.G01); }
public void FinishGuide(GuideScriptID id) { UserData user = UserManager.GetInstance().user; user.guides.Add((int)id); }
public bool HasFinished(GuideScriptID id) { UserData user = UserManager.GetInstance().user; return(user.guides.Contains((int)id)); }
private void OnDungeonMonsterDamage(object data) { object[] datas = data as object[]; MonsterEntity2D entity = datas[0] as MonsterEntity2D; ValidatePayload payload = datas[1] as ValidatePayload; DamagePopUpUI view = LayerManager.GetInstance().AddPopUpView <DamagePopUpUI>(); view.Initialize(payload); view.transform.position = entity.GetMountPoint(ComponentDefs.HUD).transform.position; float currentHP = entity.data.attributeBox.GetAttribute(AttributeKeys.HP); float maxHP = entity.data.attributeBox.GetAttribute(AttributeKeys.MaxHP); float percent = currentHP / maxHP; entity.UpdateHUD(); entity.componentsHolder.ValidateAndUpdate(percent); foreach (EntityComponent component in entity.componentsHolder.components) { component.Blink(); } if (entity.data.attributeBox.GetAttribute(AttributeKeys.HP) <= 0) { EventBox.Send(CustomEvent.TROPHY_UPDATE, new KeyValuePair <TrophyType, float>(TrophyType.DungeonKillMonster, 1)); entity.machine.ChangeState(StateTypes.Dead.ToString(), payload); float value = entity.data.attributeBox.GetAttribute(AttributeKeys.RP); if (value != 0) { UserManager.GetInstance().AddRP(value); } value = entity.data.attributeBox.GetAttribute(AttributeKeys.GP); if (value != 0) { UserManager.GetInstance().AddGP(value); } if (monsters.Contains(entity)) { monsters.Remove(entity); } if (entity is BossEntity2D) { EndBattle(BattleResult.Win); } else { if (monsters.Count == 0) { if (dungeon.currentGroup != null && dungeon.currentGroup.HasMonsters()) { CreateAllMonsterGroup(); } else { CheckBattleResult(); } } } } }