예제 #1
0
    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("僵尸还没靠近大门就被强力的你杀光了");
            }
        }
    }
예제 #2
0
 public NMessageInfo(MessageInfo info)
 {
     id           = info.Id;
     type         = info.Type;
     zombieInfo   = info.ZombieInfo;
     fightingInfo = info.FightingInfo;
     time         = info.Time;
     isRead       = info.IsRead;
 }
예제 #3
0
 //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);
 }
예제 #4
0
    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));
    }
예제 #5
0
    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);
    }