示例#1
0
        public static void AddGolbalTest()
        {
            NMessageInfo nMessageInfo = new NMessageInfo()
            {
                Title   = "新手福利",
                Message = "这是新手福利",
                Exp     = 200,
                Gold    = 10000,
            };

            nMessageInfo.Items.Add(new NItemInfo()
            {
                Id = 1, Count = 10
            });
            nMessageInfo.Items.Add(new NItemInfo()
            {
                Id = 2, Count = 10
            });
            TGlobalMessage tmessage = GetTGlobalMessage(nMessageInfo, 0);

            DBService.Instance.Entities.GlobalMessages.Add(tmessage);
            DBService.Instance.Save(false);

            SessionManager.Instance.ForeachSession(session =>
            {
                session.Session.Character.messageManager.SetDirty();
                MessageService.Instance.SendMessageReceive(session);
            });
            Log.Info("SendGlobalCompleted");
        }
示例#2
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("僵尸还没靠近大门就被强力的你杀光了");
            }
        }
    }
示例#3
0
        public void SendMessageReply(int messageId, MessageReply reply, MessageType type)
        {
            NMessageInfo nMessageInfo = AllMessages.Where(x => x.Id == messageId && x.Type == type).FirstOrDefault();

            if (nMessageInfo != null)
            {
                MessageService.Instance.SendMessageReply(nMessageInfo.Id, nMessageInfo.Type, reply);
            }
        }
示例#4
0
        public bool HasManager(int Id, out NMessageInfo nMessageInfo, MessageType type)
        {
            nMessageInfo = AllMessages.Where(x => x.Id == Id && x.Type == type).FirstOrDefault();

            if (nMessageInfo == null)
            {
                return(false);
            }
            return(true);
        }
示例#5
0
    void OnClick()
    {
        var          list = mailPackage.GetMailList();
        NMessageInfo info = list[mIndex];

        if (info.isRead == false)
        {
            NDictionary args = new NDictionary();
            args.Add("id", info.id);
            FacadeSingleton.Instance.InvokeService("RPCReadMail", ConstVal.Service_Sanctuary, args);
            info.isRead = true;
            pointGo.SetActive(false);
            mailPackage.SetUnreadMailCount(mailPackage.GetUnreadMailCount() - 1);
            FacadeSingleton.Instance.SendEvent("RefreshMailTag");
        }
    }
示例#6
0
    void OnReplay()
    {
        var          list = mailPackage.GetMailList();
        NMessageInfo info = list[mIndex];
        NDictionary  args = new NDictionary();

        //send read msg
        OnClick();

        if (info.type == 3)
        {
            args.Clear();
            args.Add("index", mIndex);
            FacadeSingleton.Instance.OverlayerPanel("UIInvadeResultPanel");
            FacadeSingleton.Instance.SendEvent("OpenInvadeResult", args);
        }
    }
示例#7
0
    void ShowInvadeWarning(NMessageInfo info)
    {
        replayBtn.gameObject.SetActive(false);
        zombieNum.gameObject.SetActive(true);
        zombiePower.gameObject.SetActive(true);
        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);
        date = GlobalFunction.DateFormat(info.zombieInfo.ZombieInvadeTime);
        contentLabel.text = string.Format("僵尸正在朝你的庄园行进,请做好准备\n预计将在{0:D2}月{1:D2}日{2:D2}:{3:D2}抵达",
                                          date.Month, date.Day, date.Hour, date.Minute);
        ZOMBIE_ATTR config = ConfigDataStatic.GetConfigDataTable("ZOMBIE_ATTR")[info.zombieInfo.ConfigId] as ZOMBIE_ATTR;

        zombieNum.text   = string.Format("僵尸数量:{0}", config.ZombieNum);
        zombiePower.text = string.Format("战斗力:{0}", 6324);
    }
示例#8
0
        private NMessageInfo GetMessageInfo(TMessage tmessage)
        {
            NMessageInfo info = new NMessageInfo()
            {
                Id      = tmessage.Id,
                Type    = (MessageType)tmessage.Type,
                Status  = tmessage.Status,
                Title   = tmessage.Title ?? "",
                Message = tmessage.Message ?? "",
                Gold    = tmessage.Gold ?? 0,
                Exp     = tmessage.Exp ?? 0,
                Time    = tmessage.Time
            };

            info.FromInfo = GetMessageCharInfo(tmessage.FromID);
            GetBinary2Items(info.Items, tmessage.Items ?? new byte[0]);
            GetBinary2Equips(info.Equips, tmessage.Equips ?? new byte[0]);

            return(info);
        }
示例#9
0
    public override void DrawCell(int index, int count = 0)
    {
        mIndex = index;
        var          list = mailPackage.GetMailList();
        NMessageInfo info = list[index];

        if (info.type == 2)
        {
            ShowInvadeWarning(info);
        }
        else if (info.type == 3)
        {
            ShowInvadeResult(info);
        }
        if (info.isRead == false)
        {
            pointGo.SetActive(true);
        }
        else
        {
            pointGo.SetActive(false);
        }
    }