void ShowInvadeResult(NMessageInfo info) { replayBtn.gameObject.SetActive(true); zombieNum.gameObject.SetActive(false); zombiePower.gameObject.SetActive(false); nameLabel.text = "僵尸入侵"; var date = GlobalFunction.DateFormat(info.time); timeLabel.text = string.Format("{0:D2}月{1:D2}日 {2:D2}:{3:D2}", date.Month, date.Day, date.Hour, date.Minute); FightingInfo fightingInfo = info.fightingInfo; //zombie break in if (fightingInfo.LossInfo.Gold != 0 || fightingInfo.LossInfo.Resource != 0) { contentLabel.text = string.Format("僵尸闯入了你的庄园并掠夺了资源"); } //zombie didnt break in else { if (IsBreakingDoor(fightingInfo)) { contentLabel.text = string.Format("僵尸在击破大门前被你击退"); } else { contentLabel.text = string.Format("僵尸还没靠近大门就被强力的你杀光了"); } } }
public NMessageInfo(MessageInfo info) { id = info.Id; type = info.Type; zombieInfo = info.ZombieInfo; fightingInfo = info.FightingInfo; time = info.Time; isRead = info.IsRead; }
//check if zombie has broken into door bool IsBreakingDoor(FightingInfo info) { for (int i = 0; i < info.InvadeResultInfosCount; i++) { if (info.GetInvadeResultInfos(i).Id == -1) { return(true); } } return(false); }
void OpenInvadeResult(NDictionary args) { int idx = args.Value <int>("index"); var list = mailPackage.GetMailList(); if (idx >= list.Count) { return; } FightingInfo res = list[idx].fightingInfo; StartCoroutine(PlayInvadeAnimation(res)); }
IEnumerator PlayInvadeAnimation(FightingInfo result) { //init player view for (int i = 0; i < result.UserInfosCount; i++) { UserInfo userInfo = result.GetUserInfos(i); PlayerIndexMap.Add(userInfo.Uid, i); SetPlayerView(ref playerViewList[i], userInfo); } for (int i = result.UserInfosCount; i < 4; i++) { DisablePlayerView(ref playerViewList[i]); } //play animation string resStr = null; resStr = "战斗开始"; AddText(ref resStr, false); for (int i = 3; i > 0; i--) { resStr = ""; int count = i; while (count-- > 0) { resStr += "."; } AddText(ref resStr, false); yield return(new WaitForSeconds(1.0f)); } resStr = ""; AddText(ref resStr); for (int i = 0; i < result.InvadeResultInfosCount; i++) { InvadeResultInfo info = result.GetInvadeResultInfos(i); ProcessSingleInfo(info, out resStr); AddText(ref resStr); yield return(new WaitForSeconds(1.0f)); } ShowResult(result.LossInfo, out resStr); AddText(ref resStr); }