public void SetData(BossChallengeData data, System.Action <BossChallengeData> callback, bool isChecked) { bossData = data; curCallback = callback; if (labName != null) { labName.text = data.bossName; } if (tipPic != null) { tipPic.enabled = data.CanKill; } //新增提示今日已通关 By唐源 if (otherTipPic != null) { //Debug.Log("今日已通关data.AlreadyCarnet:" + data.AlreadyCarnet); //otherTipPic.enabled = data.AlreadyCarnet; otherTipPic.gameObject.SetActive(data.AlreadyCarnet); } if (labName != null && data.CurBossRef != null) { SetBackgroundColor((BossChallengeWnd.ToggleType)data.CurBossRef.type); } if (toggle != null) { EventDelegate.Remove(toggle.onChange, OnChange); EventDelegate.Add(toggle.onChange, OnChange); } }
/// <summary> /// BOSS复活了 /// </summary> /// <param name="_bossChallengeData"></param> public void BossRelive(BossChallengeData _bossChallengeData) { if (OnBossReliveEvent != null) { OnBossReliveEvent(_bossChallengeData); } }
protected void OnClickMoveToMobBtn(GameObject go) { GameCenter.curMainPlayer.commandMng.CancelCommands(); BossChallengeData info = UIEventListener.Get(go).parameter as BossChallengeData; if(info != null && info.CurBossRef != null) { if (info.CurBossRef.type != (int)BossChallengeWnd.ToggleType.LiRongEBoss || (info.CurBossRef.type == (int)BossChallengeWnd.ToggleType.LiRongEBoss && GameCenter.mainPlayerMng.MainPlayerInfo.CurSceneUiType == SceneUiType.LIRONGELAND)) { GameCenter.curMainPlayer.GoTraceTarget(info.CurBossRef.sceneID, info.CurBossRef.sceneX, info.CurBossRef.sceneY); } else { if (GameCenter.vipMng.VipData != null) { if (GameCenter.vipMng.VipData.vLev < 2) { MessageST mst = new MessageST(); mst.messID = 496; mst.delYes = (x) => { GameCenter.uIMng.SwitchToUI(GUIType.RECHARGE); }; GameCenter.messageMng.AddClientMsg(mst); } else { if (!GameCenter.bossChallengeMng.FightLiRongEBossNoTip) { MessageST mst = new MessageST(); mst.messID = 497; object[] pa = { 1 }; mst.pars = pa; mst.delPars = delegate(object[] ob) { if (ob.Length > 0) { bool b = (bool)ob[0]; if (b) GameCenter.bossChallengeMng.FightLiRongEBossNoTip = true; } }; mst.delYes = (x) => { GameCenter.bossChallengeMng.C2S_ChallengeBoss(info.bossID, info.CurBossRef.type); }; GameCenter.messageMng.AddClientMsg(mst); } else { GameCenter.bossChallengeMng.C2S_ChallengeBoss(info.bossID, info.CurBossRef.type); } } } } } }
public void ClearData() { curCallback = null; bossData = null; if (toggle != null) { toggle.value = false; } gameObject.SetActive(false); }
protected void ShowBossTip(BossChallengeData _boss) { if (bossTipGo != null && labBossTip != null && bossIcon != null && _boss != null) { bossTipGo.SetActive(true); if(_boss.CurBossRef != null) { labBossTip.text = _boss.CurBossRef.bossTip; bossIcon.spriteName = _boss.bossIcon; } CancelInvoke("HideBossTip"); Invoke("HideBossTip",30f); } }
protected void RefreshBoss() { for (int i = 0; i < bossList.Count; i++) { bossList[i].gameObject.SetActive(false); } List<BossChallengeData> boss1DataList = GameCenter.bossChallengeMng.SceneBossList; List<BossChallengeData> boss2DataList = GameCenter.bossChallengeMng.LiRongEBossList; int index = 0; for (int i = 0, max = boss1DataList.Count; i < max; i++) { BossChallengeData item = boss1DataList[i]; if (bossList.Count < index + 1) { bossList.Add(bossListSingleInstance.CreateNew(boss1Parent.transform, index)); } bossList[index].gameObject.SetActive(true); bossList[index].SetInfo(item); UIEventListener.Get(bossList[index].gameObject).onClick -= OnClickMoveToMobBtn; UIEventListener.Get(bossList[index].gameObject).onClick += OnClickMoveToMobBtn; UIEventListener.Get(bossList[index].gameObject).parameter = item; index++; } if (boss1Parent != null) boss1Parent.repositionNow = true; int indexL = index; for (int i = 0, max = boss2DataList.Count; i < max; i++) { BossChallengeData item = boss2DataList[i]; if (bossList.Count < indexL + 1) { bossList.Add(bossListSingleInstance.CreateNew(boss2Parent.transform, indexL)); } bossList[indexL].gameObject.SetActive(true); bossList[indexL].SetInfo(item); UIEventListener.Get(bossList[indexL].gameObject).onClick -= OnClickMoveToMobBtn; UIEventListener.Get(bossList[indexL].gameObject).onClick += OnClickMoveToMobBtn; UIEventListener.Get(bossList[indexL].gameObject).parameter = item; indexL++; } if (boss2Parent != null) boss2Parent.repositionNow = true; if (tableBoss != null) tableBoss.repositionNow = true; SceneUiType uiType = GameCenter.mainPlayerMng.MainPlayerInfo.CurSceneUiType; switch (uiType) { case SceneUiType.LIRONGELAND: if (toggle2Boss != null) toggle2Boss.value = true; break; } }
/// <summary> /// 显示可击杀BOSS /// </summary> void ShowToggle(List <BossRef> bossList) { HideToggle(); int index = 0; BossToggleItemUI firstItemUI = null; for (int i = 0, max = bossList.Count; i < max; i++) { var item = bossList[i]; BossToggleItemUI itemUI = null; if (!toggleDic.TryGetValue(index, out itemUI)) { BossToggleItemUI go = Instantiate(toggleGo) as BossToggleItemUI; toggleDic[index] = go.GetComponent <BossToggleItemUI>(); } itemUI = toggleDic[index]; if (itemUI != null) { itemUI.gameObject.SetActive(true); itemUI.transform.parent = parent.transform; itemUI.transform.localScale = Vector3.one; itemUI.transform.localPosition = new Vector3(positionInfo.x, positionInfo.y + positionInfo.w * index, -1); itemUI.SetData(item); if (index == 0) { firstItemUI = itemUI; } } index++; } if (firstItemUI != null) { firstItemUI.SetChecked(); } if (parent != null) { parent.clipOffset = Vector2.zero; parent.transform.localPosition = Vector3.zero; } if (bossList.Count > 0) { BossChallengeData data = new BossChallengeData(bossList[0]); OnChangeBoss(data); } }
public void SetData(int bossID, System.Action <BossChallengeData> callback, bool isChecked) { BossChallengeData data = GameCenter.bossChallengeMng.BossChallengeDic.ContainsKey(bossID)?GameCenter.bossChallengeMng.BossChallengeDic[bossID]:null; bossData = data; curCallback = callback; if (data != null) { if (labName != null) { labName.text = data.bossName; } if (tipPic != null) { tipPic.enabled = data.CanKill; } //if (otherTipPic != null) otherTipPic.enabled = data.AlreadyCarnet; if (data.CurBossRef.type == (int)BossChallengeWnd.ToggleType.SealBoss) { int startUp = (int)Time.realtimeSinceStartup; tipPic.enabled = data.CanKill && data.CurBossRef.needLevel <= GameCenter.mainPlayerMng.MainPlayerInfo.CurLevel && data.AppearTime <= startUp; } else { tipPic.enabled = data.CanKill; } if (otherTipPic != null) { //Debug.Log("进入到是否已通关"); //Debug.Log("boss:"+ data.bossName+"是否已通关"+ data.AlreadyCarnet); otherTipPic.gameObject.SetActive(data.AlreadyCarnet); } if (labName != null && data.CurBossRef != null) { SetBackgroundColor((BossChallengeWnd.ToggleType)data.CurBossRef.type); } if (toggle != null) { EventDelegate.Remove(toggle.onChange, OnChange); EventDelegate.Add(toggle.onChange, OnChange); } } }
int CompareByAppearTime(BossChallengeData boss1, BossChallengeData boss2) { if (boss1.AppearTime > (int)Time.realtimeSinceStartup && boss2.AppearTime > (int)Time.realtimeSinceStartup) //未出现 { if (boss1.CurBossRef.needLevel > boss2.CurBossRef.needLevel) { return(1); } if (boss1.CurBossRef.needLevel < boss2.CurBossRef.needLevel) { return(-1); } } else if (boss1.AppearTime <= (int)Time.realtimeSinceStartup && boss2.AppearTime <= (int)Time.realtimeSinceStartup) //已出现的BOSS按等级排序 { if (boss1.CurBossRef.needLevel > boss2.CurBossRef.needLevel) { return(1); } if (boss1.CurBossRef.needLevel < boss2.CurBossRef.needLevel) { return(-1); } } else //已出现和未出现比较 { if (boss1.AppearTime <= (int)Time.realtimeSinceStartup) { return(-1); } if (boss2.AppearTime <= (int)Time.realtimeSinceStartup) { return(1); } } return(0); }
private void OnClicked() { if (_data == null) { EB.Debug.LogError("LTBossChallengeActivityItem.OnClicked: _data is null"); return; } if (EB.Time.Now >= _endTime) { MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, EB.Localizer.GetString("ID_uifont_in_LTLegionWarQualify_End_4")); return; } if (BalanceResourceUtil.GetUserVigor() < _data.vigor) { BalanceResourceUtil.TurnToVigorGotView(); return; } BossChallengeData challengeData = new BossChallengeData(); challengeData.UnitValue = _data.bonus_add; challengeData.BuffName = _data.bonus_name; challengeData.DescribeFormat = _data.bonus_describe; BattleReadyHudController.Open(eBattleType.BossChallenge, () => { LTHotfixApi.GetInstance().ExceptionFunc = (EB.Sparx.Response response) => { if (response.error != null) { string strObjects = (string)response.error; string[] strObject = strObjects.Split(",".ToCharArray(), 2); switch (strObject[0]) { case "event is not running": { MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, EB.Localizer.GetString("ID_uifont_in_LTLegionWarQualify_End_4")); //活动已结束 return(true); } case "nsf": { MessageTemplateManager.ShowMessage(eMessageUIType.MessageDialogue_4, EB.Localizer.GetString("ID_codefont_in_NationBattleSelectTeamController_8317"), delegate(int result) { if (result == 0) { InputBlockerManager.Instance.Block(InputBlockReason.FUSION_BLOCK_UI_INTERACTION, 0.5f); GlobalMenuManager.Instance.Open("LTChargeStoreHud", null); } }); return(true); } } } return(false); }; EB.Sparx.Request request = LTHotfixApi.GetInstance().Post("/specialactivity/startChallenge"); request.AddData("type", eBattleType.BossChallenge.ToInt32()); request.AddData("id", _data.id); LTHotfixApi.GetInstance().BlockService(request, (Hashtable data) => { if (!GlobalMenuManager.Instance.IsContain("LTActivityHud")) { GlobalMenuManager.Instance.PushCache("LTActivityHud", _title); } }); }, null, (Data.eRoleAttr)_data.partner_attr, challengeData); }
/// <summary> /// BOSS列表获取协议 /// </summary> protected void S2C_GotBossList(Pt _info) { //Debug.Log("S2C_GotBossList"); bool noUnderTip = true; bool noSceneTip = true; bool noSealTip = true; bool noRongETip = true; bool noLiRongETip = true; pt_boss_challenge_list_d701 pt = _info as pt_boss_challenge_list_d701; if (pt != null) { BossChallengeDic.Clear(); for (int i = 0, max = pt.underground_palace_boss.Count; i < max; i++) { BossChallengeData data = new BossChallengeData(pt.underground_palace_boss[i]); BossChallengeDic[pt.underground_palace_boss[i].boss_id] = data; if (data.CanKill) { GameCenter.mainPlayerMng.SetFunctionRed(FunctionType.UNDERBOSS, true); noUnderTip = false; } } if (noUnderTip) { GameCenter.mainPlayerMng.SetFunctionRed(FunctionType.UNDERBOSS, false); } for (int i = 0, max = pt.scene_boss.Count; i < max; i++) { BossChallengeData data = new BossChallengeData(pt.scene_boss[i]); BossChallengeDic[pt.scene_boss[i].boss_id] = data; if (data.CanKill) { GameCenter.mainPlayerMng.SetFunctionRed(FunctionType.SCENEBOSS, data.CanKill); noSceneTip = false; } } if (noSceneTip) { GameCenter.mainPlayerMng.SetFunctionRed(FunctionType.SCENEBOSS, false); } for (int i = 0, max = pt.seal_boss.Count; i < max; i++) { BossChallengeData data = new BossChallengeData(pt.seal_boss[i]); BossChallengeDic[pt.seal_boss[i].boss_id] = data; if (data.CanKill && data.CurBossRef.needLevel <= GameCenter.mainPlayerMng.MainPlayerInfo.CurLevel && data.AppearTime <= (int)Time.realtimeSinceStartup) { GameCenter.mainPlayerMng.SetFunctionRed(FunctionType.SEALBOSS, true); noSealTip = false; } } if (noSealTip) { GameCenter.mainPlayerMng.SetFunctionRed(FunctionType.SEALBOSS, false); } //for (int i = 0,max=pt.smeltters_boss.Count; i < max; i++) { // BossChallengeData data = new BossChallengeData(pt.smeltters_boss[i]); // BossChallengeDic[pt.smeltters_boss[i].boss_id] = data; // if(data.CanKill) // { // GameCenter.mainPlayerMng.SetFunctionRed(FunctionType.RONGEBOSS,true); // noRongETip = false; // } //} //if(noRongETip) // GameCenter.mainPlayerMng.SetFunctionRed(FunctionType.RONGEBOSS,false); for (int i = 0, max = pt.li_smeltters_boss.Count; i < max; i++) { BossChallengeData data = new BossChallengeData(pt.li_smeltters_boss[i]); BossChallengeDic[pt.li_smeltters_boss[i].boss_id] = data; if (data.CanKill) { GameCenter.mainPlayerMng.SetFunctionRed(FunctionType.LIRONGEBOSS, true); noLiRongETip = false; } } if (noLiRongETip) { GameCenter.mainPlayerMng.SetFunctionRed(FunctionType.LIRONGEBOSS, false); } } if (OnGotChallengListEvent != null) { OnGotChallengListEvent(); } }
public void SetInfo(BossChallengeData _info) { info = _info; Refresh(); }
void ChallengeBoss(GameObject go) { BossChallengeData data = UIEventListener.Get(go).parameter as BossChallengeData; if (data == null) { return; } switch ((ToggleType)data.CurBossRef.type) { case ToggleType.UnderBoss: int num = GameCenter.inventoryMng.GetNumberByType(2600017); if (num > 0) { GameCenter.bossChallengeMng.C2S_ChallengeBoss(data.bossID, data.CurBossRef.type); } else { EquipmentInfo info = new EquipmentInfo(2600017, EquipmentBelongTo.PREVIEW); MessageST mst = new MessageST(); mst.messID = 508; mst.words = new string[] { info.ItemName, info.DiamondPrice.ToString() }; mst.delYes = (y) => { if (GameCenter.mainPlayerMng.MainPlayerInfo.TotalDiamondCount < info.DiamondPrice) { MessageST mst1 = new MessageST(); mst1.messID = 137; mst1.delYes = (z) => { GameCenter.uIMng.SwitchToUI(GUIType.RECHARGE); }; GameCenter.messageMng.AddClientMsg(mst1); } else { GameCenter.bossChallengeMng.C2S_ChallengeBoss(data.bossID, data.CurBossRef.type); } }; GameCenter.messageMng.AddClientMsg(mst); } break; case ToggleType.SealBoss: if (data.CurBossRef.needLevel > GameCenter.mainPlayerMng.MainPlayerInfo.CurLevel) { GameCenter.messageMng.AddClientMsg(13); return; } GameCenter.bossChallengeMng.C2S_ChallengeBoss(data.bossID, data.CurBossRef.type); break; case ToggleType.LiRongEBoss: if (GameCenter.vipMng.VipData != null && GameCenter.vipMng.VipData.vLev < 2) { GameCenter.messageMng.AddClientMsg(154); return; } //GameCenter.curMainPlayer.GoTraceTarget(data.CurBossRef.sceneID,data.CurBossRef.sceneX,data.CurBossRef.sceneY); //GameCenter.uIMng.SwitchToUI(GUIType.NONE); GameCenter.bossChallengeMng.C2S_ChallengeBoss(data.bossID, data.CurBossRef.type); break; case ToggleType.BOSSCOPPY: if (GameCenter.bossChallengeMng.ChallengeBossCoppyTimes > 0) { GameCenter.activityMng.C2S_FlyHangUpCoppy(160013); } else { GameCenter.messageMng.AddClientMsg(168); } break; default: GameCenter.curMainPlayer.GoNormal(); GameCenter.curMainPlayer.GoTraceTarget(data.CurBossRef.sceneID, data.CurBossRef.sceneX, data.CurBossRef.sceneY); //Debug.Log("X:"+data.CurBossRef.sceneX+",Y:"+data.CurBossRef.sceneY); //GameCenter.uIMng.SwitchToUI(GUIType.NONE); Invoke("InvokeCloseWnd", 0.1f); break; } }
void OnChangeBoss(BossChallengeData data) { if (data.CurBossRef != null) { if (address != null) { address.text = data.CurBossRef.wayres; } if (textureBoss != null) { textureBoss.enabled = true; GameCenter.previewManager.TryPreviewSingelMonster(data.CurBossRef.monsterId, textureBoss, PreviewConfigType.Dialog); } if (labDes != null) { labDes.text = data.CurBossRef.res; } if (timeGo != null) { timeGo.SetActive(false); } if (appearGo != null) { appearGo.SetActive(false); } if (killGo != null) { killGo.SetActive(false); } if (bossCoppyGo != null) { bossCoppyGo.SetActive(false); } if (buyTimesGo != null) { buyTimesGo.gameObject.SetActive(false); } if (lastKillerGo != null) { lastKillerGo.SetActive(true); } switch (data.CurBossRef.type) { case (int)ToggleType.UnderBoss: break; case (int)ToggleType.SceneBoss: if (timeGo != null) { timeGo.SetActive(true); } if (appearGo != null) { appearGo.SetActive(false); } if (data.AppearTime > (int)Time.realtimeSinceStartup) { if (timer != null) { timer.StopTimer(); timer.StartIntervalTimer(data.AppearTime - (int)Time.realtimeSinceStartup); timer.onTimeOut = (x) => { if (timeGo != null) { timeGo.SetActive(false); } if (appearGo != null) { appearGo.SetActive(true); } }; } } else { if (timeGo != null) { timeGo.SetActive(false); } if (appearGo != null) { appearGo.SetActive(true); } } break; case (int)ToggleType.SealBoss: if (timeGo != null) { timeGo.SetActive(true); } if (appearGo != null) { appearGo.SetActive(false); } if (lastKillerGo != null) { lastKillerGo.SetActive(false); } if (data.AppearTime > (int)Time.realtimeSinceStartup) { if (timer != null) { timer.StopTimer(); timer.StartIntervalTimer(data.AppearTime - (int)Time.realtimeSinceStartup); timer.onTimeOut = (x) => { if (timeGo != null) { timeGo.SetActive(false); } if (appearGo != null) { appearGo.SetActive(true); } }; } } else { if (data.CanKill) { if (timeGo != null) { timeGo.SetActive(false); } if (appearGo != null) { appearGo.SetActive(true); } } else { if (killGo != null) { killGo.SetActive(true); } if (timeGo != null) { timeGo.SetActive(false); } } } string realDes = data.CurBossRef.res.Replace("#1#", (data.CanKill?"1":"0")); realDes = realDes.Replace("#0#", (data.CurBossRef.needLevel > GameCenter.mainPlayerMng.MainPlayerInfo.CurLevel)?"[ff0000]":"[00ff00]"); if (labDes != null) { labDes.text = realDes; //封印BOSS } break; case (int)ToggleType.RongEBoss: case (int)ToggleType.LiRongEBoss: if (timeGo != null) { timeGo.SetActive(true); } if (appearGo != null) { appearGo.SetActive(false); } if (data.CanKill) { if (timeGo != null) { timeGo.SetActive(false); } if (appearGo != null) { appearGo.SetActive(true); } } else //已击杀or倒计时 { if (data.AppearTime > (int)Time.realtimeSinceStartup) { if (timer != null) { timer.StopTimer(); timer.StartIntervalTimer(data.AppearTime - (int)Time.realtimeSinceStartup); timer.onTimeOut = (x) => { if (timeGo != null) { timeGo.SetActive(false); } if (appearGo != null) { appearGo.SetActive(true); } }; } } else //已击杀 { if (killGo != null) { killGo.SetActive(true); } if (timeGo != null) { timeGo.SetActive(false); } } } break; case (int)ToggleType.BOSSCOPPY: if (bossCoppyGo != null) { bossCoppyGo.SetActive(true); } if (remainTimes != null) { remainTimes.text = GameCenter.bossChallengeMng.RemainBuyBossCoppyTimes.ToString(); } string des = data.CurBossRef.res.Replace("#0#", GameCenter.bossChallengeMng.ChallengeBossCoppyTimes.ToString()); des = des.Replace("#1#", (data.CurBossRef.needLevel > GameCenter.mainPlayerMng.MainPlayerInfo.CurLevel)?"[ff0000]":"[00ff00]"); if (labDes != null) { labDes.text = des; } if (lastKillerGo != null) { lastKillerGo.SetActive(false); } break; } if (labDes != null) { labDes.text = labDes.text.Replace("\\n", "\n"); } if (labTip != null) { labTip.text = data.CurBossRef.tip; } if (rewardItem != null) { rewardItem.CellHeight = 80; rewardItem.CellWidth = 80; //Debug.Log("data.rewardList" + data.rewardList.Count); rewardItem.RefreshItems(data.rewardList, 3, data.rewardList.Count); } if (btnFight != null) { btnFight.enabled = true; UIEventListener.Get(btnFight.gameObject).parameter = data; } } if (lastKiller != null) { lastKiller.text = data.KillName; } }