public void Prase(EffectMsg msg) { Value = msg.value; if (msg.card != null && msg.card.cardId > 0) { CardItem = msg.card; } Source = new EffecterVO(); Source.Prase(msg.source); Target = new EffecterVO(); Target.Prase(msg.target); Type = msg.target.type; //type 目标类型(英雄,卡牌,玩家)RolePropType,HeroPropType,CardPropType if (Target.Type == TargetType.Hero) { HeroProp = (HeroPropType)msg.prop; } else if (Target.Type == TargetType.Card) { CardProp = (CardPropType)msg.prop; } else if (Target.Type == TargetType.Role) { RoleProp = (RolePropType)msg.prop; } }
/// <summary>刷新英雄信息</summary> /// <param name="item"></param> void UpdateHeroGrid(UIGridItem item) { if (item == null || item.oData == null || item.mScripts == null) { return; } //item.onClick = SetHeroItem; FightCardMsg info = item.oData as FightCardMsg; UITexture texture = item.mScripts[0] as UITexture; UILabel name = item.mScripts[1] as UILabel; UILabel leftNumLab = item.mScripts[2] as UILabel; UILabel rightNumLab = item.mScripts[3] as UILabel; TD_Card card = CardConfig.GetItem(info.cardId); if (card == null) { Debug.LogError("no this card cfg:" + info.cardId); return; } name.text = card.name; LoadSprite.LoaderCard(texture, card.res); }
protected override void OnShow(INotification notification) { Instance = this; m_Panel.overLab.gameObject.SetActive(false); m_Panel.panAddPower.gameObject.SetActive(false); UIEventListener.Get(m_Panel.backBtn.gameObject).onClick = OnClick_BackBtn; List <Transform> exps = new List <Transform> { m_Panel.addExpItem0, m_Panel.addExpItem1, m_Panel.addExpItem2, m_Panel.addExpItem3, m_Panel.addExpItem4, m_Panel.addExpItem5 }; int len = exps.Count; for (int n = 0; n < len; n++) { UIEventListener.Get(exps[n].gameObject).onDrop = OnDrop_ExpItem; UIEventListener.Get(exps[n].gameObject).onHover = OnHover_ExpItem; } List <Transform> cards = new List <Transform> { m_Panel.Card0, m_Panel.Card1, m_Panel.Card2, m_Panel.Card3, m_Panel.Card4, m_Panel.Card5, m_Panel.CardOp0, m_Panel.CardOp1, m_Panel.CardOp2, m_Panel.CardOp3, m_Panel.CardOp4, m_Panel.CardOp5 }; int cnt = cards.Count; bool haveData = null != FightProxy.Instance.RoomInfo; int fLen = 0; int sLen = 0; bool isMe = true; List <FightCardMsg> teamACardMsg = null; List <FightCardMsg> teamBCardMsg = null; mExp = new List <Transform>(); exp_cardItem = new Dictionary <Transform, FightPanel_CardItem>(); if (haveData) { isMe = FightProxy.Instance.RoomInfo.frole.pid == PlayerProxy.Instance.Info.pid; m_Panel.mynameLab.text = FightProxy.Instance.RoomInfo.frole.name; m_Panel.opnameLab.text = FightProxy.Instance.RoomInfo.srole.name; if (isMe) { teamACardMsg = FightProxy.Instance.RoomInfo.frole.cards.card; teamBCardMsg = FightProxy.Instance.RoomInfo.srole.cards.card; } else { teamACardMsg = FightProxy.Instance.RoomInfo.srole.cards.card; teamBCardMsg = FightProxy.Instance.RoomInfo.frole.cards.card; } fLen = teamACardMsg.Count; sLen = teamBCardMsg.Count; } mTeamCards = new List <FightPanel_CardItem>(); mTeamBCards = new List <FightPanel_CardItem>(); mInitTeamCards = new List <FightPanel_CardItem>(); mInitTeamBCards = new List <FightPanel_CardItem>(); mTeamCardsFreeQueque = new List <FightPanel_CardItem>(); mTeamAInitPosition = new List <Vector3>(); mTeamBInitPosition = new List <Vector3>(); for (int i = 0; i < cnt; i++) { FightPanel_CardItem cardItem = ScriptHelper.BindField(cards[i], "FightPanel_CardItem") as FightPanel_CardItem; int index = i % 6; if (Define.VSTest) { FightCardMsg tmsg = new FightCardMsg(); tmsg.index = index; cardItem.SerData = tmsg; } if (i < 6) { if (haveData && index < fLen) { mTeamCards.Add(cardItem); } if (!haveData) { mTeamCards.Add(cardItem); } mInitTeamCards.Add(cardItem); mTeamAInitPosition.Add(cardItem.transform.position); cardItem.ExpItem = exps[i].transform; mExp.Add(exps[i].transform); exp_cardItem[exps[i].transform] = cardItem; if (haveData && index >= fLen) { exps[i].gameObject.SetActive(false); } } if (index < fLen && i < 6) { if (haveData) { cardItem.SerData = teamACardMsg[i]; } } else if (index >= fLen && i < 6) { if (haveData) { mTeamCardsFreeQueque.Add(cardItem); } } else if (i >= 6) { UICardDrag dragItm = cardItem.GetComponent <UICardDrag>(); dragItm.IsCustomDrag = false; dragItm.CanClickTween = false; mTeamBInitPosition.Add(cardItem.transform.position); mInitTeamBCards.Add(cardItem); if (haveData && index < sLen) { mTeamBCards.Add(cardItem); cardItem.SerData = teamBCardMsg[index]; } if (!haveData) { mTeamBCards.Add(cardItem); } } if (haveData) { cardItem.UpdateDisplay(); } } AddExpPan_InitPosition = m_Panel.panAddPower.position; OpPan_InitPosition = m_Panel.panOpCard.position; if (Define.VSTest) { m_Panel.myTurnWarnPan.gameObject.SetActive(false); m_Panel.opTurnWarnPan.gameObject.SetActive(false); } else { m_Panel.myTurnWarnPan.gameObject.SetActive(InitIsMyAtk == -1); m_Panel.opTurnWarnPan.gameObject.SetActive(InitIsMyAtk == 1); mCountTimer = 90; string warstr = InitIsMyAtk == -1 ? "FightMyTurn" : "FightOpTurn"; m_Panel.turnLab.text = TextManager.GetUIString(warstr); m_Panel.countLab.text = mCountTimer.ToString(); m_Panel.btnTurn.gameObject.SetActive(InitIsMyAtk == -1); if (InitIsMyAtk == -1) { Tween_MyTrunWarn(); } else { Tween_OpTrunWarn(); } } UpdateArcane(); if (null != mOpenEffectList) { int eftLen = mOpenEffectList.Count; for (int ei = 0; ei < eftLen; ei++) { DoEffect(mOpenEffectList[ei]); } } TimerManager.AddTimerRepeat(mTimer_CountDown, 1f, OnTimer_CountDown); }