public static AwardCache getAwardCache(string key) { if (!awards.Contains(key)) { AwardCache cache = new AwardCache(); awards.Add(key, cache); } return(awards [key] as AwardCache); }
/** 弹出积分奖励 */ void OpenPopIntegralAward() { AwardCache cache = AwardsCacheManager.getAwardCache(AwardManagerment.AWARDS_LUCKY_CARD); if (cache != null) { Award[] awards = cache.getAwards(); cache.clear(); if (awards != null && awards.Length > 0) { PrizeSample[] prizes = AllAwardViewManagerment.Instance.exchangeAwards(awards); bool isOpen = HeroRoadManagerment.Instance.isOpenHeroRoad(prizes); if (isOpen) { UiManager.Instance.createMessageLintWindow(LanguageConfigManager.Instance.getLanguage("HeroRoad_open")); } UiManager.Instance.openDialogWindow <AllAwardViewWindow>((win) => { win.Initialize(prizes, LanguageConfigManager.Instance.getLanguage("s0562")); }); } } }
//注入奖励 //添加新奖励类型时需要修改此方法 public void addAwards(string type, Award[] awards) { AwardCache cache = AwardsCacheManager.getAwardCache(type); //设置奖励 if (type == AWARDS_FUBEN_RES || type == AWARDS_FUBEN_OVER || type == AWARDS_BATTLE || type == AWARDS_BOX || type == AWARDS_PVP_DOUBLE || type == AWARDS_ACHIEVE || type == AWARDS_HERO_ROAD || type == AWARDS_STAR_PRAY || type == DIVINATION || type == AWARDS_INVITE_EVENT || type == AWARDS_LADDER || type == AWARDS_LUCKY_CARD || type == AWARDS_LUCKY_EQUIP || type == AWARDS_INVITE_SDKAWARD || type == AWARDS_GUILD_WAR || type == AWARDS_MINERAL_WAR || type == AWARDS_GODSWAR_GROUP || type == BOSS_INFO_AWARD || type == LASTBATTLE_AWARD || type == LASTBATTLE_BOSS_AWARD) { cache.setAwards(awards); } //添加奖励 else { } }
/** 弹出积分奖励 */ void OpenPopIntegralAward() { AwardCache cache = null; if (luckySample.idsType == "2") { cache = AwardsCacheManager.getAwardCache(AwardManagerment.AWARDS_LUCKY_CARD); } else { return; } if (cache != null) { Award[] awards = cache.getAwards(); cache.clear(); if (awards != null && awards.Length > 0) { UiManager.Instance.openDialogWindow <AllAwardViewWindow> ((win) => { win.Initialize(awards, LanguageConfigManager.Instance.getLanguage("s0562")); }); } } }
public static void setAwards(string key, Award[] awads) { AwardCache cache = getAwardCache(key); cache.setAwards(awads); }
private void playAnimation() { if (setp == nextSetp) { return; } //放狗 if (setp == 0) { EffectManager.Instance.CreateEffectCtrlByCache(goddess.gameObject.transform, "Effect/UiEffect/SummonBeast", (obj, ec) => { ec.transform.localPosition = new Vector3(0, goddess.transform.localPosition.y - 300, 0); }); StartCoroutine(Utils.DelayRun(() => { iTween.ValueTo(gameObject, iTween.Hash("delay", 0.3f, "from", 0, "to", 1f, "easetype", iTween.EaseType.easeInCubic, "onupdate", "colorChange", "time", 0.4f)); StartCoroutine(Utils.DelayRun(() => { NextSetp(); }, 2f)); }, 1f)); } //骂街 else if (setp == 1) { msg.SetActive(true); TweenPosition tp = TweenPosition.Begin(msg, 0.3f, msg.transform.localPosition); tp.from = new Vector3(msg.transform.localPosition.x, -500, msg.transform.localPosition.z); EventDelegate.Add(tp.onFinished, () => { NextSetp(); }, true); } //卡片扑过去 else if (setp == 2) { AwardCache ac = AwardsCacheManager.getAwardCache(AwardManagerment.AWARDS_STAR_PRAY); Award aw = ac.getAward(); if (aw == null) { NextSetp(); return; } float delay = 0.0f; Card card; foreach (CardAward each in aw.cards) { StartCoroutine(Utils.DelayRun(() => { cardMove.transform.localPosition = beginMove; card = CardManagerment.Instance.createCard(each.sid); ResourcesManager.Instance.LoadAssetBundleTexture(ResourcesManager.CARDIMAGEPATH + card.getImageID(), roleMove); qualityMove.spriteName = QualityManagerment.qualityIDToString(card.getQualityId()); cardMove.SetActive(true); TweenPosition tp = TweenPosition.Begin(cardMove, 0.8f, cardStop.transform.localPosition); tp.from = beginMove; TweenScale ts = TweenScale.Begin(cardMove, 0.8f, Vector3.one); ts.from = Vector3.zero; EventDelegate.Add(tp.onFinished, () => { ResourcesManager.Instance.LoadAssetBundleTexture(ResourcesManager.CARDIMAGEPATH + card.getImageID(), roleStop); qualityStop.spriteName = QualityManagerment.qualityIDToString(card.getQualityId()); cardMove.transform.localScale = Vector3.zero; cardMove.SetActive(false); cardStop.SetActive(true); }); }, delay)); delay += 1.2f; } StartCoroutine(Utils.DelayRun(() => { NextSetp(); }, delay)); } //扑过去的都扑街了 else if (setp == 3) { TweenScale ts = TweenScale.Begin(cardStop, 0.8f, Vector3.zero); ts.from = Vector3.one; EventDelegate.Add(ts.onFinished, () => { isPlayAnimation = false; goddess.color = Color.black; msg.SetActive(false); cardStop.SetActive(false); cardStop.transform.localScale = Vector3.one; MaskWindow.UnlockUI(); }); } ++setp; }
public void clearCacheByType(string type) { AwardCache cache = AwardsCacheManager.getAwardCache(type); cache.clear(); }
//注入回调函数 public void addFunc(string type, CallBackAwards callback) { AwardCache cache = AwardsCacheManager.getAwardCache(type); cache.addFunc(callback); }