Exemplo n.º 1
0
    //队员希望邀请
    public void MemberWantInvite(int type, string memberName, string toName, ulong toId)
    {
        var noticeData = PlayerDataManager.Instance.NoticeData;

        if (noticeData.TeamOpenFlag == false)
        {
//功能未开放,不处理队伍消息
            return;
        }
        switch (type)
        {
        case 1:     //被characterId邀请
        {
            //判断是否是自动接受申请
            var controllerBase = UIManager.Instance.GetController(UIConfig.TeamFrame);
            if (controllerBase == null)
            {
                return;
            }
            var myModel = controllerBase.GetDataModel("") as TeamDataModel;

            if (myModel.AutoAccept)
            {
                var e = new UIEvent_OperationList_AcceptInvite(toId, toId);
                EventDispatcher.Instance.DispatchEvent(e);
                return;
            }
            UIManager.Instance.ShowMessage(MessageBoxType.OkCancel,
                                           string.Format(GameUtils.GetDictionaryText(220113), memberName), "",
                                           () =>
                {
                    var e = new UIEvent_OperationList_AcceptInvite(toId, toId);
                    EventDispatcher.Instance.DispatchEvent(e);
                },
                                           () =>
                {
                    var e = new UIEvent_OperationList_RefuseInvite(toId, toId);
                    EventDispatcher.Instance.DispatchEvent(e);
                }, false, true);
        }
        break;

        case 2:     //队员推荐人加入队伍
        {
            UIManager.Instance.ShowMessage(MessageBoxType.OkCancel,
                                           string.Format(GameUtils.GetDictionaryText(220114), memberName, toName), "",
                                           () =>
                {
                    var e = new Event_TeamInvitePlayer(toId);
                    EventDispatcher.Instance.DispatchEvent(e);
                }, null, false, true);
        }
        break;

        case 3:     //characterId加入了队伍
        {
            EventDispatcher.Instance.DispatchEvent(
                new ShowUIHintBoard(string.Format(GameUtils.GetDictionaryText(220101), memberName)));
            var e = new UIEvent_TeamFrame_Message(type, 0, toId);
            EventDispatcher.Instance.DispatchEvent(e);
        }
        break;

        case 4:     //characterId想要加入队伍,是否同意
        {
            var controllerBase = UIManager.Instance.GetController(UIConfig.TeamFrame);
            if (controllerBase == null)
            {
                return;
            }
            var myModel = controllerBase.GetDataModel("") as TeamDataModel;

            if (myModel.AutoJoin)
            {
                var e = new Event_TeamAcceptJoin(toId);
                EventDispatcher.Instance.DispatchEvent(e);
                return;
            }
            UIManager.Instance.ShowMessage(MessageBoxType.OkCancel,
                                           string.Format(GameUtils.GetDictionaryText(220120), memberName), "",
                                           () =>
                {
//同意申请
                    var e = new Event_TeamAcceptJoin(toId);
                    EventDispatcher.Instance.DispatchEvent(e);
                },
                                           () =>
                {
//不同意申请
                    var e = new Event_TeamRefuseJoin(toId);
                    EventDispatcher.Instance.DispatchEvent(e);
                }, false, true);
        }
        break;

        case 5:     //characterId退出了队伍
        {
            EventDispatcher.Instance.DispatchEvent(
                new ShowUIHintBoard(string.Format(GameUtils.GetDictionaryText(220102), memberName)));
            var e = new UIEvent_TeamFrame_Message(type, 0, toId);
            EventDispatcher.Instance.DispatchEvent(e);
        }
        break;

        case 8:     //队伍中的characterId 下线了
        {
            var controllerBase = UIManager.Instance.GetController(UIConfig.TeamFrame);
            if (controllerBase == null)
            {
                return;
            }
            controllerBase.CallFromOtherClass("SetLeaveState", new object[2] {
                    true, toId
                });
            EventDispatcher.Instance.DispatchEvent(
                new ShowUIHintBoard(string.Format(GameUtils.GetDictionaryText(220123), memberName)));
        }
        break;

        case 9:     //队伍中的characterId 上线了
        {
            var controllerBase = UIManager.Instance.GetController(UIConfig.TeamFrame);
            if (controllerBase == null)
            {
                return;
            }
            controllerBase.CallFromOtherClass("SetLeaveState", new object[2] {
                    false, toId
                });
            EventDispatcher.Instance.DispatchEvent(
                new ShowUIHintBoard(string.Format(GameUtils.GetDictionaryText(220122), memberName)));
        }
        break;

        case 11:     //有人拒绝了你的邀请
        {
            EventDispatcher.Instance.DispatchEvent(
                new ShowUIHintBoard(string.Format(GameUtils.GetDictionaryText(220116), memberName)));
        }
        break;

        case 14:     //有了新队长
        {
            EventDispatcher.Instance.DispatchEvent(
                new ShowUIHintBoard(string.Format(GameUtils.GetDictionaryText(220110), memberName)));
            var e = new UIEvent_TeamFrame_Message(type, 0, toId);
            EventDispatcher.Instance.DispatchEvent(e);
        }
        break;
        }
    }
Exemplo n.º 2
0
    //队员希望邀请
    public void MemberWantInvite(int type, string memberName, int memberJob, int memberlevel, string toName, ulong toId)
    {
        var noticeData = PlayerDataManager.Instance.NoticeData;

        if (noticeData.TeamOpenFlag == false)
        {
//功能未开放,不处理队伍消息
            return;
        }

        var jobStr = string.Empty;

        if (memberJob == 0)
        {
            jobStr = GameUtils.GetDictionaryText(220697);
        }
        else if (memberJob == 1)
        {
            jobStr = GameUtils.GetDictionaryText(220698);
        }
        else if (memberJob == 2)
        {
            jobStr = GameUtils.GetDictionaryText(220699);
        }

        switch (type)
        {
        case 1:     //被characterId邀请
        {
            //判断是否是自动接受申请
            var controllerBase = UIManager.Instance.GetController(UIConfig.TeamFrame);
            if (controllerBase == null)
            {
                return;
            }
            var myModel = controllerBase.GetDataModel("") as TeamDataModel;

            if (myModel.AutoAccept)
            {
                var e = new UIEvent_OperationList_AcceptInvite(toId, toId);
                EventDispatcher.Instance.DispatchEvent(e);
                return;
            }
            if (PlayerDataManager.Instance.isInTeamInvite)
            {
                var e1 = new Close_UI_Event(UIConfig.MessageBox);
                EventDispatcher.Instance.DispatchEvent(e1);
            }
            PlayerDataManager.Instance.isInTeamInvite = true;
            UIManager.Instance.ShowMessage(MessageBoxType.OkCancel,
                                           string.Format(GameUtils.GetDictionaryText(220113), memberName, jobStr, memberlevel), "",
                                           () =>
                {
                    var e = new UIEvent_OperationList_AcceptInvite(toId, toId);
                    EventDispatcher.Instance.DispatchEvent(e);
                },
                                           () =>
                {
                    var e = new UIEvent_OperationList_RefuseInvite(toId, toId);
                    EventDispatcher.Instance.DispatchEvent(e);
                }, false, true);
        }
        break;

        case 2:     //队员推荐人加入队伍
        {
            UIManager.Instance.ShowMessage(MessageBoxType.OkCancel,
                                           string.Format(GameUtils.GetDictionaryText(220114), memberName, toName, jobStr, memberlevel), "",
                                           () =>
                {
                    var e = new Event_TeamInvitePlayer(toId);
                    EventDispatcher.Instance.DispatchEvent(e);
                }, null, false, true);
        }
        break;

        case 3:     //characterId加入了队伍
        {
            if (PlayerDataManager.Instance.GetName() != memberName)
            {
                EventDispatcher.Instance.DispatchEvent(
                    new ShowUIHintBoard(string.Format(GameUtils.GetDictionaryText(220101), memberName)));
            }
            var e = new UIEvent_TeamFrame_Message(type, 0, toId);
            EventDispatcher.Instance.DispatchEvent(e);
        }
        break;

        case 4:     //characterId想要加入队伍,是否同意
        {
            var controllerBase = UIManager.Instance.GetController(UIConfig.TeamFrame);
            if (controllerBase == null)
            {
                return;
            }
            var myModel = controllerBase.GetDataModel("") as TeamDataModel;

            if (myModel.AutoJoin)
            {
                var e = new Event_TeamAcceptJoin(toId);
                EventDispatcher.Instance.DispatchEvent(e);
                return;
            }
            //                UIManager.Instance.ShowMessage(MessageBoxType.OkCancel,
            //                    string.Format(GameUtils.GetDictionaryText(220120), memberName, jobStr, memberlevel), "",
            //                    () =>
            //                    {
            ////同意申请
            //                        var e = new Event_TeamAcceptJoin(toId);
            //                        EventDispatcher.Instance.DispatchEvent(e);
            //                    },
            //                    () =>
            //                    {
            ////不同意申请
            //                        var e = new Event_TeamRefuseJoin(toId);
            //                        EventDispatcher.Instance.DispatchEvent(e);
            //                    }, false, true);
            //GameUtils.ShowHintTip(string.Format (GameUtils.GetDictionaryText (220127), memberName));

            var msgStr = string.Format(GameUtils.GetDictionaryText(200007006), memberlevel, memberName);

            UIManager.Instance.ShowMessage(MessageBoxType.OkCancel,
                                           msgStr,
                                           "",
                                           () =>
                {
                    var e = new Event_TeamAcceptJoin(toId);
                    EventDispatcher.Instance.DispatchEvent(e);
                });
        }
        break;

        case 5:     //characterId退出了队伍
        {
            if (PlayerDataManager.Instance.TeamDataModel.HasTeam)
            {
                if (PlayerDataManager.Instance.GetName() != memberName)
                {
                    EventDispatcher.Instance.DispatchEvent(
                        new ShowUIHintBoard(string.Format(GameUtils.GetDictionaryText(220102), memberName)));
                }
                var e = new UIEvent_TeamFrame_Message(type, 0, toId);
                EventDispatcher.Instance.DispatchEvent(e);
            }
        }
        break;

        case 8:     //队伍中的characterId 下线了
        {
            var controllerBase = UIManager.Instance.GetController(UIConfig.TeamFrame);
            if (controllerBase == null)
            {
                return;
            }
            controllerBase.CallFromOtherClass("SetLeaveState", new object[2] {
                    true, toId
                });
            EventDispatcher.Instance.DispatchEvent(
                new ShowUIHintBoard(string.Format(GameUtils.GetDictionaryText(220123), memberName)));
        }
        break;

        case 9:     //队伍中的characterId 上线了
        {
            var controllerBase = UIManager.Instance.GetController(UIConfig.TeamFrame);
            if (controllerBase == null)
            {
                return;
            }
            controllerBase.CallFromOtherClass("SetLeaveState", new object[2] {
                    false, toId
                });
            EventDispatcher.Instance.DispatchEvent(
                new ShowUIHintBoard(string.Format(GameUtils.GetDictionaryText(220122), memberName)));
        }
        break;

        case 11:     //有人拒绝了你的邀请
        {
            EventDispatcher.Instance.DispatchEvent(
                new ShowUIHintBoard(string.Format(GameUtils.GetDictionaryText(220116), memberName)));
        }
        break;

        case 14:     //有了新队长
        {
            EventDispatcher.Instance.DispatchEvent(
                new ShowUIHintBoard(string.Format(GameUtils.GetDictionaryText(220110), memberName)));
            var e = new UIEvent_TeamFrame_Message(type, 0, toId);
            EventDispatcher.Instance.DispatchEvent(e);
        }
        break;
        }
    }